query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
build_payload creates a list of parameters to be used in the payload of the api call | def build_payload(parameters):
payload = []
for param in parameters:
"""
Do not include path parameters in the payload
"""
if param['paramType'] != 'path':
field_name = clean_param(param['name'])
field = flatten_param(field_name)
if is_array_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_payload(self, **kwargs):\n\n return None",
"def build_payload():\n payload = json.dumps({\"method\": \"ListAccounts\", \"params\": {}, \"id\": 1})\n return payload",
"def _build_payload(self, body: Dict) -> Dict[str, Any]:\n return {'jsonrpc': '2.0',\n 'id': self._i... | [
"0.73088354",
"0.71508425",
"0.6918581",
"0.69140506",
"0.6796427",
"0.67317855",
"0.66412216",
"0.6116565",
"0.6034691",
"0.6007825",
"0.5997449",
"0.5952233",
"0.59042174",
"0.5879261",
"0.5848162",
"0.5779257",
"0.5766688",
"0.5747198",
"0.5743052",
"0.57350177",
"0.572885... | 0.72281057 | 1 |
Check for the existance of enums in the parameter list. If an enum exists, we need to build a tuple of the emum names as well as the code that will validate the the enum. We create two lists one that contains the enums as tuples and another that contains the valdiate code. The method returns a list that consistes of th... | def check_for_enums(parameters):
enum_line = ''
enum_lines = []
validate_enums = []
for param in parameters:
if 'enum' in param:
param_name = check_param(flatten_param(param['name']))
param_enum = param['enum']
enum_line = param_name + '_types = ('
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_available_enum(enum_type: Type[Enum]) -> List[str]:\n return [f\"{i}: {v}\" for (i, v) in enumerate(enum_type)] # type: ignore[var-annotated]",
"def handle_enum(enum_annotations: Any) -> list:\n result = []\n for attribute in list(enum_annotations):\n result.append(attribute... | [
"0.6401213",
"0.63181007",
"0.63141215",
"0.61072165",
"0.60310066",
"0.56923455",
"0.56852007",
"0.55856186",
"0.55427897",
"0.5502843",
"0.548926",
"0.5463231",
"0.542895",
"0.5422927",
"0.5402525",
"0.5377337",
"0.5361586",
"0.5300357",
"0.5296258",
"0.5267555",
"0.5186078... | 0.7524469 | 0 |
check the parameter list for the pre_attachment[] parameter. This param is not correct, it's simply a placeholder for the | def check_for_pre_attachment_param(parameters):
for idx, param in enumerate(parameters):
if param['name'] == 'pre_attachment[*]':
del parameters[idx]
parameters.insert(idx, pre_attachment_content_type)
parameters.insert(idx + 1, pre_attachment_parent_folder_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_provider_attachment_create(self, resource_dict):\n pass",
"def required_attachments(self, required_attachments):\n\n self._required_attachments = required_attachments",
"def pre_customer_attachment_create(self, resource_dict):\n pass",
"def setPreUp(self, pre):\n # type: (... | [
"0.5808577",
"0.5733911",
"0.55609274",
"0.530507",
"0.52761936",
"0.5258297",
"0.52529293",
"0.5246867",
"0.5238447",
"0.5232915",
"0.5209431",
"0.5200901",
"0.51895285",
"0.5150902",
"0.5100585",
"0.5098105",
"0.5080987",
"0.50742763",
"0.50629646",
"0.50629646",
"0.5062964... | 0.8184055 | 0 |
Create the canvas_sdk/methods directory if it doesn't already exist | def create_sdk_directories():
try:
os.makedirs(METHODS_DIR)
init_file = METHODS_DIR+'/__init__.py'
if not os.path.isfile(init_file):
new_init_file = open(init_file, 'w')
new_init_file.close()
except OSError as exception:
if exception.errno != errno.EEXIST... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(argv=None):\n if argv is None:\n argv = sys.argv\n\n parser = argparse.ArgumentParser(description='Build Canvas SDK methods')\n parser.add_argument('-u','--url', help='Base Canvas url, default is (https://canvas.instructure.com)')\n args = vars(parser.parse_args())\n\n \"\"\"\n De... | [
"0.6024213",
"0.5447391",
"0.54416734",
"0.5415922",
"0.5409212",
"0.5375797",
"0.52315885",
"0.52250993",
"0.51826185",
"0.5177353",
"0.51455146",
"0.5119641",
"0.5115451",
"0.50884795",
"0.50842744",
"0.50561905",
"0.5041633",
"0.5029327",
"0.50157297",
"0.49913386",
"0.497... | 0.7748334 | 0 |
This method demapp entity objects to data frame. It will help programmer to analys using pandas library. | def __object_demapper(self, data: list) -> pd.DataFrame:
data = pd.DataFrame.from_records([s.to_dict() for s in data])
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pandas_convert(self):\n data = {}\n\n for names in self.data[0]:\n col_values = []\n\n if names in objects:\n for items in self.data[0][names]:\n col_values = []\n\n col_name = names + \"_\" + items\n\n ... | [
"0.6892027",
"0.6508207",
"0.6472042",
"0.6281258",
"0.6169941",
"0.61465824",
"0.613803",
"0.61098313",
"0.6088293",
"0.6079013",
"0.6077937",
"0.6062319",
"0.60613316",
"0.6043503",
"0.60430515",
"0.60380507",
"0.60380507",
"0.60380507",
"0.60380507",
"0.60380507",
"0.60256... | 0.6550998 | 1 |
Gets the variables in the template from the logs limited to the ones represented by asterisks ('') only. These are the only ones being considered in the triples. As the pointers advance on both the log and the template the variables are only collected when is encountered on the template | def __get_vars_list(self, template_idx, log):
template = self.templates[template_idx].split()
log = log.split()
variables = []
pt = pl = 0
while pt < len(template) and pl < len(log):
if template[pt] == log[pl]:
pt += 1
pl += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_placeholders(template):\n return [p[1] for p in string.Formatter().parse(template)\n if p[1] is not None and len(p[1]) > 0]",
"def find_template_variables(code):\n return re.findall(re_template_var, code)",
"def get_variables(self):\n return [self.g_t, self.m_t]",
"def context(te... | [
"0.5529201",
"0.5246363",
"0.51169056",
"0.5084532",
"0.5074781",
"0.49252644",
"0.4919884",
"0.486573",
"0.48477352",
"0.48411506",
"0.48227668",
"0.48202914",
"0.4777373",
"0.476468",
"0.47486478",
"0.473558",
"0.47355154",
"0.47204447",
"0.47187525",
"0.47119597",
"0.47052... | 0.687035 | 0 |
Wait for the call count on the mock to reach or exceed a threashold, or a timeout occurs. Useful for multithreaded testing. | def wait_for_calls(mock, count, timeout_seconds):
timeout = datetime.datetime.now() + datetime.timedelta(seconds=timeout_seconds)
while mock.call_count < count:
time.sleep(0.01)
if datetime.datetime.now() > timeout:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wait_before_call(self):\n while (dt.datetime.now() - self._last_call_ts) <= dt.timedelta(\n seconds=self.api_timeout\n ):\n time.sleep(0.5)\n self._last_call_ts = dt.datetime.now()",
"def wait_fluently(condition: Callable, timeout: TimeoutType, err_msg: str):\n ... | [
"0.6498459",
"0.6334335",
"0.632674",
"0.6275306",
"0.62697285",
"0.6268087",
"0.62155145",
"0.616202",
"0.6141317",
"0.61329114",
"0.60898757",
"0.6051971",
"0.60427356",
"0.6019092",
"0.60161436",
"0.6015936",
"0.6009689",
"0.6005865",
"0.596967",
"0.5925834",
"0.58968174",... | 0.7268512 | 0 |
Helper function for update_return_factor > activates. | def _activate_return_factor(self):
self.active = True
effect = self.factor
return effect | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_return_factor(self):\n if not self.active:\n effect = self._activate_return_factor()\n elif self.active:\n effect = self._deactivate_return_factor()\n return effect",
"def _deactivate_return_factor(self):\n self.active = False\n effect = 1 / sel... | [
"0.7619489",
"0.7287964",
"0.58440965",
"0.5589851",
"0.55477417",
"0.55023503",
"0.5478167",
"0.5450696",
"0.5412159",
"0.54077435",
"0.5368345",
"0.53519577",
"0.53423446",
"0.53316164",
"0.5300739",
"0.52776587",
"0.5277615",
"0.52698386",
"0.52678233",
"0.52527237",
"0.52... | 0.7389867 | 1 |
Helper function for update_return_factor > deactivates. | def _deactivate_return_factor(self):
self.active = False
effect = 1 / self.factor
return effect | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_return_factor(self):\n if not self.active:\n effect = self._activate_return_factor()\n elif self.active:\n effect = self._deactivate_return_factor()\n return effect",
"def _activate_return_factor(self):\n self.active = True\n effect = self.facto... | [
"0.72491986",
"0.7173555",
"0.565905",
"0.548633",
"0.52655476",
"0.52646697",
"0.5120895",
"0.5088434",
"0.50735825",
"0.5009577",
"0.49936694",
"0.4986948",
"0.49810562",
"0.49603486",
"0.49565622",
"0.4942595",
"0.49352244",
"0.4931155",
"0.4921053",
"0.49184957",
"0.49069... | 0.8133898 | 0 |
Generates JSON for all categories | def allCategoriesJSON():
categories = db_session.query(Category).all()
return jsonify(categories=[c.serialize for c in categories]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_categories_handler():\n categories = getAllCategories()\n return jsonify(categories=[i.serialize for i in categories])",
"def get_all_categories():\n return jsonify({\n \"success\": True,\n \"categories\": _read_all_categories()\n })",
"def categoriesJSON():\n ... | [
"0.80022",
"0.7764015",
"0.7749237",
"0.7702453",
"0.7634991",
"0.76159203",
"0.75909245",
"0.7532368",
"0.74889326",
"0.7449233",
"0.74030787",
"0.7385225",
"0.7377895",
"0.7366753",
"0.73639095",
"0.7266052",
"0.721529",
"0.714454",
"0.7087932",
"0.7027108",
"0.6994505",
... | 0.78281426 | 1 |
Generates JSON for a book specified by the book_id | def bookJSON(book_id):
book = db_session.query(Book).filter_by(id=book_id).one()
return jsonify(book=book.serialize) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def book_info(book_id):\n\n book = data_manager.get_book(book_id)\n if not book:\n return jsonify({\"error\": \"No book found\"})\n if book.has_records == False:\n return jsonify({'book_id': book_id,\n 'title': book.title,\n 'author': book.author... | [
"0.68194824",
"0.66605145",
"0.6633134",
"0.6563902",
"0.65159816",
"0.65159816",
"0.6498835",
"0.6487234",
"0.64699584",
"0.6375881",
"0.6324021",
"0.63159806",
"0.63023865",
"0.6282721",
"0.62815195",
"0.6272364",
"0.60790217",
"0.59934425",
"0.5943473",
"0.5903797",
"0.589... | 0.8344132 | 0 |
Generates JSON for a category with all books in the category Specified by the category_id | def categoryWithBooksJSON(category_id):
books = db_session.query(Book).filter_by(category_id=category_id).all()
return jsonify(Category=[b.serialize for b in books]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_category_items(category_id):\n items = session.query(Item).filter(Item.category_id == category_id)\n return jsonify(json_list=[i.to_json() for i in items.all()])",
"def categoryItemJSON(category_id):\n category = db.getByCategory(category_id)\n items = db.getItemsByCategory(category_id)\n ... | [
"0.7138958",
"0.7041303",
"0.69258463",
"0.6853855",
"0.67250127",
"0.6645023",
"0.66027105",
"0.65864533",
"0.6539297",
"0.6498139",
"0.642202",
"0.6416721",
"0.63761836",
"0.6373455",
"0.6321239",
"0.62749213",
"0.62676096",
"0.6253013",
"0.62493944",
"0.6240726",
"0.622268... | 0.8570861 | 0 |
Checks the given job_id if it has failed due to Wall Clock Time | def check_wct_hit(self, job_id: int):
cmd = f"qstat -x {job_id} -f -F json | grep walltime"
output, err = self._run_command_and_wait(cmd=[cmd], shell=True)
walltime_split = output.split()
_, limit_hour, limit_min, limit_sec = (
walltime_split[1].replace('"', "").split(":")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_job_status_by_id(job_id):\n print('=' * 40)\n print('check_status_by_job_id', job_id)\n print('=' * 40)\n\n it_worked = check_job_status(job)\n if it_worked:\n return ok_resp(job)\n\n user_msg = ('PreprocessJob still in process: %s') % (job_id)\n return err_resp(user_msg)",
... | [
"0.6274467",
"0.5929514",
"0.58271253",
"0.5742374",
"0.57365143",
"0.56687313",
"0.56491256",
"0.5644406",
"0.5643484",
"0.56422216",
"0.5603327",
"0.5548267",
"0.552676",
"0.55206394",
"0.5519704",
"0.55171937",
"0.5463247",
"0.54274446",
"0.541504",
"0.5409407",
"0.5378929... | 0.72177875 | 0 |
Reads a commaseparated csv file (with header) and write in Parquet | def csv_to_parquet(filename, schema, input_dir=DIR_DATA_CSV, output_dir=DIR_DATA_PARQUET):
df = spark.read.load(input_dir + "/" + filename + ".csv",
format='com.databricks.spark.csv',
header='true',
schema=schema,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_file_to_parquet(input_file, output_file):\n df = pd.read_csv(input_file)\n df.to_parquet(output_file)",
"def sandia2parquet(csvPaths, outputPath):\r\n df = pd.concat(pd.read_csv(p, parse_dates=[[0, 1]], index_col=0) for p in csvPaths)\r\n df.drop_duplicates(inplace=True)\r\n df.sort_index(... | [
"0.798741",
"0.7135128",
"0.6974975",
"0.6251544",
"0.6232588",
"0.6227769",
"0.6079703",
"0.60275185",
"0.59676653",
"0.5946072",
"0.59393716",
"0.57928514",
"0.5785504",
"0.57794386",
"0.5753632",
"0.5752843",
"0.57419115",
"0.57325166",
"0.57178354",
"0.56992704",
"0.56793... | 0.77135056 | 1 |
Transform Django ValidationError into an equivalent DRF ValidationError. Note that even if this approach is not technically recommended, this is still the most convenient way to handle shared validation between Django admin and API. | def transform_exception_to_drf(exception: Exception) -> Exception:
if isinstance(exception, DjangoValidationError):
detail: Any = str(exception)
if hasattr(exception, "message_dict"):
detail = exception.message_dict
elif hasattr(exception, "messages"):
detail = except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_validation_error(self, error, bundle_errors):\n \n error_str = six.text_type(error)\n error_msg = self.help.format(error_msg=error_str) if self.help else error_str\n msg = {self.name: error_msg}\n\n if bundle_errors:\n return error, msg\n flask_restfu... | [
"0.59149027",
"0.5802986",
"0.5730593",
"0.5652993",
"0.5632285",
"0.56285733",
"0.56061673",
"0.55691904",
"0.55682784",
"0.54951966",
"0.5435993",
"0.53793496",
"0.53500307",
"0.5321213",
"0.53003645",
"0.5265524",
"0.52309984",
"0.5222705",
"0.5215385",
"0.52040416",
"0.52... | 0.64906365 | 0 |
Custom DRF exception handler which converts Django ValidationError to DRF ValidationError. Note that even if this approach is not technically recommended, this is still the most convenient way to handle shared validation between Django admin and API. | def custom_exception_handler(exc, context):
if isinstance(exc, DjangoValidationError):
exc = transform_exception_to_drf(exc)
return drf_exception_handler(exc, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exception_handler(exception, context):\n\n if isinstance(exception, DjangoValidationError):\n if isinstance(exception, DjangoValidationError):\n if hasattr(exception, 'message_dict'):\n detail = exception.message_dict\n elif hasattr(exception, 'message'):\n ... | [
"0.75938827",
"0.69092166",
"0.6425186",
"0.63345057",
"0.63084227",
"0.6122498",
"0.60641307",
"0.60489315",
"0.59760827",
"0.5902956",
"0.5901507",
"0.58674586",
"0.5848629",
"0.58323437",
"0.58078736",
"0.57541656",
"0.574886",
"0.5721575",
"0.570441",
"0.5695655",
"0.5677... | 0.7843261 | 0 |
Get parameters for ``rotate`` for a random rotation. | def get_params(degrees):
angle = random.uniform(degrees[0], degrees[1])
return angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(degrees):\r\n angle = np.random.uniform(degrees[0], degrees[1])\r\n\r\n return angle",
"def get_params(degrees, translate, scale_ranges, shears, img_size):\n angle = np.random.uniform(degrees[0], degrees[1])\n if translate is not None:\n max_dx = translate[0]... | [
"0.66462475",
"0.65740985",
"0.6535509",
"0.5788123",
"0.57785267",
"0.576172",
"0.5759544",
"0.57201487",
"0.5681243",
"0.5631103",
"0.5580636",
"0.55774826",
"0.55569464",
"0.5549427",
"0.55484426",
"0.5545225",
"0.5545225",
"0.5545225",
"0.5545225",
"0.5545225",
"0.5545225... | 0.6891688 | 1 |
Instantiate a CSRFaware test client and verify that the CSRF Middleware rotates the CSRF token per session by logging in getting token1, logging out and back in, getting token2, then assert that token1 does not equal token2. | def test_csrf_token_session_rotation(self):
csrf_client = Client(enforce_csrf_checks=True)
csrf_client.login(username='archen', password='mytestpassword')
# todo: add settings for test URL
response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))
token1 = "{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csrf_token_request_rotation(self):\n\n csrf_client = Client(enforce_csrf_checks=True)\n csrf_client.login(username='archen', password='mytestpassword')\n\n # todo: add settings for test URL\n response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))\n ... | [
"0.7902339",
"0.6988401",
"0.6771556",
"0.66788286",
"0.6662817",
"0.6656818",
"0.65886146",
"0.65124655",
"0.62826264",
"0.62812984",
"0.625079",
"0.62410915",
"0.61570483",
"0.61082435",
"0.6089133",
"0.6068556",
"0.6063395",
"0.603713",
"0.6002983",
"0.5986709",
"0.5982652... | 0.77802 | 1 |
Instantiate a CSRFaware test client and verify that the CSRF Middleware rotates the CSRF token per request by logging in getting token1, getting token2, then assert that token1 does not equal token2. | def test_csrf_token_request_rotation(self):
csrf_client = Client(enforce_csrf_checks=True)
csrf_client.login(username='archen', password='mytestpassword')
# todo: add settings for test URL
response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))
token1 = "{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csrf_token_session_rotation(self):\n\n csrf_client = Client(enforce_csrf_checks=True)\n csrf_client.login(username='archen', password='mytestpassword')\n\n # todo: add settings for test URL\n response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))\n ... | [
"0.75068396",
"0.67863727",
"0.6705328",
"0.66953987",
"0.65281594",
"0.64516985",
"0.6424007",
"0.6370507",
"0.636057",
"0.6342661",
"0.63172245",
"0.6177671",
"0.6174722",
"0.613412",
"0.6096326",
"0.6073039",
"0.6046885",
"0.60453147",
"0.601192",
"0.60011077",
"0.5999106"... | 0.798472 | 0 |
List the memomethods associated with this class | def _memomethods(cls, base=True, clsmethods=False):
if not base:
return set(k for k, v in iteritems(cls.__dict__)
if isinstance(v, MemoMethod) and
(clsmethods or not isinstance(v, MemoClsMethod) ) )
else:
return set().union(*(
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_methods(self):\n return list(self.methods.keys())",
"def __methods(cls):\n _dict = {}\n __methodDict(cls, _dict)\n return _dict.keys()",
"def listMethods(self):\r\n methods = self._listMethods()\r\n keys = list(methods.keys())\r\n keys.sort()\r\n return keys... | [
"0.70443636",
"0.6637453",
"0.6556638",
"0.6555706",
"0.64970905",
"0.63522935",
"0.63453037",
"0.61935425",
"0.6121395",
"0.60850805",
"0.60794735",
"0.60586596",
"0.5946513",
"0.5932714",
"0.5922627",
"0.5846858",
"0.58021754",
"0.5788156",
"0.5743604",
"0.572228",
"0.57138... | 0.71347845 | 0 |
Signal that something has changed in this object Raises a ValueError if this object is locked Clears the caches on this object, then calls 'mutate' on anything returned by self.mutates_with_this() | def mutate(self, _stack=None):
if not hasattr(self, "_memo_init"):
return
if self.is_locked:
raise ValueError("Cannot mutate locked object {0}".format(self) )
if _stack is None:
_stack = set()
elif id(self) in _stack:
# avoid infinite recur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock (self):\n self.locked = True\n self._changed = False",
"def reset(self, owner):\n if self.cached:\n oldvalue = self.get_slot(owner)\n self.del_slot(owner)\n if self.has_observers() or owner.has_observers(self.name):\n newvalue = self.d... | [
"0.60226405",
"0.57842845",
"0.5725537",
"0.5721362",
"0.57192576",
"0.57150596",
"0.56712085",
"0.5663763",
"0.5658444",
"0.5652563",
"0.56195235",
"0.56181794",
"0.5615706",
"0.56071895",
"0.5597781",
"0.5595289",
"0.55938435",
"0.559223",
"0.5587769",
"0.5576639",
"0.55678... | 0.6292293 | 0 |
Enable the cache on all memomethods | def enable_caches(self, clsmethods=False):
if not hasattr(self, "_memo_init"):
return
self._caches_enabled = True
for m in self._memomethods(clsmethods=clsmethods):
getattr(self, m).enable_cache() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_caches(self, clsmethods=False):\n if not hasattr(self, \"_memo_init\"):\n return\n self._caches_enabled = False\n for m in self._memomethods(clsmethods=clsmethods):\n getattr(self, m).disable_cache()",
"def enable_cache(self, **kwargs: Dict[str, Any]) -> Non... | [
"0.74225974",
"0.7077383",
"0.689496",
"0.6892741",
"0.66630596",
"0.66365635",
"0.6579165",
"0.65108114",
"0.6508244",
"0.6482745",
"0.6480428",
"0.6444183",
"0.6429827",
"0.63991463",
"0.6329355",
"0.6286894",
"0.6266778",
"0.6248951",
"0.6218654",
"0.6218115",
"0.62179226"... | 0.8367143 | 0 |
Disable the cache on all memomethods | def disable_caches(self, clsmethods=False):
if not hasattr(self, "_memo_init"):
return
self._caches_enabled = False
for m in self._memomethods(clsmethods=clsmethods):
getattr(self, m).disable_cache() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_caches(self, clsmethods=False):\n if not hasattr(self, \"_memo_init\"):\n return\n self._caches_enabled = True\n for m in self._memomethods(clsmethods=clsmethods):\n getattr(self, m).enable_cache()",
"def clearmemo(self):\n # see utils.memozie_method\n... | [
"0.71638656",
"0.70316917",
"0.6965892",
"0.68943864",
"0.68892354",
"0.6815377",
"0.6801101",
"0.66888326",
"0.66416496",
"0.6572776",
"0.65559536",
"0.6547328",
"0.6539086",
"0.65341306",
"0.64940375",
"0.64625096",
"0.64194775",
"0.638353",
"0.63695186",
"0.63673973",
"0.6... | 0.82815826 | 0 |
Clear the cache on all memomethods | def clear_caches(self, clsmethods=False):
if not hasattr(self, "_memo_init"):
return
for m in self._memomethods(clsmethods=clsmethods):
getattr(self, m).clear_cache() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearmemo(self):\n # see utils.memozie_method\n if hasattr(self, '_cache'):\n self._cache.clear()",
"def clear_cache():\n # TODO\n pass",
"def cache_clear(self):\n\t\tself.__cache = {}",
"def clear_cache(self):\n pass",
"def clear_all(self) -> None:\n ... | [
"0.8305153",
"0.8063542",
"0.8048527",
"0.79982877",
"0.78870875",
"0.76729065",
"0.7611736",
"0.7596422",
"0.7585412",
"0.7551643",
"0.744164",
"0.74281377",
"0.74196523",
"0.74128884",
"0.74125355",
"0.73761576",
"0.7359436",
"0.7351489",
"0.7349383",
"0.73434705",
"0.72377... | 0.8368596 | 0 |
Lock the class A locked class' caches are always enabled and calling a mutating method on it results in a ValueError | def lock(self):
if not hasattr(self, "_memo_init"):
raise ValueError(
"Cannot lock MemoClass before MemoClass.__init__" +
"is finished!")
self.enable_caches()
self._locked = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(self):\n raise NotImplementedError",
"def __setattr__(self, key, value):\n if not hasattr(self, \"_memo_init\"):\n # If we haven't finished initialising the memoclass, the class acts\n # like it's unlocked\n pass\n elif key == \"_locked\" or self._mu... | [
"0.723524",
"0.6595321",
"0.6561136",
"0.64092267",
"0.6290298",
"0.6239937",
"0.6218193",
"0.6098448",
"0.6024287",
"0.5995096",
"0.5908495",
"0.58645964",
"0.57786083",
"0.5771644",
"0.57694465",
"0.5726698",
"0.5706033",
"0.5695505",
"0.5678543",
"0.56641036",
"0.56514704"... | 0.6666595 | 1 |
Check the preservation sheet against expectations of Media Ingest. | def validate_workbook(self):
valid = True
#Check for a sheet that should have preservation metadata data
try:
self.check_presSheetExists()
except AMIExcelError as e:
print("Error in workbook sheets: ", e.value)
valid = False
#Check that preservation sheet contains required heade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_monitor_correctly_does_not_process_already_processed_pages(self):\n # Arrange\n # There are two pages: page # 1 and page # 2\n feeds = [fixtures.PROQUEST_FEED_PAGE_1, fixtures.PROQUEST_FEED_PAGE_2]\n # But only the page # 1 will be processed\n expected_calls = [call(fixt... | [
"0.5778201",
"0.57246935",
"0.5717508",
"0.5711417",
"0.57104516",
"0.57044643",
"0.57044643",
"0.57044643",
"0.5680794",
"0.55978537",
"0.556326",
"0.55619204",
"0.55233854",
"0.5514667",
"0.5509379",
"0.54983896",
"0.5490243",
"0.5474077",
"0.5471501",
"0.54564965",
"0.5453... | 0.66293484 | 0 |
Identifies sheets that should contain data about preservation files, edit master files, and untransferred objects. | def set_amiSheetNames(self):
self.pres_sheetname = None
self.edit_sheetname = None
self.notransfer_sheetname = None
for sheet in self.wb.sheet_names():
sheet_lower = sheet.lower()
#Check if two sheets get identfied by regex below?
if re.match("(original|preservation|file|full|archive... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self):\n if len(self.handle.sheet_names) > 1: self.multi_sheet()\n else: self.mono_sheet()",
"def sync_spreadsheet(self):\n\n\t\t# Open up the main sheet\n\n\t\t# Glob in columns to let us figure out which row each parent is in\n\n\t\t# For each parent\n\... | [
"0.58607453",
"0.58228004",
"0.5529762",
"0.55206317",
"0.5505007",
"0.5484701",
"0.5476601",
"0.541435",
"0.5361357",
"0.5333867",
"0.5233947",
"0.52256787",
"0.5194104",
"0.51663905",
"0.5108304",
"0.50837946",
"0.5076943",
"0.50490385",
"0.5043912",
"0.5030903",
"0.5010544... | 0.6074781 | 0 |
Checks if a preservation sheet has been identified by set_amiSheetNames() | def check_presSheetExists(self):
if not self.pres_sheetname:
self.raise_excelerror("Required sheet for preservation files" +
"could not be found in workbook.")
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_amiSheetNames(self):\n\n self.pres_sheetname = None\n self.edit_sheetname = None\n self.notransfer_sheetname = None\n\n for sheet in self.wb.sheet_names():\n sheet_lower = sheet.lower()\n #Check if two sheets get identfied by regex below?\n if re.match(\"(original|preservation|fi... | [
"0.66302073",
"0.65046644",
"0.5886013",
"0.5579476",
"0.5479899",
"0.54747397",
"0.53408045",
"0.52864134",
"0.5272514",
"0.52497303",
"0.5119719",
"0.5086039",
"0.5080697",
"0.5060596",
"0.49829373",
"0.49792847",
"0.4975354",
"0.49734163",
"0.4972198",
"0.49180233",
"0.491... | 0.68520504 | 0 |
Return normalized values from a single row of headers on a specified sheet. Newline characters are retained. | def get_headerRow(self, sheetname, row):
sheet = self.wb.sheet_by_name(sheetname)
headers = []
for i in range(0, sheet.ncols):
value = str(sheet.cell(row, i).value)
if value:
headers.append(value.lower())
return headers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_clean_row(row_of_data):\n header = row_of_data.get('header')[1]\n z = list(set(remove_filler_words([header])))\n return z",
"def normalize_columns_separately(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tcolumn_max=column_matrix.max(1)\n\tcolumn_min=column_matrix.min(1)\n\trange=... | [
"0.5955093",
"0.5862677",
"0.57885176",
"0.5694795",
"0.5683874",
"0.5663597",
"0.5579662",
"0.5545275",
"0.53721654",
"0.5349391",
"0.5349019",
"0.5303909",
"0.529971",
"0.529876",
"0.5280982",
"0.52768624",
"0.5258287",
"0.52513075",
"0.5238778",
"0.51832134",
"0.5182358",
... | 0.68116575 | 0 |
Returns delimited string based on the output of get_headerEntryAsTuple() | def get_headerEntryAsString(self, sheetname, column, delimiter = "|"):
header_entry = self.get_headerEntryAsTuple(sheetname, column)
#remove empty tuple values before adding delimiter
header_string = delimiter.join(filter(None, header_entry))
#remove newlines since they're inconsistent
header_strin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_text(self):\n return os.linesep.join(map(str, self.headers))",
"def header(self, as_list=False, separator='\\t'):\n if not self.attrs():\n return None\n if as_list:\n return self.attrs()\n else:\n return separator.join(self.attrs())",
"def... | [
"0.6526169",
"0.6299746",
"0.62636864",
"0.62408084",
"0.61534923",
"0.6079989",
"0.60790026",
"0.5927346",
"0.59263724",
"0.5761145",
"0.57610416",
"0.5759684",
"0.5710751",
"0.5688107",
"0.5626773",
"0.56125677",
"0.56002694",
"0.5573979",
"0.5566358",
"0.55484164",
"0.5548... | 0.7469031 | 0 |
Check that a row of headers contains all the required values | def check_headerRow(self, expected, found):
# spreadsheets must have either a barcode field or a object ID field, but both are not required
header1 = 'barcode'
header2 = ('object identifier\n(edit heading to specify type' +
' - e.g. barcode)')
expected = self.remove_annoying(header1, header2, exp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_header(self, header_row):\n\n self.logger.info(\"Validating header row.\")\n \n # assume value.\n is_valid = True\n\n # check if @header_row is perfect.\n required_keys = tuple(self.required_headers.keys())\n if sorted(header_row) == sorted(required_ke... | [
"0.73380065",
"0.6967268",
"0.6915856",
"0.6891492",
"0.6657438",
"0.6634957",
"0.66104305",
"0.65021867",
"0.6489007",
"0.64572406",
"0.6453303",
"0.6440663",
"0.64279026",
"0.6417046",
"0.6379434",
"0.63733184",
"0.6361163",
"0.63432103",
"0.6335669",
"0.63233525",
"0.63167... | 0.7477214 | 0 |
Check that a sheet contains the required heirarchy of headers | def check_headerEntries(self, expected, found):
# spreadsheets must have either a barcode field or a object ID field, but both are not required
header1 = ('original master', 'object', 'barcode')
header2 = ('original master', 'object',
'object identifier\n(edit heading to specify type ' +
'- e.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_headerRow(self, expected, found):\n\n # spreadsheets must have either a barcode field or a object ID field, but both are not required\n header1 = 'barcode'\n header2 = ('object identifier\\n(edit heading to specify type' +\n ' - e.g. barcode)')\n expected = self.remove_annoying(header1, ... | [
"0.7131683",
"0.6868942",
"0.6488493",
"0.64007354",
"0.6346215",
"0.61032695",
"0.60922384",
"0.6072071",
"0.6069789",
"0.6030912",
"0.59228843",
"0.5911827",
"0.59027445",
"0.58506954",
"0.5840867",
"0.5775385",
"0.5770583",
"0.574336",
"0.5699513",
"0.565149",
"0.5625152",... | 0.7361219 | 0 |
Verify that no column in a sheet contains an equation Based on checking every cell in the 4th row | def check_noequations(self, sheetname):
self.wb_open = load_workbook(self.name, read_only = True)
sheet = self.wb_open.get_sheet_by_name(sheetname)
for i in range(1, self.wb.sheet_by_name(sheetname).ncols):
value = sheet.cell(row = 4, column = i).value
# equation check logic, might be better c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(l):\n rows = split_rows(l)\n columns = split_columns(l)\n for r in rows + columns:\n if 0 in r:\n continue\n if sum(r) != row_sum:\n return False\n return True",
"def is_valid_number(self):\n for condition in [self.game.getRow(self.pos), self.game.getC... | [
"0.6211021",
"0.6107029",
"0.6034179",
"0.60124844",
"0.60116315",
"0.59965813",
"0.5968232",
"0.59513086",
"0.59452796",
"0.5932194",
"0.591399",
"0.59075063",
"0.58937216",
"0.5892847",
"0.58496976",
"0.5845121",
"0.5805711",
"0.57959926",
"0.57858694",
"0.5783577",
"0.5775... | 0.7303464 | 0 |
Convert Excel sheet into pandas dataframe Each list represents one row of the spreadsheets Header values are normalized based on dictionary Datetime values are automatically converted to ISO formats Row values are normalized based on dictionary | def normalize_excelSheet(self, sheetname, conversion_dictionary):
sheet = self.wb.sheet_by_name(sheetname)
ami_data = []
date_headers = ["bibliographic.date", "technical.dateCreated"]
time_headers = ["technical.durationHuman"]
#copy everything from the 3rd row to the last row with a filename
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_xls_sheet_to_df(sheet: opxl.workbook,\n min_row: Optional[int] = 1,\n relevant_cols: Optional[list] = None,\n irrelevant_cols: Optional[list] = None) -> pd.DataFrame:\n parsed_sheet_dict = {}\n\n for col in sheet.iter_cols(m... | [
"0.65646905",
"0.6434385",
"0.62506163",
"0.6013509",
"0.5990602",
"0.5971323",
"0.59404683",
"0.5817023",
"0.58159024",
"0.5812178",
"0.5791551",
"0.57195747",
"0.5708776",
"0.56478894",
"0.5630219",
"0.56153893",
"0.56145465",
"0.5602438",
"0.55972296",
"0.5595342",
"0.5594... | 0.7525733 | 0 |
Normalize all entries via dictionaries defined in the ami_md_constants module. Returns a list of lists | def normalize_values(self, data):
df = pd.DataFrame(data[1:], columns = data[0]).astype(str)
df = df.replace(ami_md_constants.NAS)
df = df.replace(ami_md_constants.REGEX_REPLACE_DICT, regex=True)
df = df.replace(ami_md_constants.STRING_REPLACE_DICT)
df['source.object.format_type'] = df['source.ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_metadata(self, md):\n md = ast.literal_eval(md)\n dd = defaultdict(list)\n\n for entry in md:\n try:\n for k, v in entry.items():\n dd[k].append(v)\n except AttributeError:\n continue\n return dd",
"def ... | [
"0.5396862",
"0.5393085",
"0.53370476",
"0.5333234",
"0.5234334",
"0.5232578",
"0.52290213",
"0.5222074",
"0.519915",
"0.5179328",
"0.50804114",
"0.504555",
"0.50220764",
"0.50206935",
"0.5009291",
"0.5001079",
"0.49918917",
"0.49794748",
"0.49771154",
"0.4963656",
"0.4960963... | 0.61622775 | 0 |
Convert all rows in an Excel sheet into JSON files with normalized data. Filename is based on described file's name. | def convert_amiExcelToJSON(self, sheetname, json_directory,
conversion_dictionary = HEADER_CONVERSION):
ami_data = self.normalize_excelSheet(sheetname,
conversion_dictionary)
cols = len(ami_data[0])
headers = ami_data[0]
json_directory = os.path.abspath(json_directory)
for row in ami... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excel_to_json(file_path, sheet=None):\n df = pd.read_excel(file_path, sheet_name=sheet)\n columns = [str(k) for k in df.columns]\n data = [dict(zip(columns, row)) for row in df.values]\n return data",
"def nodes_data_excel_to_json(excel_path,json_path,**kwargs):\n if not os.path.isfile(excel_p... | [
"0.70595056",
"0.6563447",
"0.6152082",
"0.60554063",
"0.5985892",
"0.59744626",
"0.5919833",
"0.5697941",
"0.5653924",
"0.5568321",
"0.5554736",
"0.5531523",
"0.5522933",
"0.5502785",
"0.5476106",
"0.5474166",
"0.54540044",
"0.5443829",
"0.5430915",
"0.54281086",
"0.5397335"... | 0.7532426 | 0 |
Creates a ListNode out of a list of values | def create_node_list(values: list[int]) -> ListNode:
head = ListNode(values[0])
last_node = head
for value in values[1:]:
node = ListNode(value)
last_node.next = node
last_node = node
return head | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constructList(vals):\n # Current method is iterative, recursive soln also exists\n head = ListNode(val=vals.pop(0))\n current = head\n while len(vals) > 0:\n nex = ListNode(val=vals.pop(0))\n current.next = nex; current = nex\n return head",
"def create_list(nums):\n return_no... | [
"0.7668803",
"0.7625678",
"0.76216567",
"0.7119708",
"0.7033482",
"0.6983948",
"0.6870438",
"0.6869323",
"0.685177",
"0.6708658",
"0.6708658",
"0.6691854",
"0.66799533",
"0.6566763",
"0.6503184",
"0.64228106",
"0.64188063",
"0.6257366",
"0.62438476",
"0.6127412",
"0.61024964"... | 0.8245124 | 0 |
Returns the values in linked list | def get_values(node: ListNode) -> list[int]:
values = [node.val]
curr = node.next
while curr is not None:
values.append(curr.val)
curr = curr.next
return values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __to_list__(self):\r\n out = []\r\n node = self.head\r\n while node:\r\n out.append(node.value)\r\n node = node.next\r\n return out",
"def printlist(self):\n current_element = self.head\n items = []\n while current_element:\n i... | [
"0.7188965",
"0.6925471",
"0.6883925",
"0.68687975",
"0.68568766",
"0.6756867",
"0.6735603",
"0.6717372",
"0.66654414",
"0.6618168",
"0.65939355",
"0.6582247",
"0.65145826",
"0.6504266",
"0.64761305",
"0.6446153",
"0.6434364",
"0.6402573",
"0.63876903",
"0.63876903",
"0.63695... | 0.70627177 | 1 |
Send the new presence states to the appropriate destinations. This actually queues up the presence states ready for sending and triggers a background task to process them and send out the transactions. | def send_presence(self, states):
if not self.hs.config.use_presence:
# No-op if presence is disabled.
return
# First we queue up the new presence by user ID, so multiple presence
# updates in quick successtion are correctly handled
# We only want to send presence... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_presence_inner(self, states):\n hosts_and_states = yield get_interested_remotes(self.store, states, self.state)\n\n for destinations, states in hosts_and_states:\n for destination in destinations:\n if destination == self.server_name:\n contin... | [
"0.63299507",
"0.62768155",
"0.6022448",
"0.58827865",
"0.5726486",
"0.5599578",
"0.5594017",
"0.5575293",
"0.54970497",
"0.5493874",
"0.5484622",
"0.54680294",
"0.5442738",
"0.5420104",
"0.54031575",
"0.52907646",
"0.5263941",
"0.5263679",
"0.5166595",
"0.51161945",
"0.51116... | 0.748558 | 0 |
Given a list of states populate self.pending_presence_by_dest and poke to send a new transaction to each destination | def _process_presence_inner(self, states):
hosts_and_states = yield get_interested_remotes(self.store, states, self.state)
for destinations, states in hosts_and_states:
for destination in destinations:
if destination == self.server_name:
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_presence(self, states):\n if not self.hs.config.use_presence:\n # No-op if presence is disabled.\n return\n\n # First we queue up the new presence by user ID, so multiple presence\n # updates in quick successtion are correctly handled\n # We only want to s... | [
"0.6810247",
"0.5623089",
"0.5551934",
"0.5548037",
"0.54922086",
"0.5445148",
"0.5405358",
"0.53879744",
"0.52504075",
"0.5156768",
"0.5064558",
"0.50595564",
"0.50569946",
"0.504726",
"0.504384",
"0.50202674",
"0.50122774",
"0.5000987",
"0.49834234",
"0.49677846",
"0.496333... | 0.69715214 | 0 |
Try to start a new transaction to this destination If there is already a transaction in progress to this destination, returns immediately. Otherwise kicks off the process of sending a transaction in the background. | def _attempt_new_transaction(self, destination):
# list of (pending_pdu, deferred, order)
if destination in self.pending_transactions:
# XXX: pending_transactions can get stuck on by a never-ending
# request at which point pending_pdus_by_dest just keeps growing.
# we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startTransaction(self):\n if self._transaction is None:\n d = self._config.startTxn()\n\n def processTxn(result):\n self._transaction = result\n return self._transaction\n\n d.addCallback(processTxn)\n retu... | [
"0.7000915",
"0.67738664",
"0.6762412",
"0.6707133",
"0.6538464",
"0.6440339",
"0.62238014",
"0.6156051",
"0.6078979",
"0.59524673",
"0.5896528",
"0.58385485",
"0.5802584",
"0.57806635",
"0.5777683",
"0.57267606",
"0.5691366",
"0.56613284",
"0.5601267",
"0.5547398",
"0.55116"... | 0.7620211 | 0 |
Does some preprocessinc on information. If submodules of a module are the responsbility of one developer we aggregrate them in our style check. | def preProcess(self):
for moduleName in self.module.keys():
# find the one with the most votes per module:
votes = 0
winner = ''
for voter in self.module[moduleName].keys():
if self.module[moduleName][voter] > votes:
votes = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_module_list(self, modules):",
"def process_module(self, node):\n code = node.file_stream.read()\n\n try:\n tree = compile(code, node.file, \"exec\", ast.PyCF_ONLY_AST)\n except SyntaxError:\n # Pylint would have already failed\n return\n\n ... | [
"0.54041815",
"0.5396395",
"0.5298839",
"0.52766603",
"0.52583736",
"0.51609725",
"0.5023325",
"0.50173897",
"0.50173897",
"0.50173897",
"0.50173175",
"0.50173175",
"0.50173175",
"0.50173175",
"0.50173175",
"0.49220988",
"0.492106",
"0.49128735",
"0.48859426",
"0.48705772",
"... | 0.56209105 | 0 |
Generates a python file that uses the result of parsing and this class to generate a script that checks to code quality. | def generate(self, fileName):
self.preProcess()
styleFile = open(fileName, 'w')
# write head part
head = """#!/usr/bin/env python
import os
from WMQuality.Code import Code
# output of the log files
# prefix of the files in cvs
# quality script for using pylint:
qualityScript = '%s'
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self):\n logger=self.logger\n outputter=self.OutputType()\n outputter.make_runner(parser=self.parser,dry_run=self.dry_run,\n setarith=self.setarith)\n con=fileless_context(\n scopes=[self.parse_result],verbose=self.verbose,logger=logg... | [
"0.67679656",
"0.66761065",
"0.6591752",
"0.65536964",
"0.6444953",
"0.6438405",
"0.62742144",
"0.615006",
"0.61399806",
"0.6091215",
"0.6081134",
"0.59454465",
"0.5871897",
"0.58534235",
"0.5835145",
"0.5828372",
"0.5812517",
"0.5808845",
"0.5806871",
"0.57893455",
"0.576894... | 0.7254187 | 0 |
Test for Library System creation | def test_System_creation(self):
s1 = System()
self.assertEqual(s1.get_library_name(), "default") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_system_entire(self):\n pass",
"def test_library(self):\n self.assertEqual(LibraryConfig.name, \"library\")",
"def test_create_software_bundle_from_system_module(self):\n pass",
"def test_get_system(self):\n pass",
"def test_list_available_libraries(self):\n ... | [
"0.7114945",
"0.7110992",
"0.69046354",
"0.6895962",
"0.6762503",
"0.6724689",
"0.67044646",
"0.6660487",
"0.6562099",
"0.6488525",
"0.6482666",
"0.6377499",
"0.6375429",
"0.63601446",
"0.6281375",
"0.627325",
"0.62369835",
"0.62260705",
"0.6192796",
"0.61692935",
"0.61692935... | 0.8082865 | 0 |
Test for set_get_library_name methods | def test_set_library_name(self):
s1 = System()
s1.set_library_name("Andreson")
self.assertEqual(s1.get_library_name(), "Andreson") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_library(self):\n self.assertEqual(LibraryConfig.name, \"library\")",
"def test_get_module_name_alternate(self):\n target = Mock(['__name__'])\n target.__name__ = 'hello'\n self.assertEqual('hello', reloading.get_module_name(target))",
"def test_System_creation(self):\n ... | [
"0.6658442",
"0.6303437",
"0.61149365",
"0.6047091",
"0.5958926",
"0.5918382",
"0.5897615",
"0.5862234",
"0.5839088",
"0.5758882",
"0.5628555",
"0.56156504",
"0.55159885",
"0.5514347",
"0.54656523",
"0.5462677",
"0.54573643",
"0.5456163",
"0.5449216",
"0.5434502",
"0.5413884"... | 0.7909149 | 0 |
Test for set_get_address methods | def test_set_address(self):
s1 = System()
s1.set_address("101 St James Rd")
self.assertEqual(s1.get_address(), "101 St James Rd") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_address_retrieve(self):\n pass",
"def test_client_address_update(self):\n pass",
"def test_address_info(self):\n from supvisors.rpcinterface import RPCInterface\n # prepare context\n self.supervisor.supvisors.context.addresses = {\n '10.0.0.1': Mock... | [
"0.7707231",
"0.7532003",
"0.7299374",
"0.71625394",
"0.714698",
"0.677194",
"0.67455375",
"0.66716015",
"0.6585854",
"0.6518641",
"0.6498674",
"0.6489233",
"0.64433426",
"0.6354058",
"0.6336124",
"0.6326224",
"0.62694657",
"0.62578624",
"0.62524426",
"0.6246869",
"0.62225807... | 0.80260247 | 0 |
Test for get_catalogue method | def test_get_catalogue(self):
s1 = System()
self.assertEqual(len(s1.get_catalogue()), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_ucs_get_catalog(self):\n api_data = request(\"get\", \"/sys\")\n self.assertEqual(api_data['status'], 200,\n 'Incorrect HTTP return code, expected 200, got:' + str(api_data['status']))\n total_elements = 0\n for elementTypes in api_data[\"json\"]:\n ... | [
"0.6866592",
"0.6642273",
"0.65242225",
"0.64913774",
"0.63869",
"0.63858384",
"0.6321552",
"0.63013244",
"0.62671864",
"0.62502635",
"0.6246352",
"0.6245286",
"0.62361485",
"0.6227771",
"0.6207126",
"0.6173256",
"0.61397535",
"0.6139452",
"0.6126137",
"0.6113673",
"0.6067933... | 0.7337848 | 0 |
Test for add_resource method | def test_add_resource(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertNotIn(b1, s1.catalogue)
s1.add_resource(b1)
self.assertIn(b1, s1.catalogue)
s1.add_resource(b1)
self.assertEqual(len(s1.catalogue),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resource_user_resource_add_user_post(self):\n pass",
"def test_add_resource(self):\n self.login_editor() \n\n # invalid submission with missing required fields\n form_data = minimal_form_data()\n response = self.client.post('/resource/new', form_data )\n ... | [
"0.75176287",
"0.7469037",
"0.737283",
"0.72444254",
"0.7171602",
"0.68219227",
"0.66673607",
"0.66355",
"0.6561624",
"0.6520029",
"0.65143245",
"0.65109766",
"0.6500391",
"0.6483741",
"0.6471121",
"0.64403176",
"0.64361775",
"0.63794154",
"0.6364287",
"0.6359559",
"0.6358183... | 0.78162867 | 0 |
Test for get_catalogue_lengh method | def test_get_catalogue_lengh(self):
s1 = System()
self.assertEqual(s1.get_catalogue_lengh(), 0)
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
s1.add_resource(b1)
self.assertEqual(s1.get_catalogue_lengh(), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_catalog_size() -> int:\n return len(gift_catalog)",
"def test_get_catalogue(self):\n s1 = System()\n self.assertEqual(len(s1.get_catalogue()), 0)",
"def get_lengte(self):",
"def test_default_num_products(self):\r\n prod = generate_products()\r\n self.assertEqual(len(pro... | [
"0.75294435",
"0.7064883",
"0.64226764",
"0.6203608",
"0.6200589",
"0.6065192",
"0.6011624",
"0.6011624",
"0.6011624",
"0.5977219",
"0.59744227",
"0.59733105",
"0.59733105",
"0.5972438",
"0.59704494",
"0.59694606",
"0.59691674",
"0.5932574",
"0.5910652",
"0.5908123",
"0.59081... | 0.7648255 | 0 |
Test for check_resource method | def test_check_resource(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.check_resource(b1), False)
s1.add_resource(b1)
self.assertEqual(s1.check_resource(b1), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_valid_resource():\n mock_name = \"rg-001\"\n output = sh.is_valid_resource(mock_name)\n assert output is True",
"def ResourceExists(self, name):\n pass",
"def _resource_name_check(self, resource_name):\n return self._name_check(resource_name, 'resources')",
"def resources():\n ... | [
"0.73959047",
"0.71328235",
"0.70060706",
"0.6716015",
"0.6670783",
"0.66292065",
"0.6610881",
"0.65043044",
"0.649458",
"0.6476513",
"0.6467334",
"0.6438803",
"0.64315283",
"0.63967735",
"0.63661104",
"0.6344003",
"0.6321799",
"0.63212746",
"0.62832993",
"0.62726897",
"0.625... | 0.81357706 | 0 |
Test for edit_resource method | def test_edit_resource(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
s1.edit_resource(b1, "Animal Farm")
self.assertEqual(b1.get_title(), "1984")
s1.add_resource(b1)
s1.edit_resource(b1, "Animal Farm")
self.ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_edit(self):\n response = self.get('/study/edit/1')\n self.assertEqual(response.code, 200)\n self.assertNotEqual(str(response.body), \"\")",
"def test_offers_edit(self, mock_find):\n mock_find.return_value = sample_offer\n\n result = self.client.get(f'/offers/{sampl... | [
"0.73706436",
"0.7300331",
"0.7283525",
"0.6929135",
"0.6886645",
"0.68010265",
"0.67788994",
"0.67335325",
"0.66969943",
"0.66636723",
"0.6662277",
"0.6639534",
"0.6626035",
"0.6625544",
"0.6624509",
"0.6613107",
"0.6602862",
"0.658556",
"0.6576637",
"0.65542984",
"0.653163"... | 0.7786377 | 0 |
Test for search_resource method | def test_search_resource(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.search_resource(b1), None)
s1.add_resource(b1)
self.assertEqual(s1.search_resource(b1), b1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search(self):\n pass",
"def test_search(self):\n pass",
"def test_search(self):\n pass",
"def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])",
"def test_search_term_found_in_titl... | [
"0.75347525",
"0.75347525",
"0.75347525",
"0.7347876",
"0.70456636",
"0.6963902",
"0.6943536",
"0.69269586",
"0.6910861",
"0.690744",
"0.6829568",
"0.6813505",
"0.6797388",
"0.6785908",
"0.67844117",
"0.67436486",
"0.6666172",
"0.66304046",
"0.659121",
"0.6566244",
"0.6546078... | 0.8162452 | 0 |
Test for search_by_ISBN method | def test_search_by_ISBN(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.search_by_ISBN("0123456789123"), 0)
s1.add_resource(b1)
self.assertEqual(s1.search_by_ISBN("0123456789123"), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_client_by_isbn(self, mock_get):\n\n response = isbn_utils.search_by(self.filter_isbn, self.ISBN)\n self.assertEqual(response.data, json.loads(open(UNIT_TEST_RESOURCES_FOLDER +\n FILE_NAME_ISBN_SEARCH_RESPONSE).read())[\"data\"])",
"d... | [
"0.77695554",
"0.72875947",
"0.714704",
"0.6777699",
"0.67719877",
"0.675688",
"0.67482865",
"0.6720576",
"0.6668579",
"0.6662156",
"0.6598414",
"0.657023",
"0.6536934",
"0.64985555",
"0.6488425",
"0.6473168",
"0.6417611",
"0.64053017",
"0.6354876",
"0.6300086",
"0.62986517",... | 0.8734922 | 0 |
Test for search_by_author method | def test_search_by_author(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.search_by_author("George Orwell"), 0)
s1.add_resource(b1)
self.assertEqual(s1.search_by_author("George Orwell"), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_author(self):\n\n\t\titem_id = mock_item(title='Dummy Title', author='Made Up Author')[0]\n\n\t\titem = models.search('Made')[0]\n\t\tself.assertEqual(item['id'], item_id)",
"def test_absorbs_naked_author_search(self):\n invenio_search = \"author:ellis\"\n spi_search = \"aut... | [
"0.8368521",
"0.82203734",
"0.80754197",
"0.79184866",
"0.7810743",
"0.7788319",
"0.7780222",
"0.7542295",
"0.7385078",
"0.73468894",
"0.7330463",
"0.72824466",
"0.7165914",
"0.71103066",
"0.71090764",
"0.70983607",
"0.69483745",
"0.69440126",
"0.6858059",
"0.6829173",
"0.679... | 0.8337529 | 1 |
Test for remove_resource method | def test_remove_resource(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.remove_resource(b1), print())
s1.add_resource(b1)
self.assertIn(b1, s1.catalogue)
s1.remove_resource(b1)
self.assertNot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_remove(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWithName(\"... | [
"0.7665867",
"0.75597936",
"0.7369516",
"0.68952036",
"0.6845173",
"0.6773295",
"0.6739468",
"0.67386067",
"0.67290366",
"0.66695964",
"0.66498464",
"0.6646193",
"0.6591958",
"0.6567395",
"0.6535467",
"0.65260106",
"0.6509816",
"0.6509816",
"0.65032136",
"0.649242",
"0.646448... | 0.80478346 | 0 |
Test for delete_resource_from_index_position method | def test_delete_resource_from_index_position(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.delete_resource_from_index_position(0), print())
self.assertEqual(s1.delete_resource_from_index_position(-1), print())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_removing_index(self):",
"def test_index_delete(self):\n a = self.test_index()\n a.delete()\n es = self.es\n es.refresh()\n r = es.search(query=StringQuery('zool'))\n eq_(r['hits']['total'], 0, \"We shouldn't get any hits.\")",
"def test_delete_document(index_w... | [
"0.716394",
"0.7033717",
"0.6886999",
"0.68802756",
"0.6583773",
"0.6499626",
"0.64575",
"0.6355071",
"0.6347227",
"0.63249075",
"0.63136363",
"0.6283639",
"0.6282689",
"0.6277738",
"0.62753356",
"0.62416536",
"0.6220821",
"0.6220821",
"0.6212967",
"0.6180838",
"0.61782694",
... | 0.82605475 | 0 |
Test for lending_process method | def test_lending_process(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
m1 = Members("Richard", "Blackmore", "14-04-1945", "Weston")
m2 = Members("Eric", "Eric Clapton", "30-03-1945", "Riplay")
#test what happens if book not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_startProcess(self):\r\n self.pm.addProcess(\"foo\", [\"foo\"])\r\n self.pm.startProcess(\"foo\")\r\n self.assertIsInstance(self.pm.protocols[\"foo\"], LoggingProtocol)\r\n self.assertIn(\"foo\", self.pm.timeStarted.keys())",
"def process():\n pass",
"def test_start_proce... | [
"0.6173282",
"0.5930779",
"0.589129",
"0.58374673",
"0.5807327",
"0.57782507",
"0.5777092",
"0.5739012",
"0.57290083",
"0.56662744",
"0.56134325",
"0.55600566",
"0.551325",
"0.5463071",
"0.5449737",
"0.54214317",
"0.54202276",
"0.5412321",
"0.5412321",
"0.5412321",
"0.5399937... | 0.6112398 | 1 |
Test for return_book_process method | def return_book_process(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
m1 = Members("Richard", "Blackmore", "14-04-1945", "Weston")
s1.add_resource(b1)
s1.lending_process(b1, m1)
s1.remove_resource(b1)
#prove th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_book():\n return render_template('process_book.html')",
"def return_book(self, book_id, return_date):\r\n for book in LibraryDB.book_list:\r\n if book.book_id == book_id and book_id in [i.book_id for i in self.issued_books]:\r\n book.availability = True\r\n ... | [
"0.62140787",
"0.61643386",
"0.6148973",
"0.5966506",
"0.5959692",
"0.59526885",
"0.59435666",
"0.57925487",
"0.57628417",
"0.57617724",
"0.5734467",
"0.5713324",
"0.56746566",
"0.5623255",
"0.5604597",
"0.55610216",
"0.54859006",
"0.54459155",
"0.543411",
"0.5414501",
"0.538... | 0.78834885 | 0 |
Parse TQL ascii time field returning datetime.time | def parse_tql_time(self, data, pid, label):
field = self.parse_tql_field(data, pid, label)
if field:
hour, minute, second = [int(i) for i in field.split(':')[0:3]]
field = datetime.time(hour, minute, second)
return field | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(text_time):\n # return Observer.datetime_to_astropy_time(dt.datetime.strptime(text_time, '%d/%m/%Y %H:%M'))\n the_time = dt.datetime.strptime(text_time, '%d/%m/%Y %H:%M')\n return Time(the_time.strftime('%Y-%m-%d %H:%M'))\n #date = [int(i) for i in date.split('/')]",
"def _parse_time_str... | [
"0.70914274",
"0.70201325",
"0.68314403",
"0.67921424",
"0.6737764",
"0.66979635",
"0.6697224",
"0.6691148",
"0.6679622",
"0.6647432",
"0.6640266",
"0.6632124",
"0.6588161",
"0.6530218",
"0.6529041",
"0.65162116",
"0.6500483",
"0.64943856",
"0.64922947",
"0.64789206",
"0.6478... | 0.83321196 | 0 |
called when staged order ticket request has been submitted with 'poke' and Ack has returned | def ticket_submit_ack_callback(self, data):
self.output('staged order ticket submission acknowledged: %s' % repr(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_submit_ack_callback(self, data):\n self.output('order submission acknowleded: %s' % repr(data))",
"def ticket_submit_callback(self, data):\n self.output('staged order ticket submitted: %s' % repr(data))",
"def acknowledged(self):\n ...",
"def handleSent(): \r\n gl... | [
"0.65402454",
"0.6140557",
"0.6103491",
"0.6096946",
"0.6077967",
"0.6076535",
"0.6049912",
"0.5990767",
"0.59754926",
"0.5922344",
"0.5860195",
"0.5799573",
"0.57155365",
"0.57155365",
"0.5699258",
"0.56790817",
"0.5563556",
"0.55532837",
"0.55094004",
"0.5504198",
"0.550243... | 0.7298359 | 0 |
called when order has been submitted with 'poke' and Ack has returned | def order_submit_ack_callback(self, data):
self.output('order submission acknowleded: %s' % repr(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ack(self):\n self.consumer.ack(self)",
"def ticket_submit_ack_callback(self, data):\n self.output('staged order ticket submission acknowledged: %s' % repr(data))",
"async def ack(self, offset: int):",
"def acknowledged(self):\n ...",
"def handleReceived():\r\n global receivedAck... | [
"0.6417594",
"0.63553673",
"0.6310921",
"0.6280499",
"0.6235027",
"0.6160638",
"0.615443",
"0.61338025",
"0.61163735",
"0.61023057",
"0.59978265",
"0.5971444",
"0.5940968",
"0.5938956",
"0.5914693",
"0.5914693",
"0.5908057",
"0.5868182",
"0.5846094",
"0.5846094",
"0.5846094",... | 0.70445883 | 0 |
Return a copy of this session with different max_retries. | def with_retry(self, retry: Optional[urllib3.util.retry.Retry]) -> "Session":
return type(self)(
master=self._master,
user=self._user,
auth=self._auth,
cert=self._cert,
max_retries=retry,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session_retry(self, retries=3, backoff_factor=0.2,\n status_forcelist=(404, 500, 502, 504),\n session=None):\n session = session or requests.Session()\n retry = Retry(total=retries, read=retries, connect=retries,\n backoff... | [
"0.6693097",
"0.6055224",
"0.6011351",
"0.5991151",
"0.5978382",
"0.5869661",
"0.5861507",
"0.5788364",
"0.5755023",
"0.57389003",
"0.5561054",
"0.5491818",
"0.54451287",
"0.5423037",
"0.54150796",
"0.53628075",
"0.5357361",
"0.53417206",
"0.5197484",
"0.5182304",
"0.51763517... | 0.6716732 | 0 |
The hashing function takes a string input and converts it into a hash using the SHA256 hashing technique present in the hashlib library in python. Arguments | def hashing(word) :
ans = hashlib.sha256(word.encode())
return ans.hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def h(x):\n\n hasher = hashlib.sha256()\n hasher.update(x)\n return hasher.digest()",
"def get_256_hash_from_string(string):\n\n sha256 = hashlib.sha256()\n sha256.update(string.encode('utf-8'))\n\n return sha256.hexdigest()",
"def sha256_2_string(string_to_hash):\n\n # Solutio... | [
"0.7626421",
"0.74969774",
"0.7493603",
"0.73092085",
"0.7217957",
"0.71965355",
"0.7123386",
"0.71210426",
"0.71210426",
"0.7113178",
"0.70950216",
"0.7090701",
"0.70856744",
"0.7085671",
"0.7048058",
"0.70315",
"0.70186573",
"0.7007464",
"0.6985593",
"0.6978819",
"0.6970663... | 0.77725095 | 0 |
Remove a measurement or a list of measurement. | def remove(self, measurements):
if not isinstance(measurements, Iterable):
measurements = [measurements]
notification = ContainerChange(obj=self, name='measurements')
for measurement in measurements:
old = self.measurements.index(measurement)
del self.measure... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_measurement():\n meas_id = request.args.get('id', type=int)\n if meas_id is not None:\n db.session.query(Measurement).filter(Measurement.id == meas_id).delete()\n db.session.commit()\n\n return redirect('/measurements')",
"def remove_measurement(self):\n idx = self.measur... | [
"0.7006039",
"0.6825674",
"0.6718692",
"0.6366676",
"0.59642595",
"0.5941515",
"0.58450425",
"0.5829295",
"0.57420117",
"0.57420117",
"0.5720286",
"0.57030857",
"0.56745726",
"0.56653845",
"0.5613495",
"0.56089056",
"0.56086564",
"0.5605919",
"0.5605919",
"0.55991286",
"0.558... | 0.75901985 | 0 |
the bellman operator for the behavioral policy as a python function which takes the value function s^T P s + b represented as a numpy squared array P T(P,b) = R + theta_p^T Q theta_p + gamma (A + B theta_p)^T P (A + B theta_p), gamma (b + tr(P Sigma)) | def bellman_operator(self, P, b, policy="behavior"):
Q = np.matrix(self.mdp.Q)
R = np.matrix(self.mdp.R)
A = np.matrix(self.mdp.A)
B = np.matrix(self.mdp.B)
Sigma = np.matrix(np.diag(self.mdp.Sigma))
if policy == "behavior":
theta = np.matrix(self.behavior_po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RobustBellmanOp(P, Sigma, state, action, gamma):\n BV = 0\n # Here there is a strong assumption that\n # sum(p(s'|(s,a)) * R(s,a,s')) = R(s,a,s') = R(s,a)\n for t in P[state][action]:\n probability = t[0]\n nextstate = t[1]\n cost = t[2]\n done = t[3]\n # BV += ... | [
"0.71001726",
"0.68565446",
"0.6523547",
"0.6306089",
"0.6291289",
"0.6230942",
"0.61771154",
"0.6148315",
"0.60413855",
"0.5933376",
"0.5930906",
"0.5928049",
"0.5900982",
"0.5886188",
"0.5881746",
"0.58785963",
"0.58734393",
"0.5857429",
"0.58492917",
"0.5840334",
"0.581764... | 0.7670253 | 0 |
Return all softmasked regions as a BED3 format string. | def get_masked_regions(contig):
masked_regions = ""
seq = contig.seq
contig_end = len(seq)-1
masked = False
for i, n in enumerate(seq):
# mark the starting position of a softmasked region
if not masked and n.islower():
masked = True
start = i
# mark ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_regions_mask(self, input):",
"def dump(self, contents=False):\n print(self)\n for region in self.regions:\n print(region)\n hexdump(region.data, address=region.address)",
"def read_BEC_region_mask(grid):\n region_mask_file = '/home/ivan/Python/data/BEC_REGION_MASK... | [
"0.59224325",
"0.54149204",
"0.5379897",
"0.53791404",
"0.52565",
"0.5155345",
"0.5125964",
"0.50116074",
"0.5007976",
"0.50038373",
"0.50032556",
"0.49970403",
"0.49952328",
"0.49776202",
"0.494399",
"0.49382335",
"0.4912289",
"0.49092403",
"0.48832148",
"0.48810032",
"0.486... | 0.6836982 | 0 |
Builds a resource URL for the given kwargs. Given an example collection where `collection_key = 'entities'` and `key = 'entity'`, the following URL's could be generated. | def build_url(self, dict_args_in_out=None):
if dict_args_in_out is None:
dict_args_in_out = {}
url = dict_args_in_out.pop('base_url', None) or ''
url += '/%s' % self.collection_key
# do we have a specific entity?
entity_id = dict_args_in_out.pop('%s_id' % self.key, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_collection_url(self, **kwargs):\n\n url = self._generate_url(url_type='collection', **kwargs)\n return url",
"def _build_uri(self, **kwargs):\n target_uri, version = str(), None\n\n if kwargs.get('category') not in ['performance', 'common']:\n version = self._build_... | [
"0.65982926",
"0.64410657",
"0.6376219",
"0.5949595",
"0.59395957",
"0.5937871",
"0.5891844",
"0.5872246",
"0.5872246",
"0.58385074",
"0.58289504",
"0.5797399",
"0.5791687",
"0.57855177",
"0.57543904",
"0.5751335",
"0.57417595",
"0.573921",
"0.57283247",
"0.5718494",
"0.57029... | 0.7582599 | 0 |
Test user can get all sales | def test_get_all_sales(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
response = self.client.get(self.sl_url,
headers=dict(Authorization="Bearer " + access_token))
result = json.loads(response.data.decode())
self.assertEqual(response.stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_all_sale_records(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \"quanti... | [
"0.7474644",
"0.73433435",
"0.7226546",
"0.71686345",
"0.68853",
"0.68461",
"0.68375087",
"0.6793282",
"0.67523843",
"0.6588984",
"0.6573936",
"0.6551599",
"0.6486141",
"0.6473017",
"0.64615905",
"0.64156425",
"0.6399153",
"0.63895774",
"0.6347083",
"0.63440025",
"0.63045716"... | 0.8110322 | 0 |
test create a sale record | def test_post_sale_record(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
res = self.client.post(self.p_url,
data=self.products_data,
headers=dict(Authorization="Bearer " + access_token))
result = json.loads(res.data.decode())
self.asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_sale_record(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \"quantity\":... | [
"0.78964686",
"0.7810856",
"0.7591687",
"0.7530914",
"0.7336629",
"0.70531434",
"0.70490855",
"0.70409393",
"0.6985339",
"0.692475",
"0.69237953",
"0.68040955",
"0.677054",
"0.6726252",
"0.6721466",
"0.67095804",
"0.6703448",
"0.6622187",
"0.66104954",
"0.65952396",
"0.657949... | 0.7876173 | 1 |
test get a specific sale_record by id | def test_get_one_sale_record(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
response = self.client.post('/api/v1/sales',
data=self.sales_data,
headers=dict(Authorization="Bearer " + access_token))
self.assertEqual(response.status_code,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_specific_sale_record(self):\n \n self.register_admin_test_account()\n token = self.login_admin_test()\n\n response = self.app_test_client.get(\n '{}/saleorder'.format(self.base_url), json={\n 'sale_id': 1,\n 'name': \"Sample Bags\",\n ... | [
"0.8488579",
"0.734553",
"0.706829",
"0.69891703",
"0.68932825",
"0.6712079",
"0.66892236",
"0.6686362",
"0.66299886",
"0.6611321",
"0.6520579",
"0.6505532",
"0.64531493",
"0.6440169",
"0.63657",
"0.63465416",
"0.6296529",
"0.6288324",
"0.62848693",
"0.6208785",
"0.6182311",
... | 0.7370436 | 1 |
test a non existing sale_record cannot be retrieved | def test_get_non_existing_sale_record(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
response = self.client.get('/api/v1/sale/100',
headers=dict(Authorization="Bearer " + access_token))
self.assertEqual(response.status_code, 404)
result =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_get_empty_sales(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n\n resp = self.client.get(\n '/api/v1/sales/1',\n headers={'Authorization': 'Bearer {}'.f... | [
"0.67065454",
"0.65563065",
"0.6445439",
"0.6376305",
"0.6364539",
"0.63549346",
"0.6344477",
"0.63023585",
"0.6260622",
"0.62462413",
"0.6177097",
"0.61122227",
"0.6104429",
"0.6096169",
"0.60852754",
"0.6059171",
"0.6040166",
"0.6034094",
"0.6025876",
"0.60226256",
"0.60205... | 0.83915794 | 0 |
test create a sale record with quantity as string | def test_post_sale_record_with_quantity_string(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
res = self.client.post(self.sl_url,
data=self.string_sales,
headers=dict(Authorization="Bearer " + access_token))
result = json.loads(res.data.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_sale_with_invalid_quantity(self):\n self.register_admin_test_account()\n token = self.login_admin_test()\n \n response = self.app_test_client.post('{}/saleorder'.format(\n self.base_url), json={'name': \"Hand Bag\", 'price': 1500, 'quantity': \"5\", 'totalamt': \... | [
"0.73696387",
"0.7272735",
"0.6952385",
"0.6769718",
"0.6723913",
"0.65521663",
"0.6526882",
"0.6447317",
"0.642388",
"0.6377979",
"0.6343794",
"0.63268614",
"0.628641",
"0.6271526",
"0.6246291",
"0.6237712",
"0.62305063",
"0.6228506",
"0.61977756",
"0.6193409",
"0.6190083",
... | 0.82792795 | 0 |
Reads input.yml and returns a list of optional packages for the fixture | def optional_packages():
with open(r"tests/input.yml") as file:
inputs = yaml.load(file, Loader=yaml.FullLoader)
return inputs["optional_packages"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def python_packages():\n with open(r\"tests/input.yml\") as file:\n inputs = yaml.load(file, Loader=yaml.FullLoader)\n return inputs[\"python_packages\"]",
"def required_packages():\n with open(r\"required-packages.yml\") as file:\n inputs = yaml.load(file, Loader=yaml.FullLoader)\n ret... | [
"0.74960756",
"0.72168744",
"0.6479338",
"0.59237087",
"0.5857561",
"0.5720948",
"0.5557785",
"0.54705644",
"0.54513747",
"0.54507947",
"0.5422149",
"0.5409515",
"0.5387675",
"0.5322175",
"0.5320085",
"0.52968514",
"0.52756894",
"0.5262094",
"0.52328485",
"0.52328485",
"0.522... | 0.82169074 | 0 |
Reads input.yml and returns a list of python related packages | def python_packages():
with open(r"tests/input.yml") as file:
inputs = yaml.load(file, Loader=yaml.FullLoader)
return inputs["python_packages"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_packages():\n with open(r\"required-packages.yml\") as file:\n inputs = yaml.load(file, Loader=yaml.FullLoader)\n return inputs[\"required_packages\"]",
"def optional_packages():\n with open(r\"tests/input.yml\") as file:\n inputs = yaml.load(file, Loader=yaml.FullLoader)\n ... | [
"0.7422069",
"0.6971301",
"0.6811929",
"0.6220798",
"0.6169701",
"0.60719687",
"0.5946472",
"0.58931",
"0.58555245",
"0.5743362",
"0.57142967",
"0.5677042",
"0.56702876",
"0.5617658",
"0.5599167",
"0.5591488",
"0.5534712",
"0.5522331",
"0.5520315",
"0.55116594",
"0.55114037",... | 0.83976966 | 0 |
Scans the database for jobs that are eligible to run; in other words, those with an empty dependency list and the status "Not Submitted". | def scan_for_runnable(limit=None):
logging.debug('Finding runnable jobs')
ready_jobs_query = Session.query(Job).filter(~Job.depends_on.any()). \
filter_by(status_id=Status.NOT_SUBMITTED)
if limit:
ready_jobs_query = ready_jobs_query.limit(limit)
ready_jobs = ready... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_waiting_jobs(self):\n return []",
"def run_pending(self):\n logger.debug(\"available jobs: \" + str(self.jobs))\n runnable_jobs = (job for job in self.jobs if job.should_run())\n logger.debug(\"runnable jobs: \" + str(self.jobs))\n for job in runnable_jobs:\n ... | [
"0.6436594",
"0.64285314",
"0.62542844",
"0.61889505",
"0.6012798",
"0.6004328",
"0.5882026",
"0.5847893",
"0.58347625",
"0.5828717",
"0.5812674",
"0.5812287",
"0.57511747",
"0.5739757",
"0.5721309",
"0.57154495",
"0.57145697",
"0.56779337",
"0.5662949",
"0.56397986",
"0.5629... | 0.6924647 | 0 |
At Inference time, load model, params and preprocess data. Not saving the data, only output final dataframe | def preprocess_inference(df, path_pipeline="data/pipeline/pipe_01/", preprocess_pars={}, cols_group=None):
from util_feature import load, load_function_uri, load_dataset
#### Pipeline Execution ####################################################
pipe_default = [
{'uri' : 'source/prepro.py::pd_colnu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n df = prepro_last()\n X, y = train_build(df)\n fit_store(X, y)",
"def main():\n data = load_data()\n analyze_features(data['full_features'])\n model = train(data)\n\n with open('model.pickle', 'wb') as f:\n pickle.dump(model, f)\n evaluate(model, data)",
"def load_mo... | [
"0.64184946",
"0.6337976",
"0.6275767",
"0.62493265",
"0.62413377",
"0.6229349",
"0.6225312",
"0.62025195",
"0.6174834",
"0.61704147",
"0.61677074",
"0.61300826",
"0.6080634",
"0.6062665",
"0.60608184",
"0.6054831",
"0.6052776",
"0.60308474",
"0.60219646",
"0.6020345",
"0.599... | 0.6648521 | 0 |
Create a pumping rate well | def __init__(self, name="", description="", time_units="s", len_units="m",
pump_units="m3/s"):
# Set general info
self._type = 1 # pumping well id
self.parameters = {'full': True,
'rw': 1.,
'd': 0.,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(window_type=WindowType.DEFAULT, rate=10):\n pass",
"def create_pumper():\n return _Kalamazoo()",
"def run_loop_measurement(t=0.5, name='test', loops=4, pump_t=180, total_t=600, jump_x=10):\n\n incident_angles = [0.1, 0.4]\n waxs_arc = [20, 0]\n user = \"TP\"\n\n condition = (\n... | [
"0.6111014",
"0.59055704",
"0.5620826",
"0.5561464",
"0.5551125",
"0.5525205",
"0.547904",
"0.5449968",
"0.5444173",
"0.54401493",
"0.5416738",
"0.54025877",
"0.53928125",
"0.538614",
"0.536652",
"0.5296037",
"0.5283478",
"0.5277413",
"0.52544755",
"0.5250356",
"0.5236363",
... | 0.6467801 | 0 |
Add new observation well or piezometer object to the actual pumping well INPUTS x [int, float, list, tuple, ndarray] time vector y [int, float, list, tuple, ndarray] drawodwn vector wtype [int] type of data 0 observation well 1 piezometer name [string] well name that is used as label for plot description [string] well ... | def add_well(self, x=1, y=1, wtype=0, name="New well", description="Added well"):
if wtype == 0:
new_well = ObservationWell(name, description, time_units=self.time_units,
len_units=self.len_units)
elif wtype == 1:
new_well = Piezometer(name,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_figure(picks, curve, active_well): \n w = p.get_well(active_well) ##selects the correct welly.Well object\n picks_df = pd.read_json(picks)\n picks_selected = picks_df[picks_df['UWI'] == active_well.replace(' ', '-')]\n \n # regenerate figure with the new horizontal line\n fig = helper... | [
"0.5584504",
"0.53288746",
"0.52431315",
"0.5236649",
"0.5117322",
"0.5074837",
"0.5043187",
"0.50353146",
"0.5032513",
"0.4923973",
"0.48615775",
"0.48594245",
"0.48498887",
"0.4801942",
"0.47999173",
"0.4759228",
"0.4738073",
"0.47359067",
"0.47266603",
"0.47177938",
"0.471... | 0.78409934 | 0 |
Convert parameters, pumping rate, drawdown and data units given new units INPUTS time_units [string] new time units. If None, actual units are used length_units [string] new length units. If None, actual units are used pump_units [string] new pumping rate units. If None, actual units are used same [bool] if True, pump_... | def convert_units(self, time_units=None, len_units=None, pump_units=None,
same=False):
in_time = self.time_units
# Check new time units
if time_units is None:
time_units = in_time
flag = _units.validate_units(time_units)
if flag == -1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_units(self, time_units=None, len_units=None):\n in_time = self.time_units\n # Check new time units\n if time_units is None:\n time_units = in_time\n flag = _units.validate_units(time_units)\n if flag == -1:\n raise ValueError('Bad time units inpu... | [
"0.73620564",
"0.6910942",
"0.62991405",
"0.6231261",
"0.5903703",
"0.57218415",
"0.57206535",
"0.5695423",
"0.56943077",
"0.5688793",
"0.56632334",
"0.5642992",
"0.5642229",
"0.560559",
"0.5601575",
"0.55584586",
"0.5550535",
"0.5549772",
"0.5539942",
"0.5536012",
"0.5520892... | 0.81115675 | 0 |
Converts the actual pumping rate units to the equivalent length and time units used in parameters and drawdown | def convert_same_units(self):
# Convert pumping rate data
pump_units = "%s3/%s" % (self.len_units, self.time_units)
flag = _units.validate_units(pump_units)
if flag == 2:
self.pumprate.convert_units(self.time_units, pump_units)
self.pump_units = pump_units | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_units(self,):\n self.UNITS = {'pressure':'Pa',}\n return",
"def update_units(self):\n unit_var_value = self.view.vars['unit'].get()\n if unit_var_value == 'm3ph':\n self.minran_u_label.config(text='m³/h')\n self.maxran_u_label.config(text='m³/h')\n ... | [
"0.68502927",
"0.6652245",
"0.6640804",
"0.65066785",
"0.64253104",
"0.6364545",
"0.6226802",
"0.6216705",
"0.6182806",
"0.61223763",
"0.5989723",
"0.5980712",
"0.5951391",
"0.5941575",
"0.5923968",
"0.5891878",
"0.58807355",
"0.58771986",
"0.5800373",
"0.5793957",
"0.5791693... | 0.6932813 | 0 |
Removes the well object from the associated wells list given the well name or index | def delete_well(self, key):
if type(key) is str:
idx = self.get_well_id(key)
elif type(key) is int:
idx = key
else:
raise TypeError('key must be a string or an integer.')
n = self.well_count()
if 0 <= idx <= n - 1:
raise ValueError(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all_wells(self):\n self.wells = []",
"def remove(self, index):\n self._checkIndex(index)\n self._updateOwner(index, register=False)\n discard = self._items.pop(index)",
"def removePlayer(self, index):\n\n self.eloList.pop(index)\n self.idList.pop(index)",
... | [
"0.65468025",
"0.6206192",
"0.6196141",
"0.6068812",
"0.60405266",
"0.5954996",
"0.5951935",
"0.5905774",
"0.58772933",
"0.5833229",
"0.5827092",
"0.5823839",
"0.5822445",
"0.5816786",
"0.5801315",
"0.57647634",
"0.5764105",
"0.57499415",
"0.5734532",
"0.572572",
"0.57193094"... | 0.71419835 | 0 |
Removes all the associated observation wells or piezometers | def delete_all_wells(self):
self.wells = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeIrisToOcc(self):\n\t\tshas = self._getShapes()\n\t\tfor sha in shas:\n\t\t\tif sha.a.iris_Occ.exists:\n\t\t\t\tsha.a.iris_Occ.delete()",
"def clean():\n filter_phase_data()\n combine_phase_data()\n remove_duplicates_phase_data()",
"def clear(self):\n for ob in self.obs:\n o... | [
"0.65370387",
"0.6513907",
"0.6458628",
"0.64248127",
"0.6260866",
"0.62452203",
"0.62053883",
"0.62028664",
"0.6195377",
"0.615413",
"0.60914683",
"0.6066282",
"0.60553503",
"0.6043595",
"0.6036875",
"0.60030484",
"0.59885705",
"0.59833914",
"0.59626335",
"0.59259456",
"0.59... | 0.75973433 | 0 |
Returns a list of plot options with the visible data to be plotted including pumping well, observation well or piezometer drawdown | def get_plot_options(self):
plot_options = []
# Get pumping rate plot options
op = self.pumprate.get_plot_options()
if op['visible']:
plot_options.append(op)
# Get associated data options
for i in range(self.well_count()):
well_options = self.wells... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plot_options(self):\n plot_options = []\n # Get drawdown plot options\n op = self.drawdown.get_plot_options()\n if op['visible']:\n plot_options.append(op)\n # Get associated data options\n for i in range(self.data_count()):\n op = self.data[i... | [
"0.7651929",
"0.61596566",
"0.59600675",
"0.59015876",
"0.5859506",
"0.57540476",
"0.5697014",
"0.5660056",
"0.55900997",
"0.55315745",
"0.5520085",
"0.55183053",
"0.55124867",
"0.5510683",
"0.5503015",
"0.55007356",
"0.5492204",
"0.547329",
"0.5446899",
"0.5444196",
"0.54159... | 0.81560767 | 0 |
Returns the well id given a well name Only the first well with similar names is returned When well name is not found, 1 is returned | def get_well_id(self, name):
idx = -1
if type(name) is str:
wells_names = self.wells_list()
if name in wells_names:
idx = wells_names.index(name)
return(idx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getwellid(infile, wellinfo):\r\n m = re.search(\"\\d\", getfilename(infile))\r\n s = re.search(\"\\s\", getfilename(infile))\r\n if m.start() > 3:\r\n wellname = getfilename(infile)[0:m.start()].strip().lower()\r\n else:\r\n wellname = getfilename(infile)[0:s.start()].strip().lower()\... | [
"0.7484223",
"0.6575883",
"0.62805164",
"0.6043915",
"0.60195637",
"0.5838901",
"0.5630826",
"0.55032206",
"0.549321",
"0.54633754",
"0.54303014",
"0.536089",
"0.53045803",
"0.5288866",
"0.5257819",
"0.52421564",
"0.5241637",
"0.5231975",
"0.5201168",
"0.5197424",
"0.51961",
... | 0.7903967 | 0 |
Returns well name using the data index as input If well index does not exist then None is returned | def get_well_name(self, idx):
name = None
if type(idx) is int:
n = self.well_count()
assert 0 <= idx <= n - 1, "Bad well index"
name = self.wells[idx].drawdown.name
return(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index_from_well(self, well):\n pass",
"def index_to_wellname(index, num_wells, direction=\"row\"):\n row, column = index_to_row_column(index, num_wells, direction)\n return coordinates_to_wellname((row, column))",
"def get_indexname(self,index):\n if index in self.indexname2index:\n... | [
"0.6899968",
"0.66426885",
"0.6603633",
"0.659633",
"0.63491505",
"0.60702014",
"0.60461676",
"0.591587",
"0.5881933",
"0.579355",
"0.57482564",
"0.5638517",
"0.55967",
"0.55727726",
"0.55493134",
"0.55107397",
"0.54778844",
"0.5453047",
"0.5377641",
"0.5374415",
"0.53504837"... | 0.75987595 | 0 |
Check if the well has a constant pumping rate (True) or if pumping rate varies in time (False) | def is_constant_rate(self):
n1 = self.pumprate.x.size
n2 = self.pumprate.y.size
if n1 == n2:
if n1 == 1:
return(True)
else:
return(False)
else:
raise ValueError('Pumping rate is incorrect, check the assigned values!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_pump(self, pump):\n if pump > MAX_PUMPS:\n return False\n return bool(self.pump_array[pump])",
"def ready_to_measure(self):\n\n constant_tank_ready = self.tanks[CONSTANT_TANK].is_filled\n measuring_tank_ready = (\n self.valves[MEASURING_DRAIN_VALVE].is_c... | [
"0.62926847",
"0.62068665",
"0.6156856",
"0.6154851",
"0.6148754",
"0.6126147",
"0.6086376",
"0.60729843",
"0.60600513",
"0.60233563",
"0.6013671",
"0.59107727",
"0.5866539",
"0.5859206",
"0.5843414",
"0.58411956",
"0.57965446",
"0.57905734",
"0.57867235",
"0.577967",
"0.5741... | 0.6840193 | 0 |
Returns a dictionary with all the data contained by the pumping well (including observation wells). It could be used to save data into a .json file | def to_dict(self):
out_dict = _deepcopy(self.__dict__)
out_dict["pumprate"] = self.pumprate.to_dict()
out_wells = []
for i in range(self.well_count()):
out_wells.append(self.wells[i].to_dict())
out_dict["wells"] = out_wells
return(out_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDictWells(self):\n #Method begins here\n #nx=self.__grid['nx'] #From the geometry in grid\n ny=self.__grid['ny']\n nz=self.__grid['nz']\n minx=self.__grid['ox']\n miny=self.__grid['oy']\n minz=self.__grid['oz']\n rx=self.__grid['dx']\n ry=self... | [
"0.7113749",
"0.60998636",
"0.5969908",
"0.59269804",
"0.5899864",
"0.5834773",
"0.5746034",
"0.57153934",
"0.5714173",
"0.5697139",
"0.56901616",
"0.56225646",
"0.56192833",
"0.56154716",
"0.55966175",
"0.5588612",
"0.5565126",
"0.55407035",
"0.55356914",
"0.5494014",
"0.548... | 0.6850534 | 1 |
Updates the pumping well object using an input dictionary | def update(self, new_data):
if type(new_data) is not dict:
raise TypeError("Input parameter must be a dict")
# Update parameters
self._type = new_data.get("_type", self._type)
self.time_units = new_data.get("time_units", self.time_units)
self.len_units = new_data.get(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_dict(new,old):",
"def normal_update(self, game, elfDict):\n self.game = game # update game\n self.my_elves = [elf for elf in elfDict.values() if not elf.elf.already_acted] # update self.my_elves\n self.game = game # update self.game\n self.portals.portals_update(game) #... | [
"0.5895445",
"0.5812442",
"0.577191",
"0.5706581",
"0.56495655",
"0.5521227",
"0.5519335",
"0.5515376",
"0.55042815",
"0.5486805",
"0.54773784",
"0.53881663",
"0.5346425",
"0.5302062",
"0.528914",
"0.5283164",
"0.5267203",
"0.5243199",
"0.5229438",
"0.5223958",
"0.5216763",
... | 0.6680555 | 0 |
Verify well parameters and returns warnings according to possible errors | def validate_parameters(self):
flag = True
warnings = ""
# Check radius
r = self.parameters.get('rw', 0)
if type(r) not in [int, float]:
flag = False
warnings += "Well radius rw must be a float value\n"
else:
if r <= 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Check(self, parameters):",
"def check_errors(self) -> None:",
"def _check_params(self):\n\t\tstrange_param_helper = False\n\t\tfor param in self.params:\n\t\t\n\t\t\t# It could be that the param encapsulates several values (e.g., \"FLUX_RADIUS(10)\")\n\t\t\t# So we have to dissect this\n\t\t\tmatch = re.co... | [
"0.7046296",
"0.6972314",
"0.69019",
"0.6827856",
"0.67996854",
"0.6766278",
"0.67596585",
"0.6748443",
"0.6729965",
"0.6717157",
"0.66976315",
"0.66686934",
"0.6619799",
"0.65809375",
"0.65628576",
"0.64479285",
"0.6446445",
"0.64453197",
"0.642674",
"0.6337774",
"0.6332849"... | 0.7049662 | 0 |
Returns the number of observation wells associate to pumping well | def well_count(self):
return(len(self.wells)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_wells(self):\n return self.info_wells['well'].nunique()",
"def num_injectors(self):\n injectors = self.info_wells.groupby('well_type').get_group('inj')\n return injectors['well'].nunique()",
"def num_producers(self):\n producers = self.info_wells.groupby('well_type').get_gr... | [
"0.8019491",
"0.7295038",
"0.7184108",
"0.6849336",
"0.6847076",
"0.64381284",
"0.6317566",
"0.6127201",
"0.60816175",
"0.6061327",
"0.6042718",
"0.5989033",
"0.5961877",
"0.59533936",
"0.5948019",
"0.59341747",
"0.5918273",
"0.5909013",
"0.5906111",
"0.5804282",
"0.5790544",... | 0.7780465 | 1 |
Returns a list with the well name given a type of well | def wells_list(self, wtype='all'):
list_names = []
for well_data in self.wells:
if wtype == 'all':
list_names.append(well_data.drawdown.name)
elif wtype == well_data._type - 2:
list_names.append(well_data.drawdown.name)
return(list_names) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_well_name(self, idx):\n name = None\n if type(idx) is int:\n n = self.well_count()\n assert 0 <= idx <= n - 1, \"Bad well index\"\n name = self.wells[idx].drawdown.name\n return(name)",
"def get_well_aliases(self):\n return self.info_wells['wel... | [
"0.6303364",
"0.62997895",
"0.60606045",
"0.60131824",
"0.60059685",
"0.5961164",
"0.5938659",
"0.58209205",
"0.5689827",
"0.5598569",
"0.55082047",
"0.54078776",
"0.53718215",
"0.5231179",
"0.5161112",
"0.51495016",
"0.51280046",
"0.5123762",
"0.5105599",
"0.50994503",
"0.50... | 0.76513284 | 0 |
Add new data object to the actual observation well or piezometer INPUTS x [int, float, list, tuple, ndarray] time vector y [int, float, list, tuple, ndarray] data vector dtype [int] type of data 1 drawdown 2 drawdown first derivative 3 drawdown second derivative name [string] data name that is used as label for plot de... | def add_data(self, x=1, y=1, dtype=1, name="New data", description="New data"):
assert 1 <= dtype <= 3, "Bad value for data type"
new_data = _Data(dtype, name=name, description=description)
new_data.set_data(x=x, y=y, xunits=self.time_units, yunits=self.len_units)
self.data.append(new_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addData(self,data,x,y):\n self.nSamples+=1\n if self.nSamples == 1:\n self.indata.append(data)\n (self.ny,self.nx)=data.shape\n self.ny=int(data.shape[0])\n self.x=x\n self.y=y\n self.lx=self.x[-1:][0]\n self.ly=self.y[-... | [
"0.6510986",
"0.62951386",
"0.61421543",
"0.60370123",
"0.60024756",
"0.5935693",
"0.5730617",
"0.57196116",
"0.5718037",
"0.57020605",
"0.5682233",
"0.56609374",
"0.5654391",
"0.5629142",
"0.5609044",
"0.5552659",
"0.5545938",
"0.5531034",
"0.5513014",
"0.5501703",
"0.548691... | 0.7377167 | 0 |
Convert parameters, drawdown and data units given new units INPUTS time_units [string] new time units. If None, actual units are used length_units [string] new length units. If None, actual units are used | def convert_units(self, time_units=None, len_units=None):
in_time = self.time_units
# Check new time units
if time_units is None:
time_units = in_time
flag = _units.validate_units(time_units)
if flag == -1:
raise ValueError('Bad time units input {}'.format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_units(self, time_units=None, len_units=None, pump_units=None,\n same=False):\n in_time = self.time_units\n # Check new time units\n if time_units is None:\n time_units = in_time\n flag = _units.validate_units(time_units)\n if flag == -1... | [
"0.7270952",
"0.67853004",
"0.6321186",
"0.62948203",
"0.6257909",
"0.62499386",
"0.6237745",
"0.609285",
"0.6059407",
"0.6052014",
"0.60473174",
"0.60461247",
"0.6036106",
"0.60240674",
"0.59835577",
"0.59373957",
"0.58589494",
"0.58529156",
"0.58520365",
"0.584814",
"0.5838... | 0.82226205 | 0 |
Returns a list of plot options with the visible data to be plotted including observation well or piezometer drawdown | def get_plot_options(self):
plot_options = []
# Get drawdown plot options
op = self.drawdown.get_plot_options()
if op['visible']:
plot_options.append(op)
# Get associated data options
for i in range(self.data_count()):
op = self.data[i].get_plot_op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plot_options(self):\n plot_options = []\n # Get pumping rate plot options\n op = self.pumprate.get_plot_options()\n if op['visible']:\n plot_options.append(op)\n # Get associated data options\n for i in range(self.well_count()):\n well_options... | [
"0.7800204",
"0.60322195",
"0.59715027",
"0.59681576",
"0.58703583",
"0.58673334",
"0.57929796",
"0.5701164",
"0.55820847",
"0.5552981",
"0.5541041",
"0.5540643",
"0.55129695",
"0.5459508",
"0.54499143",
"0.544476",
"0.5441358",
"0.54261726",
"0.5417078",
"0.5395974",
"0.5373... | 0.77666795 | 1 |
Returns a list with the data name given a type of data | def data_list(self, dtype='all'):
list_names = []
for well_data in self.data:
if dtype == 'all':
list_names.append(well_data.name)
elif dtype == well_data.dtype:
list_names.append(well_data.name)
return(list_names) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataTypes(self, name: unicode) -> List[ghidra.program.model.data.DataType]:\n ...",
"def get_text_data_list(self):\n return [self.name, str(self.type)]",
"def list_of_identifiers(data, type):\n identifiers = []\n for id_data in data:\n if id_data.get('type') == type:\n ... | [
"0.728314",
"0.6950621",
"0.67950463",
"0.64226145",
"0.6325345",
"0.6290614",
"0.6279772",
"0.6163454",
"0.61411387",
"0.6140158",
"0.6051041",
"0.6050611",
"0.603196",
"0.5979531",
"0.59499097",
"0.5932981",
"0.5897951",
"0.5894344",
"0.58363205",
"0.5806849",
"0.57793367",... | 0.7135787 | 1 |
Returns the data id in the list of data using the data name Only the first data with similar names is returned When data name is not found, 1 is returned | def get_data_id(self, name):
idx = -1
if type(name) is str:
data_names = self.data_list()
if name in data_names:
idx = data_names.index(name)
return(idx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _data_id_from_label(self, label):\n for data_item in self.state.data_items:\n if data_item['name'] == label:\n return data_item['id']",
"def search(self, name):\n\n name = name.lower().strip()\n exact_names = get_close_matches(name, self.possible_names, n=1)\n ... | [
"0.6605792",
"0.6598897",
"0.6358529",
"0.6218891",
"0.6171888",
"0.5997316",
"0.59925854",
"0.5937047",
"0.5915923",
"0.5889121",
"0.58376426",
"0.5834831",
"0.57998013",
"0.57785743",
"0.5744238",
"0.569555",
"0.5694921",
"0.56620944",
"0.5656047",
"0.56512594",
"0.56259936... | 0.78273237 | 0 |
Returns data name using the data index as input If data idx does not exist then None is returned | def get_data_name(self, idx):
name = None
if type(idx) is int:
n = self.data_count()
assert 0 <= idx <= n - 1, "Bad data index"
name = self.data[idx].name
return(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_indexed_component_data_name(component, index):\n if not component.is_indexed():\n return component.name\n elif index in component._data:\n ans = component._data[index].name\n else:\n for i in range(5):\n try:\n component._data[index] = component._Com... | [
"0.72503287",
"0.68155634",
"0.65541536",
"0.650533",
"0.6259094",
"0.62368953",
"0.60989296",
"0.60197777",
"0.59163827",
"0.5891898",
"0.5812209",
"0.57695496",
"0.57461333",
"0.5738705",
"0.5722598",
"0.57208043",
"0.56727195",
"0.56393695",
"0.5613669",
"0.56084156",
"0.5... | 0.8564489 | 0 |
Returns the data type given the data index | def get_data_type(self, idx):
return(self.data[idx].dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_type():\n return DataTypeUtil.getDTypeForName(DataTypeUtil.getDtypeFromContext())",
"def data_type(self) -> int:\n return self.data[\"args\"][\"dataType\"]",
"def datatype(self):\n # datatype is type of first dataarg\n return self[self.dataargs()[0]].typename",
"def data_type... | [
"0.72349155",
"0.7209514",
"0.7037685",
"0.69469965",
"0.6839629",
"0.6827165",
"0.6827165",
"0.6827165",
"0.6680594",
"0.6609436",
"0.6554991",
"0.6540169",
"0.6508893",
"0.6493248",
"0.6450711",
"0.6441724",
"0.63943344",
"0.6353002",
"0.63170236",
"0.63162494",
"0.6316209"... | 0.8298103 | 0 |
Replaces the well drawdown given the index of a drawdown data in data list | def set_as_drawdown(self, idx):
dtype = self.get_data_type(idx)
if dtype == "Pumping rate":
x, y = self.data[idx].get_data()
self.drawdown.set_data(x, y)
else:
raise TypeError('Selected data is not drawdown!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_drawn(section: str, index: int):\r\n del drawn[section][index]",
"def activateChildWellIndex(self,index,value):\n activeIndices=self.activeChildWellIndices()\n if value and index not in activeIndices:\n activeIndices.append(index)\n activeIndices=sorted(acti... | [
"0.5802891",
"0.53335387",
"0.53131515",
"0.52770084",
"0.52692586",
"0.51205266",
"0.50659335",
"0.49722874",
"0.49578884",
"0.4950951",
"0.48292145",
"0.48174497",
"0.48127028",
"0.47716764",
"0.47540691",
"0.47284764",
"0.47264978",
"0.46799114",
"0.4676532",
"0.46628883",
... | 0.5534069 | 1 |
Create a piezometer object (works similar to Observation well) | def __init__(self, name="", description="", time_units="s", len_units="m"):
super(Piezometer, self).__init__()
# Set general info
self._type = 3 # piezometer id
self.parameters = {'full': True, # is full penetrating?
'r': 1., # distance until pumping well i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lick_piezo():\n lp_raw = read_npy_file('lickPiezo.raw.npy')\n lp_timestamps = read_npy_file('lickPiezo.timestamps.npy')\n lp_rate = get_rate(lp_timestamps)\n lick_piezo_ts = TimeSeries(\n name='lickPiezo',\n starting_time=lp_timestamps[0, 1],\n rate=lp_rate,\n data=np.ra... | [
"0.5920001",
"0.57205135",
"0.5660947",
"0.5660947",
"0.5660947",
"0.5660947",
"0.5660947",
"0.56580734",
"0.5646192",
"0.5608879",
"0.56043893",
"0.55835843",
"0.55835843",
"0.55835843",
"0.55835843",
"0.55835843",
"0.55835843",
"0.55835843",
"0.55545354",
"0.5550657",
"0.55... | 0.6613623 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.