<commit_before>import json

from behave import *

from app import server
from app.redis_inventory import PRODUCT_ID, LOCATION_ID, USED, NEW, OPEN_BOX, RESTOCK_LEVEL

TYPE = 'type'
QUANTITY = 'quantity'

@when(u'I visit "{url}"')
def step_impl(context, url):
  if url == "home page":
    context.resp = context.app.get('/')
  else:
    context.resp = context.app.get(url)
    assert context.resp.status_code == 200


@when(u'I create a product with restock level "{restock_level}"')
def step_impl(context, restock_level):
  target_url = '/inventory/products'
  data = json.dumps({"restock_level": int(restock_level)})
  context.resp = context.app.post(target_url, data=data, content_type='application/json')
  assert context.resp.status_code == 201


@when(u'I delete "{url}" with id "{id}"')
def step_impl(context, url, id):
  target_url = '/{}/{}'.format(url, id)
  context.resp = context.app.delete(target_url)
  assert context.resp.status_code == 204
  assert context.resp.data is ""


@when(u'I retrieve product with id "{id}"')
def step_impl(context, id):
  url = 'inventory/products'
  target_url = '/{}/{}'.format(url, id)
  context.resp = context.app.get(target_url)
  assert context.resp.status_code == 200
<commit_msg>minor fix on restock level<commit_after>import json

from behave import *

from app import server
from app.redis_inventory import PRODUCT_ID, LOCATION_ID, USED, NEW, OPEN_BOX, RESTOCK_LEVEL

TYPE = 'type'
QUANTITY = 'quantity'

@when(u'I visit "{url}"')
def step_impl(context, url):
  if url == "home page":
    context.resp = context.app.get('/')
  else:
    context.resp = context.app.get(url)
    assert context.resp.status_code == 200


@when(u'I create a product with restock level "{restock_level}"')
def step_impl(context, restock_level):
  target_url = '/inventory/products'
  data = json.dumps({RESTOCK_LEVEL: int(restock_level)})
  context.resp = context.app.post(target_url, data=data, content_type='application/json')
  assert context.resp.status_code == 201


@when(u'I delete "{url}" with id "{id}"')
def step_impl(context, url, id):
  target_url = '/{}/{}'.format(url, id)
  context.resp = context.app.delete(target_url)
  assert context.resp.status_code == 204
  assert context.resp.data is ""


@when(u'I retrieve product with id "{id}"')
def step_impl(context, id):
  url = 'inventory/products'
  target_url = '/{}/{}'.format(url, id)
  context.resp = context.app.get(target_url)
  assert context.resp.status_code == 200

{'fraction_non_alphanumeric': 0.14916903121199837, 'fraction_numerical': 0.009728415079043373, 'mean_word_length': 4.807058823529411, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4419559', 'n_tokens_mistral': 889, 'n_tokens_neox': 846, 'n_words': 210}