query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
wrapper around route to simplify specifying a POST method | def post(self, path, req = None, **kwargs):
req = req or []
return self.route(path, req=req+[filter_method(['POST'])], **kwargs) | [
"def http_method_post():\n return 'POST'",
"def post(self, pattern, handler):\n return self.route(Router.POST, pattern, handler)",
"def post(path, *params, **kwparams):\n def method(f):\n return config(f, 'POST', path, **kwparams)\n return method",
"def post(self, path='/', middlewa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wrapper around route to simplify specifying a GET method | def get(self, path, req = None, **kwargs):
req = req or []
return self.route(path, req=req+[filter_method(['GET'])], **kwargs) | [
"def http_method_get():\n return 'GET'",
"def route(**kwargs):\n def routed(request, *args2, **kwargs2):\n method = request.method\n if method in kwargs:\n req_method = kwargs[method]\n return req_method(request, *args2, **kwargs2)\n elif 'ELSE' in kwargs:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate wsgi application function | def wsgiapp(self):
def wrapped(environ, start_response):
"""wsgi application function"""
start_time = time.clock()
req = Request(environ)
res = Responder(start_response, environ, self.mylookup, start_time)
found_matches = None... | [
"def custom_app(environ, start_response):\n status = '200 OK'\n response_headers = [('Content-Type', 'text/plain')]\n start_response(status, response_headers)\n return ['Hello world from a simple WSGI application.\\n']",
"def app(environ, start_response):\n status = '200 OK'\n response_headers =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates the list of generatable content | def genlist(self):
out = []
def responder():
"""empty responder object used to find the template name"""
pass
responder.view = static_view_finder
for path, route in self.routes:
if route['generate']:
mako_template = route['function'](re... | [
"def list_templates(self):\n raise NotImplementedError()",
"def list_templates(self):\n raise TypeError(\"this loader cannot iterate over all templates\")",
"def GenerateContent(self):\n\n for chunk in self.content_generator:\n yield chunk",
"def do_generate(self):\n pass",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
empty responder object used to find the template name | def responder():
pass | [
"def _template(self):\n return getattr(self, self.template)()",
"def template_name(self):\n\t\traise NotImplementedError('template_name must be defined')",
"def test_get_implant_template_by_name(self):\n pass",
"def defaultTemplate(self):\n \n pass",
"def get_template_name(self):\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find enum for the goal type The goal.action_type field contains the index of the action to take. This finds the enum that represents the action based on the goal.action_type oa | def _get_action_from_goal(self, goal):
# assume the goal msg has attribute ActionEnum which is an int32
try:
type_enum = self._action_type_enum(goal.action_type.type)
#rospy.loginfo("Action server requested action {}".format(type_enum))
return type_enum
except... | [
"def get_action_index(enum_action):\n return list(enum_action.__class__).index(enum_action)",
"def action_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"action_type\")",
"def action_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"action_type\")",
"def get_action_fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use actionserver API to obtain current goal msg | def get_goal_msg(self):
goal_handle = self._as.current_goal
goal = goal_handle.get_goal()
return goal | [
"def get_message(self):\n pass",
"def get_messages(self, action: np.array) -> tuple:",
"def get_destination_and_message(post_request):\n\n #Your code here\n pass",
"def _get_action_from_goal(self, goal):\n # assume the goal msg has attribute ActionEnum which is an int32\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
revert state to previous | def revert_state(self):
if self.previous_states > 0: # checks for empty
self.update_status(self.previous_states.pop()) | [
"def _prev_state_pressed(self):\n self._history[self._history_index+1].revert(self)",
"def revert(self):\n if self._backup:\n self.set_state(self._backup)\n self._backup = None",
"def pre_revert(self):",
"def revert(self, *args, **kwargs):",
"def reset(self):\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print stack of prior states | def print_prior_states(self):
rospy.logdebug("Prior States:")
for state in self.previous_states:
enum = self._state_enums(state)
rospy.logdebug(enum) | [
"def show_stack(self) -> None:\n print(\"Show stack: \")\n ok = 1\n for i in reversed(self.items):\n print(i)\n ok = 0\n if ok:\n print(\"The stack is empty!\")\n print(\"\\n\")",
"def _debug_stack(self):\n debug(\"current stack: %s\" % se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get valid operation transitions for 'state' | def get_valid_op_transitions(self, state):
#assert( isinstance(state, self.STATES) )
if state in self._tns.keys():
out = self._tns[state]
else:
out = None
return out | [
"def state_transitions(self, state):\n return self.states(\"ANY PreviousStates.identifier = '%s'\" % _obj_id(state))",
"def transitionStates(self,state):\n newstates,rates = self.transition(state) \n newindices = self.getStateIndex(newstates) \n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return if the FSM has been preempted. Assumes incoming action is 'valid' and not 'pause' nor 'continue' | def fsm_is_preempted(self):
return self._fsm_recent_goal_preempted | [
"def _check_transit_conds(self, next_state, **kwargs):\n game = models.Hangout.get_by_id(self.hangout_id).current_game.get()\n if next_state == self.state_name:\n return kwargs['action'] == 'vote'\n elif next_state == 'scores': # okay to transition if all participants\n # have voted\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register the valid transitions for operations in the FSM | def fsm_register_op_transitions(self, mapping):
assert isinstance(mapping, dict) # mapping must be a dictionary
mapping_key_list = list(mapping.keys())
self._tns = {}
for key in mapping_key_list:
val = mapping[key]
if val is not None:
if not isins... | [
"def register_state_transition(self, start_state, end_state, transition_function):\n self.state_transition_table[(start_state, end_state)] = transition_function",
"def _validate_transition(self, action, allowed_states):\n assert self.state in allowed_states, (\n \"Coding error: invalid st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register the mapping from operations to state changes. Keys are ActionType.type, Values are status_msg.status Assumes 1 state transition per operation Convert state changes to "callbacks" in order to interface with register_callbacks function naturally | def fsm_register_status_changes(self, mapping):
assert isinstance(mapping, dict) # mapping must be a dictionary
mapping_key_list = list(mapping.keys())
self._status_mapping = mapping
def fcn_maker(key):
def fcn(goal):
state_values = self.get_status_change_fro... | [
"def fsm_register_op_transitions(self, mapping):\n assert isinstance(mapping, dict) # mapping must be a dictionary\n mapping_key_list = list(mapping.keys())\n\n self._tns = {}\n for key in mapping_key_list:\n val = mapping[key]\n if val is not None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers one function per state to be called in the FSMloop | def fsm_register_state_functions(self, fxns):
assert isinstance(fxns, dict) # cbs must be a dictionary
fxns_key_list = list(fxns.keys())
self._fxns = {}
for key in fxns_key_list: # check syntax
print("Registered function for state {}".format(key))
self._fxns[key]... | [
"def register_state_transition(self, start_state, end_state, transition_function):\n self.state_transition_table[(start_state, end_state)] = transition_function",
"def act(self):\n self.state_map[self.state]()",
"def register_step(step_function: StepFunction) -> None:\n global _step_function\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean the "efficiency" column of the core DataFrame. Replace unacceptable values with the mean acceptable value for all recipes. | def clean_efficiency(series, acceptable_min=0.5, acceptable_max=1.0):
acceptable, unacceptable = split_series_on_range(
series, acceptable_min, acceptable_max
)
mean_acceptable = acceptable.groupby(acceptable.index).first().mean()
efficiency_cleaned = acceptable.append(
pd.Series(index=u... | [
"def _sanitize_boost_cpu(self, event, df, aspects):\n if aspects['rename_cols'] and 'usage' in df:\n df.rename(columns={'usage': 'util'}, inplace=True)\n df['boosted_util'] = df['util'] + df['margin']\n return df",
"def clean_data(df):\n \n # Put in code here to execute all m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean the "ferm_yield" column of the core DataFrame. Replace unacceptable values with the mean acceptable value for that fermentable's "ferm_type". Do not replace values for fermentables whose "ferm_name" is in the list of exceptions. | def clean_ferm_yield(df, ferm_yield_cutoff=0.03, exceptions=None):
if exceptions is None:
exceptions = ["rice hulls"]
acceptable_mask, unacceptable_mask = split_series_on_range(
df["ferm_yield"], ferm_yield_cutoff, 1, return_mask=True
)
exceptions_mask = df["ferm_name"].isin(exceptions)... | [
"def clean_data(df):\n \n # Put in code here to execute all main cleaning steps:\n # convert missing value codes into NaNs, ...\n def convert_NaN(df):\n for i,j in enumerate(df.iteritems()):\n missingvalue=feat_info['missing_or_unknown'][i]\n column_heading=j[0]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies nonlinear fit and returns parameters and Rsq. Plots it. By default, it applies minimumsquare fit. If dY is specified, it applies weighted minimumsquare fit. | def nonlinear_fit(X, Y, fitfunction, initial_guess=None, dY=None,
showplot=True, plot_some_errors=(False, 20),
**kwargs):
if not isinstance(X, np.ndarray):
raise TypeError("X should be a np.array")
if not isinstance(Y, np.ndarray):
raise TypeError("Y sh... | [
"def fitgeneral(xdata, ydata, fitfunc, fitparams, domain=None, showfit=False, showstartfit=False, showdata=True,\n label=\"\", mark_data='bo', mark_fit='r-'):\n\n # sort data\n order = np.argsort(xdata)\n xdata = xdata[order]\n ydata = ydata[order]\n\n if domain is not None:\n fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that financing statement excluded registration type validation works as expected. | def test_validate_excluded_type(session, desc, valid, reg_type):
# setup
json_data = copy.deepcopy(FINANCING)
json_data['type'] = reg_type
error_msg = validator.validate(json_data)
if valid:
assert error_msg == ''
else:
# print(error_msg)
assert error_msg != ''
as... | [
"def test_gp_registration_schema():\n legal_filing = {'registration': REGISTRATION}\n\n is_valid, errors = validate(legal_filing, 'registration')\n\n if errors:\n for err in errors:\n print(err.message)\n print(errors)\n\n assert is_valid",
"def test_validate_valid_registration_wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that financing statement ppsa class registration type validation works as expected. | def test_validate_ppsa(session, desc, valid, message_content):
# setup
for reg_type in PPSATypes:
if reg_type.value != 'RL':
json_data = copy.deepcopy(FINANCING)
json_data['type'] = reg_type.value
del json_data['trustIndenture']
if desc == DESC_INCLUDES_OT... | [
"def test_gp_registration_schema():\n legal_filing = {'registration': REGISTRATION}\n\n is_valid, errors = validate(legal_filing, 'registration')\n\n if errors:\n for err in errors:\n print(err.message)\n print(errors)\n\n assert is_valid",
"def test_class_present(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that financing statement crown charge class registration type validation works as expected. | def test_validate_crown(session, desc, valid, message_content):
# setup
for reg_type in CrownChargeTypes:
if validator.validate_allowed_type(reg_type.value) != '':
continue
json_data = copy.deepcopy(FINANCING)
json_data['type'] = reg_type.value
del json_data['trustIn... | [
"def test_gp_registration_schema():\n legal_filing = {'registration': REGISTRATION}\n\n is_valid, errors = validate(legal_filing, 'registration')\n\n if errors:\n for err in errors:\n print(err.message)\n print(errors)\n\n assert is_valid",
"def test_validate_valid_registration_wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that financing statement authorization received validation works as expected. | def test_validate_authorization(session, desc, valid, message_content):
# setup
json_data = copy.deepcopy(FINANCING)
if desc == DESC_MISSING_AC:
del json_data['authorizationReceived']
elif desc == DESC_INVALID_AC:
json_data['authorizationReceived'] = False
# test
error_msg = val... | [
"def test_o_auth2_authorize(self):\n pass",
"def test_verify_that_user_can_add_new_claim():",
"def test_validate_credentials(self):\n pass",
"def test_approve_agreement(self):\n pass",
"def test_reject_agreement(self):\n pass",
"def test_excess_auth():\n # Disable validators... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that financing statement serial collateral AP type validation works as expected. | def test_validate_sc_ap(session):
# setup
json_data = copy.deepcopy(FINANCING)
json_data['vehicleCollateral'][0]['type'] = 'AP'
error_msg = validator.validate(json_data)
# print(error_msg)
assert error_msg != ''
assert error_msg.find(validator.VC_AP_NOT_ALLOWED) != -1 | [
"def test_incrementalmode_validation():\n assert_raises(ValueError, IncrementalModeStmt, 'OFF-ISH')",
"def test_versionstmt_validation():\n assert_raises(ValueError, VersionStmt, 3)",
"def test_batch_condition_is_column_from_obs(self):\n\n self.validator.adata.uns[\"batch_condition\"] = [\"NO_COLUM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a relative filepath and returns the correct execution path regaurdless of where the containing file is run from | def exepath(filename):
return os.path.abspath(os.path.join(os.path.dirname(sys._getframe(1).f_code.co_filename), filename)) | [
"def _path_for(relative_path):\n\n script_dir = os.path.dirname(__file__)\n abs_file_path = os.path.join(script_dir, relative_path)\n\n return abs_file_path",
"def runner_path():\n git_base = os.popen('git rev-parse --show-toplevel').read().strip()\n return os.path.join(git_base, RUNNER_SCRIPT_BASE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a human readable label to a valid method name | def methodize_label(label):
method_name = label.lower()
method_name = re.sub(RE_METHODIZE_FLATTEN, '_', method_name)
method_name = re.sub(RE_METHODIZE_CLEAN, '', method_name)
method_name = re.sub(RE_METHODIZE_COMPRESS, '_', method_name)
return method_name | [
"def label_to_name(self, label):\n raise NotImplementedError('label_to_name method not implemented')",
"def _get_tg_api_method_name(py_style_method_name):\n res = py_style_method_name.replace(\"_\", \" \").title().replace(\" \", \"\")\n res = res[0].lower() + res[1:]\n return res",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a reference to ref on obj using a methodized version of label | def append_reference(obj, label, ref):
method_name = methodize_label(label)
i=0
while method_name in obj.__dict__:
method_name = '%s_%s' % (method_name, i)
i += 1
obj.__dict__[method_name] = ref | [
"def relabel(obj, new_label):\n if isinstance(obj, Field):\n obj.label = new_label\n elif isinstance(obj, type) and issubclass(obj, Field):\n obj.label = new_label\n else:\n obj._label = new_label",
"def add_label(self, label):\n return self.label(label, action='ADD')",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a value of an unknown type, this method will return a tuple containing an appropriately type casted number (t[0]) and it's unit (t[1]) if one existed. | def val_to_type_unit(s):
s = ('%s' % s)
sre = re.search(VAL_TO_TYPE_UNIT, s)
if sre == None:
val, unit = s, None
else:
unit = sre.group(3) if sre.group(3) != '' else None
if sre.group(2)==None:
val = int(sre.group(1))
else:
val = float(sr... | [
"def get_unit_value_and_latex(unit: Unit) -> Tuple[Union[float, int], str]:\n return get_unit_value(unit), get_unit_latex(unit)",
"def get_unit_value(unit: Unit) -> Union[float, int]:\n if isinstance(unit, (float, int)):\n return unit\n return _UNIT_NAME_TO_VALUE[unit]",
"def typedvalue(value):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a binary string to an integer by applying int(bit_string, radix = 2) | def bin_to_int(bit_string):
return int(''.join(bit_string), 2) | [
"def bitstring_to_int(bitstr):\n b_list = bitstr.tolist()\n mystring = ''\n for s in b_list:\n if s:\n mystring += '1'\n else:\n mystring += '0'\n b = int(mystring, 2)\n return b",
"def bin2int(r: str) -> int:",
"def bin_to_dec(bit_string):\n return int(bit_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a hex string to an integer by applying int(hex_string, radix = 16) | def hex_to_int(hex_string):
return int(hex_string, 16) | [
"def __hex2int(_hex_str):\n return int(\"0x\"+_hex_str, 16)",
"def Hex2Int(hexString):\n answer = hexString[0]\n log.debug(f\"Hex {hexString} decoded to {answer}\")\n\n return answer",
"def convert_hex_str_to_int(value: str) -> int:\n if is_str(value):\n return int(value, 16)\n else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the hexadecimal string representation of integer n | def int_to_hex(n):
#return "0x%X" % n
return hex(n) | [
"def int2hex(n: int) -> str:",
"def hex(number): # real signature unknown; restored from __doc__\n return \"\"",
"def hex_str(an_int):\n ...",
"def hex_string(s, n=32):\n # take first n characters, reverse them and get ascii codes with ord()\n return 'X\"{0:>0{1}}\"'.format(''.join(['{0:x}'.format... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a gnosis.xml.objectify instance derived from the xml seed. The xml_seed can be, raw xml, a filepath to an xml document, or an object created by gnosis.xml.objectify. | def xml_as_obj(xml_seed):
if hasattr(xml_seed,'PCDATA'):
return xml_seed
else:
# gnosis.xml.objectify._XO_manufacturer = AutoPCDATA
return gnosis.xml.objectify.XML_Objectify(xml_seed).make_instance() | [
"def xml2obj(self, src):\n\n\t\tclass DataNode(object):\n\t\t\tdef __init__(self):\n\t\t\t\tself._attrs = {} # XML attributes and child elements\n\t\t\t\tself.data = None # child text data\n\n\t\t\tdef __len__(self):\n\t\t\t\t# treat single element as a list of 1\n\t\t\t\treturn 1\n\n\t\t\tdef __getitem__(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current state of the object instance's class __properties__ as a dictionary | def current_instance_state(self):
cur = {}
for prop in self.__class__.entity_atts:
cur[prop] = getattr(self, prop)
return cur | [
"def get_properties(self):\r\n\r\n return {}",
"def _get_properties(cls):\n return get_class_properties(cls)",
"def __getstate__(self):\n state = getattr(self, '__dict__', {}).copy()\n for obj in type(self).mro():\n for name in getattr(obj,'__slots__',()):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
XML representation of the object instance to_xml(output = 'str', indent = True) | def to_xml(self, doc = None, output = None, indent = False):
# Determine what format to return the values as
if output != None and output.lower() != 'str' and output.lower() != 'dom':
# Check to see if it's a filepath
if output.lower().split('.')[-1] == 'xml':
... | [
"def display(self):\n return self.xml.toprettyxml('')",
"def toXml(self, out, indent):\n self.init()\n out.write('{1}<benchmark name=\"{0}\">\\n'.format(self.name, indent))\n for classname in sorted(self.instances.keys()):\n instances = self.instances[classname]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a rnn point estimate model based on the architecture defined in the configs The input received is already padded from the data processing module for variable sequence length. Making is used to keep track of padded elements in the tensor. Keras layers such as Cropping1D and Concatenate do not use masking, hence c... | def _build_model(self):
outputs = []
# Masking information is only used by certain layers such as LSTM. Hence two copies of inputs are used, one for
# propagating the mask and second for storing inputs which are used in operations such as Cropping1D and
# concatenate.
inputs = ... | [
"def build_sum_of_r_model(r_model, tragetory_size):\n\n o_shape = r_model.inputs[0].shape.as_list()[1:]\n a_shape = r_model.inputs[1].shape.as_list()[1:]\n o_size = int(np.prod(o_shape))\n a_size = int(np.prod(a_shape))\n inp_muxed = tf.keras.layers.Input(shape=(o_size+a_size), batch_size=1, name=\"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return first item in sequence where f(item) == True. | def find(f, seq):
for item in seq:
if f(item):
return item | [
"def find(f, seq):\n for item in seq:\n if f(item):\n return item",
"def find(f, seq):\n for item in seq:\n if f(item): \n return item",
"def finditem(func, seq):\n return next((item for item in seq if func(item)))",
"def first_true(iterable, predicate=None, defaul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check last activity of each client and delete them if it's too old. | def _keep_alive_handler(self):
now = time.time()
to_be_deleted = []
for key in self.clients:
delta_last_activity = now - self.clients[key].last_activity
if delta_last_activity >= 5:
to_be_deleted.append(key)
for i in to_be_deleted:
se... | [
"def clean_clients():\n values = Client.objects.values('client_id').annotate(\n Count('pk')).filter(pk__count__gt=1)\n for val in values:\n if val['client_id'] and val['pk__count'] > 1:\n clients = Client.objects.filter(client_id=val['client_id'])\n if clients.count() > 1:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get client id from context | def _get_client_id(self, context):
for key, value in context.invocation_metadata():
if key == 'client_id':
return value
raise Exception('client id not found') | [
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self):\n return self._client_id",
"def client_id(self) -> str:",
"def get_client_id(self, request, badifinvalid=False):\n client_id = request.match_info.get('clientid', None)\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tries to import the given file. This is our own format used for party results. Supports per party panachage data. Stores the panachage results from the blank list with a blank name. | def import_party_results(election, file, mimetype):
errors = []
parties = {}
party_results = {}
party_totals = {}
panachage_results = {}
panachage_headers = None
# The party results file has one party per year per line (but only
# panachage results in the year of the election)
if f... | [
"def import_from_file(self, file, save_name):\n file = open(file,'r')\n x = 1\n running_string = \"\"\n found_load = []\n new_save_array = []\n save_name = save_name.lower()\n for line in file:\n running_string = running_string + str(line)\n save_ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that report has been properly defined | def test_report_definition(self):
self.model = self.scan.model
self.model.save()
new_model = pycotools3.tasks.CopasiMLParser(self.copasi_file).xml
reports = new_model.find('{http://www.copasi.org/static/schema}ListOfReports')
check = False
for report in reports:
... | [
"def test_report_init():\n report = PredictorReport('ERROR', descriptors=[])\n assert report.status == 'ERROR'\n assert report.model_summaries == []\n assert report.descriptors == []",
"def test_test_report(self):\n self.__opener.contents = '''<Report><Doc><Summary failed=\"1\" passed=\"2\"/></... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uploads an MLLog JSON metrics file to BigQuery. | def upload_file(metrics_file, project, dataset, table, model_name=None):
with open(metrics_file) as fp:
metrics = json.load(fp)
metrics = convert_format_in_metrics_list(metrics)
benchmark_run = [{
'metrics': metrics,
'upload_ts': _current_epoch_secs(),
'model_name': model_name,
}]
ret... | [
"def upload_metrics(metrics_dict, project, dataset, table):\n # Credentials will be loaded from envvar $GOOGLE_APPLICATION_CREDENTIALS.\n bq_client = bigquery.Client(project=project)\n table_ref = bq_client.dataset(dataset).table(table)\n errors = bq_client.insert_rows_json(table_ref, metrics_dict)\n return er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uploads a list of BigQuerycompliant metrics. Uses credentials loaded from envvars. | def upload_metrics(metrics_dict, project, dataset, table):
# Credentials will be loaded from envvar $GOOGLE_APPLICATION_CREDENTIALS.
bq_client = bigquery.Client(project=project)
table_ref = bq_client.dataset(dataset).table(table)
errors = bq_client.insert_rows_json(table_ref, metrics_dict)
return errors | [
"def upload_file(metrics_file, project, dataset, table, model_name=None):\n with open(metrics_file) as fp:\n metrics = json.load(fp)\n\n metrics = convert_format_in_metrics_list(metrics)\n\n benchmark_run = [{\n 'metrics': metrics,\n 'upload_ts': _current_epoch_secs(),\n 'model_name': model_nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adjust shape of the data to the shape of the placeholder if possible. If shape is incompatible, AssertionError is thrown | def adjust_shape(placeholder, data):
if not isinstance(data, np.ndarray) and not isinstance(data, list):
return data
if isinstance(data, list):
data = np.array(data)
placeholder_shape = [x or -1 for x in placeholder.shape.as_list()]
assert _check_shape(placeholder_shape, data.shape), \... | [
"def conform(data, shape):\n if not isinstance(data, np.ndarray):\n raise ValueError('Requires a numpy array')\n\n if not isinstance(shape, (tuple, list)):\n raise ValueError('Requires a tuple or list')\n\n data = data.copy()\n n = data.shape\n\n assert np.any([i in shape for i in n]), ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get default session or create one with a given config | def get_session(config=None):
sess = tf.get_default_session()
if sess is None:
sess = make_session(config=config, make_default=True)
return sess | [
"def use_session(session):\n if session:\n return session\n else:\n return create_session()",
"def _create_session(config):\n connection = dvs_util.connect(config)\n return connection",
"def get_session():\n request_session = requests.Session()\n\n # Try to use what was passed in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create placeholder to feed observations into of the size appropriate to the observation space | def observation_placeholder(ob_space, batch_size=None, name='Ob'):
assert isinstance(ob_space, (Discrete, Box, MultiDiscrete)), \
'Can only deal with Discrete and Box observation spaces for now'
dtype = ob_space.dtype
if dtype == np.int8:
dtype = np.uint8
return tf.placeholder(shape=(... | [
"def test_zero_size_temporaries(ctx_factory):\n # https://github.com/inducer/loopy/pull/588\n\n ctx = ctx_factory()\n cq = cl.CommandQueue(ctx)\n\n knl = lp.make_kernel(\n \"{[i]: i > 0 and i < 0}\",\n \"\"\"\n tmp[i] = i\n a[i] = tmp[i]\n \"\"\", [lp.TemporaryVariable... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes fraction of variance that ypred explains about y. Returns 1 Var[yypred] / Var[y] | def explained_variance(ypred, y):
assert y.ndim == 1 and ypred.ndim == 1
vary = np.var(y)
return np.nan if vary == 0 else 1 - np.var(y-ypred)/vary | [
"def explained_variance(ypred,y):\n assert y.ndim == 1 and ypred.ndim == 1\n vary = np.var(y)\n return np.nan if vary==0 else 1 - np.var(y-ypred)/vary",
"def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)",
"def variance(self) -> float:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Caches all checksumtobuffer entries in zipfile All "file names" in the zipfile must be checksum hexes Note that caching is temporary and entries will be removed after some time if no element (cell, expression, or highlevel library) holds their checksum This can be overridden with "incref=True" (not recommended for long... | def add_zip(manager, zipfile, incref=False):
from .core.cache.buffer_cache import empty_dict_checksum, empty_list_checksum
result = []
for checksum in zipfile.namelist():
if checksum in (empty_dict_checksum, empty_list_checksum):
continue
checksum2 = bytes.fromhex(checksum)
... | [
"def update_hash(cls, filelike, digest):\r\n block_size = digest.block_size * 1024\r\n for chunk in iter(lambda: filelike.read(block_size), b''):\r\n digest.update(chunk)",
"def hash_file_in_zip(zip_handler, file_path_in_zip, algorithm=\"sha1\"):\n block_size = 64 * 1024\n hasher = getattr(hashli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills checksums in the nodes from TEMP values, if untranslated | def fill_checksums(mgr, nodes, *, path=None):
from .core.structured_cell import StructuredCell
first_exc = None
for p in nodes:
node, old_checksum = None, None
try:
pp = path + p if path is not None else p
node = nodes[p]
if node["type"] in ("link", "conte... | [
"def fill_remaining(self, nodes, result):\n self.__database.update({node : result for node in nodes if node not in self.__database})",
"def update_totals(self):\n # Reset counts to 0\n self.total_f = self.total_s = self.total_intra = self.total_mac_regular = self.total_mac_infected = \\\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the weighted average and standard deviation. values, weights Numpy ndarrays with the same shape. | def weighted_avg_and_std(values, weights):
average = np.average(values, weights=weights)
variance = np.average((values-average)**2, weights=weights) # Fast and numerically precise
return (average, np.sqrt(variance)) | [
"def weighted_avg_and_std(values, weights):\n average = np.ma.average(values, weights=weights)\n variance = np.ma.average((values-average)**2, weights=weights) # Fast and numerically precise\n return [average, np.sqrt(variance)]",
"def weighted_avg_and_std(values, weights):\n average = np.average(val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute weighted percentiles. If the weights are equal, this is the same as normal percentiles. Elements of the C{data} and C{wt} arrays correspond to each other and must have equal length (unless C{wt} is C{None}). | def weighted_percentiles(data, wt, percentiles):
assert np.greater_equal(percentiles, 0.0).all(), "Percentiles less than zero"
assert np.less_equal(percentiles, 1.0).all(), "Percentiles greater than one"
data = np.asarray(data)
assert len(data.shape) == 1
if w... | [
"def weighted_percentile(data, wt, percentiles):\n assert np.greater_equal(percentiles, 0.0).all(), \"Percentiles less than zero\"\n assert np.less_equal(percentiles, 1.0).all(), \"Percentiles greater than one\"\n data = np.asarray(data)\n assert len(data.shape) == 1\n if wt is None:\n wt = np... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns median ignoring NAN | def nanmedian(arr, **kwargs):
return ma.median( ma.masked_where(arr!=arr, arr), **kwargs ) | [
"def nanmedian(arr):\n return median(arr[arr==arr])",
"def median_or_nan(lst):\n return np.median(lst) if len(lst) > 0 else float('nan')",
"def safe_median(s):\n return np.median([x for x in s if ~np.isnan(x)])",
"def median(x):\n\treturn np.median(x)",
"def _nanmedian(arr1d): # This only ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extracts the stem from a plural noun, or returns empty string | def noun_stem (s):
"""codes from statements.py (PART A)"""
def match (p):
return re.match(p + '$', s, re.IGNORECASE)
if (s in unchanging_plurals_list):
return s
elif (s[-3:] == 'men'):
return s[0:-3] + 'man'
elif match('.*(?<!.[aeiousxyz]|sh|ch)s'):
return s[:-1]
... | [
"def noun_stem (s): \n if s in identical_plurals:\n return s\n elif s[-3:] == \"man\":\n return s[:-2] + \"en\"\n else:\n return verb_stem(s)",
"def stem_plural_word(plural):\n matches = re.match(r'^(.*)-(.*)$', plural)\n if not matches:\n return plural\n words = [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a list of all possible tags for wd relative to lx | def tag_word (lx,wd):
resultSet = {tag for (word, tag) in function_words_tags if (word == wd)}
nS = noun_stem(wd)
vS = verb_stem(wd)
for x in lx.getAll('A'):
if (x == wd):
resultSet.add('A')
for x in lx.getAll('P'):
if (x == wd):
resultSet.add('P')
fo... | [
"def tag_word (lx,wd):\n tags = []\n if wd in lx.getAll(\"P\"):\n tags.append(\"P\")\n if wd in lx.getAll(\"A\"):\n tags.append(\"A\")\n if noun_stem(wd) in lx.getAll('N'):\n if noun_stem(wd) == wd:\n tags.append(\"Ns\")\n if wd in unchanging_plurals_list:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that the serializer renders an existing instance correctly. | def test_renders_instance_correctly(self):
# Make a service to render
service = self.project.services.create(name = 'service1', category = self.category)
# In order to render the links correctly, there must be a request in the context
request = APIRequestFactory().post('/services/{}/'.fo... | [
"def test_dict_field_instance(self):\n parent = ExampleDictSerializer(instance=self.dict_data)\n self.assertEqual(\n parent.data, self.dict_data, 'Wrong serializer reproduction')",
"def test_list_field_instance(self):\n parent = ExampleListSerializer(instance=self.list_data)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that required fields are enforced on create. | def test_create_enforces_required_fields(self):
serializer = ServiceSerializer(data = {}, context = dict(project = self.project))
self.assertFalse(serializer.is_valid())
required_fields = {'name', 'category'}
self.assertCountEqual(serializer.errors.keys(), required_fields)
for na... | [
"def test_required_fields(self):\n collection = Collection.objects.create(\n name=\"Test collection\", contributor=self.contributor\n )\n self.assertCountEqual(collection.annotation_fields.all(), [])\n self.annotation_field1.required = True\n self.annotation_field1.save... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that the serializer enforces the unique together constraint on category and name. | def test_cannot_create_with_same_category_and_name(self):
# Create an initial service
self.project.services.create(name = "service1", category = self.category)
# Then try to create the same service using the serializer
serializer = ServiceSerializer(
data = dict(name = "servi... | [
"def test_add_same_category(self):\n response = self.client.post('/api/v1/categories',\n data=json.dumps(category[0]),\n content_type='application/json',\n headers=self.admin_headers)\n self.assert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that the list serializer renders an existing instance correctly. | def test_list_renders_instance_correctly(self):
# Make a service to render
service = self.project.services.create(name = 'service1', category = self.category)
# In order to render the links correctly there must be a request in the context
request = APIRequestFactory().post('/')
s... | [
"def test_list_field_instance(self):\n parent = ExampleListSerializer(instance=self.list_data)\n self.assertEqual(\n parent.data, self.list_data, 'Wrong serializer reproduction')",
"def test_list_serializer(self):\n parent = serializers.ListSerializer(\n data=self.list_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that invalid requirements correctly fails for the list of services. | def test_list_cannot_create_with_invalid_requirement(self):
# Test with a string for the requirements
serializer = ServiceListSerializer(
data = dict(name = "service2", category = self.category.pk, requirements = "requirements1"),
context = dict(project = self.project)
)
... | [
"def _checkServices(self, expectedServices):\n it = iter(self._getServices())\n for (type_uri, service_uri) in expectedServices:\n for element in it:\n if type_uri in xrds.getTypeURIs(element):\n self.assertEqual(xrds.getURI(element), service_uri)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For now this just returns chi(z) | def chibar(z):
return chi(z) | [
"def chi(Mu, Y):\n return Y*(1-hg2f3(Mu,Y))",
"def chi2_test(data):\n\t# compress extra Z variables at the start.. not implemented yet\n\t#bins = np.amax(data, axis=0)+1\n\tbins = unique_bins(data)\n\thist,_ = np.histogramdd(data,bins=bins)\n\n\tPxyz = hist / hist.sum()# joint probability distribution over X,Y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the alpha_M parameter (unitless) | def alpha_M(z, c_M = 0):
I = CLASS(z_i)
return I.alpha_M(z, c_M) | [
"def obtener_alpha(self):\n\t\treturn self.__alpha",
"def alpha_n(Vm): \n return (0.01 * (10.0 - Vm)) / (np.exp(1.0 - (0.1 * Vm)) - 1.0)",
"def optimal_alpha():\n\n # When I checked all of alphas, -0.01 was the best\n alpha = -0.01\n # np.random.choice([-0.06, -0.01, 0.04, 0.1])\n return alpha",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For 1Darrays z, zp and k the returned Wk should be of shape (k, z, zp) Unitless | def Wk(z, zp, k, c_M=0, c_B=0):
c = 299792458/1000 # km/s
A = np.zeros((len(k), len(z), len(zp)))
chiz = np.copy(A); np.transpose(chiz, (0,2,1))[:] = chi(z)
chifraction = (chiz - chi(zp))*chi(zp)/chiz
A[:] = omega_matter(zp)*H(zp)/(1 + zp)**2*G_light(zp, c_M, c_B)
W2 = 3/2*A*chifraction
Wtra... | [
"def Wv(z, k, c_M=0):\n k *= 0.6763 # 1/Mpc\n c = 299792458/1000 # km/s\n A = np.zeros((len(k), len(z)))\n A[:] = -(1 - c/(Hcal(z)*chi(z)) + alpha_M(z, c_M)/2)*f(z)*H(z)/(1+z)\n Wtransp = np.transpose(A)*1/k**2*1/c\n W = np.transpose(Wtransp)\n return W",
"def _coupling_w(self, z, w):\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For 1Darrays z and k the returned Wk should be of shape (k, z) k must be of units [h/Mpc] Units Mpc | def Wv(z, k, c_M=0):
k *= 0.6763 # 1/Mpc
c = 299792458/1000 # km/s
A = np.zeros((len(k), len(z)))
A[:] = -(1 - c/(Hcal(z)*chi(z)) + alpha_M(z, c_M)/2)*f(z)*H(z)/(1+z)
Wtransp = np.transpose(A)*1/k**2*1/c
W = np.transpose(Wtransp)
return W | [
"def Wk(z, zp, k, c_M=0, c_B=0):\n c = 299792458/1000 # km/s\n A = np.zeros((len(k), len(z), len(zp)))\n chiz = np.copy(A); np.transpose(chiz, (0,2,1))[:] = chi(z)\n chifraction = (chiz - chi(zp))*chi(zp)/chiz\n A[:] = omega_matter(zp)*H(zp)/(1 + zp)**2*G_light(zp, c_M, c_B)\n W2 = 3/2*A*chifracti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
From a base directory, go through all subdirectories, find all files with the given extension, apply the given function 'func' to all of them. If no 'func' is passed, we do nothing except counting. INPUT basedir base directory of the dataset func function to apply to all filenames ext extension, .h5 by default RETURN n... | def apply_to_all_files(basedir,func=lambda x: x,ext='.h5'):
cnt = 0
# iterate over all files in all subdirectories
for root, dirs, files in os.walk(basedir):
files = glob.glob(os.path.join(root,'*'+ext))
# count files
cnt += len(files)
# apply function to all files
fo... | [
"def process_data(cur, filepath, func):\n # get all files matching extension from directory\n all_files = []\n for root, dirs, files in os.walk(filepath):\n files = glob.glob(os.path.join(root, '*.json'))\n for f in files:\n all_files.append(os.path.abspath(f))\n\n # get total n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given operator's name, return materials his or her skill mastering needs | def master_material(op_name):
if op_name in memory:
return memory[op_name]
r = requests.get(WIKI_PREFIX + op_name)
while r.status_code != 200:
print('http get for {0} failed: {1}'.format(WIKI_PREFIX + op_name, r.status_code))
r = requests.get(WIKI_PREFIX + op_name)
time.sleep... | [
"def find_operator(self, name):\n for a in self.operators:\n if a.name == name:\n return a\n return None",
"def operator_management():\n pass",
"def operator(self, name: str) -> pd.DataFrame:\n if self.opensky_db is None:\n return self._fmt(self.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply this L{Response} to the given L{IRequest}, setting its response code and headers. | def _applyToRequest(self, request: IRequest) -> Any:
request.setResponseCode(self.code)
for headerName, headerValueOrValues in self.headers.items():
if not isinstance(headerValueOrValues, (str, bytes)):
headerValues = headerValueOrValues
else:
head... | [
"def __init__(self, request, response):\n super(SingleResponse, self).__init__(request)\n\n self._response.status = '{0} {1}'.format(response.status_code,\n response.reason)\n self._response.headers = response.headers\n self._response.body_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to return appliance as a dictionary | def return_as_dictionary(self):
item = Inventory.return_as_dictionary(self)
item['Brand'] = self.brand
item['Voltage'] = self.voltage
return item | [
"def test_electric_appliance_return_as_dictionary():\n electric_stove = ElectricAppliances(\"C555\", \"electric stove\", 300.00, 175.00,\n \"Kenmore\", \"150 V\")\n\n assert electric_stove.return_as_dictionary() == {\"product_code\": \"C555\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute 'free m' command, grab the memory capacity and used size then return; Memory size 'total_mem', Used_mem, and percentage of used memory. | def memory(self):
# Run 'free -m' command and make a list from output.
mem_data = self.execCMD('free', '-m').split()
total_mem = int(mem_data[7]) / 1024.
used_mem = int(mem_data[15]) / 1024.
# Caculate percentage
used_mem_percent = int(used_mem / (total_mem / 100))
... | [
"def free_physmem():\n # Note: free can have 2 different formats, invalidating 'shared'\n # and 'cached' memory which may have different positions so we\n # do not return them.\n # https://github.com/giampaolo/psutil/issues/538#issuecomment-57059946\n out = sh([\"free\", \"-b\"], env={\"LANG\": \"C.U... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for discard_packet, mapped from YANG variable /system_monitor/tm/discard_packet (container) | def _get_discard_packet(self):
return self.__discard_packet | [
"def _set_discard_packet(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=discard_packet.discard_packet, is_container='container', presence=False, yang_name=\"discard-packet\", rest_name=\"discard-packet\", parent=self, path_helper=self._path_help... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for discard_packet, mapped from YANG variable /system_monitor/tm/discard_packet (container) | def _set_discard_packet(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=discard_packet.discard_packet, is_container='container', presence=False, yang_name="discard-packet", rest_name="discard-packet", parent=self, path_helper=self._path_helper, extmethods=... | [
"def _set_discard_voq_packet(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=discard_voq_packet.discard_voq_packet, is_container='container', presence=False, yang_name=\"discard-voq-packet\", rest_name=\"discard-voq-packet\", parent=self, path_he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for discard_voq_packet, mapped from YANG variable /system_monitor/tm/discard_voq_packet (container) | def _get_discard_voq_packet(self):
return self.__discard_voq_packet | [
"def _set_discard_voq_packet(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=discard_voq_packet.discard_voq_packet, is_container='container', presence=False, yang_name=\"discard-voq-packet\", rest_name=\"discard-voq-packet\", parent=self, path_he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for discard_voq_packet, mapped from YANG variable /system_monitor/tm/discard_voq_packet (container) | def _set_discard_voq_packet(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=discard_voq_packet.discard_voq_packet, is_container='container', presence=False, yang_name="discard-voq-packet", rest_name="discard-voq-packet", parent=self, path_helper=self._path... | [
"def _set_discard_packet(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=discard_packet.discard_packet, is_container='container', presence=False, yang_name=\"discard-packet\", rest_name=\"discard-packet\", parent=self, path_helper=self._path_help... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for delete_packet, mapped from YANG variable /system_monitor/tm/delete_packet (container) | def _get_delete_packet(self):
return self.__delete_packet | [
"def _set_delete_packet(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=delete_packet.delete_packet, is_container='container', presence=False, yang_name=\"delete-packet\", rest_name=\"delete-packet\", parent=self, path_helper=self._path_helper, e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for delete_packet, mapped from YANG variable /system_monitor/tm/delete_packet (container) | def _set_delete_packet(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=delete_packet.delete_packet, is_container='container', presence=False, yang_name="delete-packet", rest_name="delete-packet", parent=self, path_helper=self._path_helper, extmethods=self.... | [
"def delete_dt_request_packet(self):\n if self.dt_req_packet is not None:\n print(responses.SUCCESS_DELETING_DT_REQ_PACKET)\n self.dt_req_packet = None\n\n else:\n print(responses.ERROR_NO_REQ_PACKET)",
"def __delete_packet(self, pktid: str) -> None:\n\t\tif AppData.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload command table into the device. The command table can either be specified through the dedicated ``CommandTable`` class or in a raw format, meaning a json string or json dict. In the case of a json string or dict the command table is validated by default against the schema provided by the device. | def upload_to_device(
self,
ct: t.Union[CommandTable, str, dict],
*,
validate: bool = False,
check_upload: bool = True,
) -> None:
try:
self.data(json.dumps(ct.as_dict())) # type: ignore
except AttributeError:
if validate:
... | [
"def upload_cmd_table(self, cmd_table_str, index=None):\n\n if index is None:\n index = self.index\n\n # Validate if string is a valid JSON\n try:\n json.loads(cmd_table_str)\n except ValueError:\n self.hd.log.error(\"Command table string is invalid JSON ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load command table from the device. | def load_from_device(self) -> CommandTable:
ct = CommandTable(self.load_validation_schema(), active_validation=True)
ct.update(self.data())
return ct | [
"def load_device():",
"def load_commands(self):\n\t\tcommands = {}\n\t\ttry:\n\t\t\tfile_ = open(\"commands\", 'r')\n\t\t\tfor line in file_.readlines():\n\t\t\t\tif line == \"\":\n\t\t\t\t\tcontinue\n\t\t\t\tcommands[line.split(\"::\")[0]] = line.split(\"::\")[1].strip()\n\t\texcept OSError as e:\n\t\t\tprint(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disputa com os garcons os clientes ate alcançar seu maximo de pedidos ou nao ter mais clientes para atender na rodada | def recebe_max_ped(self):
while len(self.anotados) < self.max_cli:
cliente_atual = self.gerenciador.anotar_pedido(self)
# verifica se ainda tem clientes para serem atendidos na rodada
# if cliente_atual != -1:
if cliente_atual is not None:
if clien... | [
"def entrega_ped(self):\n for i in self.anotados:\n # acorda a thread do cliente para ele poder receber e beber\n i.continuar() # e_esperar.set()\n logging.info(\" \".join([\"garcom\",\n str(self.nome),\n \"entregou para o Clie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Vai de cliente em cliente da lista e entrega o pedido do garcom | def entrega_ped(self):
for i in self.anotados:
# acorda a thread do cliente para ele poder receber e beber
i.continuar() # e_esperar.set()
logging.info(" ".join(["garcom",
str(self.nome),
"entregou para o Cliente",
... | [
"def modifCliente():\n try:\n newdata = []\n client = [var.ui.EditDni, var.ui.EditApell, var.ui.EditNomb, var.ui.editClialta, var.ui.EditDirecc]\n for i in client:\n newdata.append(i.text())\n newdata.append(var.ui.cmbProv.currentText())\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts up AutoQuakePycker and setsup processes | def AutoQuakePycker_run():
import glob
from itertools import product
import multiprocessing
import logging
import more_itertools as mit
from munch import munchify
import os
import yaml
from obspy import read_events, Catalog
logger = multiprocessing.log_to_stderr(logging.DEBUG)
... | [
"def init_workers():\n party_queue = Queue()\n p = Producer(party_queue)\n p.daemon = True\n c = Consumer(party_queue)\n c.deamon= True\n m = MasterUpdater(db,application_name)\n m.deamon = True\n p.start()\n c.start()\n m.start()",
"def setup_amq(self):\n self.setup_amq_clust... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process picking on each trace parsed by process_station. | def process_trace(n_tr, tr, sta, orig_time, cmps, cfg):
cmp = tr.stats.channel[2:3]
sta[cmp] = {}
sta[cmp]["times"] = tr.times(reftime=orig_time)
sta[cmp]["tr_results"] = np.zeros(
(len(cfg.picking.FILT_WINS["P"]), sta["lenD"])
)
sta[cmp]["f1_results"] = np.zeros(
... | [
"def _phase_picker(self, event):\n\n event_crd = np.array([event[[\"X\", \"Y\", \"Z\"]].values])\n event_xyz = np.array(self.lut.xyz2coord(event_crd,\n inverse=True)).astype(int)[0]\n\n p_ttime = self.lut.value_at(\"TIME_P\", event_xyz)[0]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get credentials from credential_code table | def get_credentials():
sql = """
SELECT credential_name, description full_name
FROM credential_code
WHERE can_use = 1
"""
# [('CRNA', 'Certified Registered Nurse Anesthetist'), ... ]
record_set = get_record(sql)
result = dict(record_set)
return result | [
"def _get_credentials(self, code):\n try:\n return self.flow.step2_exchange(code)\n except FlowExchangeError as ex:\n raise AuthenticationError(\n \"Failed to retrieve credentials: %s\" % ex)",
"def find_by_account(cls,account):\n for credentials in cls.cr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get license type from license_type table | def get_license_type():
sql = """
SELECT license_type license, description
FROM license_types_codes
WHERE can_use = 'Y'
"""
# [('P', 'Permanent'), ... ]
record_set = get_record(sql)
result = dict(record_set)
return result | [
"def license_type(self) -> Optional[str]:\n return pulumi.get(self, \"license_type\")",
"def license_type(self) -> str:\n return pulumi.get(self, \"license_type\")",
"def lic_type():\n return VocabularyType.create(id='licenses', pid_type='lic')",
"def get_account_license_type(self) -> dict:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the reverse complementary sequence of DNA for the specfied DNA sequence | def get_reverse_complement(dna):
rev_comp = ''
for i in range(0, len(dna)):
nucleo = dna[i]
comp = get_complement(nucleo)
rev_comp = comp + rev_comp
return rev_comp | [
"def get_reverse_complement(dna):\n \n # YOUR IMPLEMENTATION HERE",
"def reverse_complement(DNA_sequence):\r\n DNA_translation_table = str.maketrans(\"ACGT\", \"TGCA\")\r\n rev_compliment = DNA_sequence.translate(DNA_translation_table)\r\n return rev_compliment[::-1]",
"def get_complementary_sequ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a DNA sequence (a string) and splits it into a list of codons as a list of strings. | def split_into_codons(dna):
dna_split = []
length = math.ceil(len(dna)/3)
for i in range(0, length):
j = 3*i
codon = dna[j:j+3]
dna_split += [codon]
return dna_split | [
"def codonify(strand: str) -> list:\n\n # Loops through the whole string and slices every set of three characters into\n # the list codons\n codons = [strand[index : index + len_codon] for index in range(0,len(strand),len_codon)]\n return codons",
"def dna_codons(dna):\r\n #create empty list of cod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the maximum length of the longest ORF over num_trials shuffles of the specfied DNA sequence | def longest_ORF_noncoding(dna, num_trials):
i = 0
longest_each_trial = []
while i < num_trials:
shuffled_dna = shuffle_string(dna)
longest_each_trial.append(longest_ORF(shuffled_dna))
i += 1
longest_longest = max(longest_each_trial, key=len)
return len(longest_longest) | [
"def longest_ORF_noncoding(dna, num_trials):\n \n maxms = []\n for i in range (0,num_trials):\n dna = list(dna)\n shuffle(dna) \n maxms.append(longest_ORF(collapse(dna))) \n return len(max(maxms,key=len))",
"def longest_ORF_noncoding(dna, num_trials):\n longes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r""" Check if a node is within a given tree | def isInTree(tree, node_id):
if tree.id == node_id:
return True
for child in tree.children:
if isInTree(child, node_id):
return True
return False | [
"def contains_tree(t1, t2):\n # Empty tree is always a subtree\n if t2 is None:\n return True\n return sub_tree(t1, t2)",
"def __contains__(self, target):\n node = self.root\n while node:\n if target == node.value:\n return True\n if target < node... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r""" Retrieve trees from the database | def retrieveTrees(c):
all_nodes = dict()
root_nodes = list()
c.execute('''SELECT id, parent_id, title FROM node''')
data_db = c.fetchall()
# Initialize nodes list
for data_line in data_db:
db_child_id = data_line[0]
db_parent_id = data_line[1]
child_title = data_lin... | [
"def get_trees(self):\n pass",
"def tree(requets):\n q_all_root = Node.objects.filter(root=None)\n # print(q_all_root)\n tree_data = {'tree': list()}\n if q_all_root.exists():\n for root_node in q_all_root.iterator():\n tree_data['tree'].append(serializers.to_json(root_node))\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test is url from local instance returns false if url is not from local instance | def test_is_url_from_local_instance_returns_false_if_url_is_not_from_local_instance(
self,
):
# Arrange / Act
return_value = BlobDownloader(
"http://google.com"
).is_url_from_local_instance()
# Assert
self.assertEqual(return_value, False) | [
"def test_is_url_from_local_instance_returns_true_if_url_is_from_local_instance(\n self,\n ):\n # Arrange / Act\n return_value = BlobDownloader(\n f\"{settings.SERVER_URI}/987653456789\"\n ).is_url_from_local_instance()\n # Assert\n self.assertEqual(return_val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test is url from local instance returns true if url is from local instance | def test_is_url_from_local_instance_returns_true_if_url_is_from_local_instance(
self,
):
# Arrange / Act
return_value = BlobDownloader(
f"{settings.SERVER_URI}/987653456789"
).is_url_from_local_instance()
# Assert
self.assertEqual(return_value, True) | [
"def test_is_url_from_local_instance_returns_false_if_url_is_not_from_local_instance(\n self,\n ):\n # Arrange / Act\n return_value = BlobDownloader(\n \"http://google.com\"\n ).is_url_from_local_instance()\n # Assert\n self.assertEqual(return_value, False)",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test get url base returns url base | def test_get_url_base_returns_url_base(self):
# Arrange / Act
return_value = BlobDownloader(
f"{settings.SERVER_URI}/987653456789"
).get_url_base()
# Assert
self.assertEqual(return_value, SERVER_URI) | [
"def test_base_url(self):\n r = self.base_check_request(\"get\", \"/\")\n\n base_urls = {\n 'apartments': self.build_url('apartments/'),\n 'companies': self.build_url('companies/'),\n 'companies-types': self.build_url('companies-types/'),\n 'complexes': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test get url base raise exception if url cannot be parsed | def test_get_url_base_raise_exception_if_url_cannot_be_parsed(self):
# Assert
with self.assertRaises(BlobDownloaderUrlParseError):
# Arrange / Act
BlobDownloader("random_string").get_url_base() | [
"def test_nonworking_url(self):\r\n urls = {\r\n 'CouchSurfing': ('http://allthatiswrong.wordpress.com/2010/01'\r\n '/24/a-criticism-of-couchsurfing-and-review-o'\r\n 'f-alternatives/#problems'),\r\n # 'Electronic': ('https://www.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test get blob response raise exception if url is unidentified | def test_get_blob_response_raise_exception_if_url_is_unidentified(self):
# Assert
with self.assertRaises(BlobDownloaderUrlParseError):
# Arrange / Act
BlobDownloader("random_string").get_blob_response() | [
"def test_get_blob_response_return_blob_from_local_if_url_is_local(\n self, mock_send_get_request\n ):\n # Arrange / Act\n mock_send_get_request.return_value = \"local\"\n return_value = BlobDownloader(\n f\"{settings.SERVER_URI}/987653456789\"\n ).get_blob_response(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test get blob response return blob from local if url is local | def test_get_blob_response_return_blob_from_local_if_url_is_local(
self, mock_send_get_request
):
# Arrange / Act
mock_send_get_request.return_value = "local"
return_value = BlobDownloader(
f"{settings.SERVER_URI}/987653456789"
).get_blob_response()
# Asse... | [
"def web_get_file(self, url):\n try:\n print(url)\n response = requests.get(url, verify=False)\n file_buffer = BytesIO(response.content)\n file_buffer.seek(0)\n return file_buffer\n except:\n print(traceback.print_exc())\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test get blob response return blob from remote if url is identified as remote federated | def test_get_blob_response_return_blob_from_remote_if_url_is_identified_as_remote_federated(
self, mock_send_get_request
):
# Arrange / Act
mock_send_get_request.return_value = "remote"
with patch.object(
settings, "INSTALLED_APPS", ["core_federated_search_app"]
)... | [
"def test_get_blob_response_return_blob_from_local_if_url_is_local(\n self, mock_send_get_request\n ):\n # Arrange / Act\n mock_send_get_request.return_value = \"local\"\n return_value = BlobDownloader(\n f\"{settings.SERVER_URI}/987653456789\"\n ).get_blob_response(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes ten users and tests that the index view gets 10 users | def test_more_profiles(self):
for x in range(0, 10):
User.objects.create_user(
username="".join(("koalabear", str(x))),
email="".join(("koalabear@example.com", str(x))),
password="".join(("secret", str(x)))
)
c = Client()
... | [
"def add_ten_users():\n\n def add_ten_users():\n users = []\n for i in range(0, 10):\n username = \"_\".join(['username', str(i)])\n email = \"@\".join([username, 'email.com'])\n user = _add_user(username, email, 'password')\n users.append(user)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the request before routing it. | def process_request(self, req, resp):
pass
"""TODO: to be defined1.
:Process the request before routing it.
Args:: TODO
"""
# self._Process the request before routing it.
# Args: = Process the request before routing it.
# Args: | [
"def process_request(self, request):\n pass",
"def process_request(self, request):\n if not self.is_ignored(request.META['PATH_INFO']):\n self.process_request_actions(request)",
"def process_request(self, req, resp):\n pass",
"def process_request(self, request):\n raise ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy the schemapi utility and its test file into altair/utils/ | def copy_schemapi_util():
# copy the schemapi utility file
source_path = abspath(join(dirname(__file__), 'schemapi', 'schemapi.py'))
destination_path = abspath(join(dirname(__file__), '..', 'altair',
'utils', 'schemapi.py'))
print("Copying\n {0}\n -> {1}".format(sou... | [
"def test_testutils():\n build()\n sh(\"%s psutil\\\\tests\\\\test_testutils.py\" % PYTHON)",
"def copy_example(pytester) -> Path:\n resources_dir = Path(__file__).parent / 'data'\n pytester.copy_example(str(resources_dir))\n return pytester.path",
"def standardSetup(): \n\n # insert the pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a schema wrapper at the given path. | def generate_vegalite_schema_wrapper(schema_file):
# TODO: generate simple tests for each wrapper
with open(schema_file) as f:
rootschema = json.load(f)
contents = [HEADER,
"from altair.utils.schemapi import SchemaBase, Undefined",
LOAD_SCHEMA.format(schemafile='vega-... | [
"def create_schema(self, schema: str):\n return",
"def make_skeleton_schema(self):\n self.schema_from_scratch = True\n # Use Jinja to render the template schema file to a variable\n env = jinja2.Environment(\n loader=jinja2.PackageLoader(\"nf_core\", \"pipeline-template\"), ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the params of a hmm for sim experiment 1 | def set_params_hmm_exp1(hmm) :
hmm.length = 12
hmm.dims = [(2,3)]*hmm.length # (latent,emit) dimspace
hmm.emit = [
[[0.6,0.2,0.2],[0.2,0.6,0.2]]
]*hmm.length
hmm.trans = [
[[0.7,0.3],[0.3,0.7]]
]*hmm.length
hmm.seqmap = [{'a':0,'b':1}]*hmm.length
hmm.seqmap2 = [{0:'a',1:'b'}]*hmm.length
hmm.featmap = [{'H'... | [
"def set_parameters(self):\n \n self.h_kappa = np.zeros(self.num_neurons, self.dtype) + 1.0\n \n self.h_delta = np.zeros(self.num_neurons, self.dtype) + 0.03\n \n self.h_bias = np.zeros(self.num_neurons, self.dtype) + 0.8\n self.h_sigma = np.zeros(self.num_neurons, s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a column with given values | def generate_column(values, previous_table):
# result = []
for i in range(0, len(previous_table)):
# current_item = previous_table[i] + values[i]
# result.append(current_item)
values[i][0:0] = previous_table[i]
# return result
print "Column(s) attached to result"
return va... | [
"def add_column(values, df=pandas.DataFrame()):\n df['col_{}'.format(len(df.columns))] = values\n return df",
"def create_column_by_example(self, name, value):\n type_ = self.db.types.guess(value)\n self.create_column(name, type_)",
"def add_column(values, df=None):\n if df is None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns word with 10% possiblity of returning null | def get_random_word_10per_null():
word_dic = wordlist
word_dic_length = len(word_dic) - 1
random_word_location = get_random_num_given_per_null(word_dic_length, 0.1)
if random_word_location:
return word_dic[random_word_location]
return None | [
"def test_get_duplicate_negative_words(self):\n pass",
"def suggested_spelling(search_string):\n html = browser_driver.taw_html(search_string)\n\n taw_soup = BeautifulSoup(html, 'html.parser')\n\n showing_results_for = spelling_showing_results_for(taw_soup)\n if showing_results_for is not None:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append given data for the fows and columns given | def append_data(start_col, end_col, rows, func_for_content):
result = [generate_header(start_col, end_col, "")]
while len(result) < rows + 1:
item = []
while len(item) < end_col - start_col + 1:
to_append = func_for_content()
item.append(to_append)
result.append... | [
"def add_data(self, rowdata):\n if not rowdata.keys():\n # No columns were specified\n return\n for colnam in rowdata.keys():\n # Check the the column is actually defined in\n # in the table\n try:\n self.list_columns().index(colnam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate csv table with given array | def generate_csv_table(table_values):
with open('ayasdi_assignment.csv', 'wb') as csvfile:
filewriter = csv.writer(csvfile, delimiter=',')
filewriter.writerows(table_values) | [
"def get_2d_table_csv_str(array2d: List[List[str]]):\n answer = \"\"\n for row in array2d:\n line = StringIO()\n writer = csv.writer(line)\n writer.writerow(row)\n # rstrips the /r/n (double new line in file)\n # the last value could be spaces, wh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |