query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Raise an exception for invalid tunnel range or malformed range. | def _parse_nexus_vni_range(self, tunnel_range):
for ident in tunnel_range:
if not self._is_valid_nexus_vni(ident):
raise exc.NetworkTunnelRangeError(
tunnel_range=tunnel_range,
error=_("%(id)s is not a valid Nexus VNI value.") %
... | [
"def test_range_constructor_invalid(args, kwargs):\n asserterror(ValueError, Range, args, kwargs)",
"def _check_one_range(r):\n if not _is_single_range(r):\n raise error.RangeSyntaxError(str(r))",
"def test_invalid_range():\n assert not check_range(\">=\", \"4.5.6\", \"<\", \"1.2.3\")\n asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Synchronize vxlan_allocations table with configured tunnel ranges. | def sync_allocations(self):
# determine current configured allocatable vnis
vxlan_vnis = set()
for tun_min, tun_max in self.tunnel_ranges:
vxlan_vnis |= set(six.moves.range(tun_min, tun_max + 1))
session = db_api.get_session()
with session.begin(subtransactions=True... | [
"def _sync_route_target_allocations(self):\n\n # Determine current configured allocatable route targets\n rt_nns = set()\n for rt_nn_range in self.rt_nn_ranges:\n rt_nn_min, rt_nn_max = rt_nn_range\n if rt_nn_max + 1 - rt_nn_min > MAX_RT_NN:\n LOG.error(\"Sk... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializing the form. We have to break down the skills list that was sent so that we can indicate what the valid choices are. | def __init__(self, *args, **kwargs):
# do pop first, so the parent doesn't get unexpected arguments.
skills = kwargs.pop('skills')
super(CharacterSkillForm, self).__init__(*args, **kwargs)
self.fields['skills'].choices = \
[(s.id, s.skill.name)
for header in s... | [
"def __init__(self,\n quiz_size_slug=Quiz.DEFAULT_QUIZ_SIZE_SLUG,\n *args, **kwargs):\n super(QuizForm, self).__init__(*args, **kwargs)\n quiz_json = QuizJson()\n question_count = Quiz.get_question_count_for_slug(quiz_size_slug)\n self.question_count = question_coun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The size of the world communicator. | def world_size(self):
return self._wsize | [
"def get_world_size(self):\n return self.WORLD_SIZE",
"def world_size() -> int:\n return dist.get_world_size() if dist.is_initialized() else 1",
"def world_size(self):\n if self.data_section is None:\n return None\n attrs = self.data_section.attrs\n if bool(attrs)==Fals... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The rank of this process in the world communicator. | def world_rank(self):
return self._wrank | [
"def get_rank():\n rank = 0\n if MPI is not None:\n rank = COMM.Get_rank()\n else:\n process_name = multiprocessing.current_process().name\n if process_name != \"MainProcess\":\n rank = int(process_name.split(\"-\")[-1])\n return rank",
"def get_rank() -> int:\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The number of process groups. | def ngroups(self):
return self._ngroups | [
"def number_groups(self):\n return len(self.groups)",
"def num_node_groups(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"num_node_groups\")",
"def num_node_groups(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"num_node_groups\")",
"def numprocesses(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The group containing this process. | def group(self):
return self._group | [
"def group(self):\n return self.__group",
"def get_group(self):\n return self._group",
"def group(self):\n import grp\n return grp.getgrgid(self.stat().st_gid).gr_name",
"def group(self):\n import grp\n return grp.getgrgid(self._stat.st_gid).gr_name",
"def group(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The size of the group containing this process. | def group_size(self):
return self._gsize | [
"def group_size(self) -> int:\n return self._pb_replica_grouping.getGroupSize()",
"def Number_proc(self):\n return self.Group_size",
"def queue_size(self):\n return len(self.groups)",
"def get_size(group, include_failed=False):\n return GroupInspector.from_parent_resource(group).size(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Distribute indivisible blocks of items between groups. Given some contiguous blocks of items which cannot be subdivided, distribute these blocks to the specified number of groups in a way which minimizes the maximum total items given to any group. Optionally weight the blocks by a power of their size when computing the... | def distribute_discrete(sizes, groups, pow=1.0):
chunks = np.array(sizes, dtype=np.int64)
weights = np.power(chunks.astype(np.float64), pow)
max_per_proc = float(distribute_partition(weights.astype(np.int64), groups))
target = np.sum(weights) / groups
dist = []
off = 0
curweight = 0.0
... | [
"def distribute_uniform(totalsize, groups):\n ret = []\n for i in range(groups):\n myn = totalsize // groups\n off = 0\n leftover = totalsize % groups\n if ( i < leftover ):\n myn = myn + 1\n off = i * myn\n else:\n off = ((myn + 1) * leftove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uniformly distribute items between groups. Given some number of items and some number of groups, distribute the items between groups in the most Uniform way possible. | def distribute_uniform(totalsize, groups):
ret = []
for i in range(groups):
myn = totalsize // groups
off = 0
leftover = totalsize % groups
if ( i < leftover ):
myn = myn + 1
off = i * myn
else:
off = ((myn + 1) * leftover) + (myn * (i ... | [
"def distribute_discrete(sizes, groups, pow=1.0):\n chunks = np.array(sizes, dtype=np.int64)\n weights = np.power(chunks.astype(np.float64), pow)\n max_per_proc = float(distribute_partition(weights.astype(np.int64), groups))\n\n target = np.sum(weights) / groups\n\n dist = []\n\n off = 0\n curw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The toast.Comm over which the data is distributed. | def comm(self):
return self._comm | [
"def create_comm(mpicomm):\n if not toast_available:\n raise RuntimeError(\"TOAST is not importable, cannot create a toast.Comm\")\n toastcomm = None\n if mpicomm is None:\n toastcomm = toast.Comm(world=mpicomm)\n else:\n worldsize = mpicomm.size\n groupsize = 1\n if w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print information about the distributed data to the specified file handle. Only the rank 0 process writes. | def info(self, handle):
# Each process group gathers their output
groupstr = ""
procstr = ""
gcomm = self._comm.comm_group
wcomm = self._comm.comm_world
rcomm = self._comm.comm_rank
if wcomm.rank == 0:
handle.write("Data distributed over {} process... | [
"def write_to_kernel(self):\n\t\tf = open(self.file_to_read,\"w\")\n\t\tf.write(\"Read the Information\\n\")\n\t\tf.close()",
"def PrintOutputToFile(GoalNodeId, NodeRepository, fd_output):\n global ROOTNODEID\n stackTraceBack = []\n nodeId = GoalNodeId\n while 1:\n node = NodeRepository[nodeId]\n stac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect a method to this slot. | def connect(self, method):
key = (method.__func__, id(method.__self__))
self._dict[key] = method.__self__ | [
"def connect(self, slot):\n self._slots.add(slot)",
"def connectSignalsToSlots(self):\n pass",
"def connect(self, sender, signal, slot, receiver=None):\n if callable(slot):\n self._connections.setdefault(sender, {}).setdefault(signal, []).append(slot)\n elif type(slot) == ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disconnect a method from this slot. | def disconnect(self, method):
key = (method.__func__, id(method.__self__))
if key in self._dict:
del self._dict[key] | [
"def disconnect(self, signal, slot):\n# print \"DISCONNECT: \", self, signal, slot\n if not hasattr(self, '_signals'):\n raise NameError, \"TODO\"\n if signal not in self._signals:\n raise NameError, \"TODO\"\n try:\n if slot not in self._signals[signal]:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To compute the geodesic distance to the walls in using \ a fastmarching method | def compute_wall_distance(self):
phi = sp.ones(self.image_red.shape)
if (len(self.mask_id[0])>0):
phi[self.mask_id] = 0
self.wall_distance = skfmm.distance(phi, dx=self.pixel_size)
grad = sp.gradient(self.wall_distance,edge_order=2)
grad_X = grad[1]/self.p... | [
"def _schlaflyDistance(self):\n\t\timport numpy as np\n\t\timport pyfits\n\t\tfrom astLib import astWCS\n\t\tself.coim = pyfits.open(self.path+'../CO_temp.fits')\n\t\tco_wcs = astWCS.WCS(self.coim[0].header,mode='pyfits')\n\t\tself.coim[0].data = np.transpose( self.coim[0].data )\n\n\t\tglon = self.glon + np.arange... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To plot the wall distances | def plot_wall_dist(self,id=1,dpi=150):
fig = plt.figure(id)
ax1 = fig.add_subplot(111)
ax1.imshow(self.image,interpolation='nearest',
extent=[self.xmin,self.xmax,self.ymin,self.ymax], origin='lower')
ax1.imshow(self.wall_distance,interpolation='nearest',
... | [
"def getDistances():\n\n # If there's a wall in the way then there's no edge that way (probably)\n\n wallL, edgeL = getDistance(-45) # Left\n wallF, edgeF = getDistance( 0) # Forward\n wallR, edgeR = getDistance( 45) # Right\n\n panTilt.pan() # Recenter\n\n return wallL, edgeL, wallF, edgeF, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iter to a list of servers and instantiate Protocol class. | def set_servers(self, servers):
if isinstance(servers, six.string_types):
servers = [servers]
assert servers, "No memcached servers supplied"
self._servers = [Protocol(
server=server,
username=self.username,
password=self.password,
com... | [
"def __init__(self, servers, binary=False):\r\n self.binary = binary\r\n self.addresses = list(servers)\r\n addr_tups = []\r\n for server in servers:\r\n addr = server\r\n port = 11211\r\n if server.startswith(\"udp:\"):\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests for Average Bioequivalence. | def test_average_bioequivalence():
# See 10.2 Example from Chow et al.
h = Average(delta=0.223, stdev=0.40, margin=0.05,
alpha=0.05, power=0.8, known_stdev=True)
h.calculate()
# Chow has 21, but they have the wrong z_beta/2. It should be 1.28,
# not 0.84. When that is fixed, the c... | [
"def test_avg_grade(self):\n\t\ts = Student_Analytics()\n\t\tself.assertEqual(s.classify_grade(s.avg_grade(3)),\"B\")",
"def test_avg_entanglement_fidelity_ensemble():\n # Test on emsemble.\n probs = [1.]\n states = [np.eye(2) / 2.]\n # Test on pauli choi matrix.\n krauss_ops = initialize_pauli_exa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests for Population Bioequivalence. | def test_population_bioequivalence():
# See 10.3 Example from Chow et al.
h = Population(l=-0.2966, stdev_11=0.2, stdev_tt=math.sqrt(0.17),
stdev_tr=math.sqrt(0.17), stdev_bt=0.4, stdev_br=0.4,
rho=0.75, alpha=0.05, power=0.8)
h.calculate()
assert h.n == 12 | [
"def test_populations(self):\n\n processor = DataProcessor(\"counts\")\n processor.append(Probability(\"00\"))\n\n # Test on a single datum.\n new_data, error = processor(self.exp_data_lvl2.data(0))\n\n self.assertEqual(new_data, 0.4)\n self.assertEqual(error, np.sqrt(0.4 *... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get observables from stix2 json | def get_observables(stix_json, log):
objects = stix_json["objects"]
observables = []
for obj in objects:
observable = get_observable(obj, log)
if observable:
observables.append(observable)
return observables | [
"def entity_to_observables(self, entityid):\n return self._make_post('neighbors/tuples/Entity/%s/Observable' %\n entityid)",
"def _get_observable_to_entities(self, objectid, entity_name):\n return self._make_post('neighbors/tuples/observable/%s/%s' %\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get observable type for a stix object | def get_observable_type(stix_obj, log):
obj_type = stix_obj[u"type"]
if obj_type == u"observed-data":
#
# so far all the observed-data has only one embedded obj
# if there is more, log the error
#
if len(stix_obj[u"objects"]) > 1:
log.error("Observed-data {} h... | [
"def get_obj_type(obj):\n return type(obj)",
"def observation_type(self) -> str:\n return self._observation_type",
"def to_observation_type(self) -> str:\n obstype = self._header[\"OBSTYPE\"].strip().lower()\n self._used_these_cards(\"OBSTYPE\")\n if obstype == \"object\":\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a stix obj using obj_id | def find_object_by_id(stix_objects, obj_id):
ret_obj = None
for obj in stix_objects:
if obj["id"] == obj_id:
ret_obj = obj
break
return ret_obj | [
"def get_object(id):",
"def find_by_id(object_id, items):\n for item in items:\n if object_id == item[\"id\"]:\n return item\n\n raise Exception(f\"Item with {object_id} not found\")",
"def get_object(obj_type, obj_id):\n if not obj_id:\n return None\n try:\n return o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find all leaf nodes below start_tag in the tag_table. Search from the start tag and down through the tag tree, until ending up at children that have no children of their own. Return the combined Series of these children. | def find_children(start_tag, tag_table):
pure_child = pd.Series([])
parents = pd.Series([start_tag])
while parents.shape[0] > 0:
pure_child = pd.concat([pure_child,
parents[~parents
.isin(tag_table['Parent'])]])
parents ... | [
"def get_children(search_tag, tag_list):\n list_return = []\n\n for tag in tag_list:\n if str(tag.parent) == str(search_tag):\n list_return.append(tag)\n list_return.extend(get_children(tag, tag_list))\n return list(set(list_return)) # This will return a list of unique element... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cleans up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '' separator with the new separator. | def _slug_strip(self,
value,
separator='-'):
separator = separator or ''
if separator == '-' or not separator:
re_sep = '-'
else:
re_sep = '(?:-|%s)' % re.escape(separator)
# Remove multiple instances and if an alternate sep... | [
"def _slug_strip(value, separator=None):\n if separator == '-' or not separator:\n re_sep = '-'\n else:\n re_sep = '(?:-|%s)' % re.escape(separator)\n value = re.sub('%s+' % re_sep, separator, value)\n return re.sub(r'^%s+|%s+$' % (re_sep, re_sep), '', value)",
"def _slug_strip(value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates and stores a unique slug of ``value`` for an instance. ``slug_field_name`` should be a string matching the name of the field to store the slug in (and the field to check against for uniqueness). ``queryset`` usually doesn't need to be explicitly provided it'll default to using the ``.all()`` queryset from th... | def unique_slugify(instance,
value,
slug_field_name='slug',
queryset=None,
slug_separator='-'):
slug_field = instance._meta.get_field(slug_field_name)
slug = getattr(instance, slug_field.attname)
slug_le... | [
"def unique_slugify(instance, value, slug_field_name='slug', queryset=None,\n slug_separator='-'):\n slug_field = instance._meta.get_field(slug_field_name)\n\n slug = getattr(instance, slug_field.attname)\n slug_len = slug_field.max_length\n\n # Sort out the initial slug, limiting its ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iRep gc_content message calculate gc content over sequence windows | def _iRep_gc_content(seq, window = 5000, slide = 100):
# convert GC
replacements = {'G':1, 'C':1, 'A':0, 'T':0, 'N':0}
GC = [] # G - C
for base in seq:
try:
GC.append(replacements[base.upper()])
except:
GC.append(0)
# calculate gc content over sliding windows
... | [
"def gcContent(sequence):\n #adds the number of c and g and divides by the total length of the sequence\n #then multiplies by 100 to get a percent\n gc = ((sequence.count('c') + sequence.count('g'))/(float(len(sequence))))*100\n return(gc)",
"def gc_content(self):\n if self.sequence is not None... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RIGHT FROM iREP linear function for sorted coverage profile y = mx + b | def coverage_function(pars, X, data = None, printPs = False):
m = pars['m'].value
b = pars['b'].value
if printPs is True:
print('m: %s b: %s' % \
('{:,}'.format(int(m)), '{:,}'.format(int(b))))
results = [float(m * x) + b for x in X]
if data is None:
return np.asarray(res... | [
"def make_lineprofile(npix,rstar,xc,vgrid,A,veq,linewidth):\n vc=(np.arange(npix)-xc)/rstar*veq\n vs=vgrid[np.newaxis,:]-vc[:,np.newaxis]\n profile=1.-A*np.exp( -(vs*vs)/2./linewidth**2)\n return profile",
"def fn(a,y):\n cost=cp.sum(cp.nan_to_num(-y*cp.log(a)-(1-y)*cp.log(1-a)))\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run each component of the PASCAL VOC dataset formatter in sequence. | def begin(self):
print("Renaming images to VOC data format...")
self.renamer.rename()
print("Renaming Complete.")
print("Splitting the data in to training/validation/test sets and creating text files respectively...")
self.data_splitter.split()
print("Data Splitting Compl... | [
"def run_pipeline(self):\n\n\t\t# Step 1 : Define the fields\n\t\tself.define_fields()\n\n\t\t# Step 2: Read data\n\t\tself.train = self.read_data(os.path.join(self.data_folder_path, self.train_file_path))\n\t\tself.test_1 = self.read_data(os.path.join(self.data_folder_path, self.test_1_file_path))\n\t\tself.test_2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Some groups were deleted, remove them from users principals. | def on_groups_deleted(event):
permission_backend = event.request.registry.permission
for change in event.impacted_objects:
group = change["old"]
bucket_id = event.payload["bucket_id"]
group_uri = utils.instance_uri(event.request, "group", bucket_id=bucket_id, id=group["id"])
pe... | [
"def cleanup_user_groups(event):\n name = event.object.name\n\n if name.startswith(\"group:\"):\n principals = get_principals()\n users_groups = [p for p in principals if name in principals[p].groups]\n for user_or_group in users_groups:\n principals[user_or_group].groups.remov... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Some groups were changed, update users principals. | def on_groups_changed(event):
permission_backend = event.request.registry.permission
for change in event.impacted_objects:
if "old" in change:
existing_record_members = set(change["old"].get("members", []))
else:
existing_record_members = set()
group = change["n... | [
"def groups_update(self, mar, request):\n group_id = mar.viewed_user_auth.user_id\n member_ids_dict, owner_ids_dict = self._services.usergroup.LookupMembers(\n mar.cnxn, [group_id])\n owner_ids = owner_ids_dict.get(group_id, [])\n member_ids = member_ids_dict.get(group_id, [])\n if not permiss... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read_json takes a list of str for the name of all json files. Uses the json to generate a Constituency objects that gets append to the Election constituency attribute | def read_json(self, json_files):
self.file_access.write_log("Attempting to read the json files {}".format(json_files))
for i in json_files:
self.constituency.append(self.file_access.read_election_json(i))
self.file_access.write_log("The {} json file has been added to the Constitu... | [
"def read_classification_json(fn):\n with open(fn) as f:\n classification_data = json.load(f)\n f.close()\n \n return classification_data",
"def read_json():\n try:\n rospack = rospkg.RosPack()\n file_path = rospack.get_path('autonomous') + \"/src/data.txt\"\n wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Confirm creation of a CountyMortgageData object from a CSV row. | def test_data_creation_from_base_row(self, mock_read_csv):
f = StringIO(self.data_header + self.data_row)
reader = csv.DictReader(f)
mock_read_csv.return_value = reader
load_values()
self.assertEqual(CountyMortgageData.objects.count(), 1)
county = CountyMortgageData.objec... | [
"def __init__(self,csvrow):\n self.raw = csvrow\n data = csvrow.split(',')\n self.number = data[0]\n self.area = int(data[1])\n self.population = int(data[5])\n self.latitude = float(data[7])\n self.longitude = float(data[8])",
"def from_csv(self, user, row):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs a backfill on a fixed number of objects. | def backfill(task, request, check_name, num_objects):
check = getattr(checks, check_name)(request.db)
target_object = getattr(packaging_models, check.hooked_object)
query = request.db.query(target_object.id).limit(num_objects)
request.log.info("Running backfill on %d %ss." % (num_objects, check.hooked_... | [
"def _grow(self): \n limit = 0\n #Iterating through the list to find the number of elements\n for i in xrange(len(self)):\n if self._items[i] != self._fillValue:\n #There's an element at index i, so update the limit\n limit = i\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compares saved folders list with the current one | def get_folders_diff(self, folders):
missing_folders = list(set(self.saved_folders).difference(set(folders)))
added_folders = list(set(folders).difference(set(self.saved_folders)))
if any([missing_folders, added_folders]):
self.saved_folders = folders
return missing_folders, ... | [
"def cmp_directories(self, dir_1='./', dir_2='./'):\n dirs_cmp = filecmp.dircmp(dir_1, dir_2)\n list_dirs_json = dict()\n path_in = self.make_path_in(dir_1, dir_2)\n\n equal_files_json = self.equal_files_to_json(\n dirs_cmp.same_files,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compares saved files data with the current files data | def get_files_diff(self, current_files_data):
if self.saved_files_data:
saved_files_paths, saved_files_hashes = zip(*self.saved_files_data.items())
else:
saved_files_paths, saved_files_hashes = [], []
if current_files_data:
current_files_paths, current_files_h... | [
"def compare_files(self):\n\n first_backup_ids = set(self.first_source_data.keys())\n second_backup_ids = set(self.second_source_data.keys())\n\n for deleted_user_id in first_backup_ids.difference(second_backup_ids):\n self.changes[Constants.DELETED_USER]\\\n .append({... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Infinite checker to determine any files and folders changes | def check_folder_state(self):
while self:
diff = self.get_diff()
print(diff or 'No changes detected')
if diff:
self.parent.send_diff_data(diff)
time.sleep(1) | [
"def test_scanning_unchanged_dir_succeeds(self):\n self.setup_directory_tree()\n self.assertFalse(self.scanner.has_changed())",
"def test_scanning_unchanged_empty_dir_succeeds(self):\n self.assertFalse(self.scanner.has_changed())",
"def test_scanning_changed_file_in_subdir_succeeds(self):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get top k largest elements from each corressponding rows of matrix | def get_top_k(matrix,k):
assert k <= matrix.shape[1]
col_inds = np.argpartition(matrix, -k)[:,-k:].flatten()
row_inds = np.repeat(range(matrix.shape[0]),k)
vals = matrix[row_inds, col_inds]
return vals, col_inds | [
"def fetch_top_k(vect, mat, k):\n resultant = np.dot(mat, vect)\n arglist = np.argsort(resultant)\n arglist = arglist[-1:(-1 - k):-1]\n return arglist, resultant",
"def np_topk(x,k,dim=0):\n topk_index = np.argsort(-x,axis=dim)[:k]",
"def topK(arr,k):\n c=np.copy(arr)\n value=[]\n idxs=[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get k random element from each corressponding rows of matrix | def get_random_k(matrix, k):
assert k <= matrix.shape[1]
col_inds = np.array([np.random.choice(matrix.shape[1],k) for _ in range(matrix.shape[0])]).flatten()
row_inds = np.repeat(range(matrix.shape[0]),k)
vals = matrix[row_inds, col_inds]
return vals, col_inds | [
"def row_sample(mat: np.ndarray, k: int) -> np.ndarray:\n m, n = mat.shape\n col = np.random.randint(n, size=(m, k))\n row = np.arange(m).reshape(-1, 1).repeat(k, 1)\n return mat[row, col]",
"def _randomnk(m, n, k):\n a = np.random.random((m, n))\n for i in range(k, n):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count records across batches. | def count_records(batches: List[Batch]) -> int:
return sum(b.current_size for b in batches) | [
"def count_batches(session, dataset):\n num_batches = 0\n\n try:\n while True:\n session.run(dataset)\n num_batches += 1\n except tf.errors.OutOfRangeError:\n pass\n\n return num_batches",
"def batch_size(self) -> int:\n ...",
"def get_num_batches(self, batch_size):\n return le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Crawl through the batches. Produces a generator function that yields (r.header, r.seq) for each record r across batches. Batches are crawled through their r.record_gen if self.doSort==False, otherwise using r.sorted. | def do_records(self, batches: List[Batch]) -> Iterator[Tuple[str, str]]:
if any(type(b) not in [Batch, BatchAppendable] for b in batches):
raise AssertionError()
if self.doSort:
generators = [
((str(r.header), str(r.seq)) for r in b.sorted(self.doSmart))
... | [
"def do_batch(self, batches: List[Batch]) -> Iterator[Tuple[List[str], str]]:\n crawler = self.do_records(batches)\n\n try:\n first_record = next(crawler)\n except StopIteration:\n logging.error(\"nothing to crawl\")\n return\n\n current_seq = first_recor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Group records from batches based on sequence. Crawls into groups of records from input batches. | def do_batch(self, batches: List[Batch]) -> Iterator[Tuple[List[str], str]]:
crawler = self.do_records(batches)
try:
first_record = next(crawler)
except StopIteration:
logging.error("nothing to crawl")
return
current_seq = first_record[1]
cur... | [
"def _group_by_batches(samples, check_fn):\n batch_groups = collections.defaultdict(list)\n singles = []\n out_retrieve = []\n extras = []\n for data in [x[0] for x in samples]:\n if check_fn(data):\n batch = tz.get_in([\"metadata\", \"batch\"], data)\n name = str(data[\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select the appropriate join function, based on the current mode. | def __set_join_function(self):
if self.mode == self.MODE.UNIQUE:
self.__join_function = self.join_unique
elif self.mode == self.MODE.SEQ_COUNT:
self.__join_function = self.join_sequence_count
elif self.mode == self.MODE.VEC_COUNT:
self.__join_function = self.j... | [
"def join_method(self):\n return self._join_method",
"def Join(self, table, condition, mode = ''):\r\n\t\tself.SetCurrMarker('join')\r\n\t\t# exec cur part\r\n\t\treturn self.AddJoin(table, condition, mode)",
"def join(self, join_cond: ModelFieldOp, *more: ModelFieldOp, mode: JoinMode = LeftJoin) -> 'Joi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform sequence counting through joining. Counts sequence occurrences. | def join_sequence_count(
headers: List[str], seq: str, OH: IO, **kwargs
) -> Tuple[str, int]:
batch = (seq, len(headers))
OH.write("%s\t%d\n" % batch)
return batch | [
"def count(seq):\n\treturn sum(1 for x in seq)",
"def count_sequences(self, size):\n raise NotImplementedError",
"def __count_indices__(self):\n count = 0\n for seq_read in self.seq_reads:\n if seq_read.__is_index__():\n count += 1\n return count",
"def Co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Join sequenceCount batches in parallel. | def __parallel_join(self, recordBatches: List[Batch], outpath: str) -> None:
kwargs = self._pre_join(outpath)
batcher = SeqCountBatcher.from_parent(self, self.batch_size)
batcher.doSort = self.doSort
print("Intermediate batching...")
batcher.do(recordBatches)
print("Join... | [
"def join_sequence_count(\n headers: List[str], seq: str, OH: IO, **kwargs\n ) -> Tuple[str, int]:\n batch = (seq, len(headers))\n OH.write(\"%s\\t%d\\n\" % batch)\n return batch",
"def join(self, batches: List[Batch], outpath: str) -> None:\n if self.threads == 1:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform kjoining of batches. | def join(self, batches: List[Batch], outpath: str) -> None:
if self.threads == 1:
super().join(batches, outpath)
else:
self.__parallel_join(batches, outpath) | [
"def __parallel_join(self, recordBatches: List[Batch], outpath: str) -> None:\n kwargs = self._pre_join(outpath)\n\n batcher = SeqCountBatcher.from_parent(self, self.batch_size)\n batcher.doSort = self.doSort\n print(\"Intermediate batching...\")\n batcher.do(recordBatches)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start batching the records. Batch seq.Sequence subclass batch.Batch records into seq.SequenceCounts batch.Batch instances. | def do(self, recordBatch: List[Batch]) -> None:
batchList = [
recordBatch[i : min(len(recordBatch), i + self.n_batches)]
for i in range(0, len(recordBatch), self.n_batches)
]
batches = Parallel(n_jobs=self.threads, verbose=11)(
delayed(SeqCountBatcher.build_ba... | [
"def RecordBatches(\n self, options: dataset_options.RecordBatchesOptions\n ) -> Iterator[pa.RecordBatch]:",
"def record_batch():\n records = []\n for _ in range(randint(3, 5)):\n records += [record := RecordFactory()]\n RecordTagFactory.create_batch(randint(0, 3), record=record)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In this part, you need to try different distance functions you implemented in part 1.1 and different values of k (among 1, 3, 5, ... , 29), and find the best model with the highest f1score on the given validation set. | def tuning_without_scaling(self, distance_funcs, x_train, y_train, x_val, y_val):
best_f1 = 0
for name, func in distance_funcs.items():
for k in range(1, 30, 2):
model = KNN(k, func)
model.train(x_train, y_train)
valid_f1 = f1_score(y_... | [
"def tuning_without_scaling(self, distance_funcs, x_train, y_train, x_val, y_val):\n K = range(1, 30, 2)\n tie_breaks = ['euclidean', 'minkowski', 'gaussian', 'inner_prod', 'cosine_dist' ]\n best_dist_func_test = None\n best_f1score = None\n best_model_test = None\n for k i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This part is the same as "tuning_without_scaling", except that you also need to try two different scalers implemented in Part 1.3. More specifically, before passing the training and validation data to KNN model, apply the scalers in scaling_classes to both of them. | def tuning_with_scaling(self, distance_funcs, scaling_classes, x_train, y_train, x_val, y_val):
# You need to assign the final values to these variables
best_f1 = 0
for scaling_name, scaling_func in scaling_classes.items():
scaler = scaling_func()
x_train_scaled ... | [
"def tuning_with_scaling(self, distance_funcs, scaling_classes, x_train, y_train, x_val, y_val):\n \n K = range(1, 30, 2)\n tie_breaks = ['euclidean', 'minkowski', 'gaussian', 'inner_prod', 'cosine_dist' ]\n scalers = ['min_max_scale', 'normalize']\n best_k_test = None\n be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for displaying all the available accounts at the home page | def all_accounts(request):
accounts = Account.objects.all()
return render(request, 'app/home.html', {'accounts': accounts}) | [
"def display_accounts(cls):\n return cls.account_list",
"def list_accounts(self):\n pass",
"def accounts():\n if not session.get('authed', False):\n flash(\"Please log in.\")\n return redirect(my_url('index'))\n account_ids = redis_client.smembers('%s-accounts' % session['phone... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for selecting a source account, and sending the application to the next page where a destination account should be chosen | def select_account(request, account_id):
account = Account.objects.get(pk=account_id)
other_accounts = Account.objects.exclude(pk=account_id)
context = {
'source': account,
'destinations': other_accounts
}
return render(request, 'app/destination.html', context) | [
"def prepare_transfer(request):\n source = Account.objects.get(pk=int(request.POST.get('source-id', False)))\n destination = Account.objects.get(pk=int(request.POST.get('destination-id', False)))\n context = {\n 'source': source,\n 'destination': destination\n }\n return render(request,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for retrieving the information about the source and destination accounts and sending the information to the transfer function | def prepare_transfer(request):
source = Account.objects.get(pk=int(request.POST.get('source-id', False)))
destination = Account.objects.get(pk=int(request.POST.get('destination-id', False)))
context = {
'source': source,
'destination': destination
}
return render(request, 'app/transf... | [
"def transfer(\n self, \n current_username: str, \n source_account_id: int, \n destination_account_id: int, \n amount: int) -> list[Account]:\n # is user valid?\n current_user: User = self.user_dao.find(current_username)\n if not current_us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for performing the transaction. If there is enough money in the source account the transaction is performed successfully and the money is transferred, otherwise, the transaction is unsuccessful and the money stays where it was. | def transfer_money(request):
source = Account.objects.get(pk=int(request.POST.get('source-id', False)))
destination = Account.objects.get(pk=int(request.POST.get('destination-id', False)))
amount = float(request.POST.get('amount', False))
enough_cash = source.available_cash >= amount
if enough_cash:... | [
"def transfer(\n self, \n current_username: str, \n source_account_id: int, \n destination_account_id: int, \n amount: int) -> list[Account]:\n # is user valid?\n current_user: User = self.user_dao.find(current_username)\n if not current_us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot a similarity matrix between a list of clusterings, using the provided scoring function. | def plot_sim_matrix(
clusterings: list, scoring: Callable[[object, object], object]
) -> object:
forDF = []
for c in clusterings:
cID = c.get_description()
for c2 in clusterings:
c2ID = c2.get_description()
forDF.append([cID, c2ID, scoring(c, c2).score])
df = pd.D... | [
"def plot_consensus_similarity(self, mode=\"heatmap\"):\r\n assert(not self.consensus_similarity_matrix is None)\r\n\r\n assert(mode in [\"heatmap\", \"spectra\"])\r\n\r\n if mode == \"heatmap\":\r\n allLabels = [''] + sorted([x for x in self.consensus])\r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot the distribution of a property among all communities for a clustering, or a list of clusterings (violinplots) | def plot_com_stat(
com_clusters: list, com_fitness: Callable[[object, object, bool], object]
) -> object:
if isinstance(com_clusters, cdlib.classes.clustering.Clustering):
com_clusters = [com_clusters]
allVals = []
allNames = []
for c in com_clusters:
prop = com_fitness(c.graph, c, ... | [
"def plot_com_properties_relation(\n com_clusters: object,\n com_fitness_x: Callable[[object, object, bool], object],\n com_fitness_y: Callable[[object, object, bool], object],\n **kwargs: dict\n) -> object:\n if isinstance(com_clusters, cdlib.classes.clustering.Clustering):\n com_clusters = [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot the relation between two properties/fitness function of a clustering | def plot_com_properties_relation(
com_clusters: object,
com_fitness_x: Callable[[object, object, bool], object],
com_fitness_y: Callable[[object, object, bool], object],
**kwargs: dict
) -> object:
if isinstance(com_clusters, cdlib.classes.clustering.Clustering):
com_clusters = [com_clusters... | [
"def plot_com_stat(\n com_clusters: list, com_fitness: Callable[[object, object, bool], object]\n) -> object:\n if isinstance(com_clusters, cdlib.classes.clustering.Clustering):\n com_clusters = [com_clusters]\n\n allVals = []\n allNames = []\n for c in com_clusters:\n prop = com_fitnes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot the scores obtained by a list of methods on a list of graphs. | def plot_scoring(
graphs: list,
ref_partitions: object,
graph_names: list,
methods: list,
scoring: Callable[
[object, object], object
] = cdlib.evaluation.adjusted_mutual_information,
nbRuns: int = 5,
) -> object:
forDF = []
for i, g in enumerate(graphs):
for m in met... | [
"def plot_tester_strategy(tester_list, data_frame, metrics):\n\n for tester_name in tester_list:\n tester_data_frame = load_tester_reports(data_frame, tester_name)\n width_height = (16, 8)\n _, axes = plt.subplots(nrows=1, ncols=1, figsize=width_height)\n\n for _, metric in enumerate(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the elevation based on tif files located in the ./data/elevation/.tif folder using rasterio library. | def get_elevation_data(lat, lon):
logging.info("Getting elevation data for the coordinate ({}, {}).".format(lat, lon))
# Initialising function variables
grid_lat = None
grid_lon = None
coord = (lon, lat)
config_data = get_config()["gis"]
elev_file_name = config_data["input_file_nam... | [
"def get_raster_elevation(dataset, resample=None, **kwargs):\n extent = get_raster_extent(dataset)\n src_ds = wradlib.io.dem.get_srtm(extent, **kwargs)\n\n driver = gdal.GetDriverByName(\"MEM\")\n dst_ds = driver.CreateCopy(\"ds\", dataset)\n\n if resample is None:\n src_gt = src_ds.GetGeoTran... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function retrieves the baseline historical weather data supplied in 'location key' of config.yaml. It uses Dark Sky API to retrieve historical weather data such as temperature, humidity and pressure. | def get_gis_historical_data():
logging.info("Generating baseline reference and historical weather data.")
# Initialising function variables
fake = Faker()
geolocator = Nominatim()
config_data = get_config()
locations = config_data["location"]
# Check if there are no duplicate locat... | [
"def get_weather(conf):\n cur_time = datetime.utcnow()\n cur_time = cur_time.replace(hour=0, minute=0, second=0, microsecond=0)\n last_week = cur_time - timedelta(days=7)\n\n historic_data = []\n\n # Have to call for each day for historic\n for i in range(7):\n prev_day = last_week + timede... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function aggregates baseline historical data by location and month | def aggregate_gis_historical_data():
logging.info("Processing historical weather data aggregation.")
# Initialising function variables
config_data = get_config()
# Initialise pandas dataframe column name for baseline reference
# and historical data.
hist_file_path = get_file_path(... | [
"def _setup_last_month(context):\n lastmonthdata = {}\n lastmonth = []\n # bit complicated, but will give us the last month data by inspecting the graphs\n for k, v in context.items():\n if v and not isinstance(v, dict):\n for region in v.data:\n key = region[\"name\"]\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a densenet201 model. | def densenet201(pretrained=False, **kwargs):
model = ResNetFeatures(BasicBlock, [3, 4, 6, 3], **kwargs)
if pretrained:
_load_pretrained(model, model_zoo.load_url(model_urls['densenet201']))
return model | [
"def densenet201(**kwargs):\n model = DenseNet(num_init_features=64, growth_rate=32, block_config=(6, 12, 48, 32),\n **kwargs)\n return model",
"def densenet161(**kwargs):\n model = DenseNet(num_init_features=96, growth_rate=48, block_config=(6, 12, 36, 24),\n **kw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called whenever data is received from a client. The only message that a client sends to the server is a RPC Request message. If the RPC Request message is valid, then the method is called in a thread | def dataReceived(self, data):
if self.__buffer:
# We have some data from the last dataReceived() so lets prepend it
data = self.__buffer + data
self.__buffer = None
while data:
dobj = zlib.decompressobj()
try:
request = rencode... | [
"def data_received(self, data):",
"def receiveData(data):\n self.clientData.append('Received Data')\n a = {}\n if self.legacy == True:\n a['data'] = {'data': data, 'queryID': guidGenerator()}\n else:\n a['data'] = data\n a['messa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends an error response with the contents of the exception that was raised. | def sendError():
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
self.sendData((
RPC_ERROR,
request_id,
(exceptionType.__name__,
exceptionValue.args[0] if len(exceptionValue.args) == 1 else "",
""... | [
"def _send_error(self, req, code=500, message=''):\n headers = {'Content-Type': 'text/plain',\n 'Content-Length': str(len(message))}\n self._send_response(req, code, body=message, headers=headers)",
"def send_error(self, status_code=500, **kwargs):\r\n if self._headers_writt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load data from disk. If ``kind`` is `gwosc` assumes input is an strain HDF5 file downloaded | def read(cls, path, kind=None, **kws):
kind = (kind or '').lower()
if not kind:
# attempt to guess filetype
ext = os.path.splitext(path)[1].lower().strip('.')
if ext in ['h5', 'hdf5', 'hdf']:
kind = 'hdf'
elif ext in ['txt', 'gz', 'dat', 'c... | [
"def Load(self, kind, data):\n data = data.encode('utf-8')\n Validate(kind, basestring)\n Validate(data, basestring)\n output = []\n\n try:\n loader = Loader.RegisteredLoaders()[kind]\n except KeyError:\n output.append('Error: no Loader defined for kind %s.' % kind)\n return (httpli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return cyclic ACF corresponding to PSD obtained by inverse Fourier transforming. Returns | def to_acf(self):
rho = 0.5*np.fft.irfft(self) / self.delta_t
return AutoCovariance(rho, delta_t=self.delta_t) | [
"def PSD_to_ACF(freq, psd, lags):\n freq_sym = np.append(-freq[::-1], freq) \n psd_sym = np.append(psd[::-1], psd)\n\n steps = freq_sym[1:] - freq_sym[:-1]\n height = psd_sym[1:]\n\n # nd = np.tile(freq_sym[1:], (len(lags), 1)).T\n nd = np.tile(freq_sym, (len(lags), 1)).T\n\n # acf = np.cos(-2*... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get an output/input variable. | def __getitem__(self, name):
if self.outputs is not None:
try:
return self.outputs[name]
except KeyError:
if name in self._auto_ivc_map:
return self.inputs[self._auto_ivc_map[name]]
if self.inputs is not None:
... | [
"def get_variable(self, name):\n if self._scalamagic:\n intp = self.scala_interpreter\n intp.interpret(name)\n return intp.last_result()",
"def get_output_by_name(self, name):\n for var in self.outputs:\n if var.get_object().name == name:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the units for a variable name. | def _get_units(self, name):
meta = self._abs2meta
if name in meta:
return meta[name]['units']
proms = self._prom2abs
if name in proms['output']:
abs_name = proms['output'][name][0]
return meta[abs_name]['units']
elif name in proms['input']:... | [
"def get_units(name):\r\n from ..prms import Helper\r\n\r\n help = Helper()\r\n\r\n if name in help.prms_parameter_names:\r\n return help.prms_parameter_names[name][\"Units\"]\r\n\r\n elif name in help.prms_output_variables:\r\n return help.prms_output_variables[name][\"Units\"]\r\n\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the values of the design variables, as seen by the driver, for this case. | def get_design_vars(self, scaled=True, use_indices=True):
return self._get_variables_of_type('desvar', scaled, use_indices) | [
"def designvars(self):\n return self._designvars",
"def get_design_var_values(self, get_remote=True, driver_scaling=True):\n return {n: self._get_voi_val(n, dv, self._remote_dvs, get_remote=get_remote,\n driver_scaling=driver_scaling)\n for n, dv in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write table of variable names, values, residuals, and metadata to out_stream. | def _write_table(self, var_type, var_data, hierarchical, print_arrays, out_stream):
if out_stream is None:
return
# Make a dict of variables. Makes it easier to work with in this method
var_dict = OrderedDict()
for name, vals in var_data:
var_dict[name] = vals
... | [
"def save_output(self, out_name):\n with open(out_name, 'x') as file:\n file.write(self.param_table())\n file.write('\\n')\n file.write(self.result_table())\n print(f'Output wiitten to {out_name}')",
"def writeStats(self, out):\n out.write('\\tTP FP FN R P... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the absolute and promoted name versions of the provided derivative key. | def _deriv_keys(self, key):
prom2abs = self._prom2abs
abs2prom = self._abs2prom
DERIV_KEY_SEP = self._DERIV_KEY_SEP
# derivative could be tuple or string, using absolute or promoted names
if isinstance(key, tuple):
of, wrt = key
else:
of, wrt = k... | [
"def absolute_names(self):\n DERIV_KEY_SEP = self._DERIV_KEY_SEP\n\n for key in self._keys:\n if DERIV_KEY_SEP in key:\n # return derivative keys as tuples instead of strings\n of, wrt = key.split(DERIV_KEY_SEP)\n yield (of, wrt)\n els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Yield absolute names for variables contained in this dictionary. Similar to keys() but with absolute variable names instead of promoted names. Yields str absolute names for variables contained in this dictionary. | def absolute_names(self):
DERIV_KEY_SEP = self._DERIV_KEY_SEP
for key in self._keys:
if DERIV_KEY_SEP in key:
# return derivative keys as tuples instead of strings
of, wrt = key.split(DERIV_KEY_SEP)
yield (of, wrt)
else:
... | [
"def _varirable_name_iterator(self):\n return self._variables.keys()",
"def _var_name_generator():\n count = itertools.count()\n while True:\n yield '_var_' + str(count.next())",
"def _key_index_iter(self: Any) -> Iterator[Tuple[str, Any]]:\n for k, v in vars(self).items():\n yield... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get audit logs, sort by time in in reverse chronological order. This API returns the first 10,000 results only. Please use filter in the API for more relevant results. MSP Customer Would see logs of MSP's and tenants as well. | def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None,
end_time=None, description=None, target=None, classification=None,
customer_name=None, ip_address=None, app_id=None):
path = urls.TRAIL_LOG["GET_ALL"]
params = {
"li... | [
"def GetLogs(self):\n utcnow = datetime.datetime.utcnow()\n lower_filter = self.log_position.GetFilterLowerBound()\n upper_filter = self.log_position.GetFilterUpperBound(utcnow)\n new_filter = self.base_filters + [lower_filter, upper_filter]\n entries = logging_common.FetchLogs(\n log_filter='... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get audit events for all groups, sort by time in in reverse chronological order.This API returns the first 10,000 results only. Please use filter in the API for more relevant results. | def get_eventlogs(self, conn, limit=100, offset=0, group_name=None, device_id=None,
classification=None, start_time=None, end_time=None):
path = urls.EVENT_LOG["GET_ALL"]
params = {
"limit": limit,
"offset": offset
}
if group_name:
... | [
"def get_log_events(client, log_group):\n\n\tresp = client.filter_log_events(logGroupName=log_group, limit=10000)\n\treturn resp['events']",
"def update_group_events(\n self, group: GroupPage, max_entries: int = 200\n ) -> [EventPage]:\n\n # get last event from group\n last_event: EventPag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get details of an audit event/log | def get_eventlogs_detail(self, conn, id):
path = urlJoin(urls.EVENT_LOG["GET"], id)
resp = conn.command(apiMethod="GET", apiPath=path)
return resp | [
"def async_describe_logbook_event(event): # type: ignore\n data = event.data\n message = \"has been triggered\"\n if ATTR_SOURCE in data:\n message = f\"{message} by {data[ATTR_SOURCE]}\"\n return {\n \"name\": data.get(ATTR_NAME),\n \"message\": message... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checking with Microsoft Font Validator. | def com_google_fonts_check_fontvalidator(font):
# In some cases we want to override the severity level of
# certain checks in FontValidator:
downgrade_to_warn = [
# There are reports that this fontval check has an out-of-date
# understanding of valid bits in fsSelection.
# More info... | [
"def com_google_fonts_check_037(font):\n try:\n import subprocess\n fval_cmd = [\"FontValidator.exe\",\n \"-file\", font,\n \"-all-tables\",\n \"-report-in-font-dir\",\n \"+raster-tests\"]\n subprocess.check_output(fval_cmd,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate the class with a database instance and also an SMTP instance which is responsible for sending confirmation emails. Also set available timeslots that people can book for. | def __init__(self, database_manager=DataBaseManager(), emailer=EmailSender()):
self.database_manager = database_manager
self.emailer = emailer
# Set available timeslots
self.initial_time_slots = ['09:00:00',
'10:00:00',
... | [
"def __init__(self, user, password, _recipients, templatedir='templates'):\n\n self.user = user\n self.password = password\n self.recipient = _recipients if type (_recipients) is list else [_recipients]\n self.server = 'smtp.gmail.com'\n self.port = 587\n\n if os.path.isdir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getting the date of 7 days later from current day. | def next_seven_day(self):
today = datetime.date.today()
week_next = today + datetime.timedelta(days=7)
return week_next.strftime('%Y-%m-%d') | [
"def _get_previous_market_days_date() -> datetime:\n now = datetime.datetime.today()\n day_of_week = now.weekday()\n if 1 <= day_of_week <= 5:\n timedelta_days = 1\n elif day_of_week == 6:\n timedelta_days = 2\n else:\n timedelta_days = 3\n prev_day = now - datetime.timedelta(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a date into weekday string form | def get_the_weekday(self,date):
date_convert = date.split('-')
week_days = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
date_list = [int(i) for i in date_convert]
day = datetime.date(date_list[0], date_list[1], date_list[2])
# convert weekday int... | [
"def convert_to_weekday(date):\n date_obj = dt.strptime(date, '%Y-%m-%d %H:%M:%S')\n return (calendar.day_name[date_obj.weekday()]).lower()",
"def day_of_week(date):\n return date.strftime(\"%A\")",
"def weekday() -> str:\n weekday_num = date.today().isocalendar()[2]\n return day_name[weekday_num... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a given date is a weekday and if not, we tell user they cannot book that day. Also check if the booking day is inside our allowed range which is one week. | def check_weekday(self, date):
week_next = self.next_seven_day()
today = datetime.date.today().strftime('%Y-%m-%d')
if not date or date > week_next or date < today: # check the date is within one week
return False, "Sorry you can only booking consultation up to next one week. Your b... | [
"def sleep_in(weekday, vacation):\r\n if not weekday or vacation:\r\n return True\r\n return False",
"def sleep_in(weekday, vacation):\r\n if not weekday or vacation:\r\n return True\r\n else:\r\n return False",
"def sleep_in(weekday, vacation):\n if not weekday or vacation:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of available times that are booked for a given date and course | def get_time_slots(self, cid, date):
query = "SELECT time from consultation where cid = %s and date = %s"
inputs = (cid, date)
array_book = self.database_manager.execute_query(query, inputs)
array_book = [e[0] for e in array_book]
booked = array_book if array_book else []
... | [
"def get_avail_time_slots(self, cid, date):\n booked = self.get_time_slots(cid, date)\n avail_time_slots = []\n for time in self.initial_time_slots:\n if time not in booked:\n avail_time_slots.append(time)\n return avail_time_slots",
"def get_available_times(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a course id and a date, get the list of not booked time on that date for that course | def get_avail_time_slots(self, cid, date):
booked = self.get_time_slots(cid, date)
avail_time_slots = []
for time in self.initial_time_slots:
if time not in booked:
avail_time_slots.append(time)
return avail_time_slots | [
"def get_time_slots(self, cid, date):\n query = \"SELECT time from consultation where cid = %s and date = %s\"\n inputs = (cid, date)\n array_book = self.database_manager.execute_query(query, inputs)\n array_book = [e[0] for e in array_book]\n booked = array_book if array_book els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Main function for handling consultation booking query. Use the other helper function in this class to perform checks. First check the date and time to book is valid and then check if that time slot is free for booking. If successful, send the confirmation email to user | def consultation_booking_query(self, cid, sid, time, date):
if not self.check_course_exist(cid):
return ConsultationError.INVALID_COURSE.value
is_weekday, feedback = self.check_weekday(date)
time = self.round_time(time)
if is_weekday:
try:
avail_li... | [
"def make_hard_booking(self, booking_timeslot):\n \n if isinstance(booking_timeslot, TimeSlot):\n \n #check that the room isn't already booked\n cur_booking_type = self.is_booked(booking_timeslot)\n proceed_to_booking = True\n \n if cur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Time rounding function to convert time to nearest hour | def round_time(self, time):
hour, mins, _ = time.split(":")
return '{:02d}:00:00'.format(int(hour)+1 ) if int(mins) >= 30 else '{:02d}:00:00'.format(int(hour)) | [
"def round_up_to_hour(dt):\n if type(dt) == str:\n dt = get_date(dt)\n\n hour = 3600\n\n # Seconds passed in current day\n seconds = (dt - dt.min).seconds\n\n # Floor division to closest next hour if not whole hour on clock\n rounding = (seconds + hour-1) // hour * hour\n\n # Use timedelt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepares the HttpResponse that will be used to contain the CSV data | def initialize_response(self, filename):
key = 'Content-Disposition'
self.response = HttpResponse(content_type='text/csv')
self.response[key] = f'attachment; filename="{filename}"'
self.writer = UnicodeCsvWriter(self.response) | [
"def csv_response(filename, header, rows):\r\n response = HttpResponse(mimetype='text/csv')\r\n response['Content-Disposition'] = 'attachment; filename={0}'.format(filename)\r\n writer = csv.writer(response, dialect='excel', quotechar='\"', quoting=csv.QUOTE_ALL)\r\n # In practice, there... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This chapter has 'UPIA' after each section number. This breaks with the original heading regexes. | def test_ors_2011_ch_129(self):
content_file = 'ors_ch129_2011.html'
text = self.get_content(content_file)
version = 2011
chapter_str = '129'
expected_body_start = "129.200\nUPIA\n101. Short title.\nThis chapter may"
parser = OrsHtmlSubsectionParser()
text = pa... | [
"def get_numbered_section_headers(self, full_text):\n\n narrowed_string = self.get_header_text(full_text)\n\n #finds numbered headings for section titles\n number_pattern = '\\s\\d{1,2}\\s' #No nesting\n nested_1_pattern = '\\s\\d{1,2}\\.\\d{1,2}\\s' #1 level of nesting (e.g 1.1)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convolve two Ndimensional arrays using FFT. See convolve. | def fftconvolve(in1, in2, mode='same'):
s1 = array(in1.shape)
s2 = array(in2.shape)
complex_result = (np.issubdtype(in1.dtype, np.complex) or
np.issubdtype(in2.dtype, np.complex))
size = s1 + s2 - 1
# Always use 2**n-sized FFT
fsize = (2 ** np.ceil(np.log2(size))).astype('... | [
"def fft_convolve2(self,arr,*,d=1):\n size0,size1 = arr.shape\n for i in range(size0):\n arr[i,:] = self.fft_convolve(arr[i,:],d=d)\n return arr",
"def fft_convolve(self,arr,*,d=1):\n self.a[:arr.size] = arr\n\n self.b = self.fft()\n \n self.b *= self.th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends each order transaction to the database | def send_to_db(ck_transactions):
db = DDDB()
db.add_orders(ck_transactions) | [
"def put_orders(orders: []):\n conn = None\n try:\n conn = sqlite3.connect(db_file)\n except Error as error:\n print(error)\n finally:\n if conn:\n for order in orders:\n sql = f\"\"\"INSERT INTO Orders\n (OrderID, Name, Address, Po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a char into the appropriate Position, if any exists. | def convert_to_position(char: str) -> Position:
if char == 'PG':
return Position.PG
elif char == 'SG':
return Position.SG
elif char == 'SF':
return Position.SF
elif char == 'PF':
return Position.PF
elif char == 'C':
return Position.C
else:
raise Ru... | [
"def parse(s):\n if len(s) != 2:\n raise ValueError('Invalid position: ' + s)\n n = int(s[0])\n c = s[1]\n if 1 <= n <= 9 and ord('A') <= ord(c) <= ord('I'):\n return Position(n, c)\n raise ValueError('Invalid position ' + s)",
"def _charToIndex(self,ch): ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test opening cache files in a subprocess (with a clean environment). | def test_reopen_cache():
env = os.environ.copy()
# Get the path to current directory
path = os.path.dirname(os.path.realpath(__file__))
# Set the COVERAGE_PROCESS_START env. variable.
# Allows to cover files run in a subprocess
# http://nedbatchelder.com/code/coverage/s... | [
"def test_use_cache_missing_file():\n # Generate cached files\n cmd_list = [NETMIKO_GREP] + ['interface', 'all']\n _, full_dir = find_netmiko_dir()\n remove_file = 'bad_device.txt'\n remove_file_full = \"{}/{}\".format(full_dir, remove_file)\n if os.path.exists(remove_file_full) and os.path.isfile... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run encounter from start; introduce NPCs, present interaction choices, and start social/combat encounter based on choices | def begin_encounter(self):
#introduce NPCs - run all introduce methods, unless the NPCs have the same name
for i in range(len(self.npc_names)):
for _npc in self.npc_list:
if _npc.name == self.npc_names[i]:
_npc.introduce(self.npc_quantities[i], self... | [
"def do_start(self, arg):\n self.players = start_game(arg.split())\n for p in self.players:\n p.greedy = False\n self.pdict = {c.name: c for c in self.players}\n self.current_player = pick_starter(self.players)\n print(f'Type play to continue.')",
"def initiative(args... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
quick description of npcs in current location | def display_npcs(self):
if self.location == world.LocationType.INDOORS:
print("In the room before you, you see:")
for i in range(len(self.npc_list)):
print("A " + self.npc_list[i].name + " (Distance: " + str(self.npc_distances[i]) + "ft.)") | [
"def showDescription(current_room, move_results):\n print(Color.PURPLE + rooms[current_room][\"description\"] + '\\n' + Color.END)\n move_results['used_look'] = True",
"def print_location(location):\n\n if \"on_print\" in location.keys():\n location[\"on_print\"](player, locations, nice_print, For... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A method to find all saved scores from the database. | def find_all(self):
cursor = self._connection.cursor()
cursor.execute('SELECT * FROM scores ORDER BY level')
all_scores = cursor.fetchall()
return all_scores | [
"def find_all_by_level(self, level):\n cursor = self._connection.cursor()\n command = 'SELECT * FROM scores WHERE level=? ORDER BY score'\n cursor.execute(command, [level])\n all_scores_by_level = cursor.fetchall()\n return all_scores_by_level",
"def save_scores(self):\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A method to find all saved scores on a specific level. | def find_all_by_level(self, level):
cursor = self._connection.cursor()
command = 'SELECT * FROM scores WHERE level=? ORDER BY score'
cursor.execute(command, [level])
all_scores_by_level = cursor.fetchall()
return all_scores_by_level | [
"def find_all(self):\n cursor = self._connection.cursor()\n cursor.execute('SELECT * FROM scores ORDER BY level')\n all_scores = cursor.fetchall()\n return all_scores",
"def find_all_by_player(self, player):\n cursor = self._connection.cursor()\n command = 'SELECT * FROM ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A method to find all scores by a specific player. | def find_all_by_player(self, player):
cursor = self._connection.cursor()
command = 'SELECT * FROM scores WHERE player=? ORDER BY level'
cursor.execute(command, [player])
return cursor.fetchall() | [
"def get_player_scores(self):\n scores = {player.get_name(): player.get_score() for player in self.players}\n return scores",
"def get_score(self, player):\n if player in self.player_scores:\n return self.player_scores[player]\n else:\n raise Exception(\"Player no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A method to add new scores to the database. A new score is added after every game played. | def add_score(self, player, level, score):
cursor = self._connection.cursor()
command = 'INSERT INTO scores (player, level, score) VALUES (?, ?, ?)'
cursor.execute(command, [player, level, score])
self._connection.commit() | [
"def add_score(self, data):\n # sql_score_add = \"\"\"update $s SET\n for team_id, score in data.items():\n if int(score) in range(0, 14):\n column = \"score_\" + (score)\n sql_cmd = (\"UPDATE %s SET %s=1 WHERE team_id=%s\" % (self.dbtable, column, team_id))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple helper function to get the page url/ | def get_url(self, page):
return self.server_url + page | [
"def get_url(self) -> str:\n\n return self.__page_url",
"def url_for(self, page):\n if not self.urlfunc:\n return '?page=%s' % page\n return self.urlfunc(page)",
"def get_page_url_by_id(self, pageid):\n return self.cursor.execute(\"SELECT url FROM content WHERE pageid=?\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get plant details for specified timespan. | def plant_detail(self, plant_id, timespan, date):
assert timespan in Timespan
if timespan == Timespan.day:
date_str = date.strftime('%Y-%m-%d')
elif timespan == Timespan.month:
date_str = date.strftime('%Y-%m')
response = self.session.get(self.get_url('PlantDetai... | [
"def get_plant_infos():\n env = get_lambda_event_and_context()\n body, status = plant_services.get_plant_infos(env[\"event\"], env[\"context\"])\n return make_response(body, status)",
"def get_hours_per_unit_snap(now):\n print(\"/\"*50)\n print(\"GET hours_per_unit SNAP\")\n print(\"/\"*50)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get inverter data for specified date or today. | def inverter_data(self, inverter_id, date):
if date is None:
date = datetime.date.today()
date_str = date.strftime('%Y-%m-%d')
response = self.session.get(self.get_url('newInverterAPI.do'), params={
'op': 'getInverterData',
'id': inverter_id,
'type... | [
"def historical(self, date, base='USD'):\n try:\n resp = self.client.get(self.ENDPOINT_HISTORICAL %\n date.strftime(\"%Y-%m-%d\"),\n params={'base': base})\n resp.raise_for_status()\n except requests.exceptions.R... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use device_list, it's more descriptive since the list contains more than inverters. | def inverter_list(self, plant_id):
warnings.warn("This function may be deprecated in the future because naming is not correct, use device_list instead", DeprecationWarning)
return self.device_list(plant_id) | [
"def update_device_list(self, device_list):\n self.device_list = device_list\n\n self.device_combo.clear()\n\n if not device_list:\n return\n\n self.device_combo.addItem(\"\")\n\n active_entry = None\n\n for dev in device_list:\n\n action_string = \"{m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get basic plant information with device list. | def plant_info(self, plant_id):
response = self.session.get(self.get_url('newTwoPlantAPI.do'), params={
'op': 'getAllDeviceList',
'plantId': plant_id,
'pageNum': 1,
'pageSize': 1
})
data = json.loads(response.content.decode('utf-8'))
retur... | [
"def list_devices():\r\n return sd.query_devices()",
"def get_devices():\n names = devices.list()\n if request.args.get('full') is not None:\n data = {d: devices.show(d) for d in names}\n else:\n data = names\n return jsonify({'devices': data})",
"def device_list():\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the device class of the sensor. | def device_class(self):
return SENSOR_TYPES[self.sensor][3].get("device_class") | [
"def device_class(self):\n return self.sensor_type[\"class\"]",
"def device_class(self):\n return self.sensor.get('class')",
"def device_class(self):\n return self._sensor_type",
"def device_class(self):\n return DEVICE_CLASSES.get(self.sensor_data[\"model\"])",
"def device_class... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |