query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
The common routine of prepare_awkward conversion, numpy evaluation, then numpy_to_awkward conversion. | def _call_awkward(self, *args, **kwargs):
ak_args, ak_kwargs = self.prepare_awkward(*args, **kwargs)
(np_args, np_kwargs), _ = self._ak_to_np_(*ak_args, **ak_kwargs)
np_rets = self._call_numpy(*np_args, **np_kwargs)
np_rets = self._np_to_ak_.convert(np_rets)
return self.postproce... | [
"def __call__(self, *args, **kwargs):\n array_lib = self.get_awkward_lib(*args, **kwargs)\n\n if array_lib is awkward:\n return self._call_awkward(*args, **kwargs)\n elif array_lib is dask_awkward:\n return self._call_dask(*args, **kwargs)\n else:\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper required for dask awkward calls. Here we create a new callable class (_callable_wrap) that packs the prepare_awkward/numpy_call/numpy_to_awkward call routines to be passable to the dask_awkward.map_partition method. In addition, because map_partition by default expects the callable's return to be singular awkwa... | def _call_dask(self, *args, **kwargs):
def pack_ret_array(ret):
"""
In case the return instance is not a singular array, we will need to
pack the results in a way that it "looks" like a single awkward
array up to dask.
"""
if isinstance(re... | [
"def __call__(self, *args, **kwargs):\n array_lib = self.get_awkward_lib(*args, **kwargs)\n\n if array_lib is awkward:\n return self._call_awkward(*args, **kwargs)\n elif array_lib is dask_awkward:\n return self._call_dask(*args, **kwargs)\n else:\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In case the return instance is not a singular array, we will need to pack the results in a way that it "looks" like a single awkward array up to dask. | def pack_ret_array(ret):
if isinstance(ret, awkward.Array):
return ret
elif isinstance(ret, Dict):
return awkward.zip(ret)
else:
# TODO: implement more potential containers?
raise ValueError(f"Do not know how to pack arr... | [
"def _call_dask(self, *args, **kwargs):\n\n def pack_ret_array(ret):\n \"\"\"\n In case the return instance is not a singular array, we will need to\n pack the results in a way that it \"looks\" like a single awkward\n array up to dask.\n \"\"\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converting args to a (args,kwargs) pair | def args_to_pair(self, *args) -> Tuple:
ret_args = tuple(x for x in args[0 : self.args_len])
ret_kwargs = {
k: v for k, v in zip(self.kwargs_keys, args[self.args_len :])
}
return ret_args, ret_kwargs | [
"def pair_to_args(self, *args, **kwargs) -> Tuple:\n return [*args, *kwargs.values()]",
"def getnamedargs(*args, **kwargs):\n adict = {}\n for arg in args:\n if isinstance(arg, dict):\n adict.update(arg)\n adict.update(kwargs)\n return adict",
"def get_parameters(arg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converting (args,kwargs) pair to argslike | def pair_to_args(self, *args, **kwargs) -> Tuple:
return [*args, *kwargs.values()] | [
"def python_to_args(**kwargs):\n kwarglist = []\n for k,v in kwargs.iteritems():\n if len(k) > 1:\n k = k.replace('_','-')\n if v is True:\n kwarglist.append(\"--%s\" % k)\n elif v is not None and type(v) is not bool:\n kwarglist.append(\"-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highest level abstraction to be directly called by the user. Checks whether the inputs has any awkward arrays or dask_awkward arrays, and call the corresponding function if they are found. If no dask awkward or awkward arrays are found, calling the underlying _call_numpy method. | def __call__(self, *args, **kwargs):
array_lib = self.get_awkward_lib(*args, **kwargs)
if array_lib is awkward:
return self._call_awkward(*args, **kwargs)
elif array_lib is dask_awkward:
return self._call_dask(*args, **kwargs)
else:
return self._call_... | [
"def _call_numpy(self, *args, **kwargs):\n self.validate_numpy_input(*args, **kwargs)\n return self.numpy_call(*args, **kwargs)",
"def _call_awkward(self, *args, **kwargs):\n ak_args, ak_kwargs = self.prepare_awkward(*args, **kwargs)\n (np_args, np_kwargs), _ = self._ak_to_np_(*ak_args... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load a Unixstyle dictionary (one word per line) into a dictionary. Words are dictionary keys. Values are all initialized to the default | def loadDict (fp, default = 0):
startTime = time.time()
dict = {}
for l in fp:
dict[l.strip()] = default
print >>logfp, "Loaded %d words in %.1f sec" % (len(dict), time.time() - startTime)
return dict | [
"def dict():\n f = open(\"/usr/share/dict/words\", \"r\")\n words = f.read().split()\n f.close()\n return words",
"def read_dict(filename,type_conv=None,**opt):\n\n # starting config\n opt.setdefault('purge',0)\n opt.setdefault('fs',None) # field sep defaults to any whitespace\n opt.setde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write dictionary in frequencysorted order | def writeSortedDict (fp, dict, scaleTo = None):
startTime = time.time()
freqSortedWords = sorted(dict, key=(lambda w: dict[w]), reverse=True)
maxFreq = dict[freqSortedWords[0]]
if scaleTo is None:
scaleTo = maxFreq
scaleFactor = float(scaleTo)/float(maxFreq)
for word in freqSorted... | [
"def save_rings_map(ring_dic,filename):\n\n ring_map = OrderedDict(sorted(ring_dic.iteritems(), key = lambda key_value : int(10*float(key_value[0]))))\n\n f = open(filename,'w')\n f.write('{0:>8}\\n'.format(len(ring_map)))\n ic = 1\n for key,val in ring_map.iteritems():\n f.write('{0}\\n'.form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse patientID from worker context | def parse_patientid(text_to_parse, context):
patientID = context['task_state']['current_patient']['account_num']
demo_object = {
'type': 'demographics',
'data': {
'prop': 'patientID',
'value': patientID
}
}
return [demo_object] | [
"def get_task_id(worker_response):\n return worker_response.get('task_data').get('ID')",
"def _extract_task_id(full_task_id):\n task_id = None\n task_search = re.search('^(\\d+)-([^\\d]+\\d+)$', full_task_id)\n if task_search:\n task_id = task_search.group(2)\n return tas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inits an instance of the instrument class and open communication using the address. | def __init__(self, address: str = ''):
rm = pyvisa.ResourceManager()
if not address:
c = get_config()
if 'address' in c:
address = c['address']
else:
raise ValueError('An instrument address must be supplied '
... | [
"def __init__(self, address=None):\n # open resource manager\n self.rm = visa.ResourceManager()\n\n if address:\n addresses = [address]\n else:\n addresses = self.rm.list_resources()\n\n print(\"Looking for Tektronix AWG7122B\")\n self.inst = None\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the start frequency (Hz). | def set_start_freq(self, x: Union[float, str]) -> None:
self.comm.write(f'FREQuency:STARt {x}') | [
"def setFrequency(self, frequency: int) -> None:\n self.frequency = frequency",
"def setStartSweep(self,start):\r\n self.isSIUnit(start)\r\n self.startFreqSweep = start",
"def set_frequency(self):\n if self.laser_status:\n self._fiber_shooting_logic.set_frequency(self._mw.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the start frequency (Hz). | def get_start_freq(self) -> float:
x = self.comm.query('FREQuency:STARt?')
# Converts the result to the expected type,
# if fails, returns the raw string.
try:
x = float(x)
except ValueError:
x = x.strip()
return x | [
"def get_freq(self):\n return float(self.ask('FREQ?'))",
"def _read_freq1(self, data: bytes, n: int) -> int:\n op2 = self.op2\n ntotal = 16 * self.factor\n nentries = (len(data) - n) // ntotal\n struc = Struct(mapfmt(op2._endian + b'iffi', self.size))\n for unused_i in ra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the stop frequency (Hz). | def set_stop_freq(self, x: Union[float, str]) -> None:
self.comm.write(f'FREQuency:STOP {x}') | [
"def setStopSweep(self,stop):\r\n self.isSIUnit(stop)\r\n self.stopFreqSweep = stop",
"def set_frequency(self):\n if self.laser_status:\n self._fiber_shooting_logic.set_frequency(self._mw.frequency_spinBox.value())\n else:\n pass\n return",
"def set_frequ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the stop frequency (Hz). | def get_stop_freq(self) -> float:
x = self.comm.query('FREQuency:STOP?')
# Converts the result to the expected type,
# if fails, returns the raw string.
try:
x = float(x)
except ValueError:
x = x.strip()
return x | [
"def get_freq(self):\n return float(self.ask('FREQ?'))",
"def frequency_to_wavelength(freq):\n return ifc.SPEED_OF_LIGHT_METRES_PER_SECOND / freq",
"def _get_frequency(self) -> float:\n return self._parent._lib.get_frequency(self._parent._device_handle, self._axis)",
"def get_stop_wavelength(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the span (Hz). | def set_span(self, x: Union[float, str]) -> None:
self.comm.write(f'FREQuency:SPAN {x}') | [
"def set_timespan(self, timespan):\n\n # NOTE: Scopes seem to always have a grid of 10x10 divisions,\n # so we just divide the timespan by t10 to obtain the\n # time/div.\n\n time_per_div = .1 * timespan\n self.port.write_string(\"TIME_DIV %.12fS\" % time_per_div)",
"def setWave... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the content of newc dictionary to the configuration file. | def set_config(newc: dict) -> None:
c = get_config()
c.update(newc)
# Configurations are stored in the package installation folder.
filename = os.path.join(os.path.dirname(__file__), 'config.json')
with open(filename, 'w') as fp:
json.dump(c, fp, indent=1) | [
"def add_configuration_options(self, new_options):\r\n for k, v in new_options.items():\r\n self.builder.config.values[k] = v",
"def _cat_config_file(self, commands):\n if not self._init_config:\n return\n\n config = (self._config if self._init_config is True else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns time object. Examples >>> import read_data >>> d = read_data.epoch_to_datetime(1379879533) >>> d.tm_year 2013 >>> d.tm_mon 9 >>> d.tm_mday 22 >>> d.tm_hour 19 >>> d.tm_min 52 >>> d.tm_sec 13 | def epoch_to_datetime(seconds):
return time.gmtime(seconds) | [
"def epoch_time_to_datetime(self, epoch):\n return datetime.fromtimestamp(epoch/1000)",
"def longunix_to_time(timestamp_ms):\r\n return datetime.fromtimestamp(timestamp_ms/1000)",
"def unixepoch_millisec_to_humantime(unixepoch):\n return datetime.datetime.fromtimestamp(unixepoch / 1000)",
"def ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an interpolated quaternion as a function of time | def quaternion(self, t):
return self._quaternion_t(t) | [
"def getFinalTime(self):\n return _almathinternal.ALInterpolationQuinticSpline_getFinalTime(self)",
"def quaternionFromTransform(pT):\n return _almathswig.quaternionFromTransform(pT)",
"def yaw_from_quaternion(q: Quaternion) -> float:\n\n (_, _, yaw) = euler_from_quaternion([q.x, q.y, q.z, q.w])\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Methode pour retrouver les adresse mails sur une page | def getMailAddress(self, addr=""):
lg.info("Debut du recherche adresse mail sur la page")
print("Recherche d'adresse mail")
soup = BeautifulSoup(self.res.text, 'html.parser')
#regex mail
regex1 = '[a-zA-Z0-9_.+-]+\[at\]+[a-zA-Z0-9-]+\[dot\][a-zA-Z0-9-.]+'
regex2 ... | [
"def list_mail_addresses(self):\n self.cursor.execute('SELECT * from email')\n result = self.cursor.fetchall()\n print \"Listing mail addresses...\"\n for address in result:\n print \"Address:\\t\" + address[0]",
"def get_mail_users(self):\n self.cursor.execute('SELEC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the README.md file to be pypi compatible. | def parse_readme(readme: str) -> str:
# Replace the footnotes.
readme = readme.replace('<!-- Footnote -->', '#')
footnote_re = re.compile(r'\[\^([0-9]+)\]')
readme = footnote_re.sub(r'<sup>[\1]</sup>', readme)
# Remove the dark mode switcher
mode_re = re.compile(
r'<picture>[\n ]*<sourc... | [
"def parse_markdown_readme():\n # Attempt to run pandoc on markdown file\n import subprocess\n try:\n subprocess.call(\n ['pandoc', '-t', 'rst', '-o', 'README.rst', 'README.md']\n )\n except OSError:\n return LONG_DESCRIPTION\n\n # Attempt to load output\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Feed hardware in separate thread. Wait for new_frame_event and send the last frame. If no event happened for 1s refresh the last frame. | def _feed_hardware(self):
while not self.machine.thread_stopper.is_set():
# wait for new frame or timeout
self.new_frame_event.wait(1)
# clear event
self.new_frame_event.clear()
# check if we need to send any control data
while self.contr... | [
"def _on_next_frame(self, event):\n success, frame = self._acquire_frame()\n if success:\n # process current frame\n frame = self.process_frame(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))\n\n # update buffer and paint (EVT_PAINT triggered by Refresh)\n self.bmp.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert the given Enity or Driver into this Entity. | def insert(self, thing):
d = self.ensure_driver(thing,
"Can only insert an Entity or a Driver. "
"Tried to insert %s." % str(type(thing)))
if d in self:
raise PoolException("%s is already in pool %s." % (d, self))
if d.... | [
"def insert(self, entity):\n if getattr(entity, \"_id\") is not None:\n raise ValueError(\"_id is not null\")\n entity.pre_persist()\n self.db[self.collect].insert_one(entity.to_dic())",
"def insert(self, new_entity, kind=False):\n # TODO: do you want to combine the insert a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is this pool the parent of the given entity | def is_parent(self, thing):
d = self.ensure_driver(thing,
"Can only be the parent of a Driver or Entity.")
return self in d.contents() | [
"def has_parent(self):\n return not self.parent == None",
"def is_parent(self, id_, parent_id):\n return # boolean",
"def is_parent(self, tag):\n # type: (Tag) -> bool\n # If I don't require a parent, any un-VOID tag can be my parent\n if not self.parent_required:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This test, given an image with a date in the format of a string, expects to receive a new date in the format of datetime object. | def test_get_date(self):
image_with_datetaken = {
'id': '39831840270', 'datetaken': '2018-04-22 16:41:11', 'ownername': 'Marian',
'originalformat': 'jpg', 'latitude': '0', 'longitude': '0', 'height_o': '800', 'width_o': '533',
'url': 'https://live.staticflickr.com/882/3983184... | [
"def test_import_parse_date(tmp_path: pathlib.Path):\n\n # set up test images\n os.environ[\"TZ\"] = \"US/Pacific\"\n cwd = os.getcwd()\n test_image_source = os.path.join(cwd, TEST_IMAGE_NO_EXIF)\n\n default_date = datetime(1999, 1, 1, 0, 0, 0)\n test_data = [\n [\"img_1234_2020_11_22_12_34... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes list of several lines from input file and counting number of the first line from this list. Selects first RNA structure from these lines. Returns named tuple of this RNA structure, its sequence and structure in dotbracket form and number of line, at which function stopped. | def get_structure_from_input(input_lines, number):
lines = iter(input_lines)
for line in lines:
name_of_seq = line[1:].strip()
line = next(lines)
number += 1
first_sym = line[0]
while first_sym.upper() < "A" or first_sym.upper() > "Z":
line = next(lines)
... | [
"def _parse_first_line(line, fname):\n from aiida.common.exceptions import ParsingError\n\n # first line should contain the atomic number as the first argument\n first_line = line.strip().split()\n if not len(first_line) == 2:\n raise ParsingError(\n \"The first line should contain onl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes input file, containing several mRNA_sructures with their names, nucleotide sequences and experimentally determined secondary structures in dotbracket form. | def create_mRNA_structure_collection(input_filename):
mrna_collection = {}
i = 0
with open(input_filename, "r") as input_file:
input_lines = input_file.readlines()
while i < len(input_lines):
try:
line = input_lines[i]
if not line.strip():
... | [
"def read_proteins(file):\n\n input = open(file)\n\n output = []\n\n #Dummy data. Allows the structure of the loop\n #to be somewhat simpler.\n sequence = []\n name = 'dummy'\n \n for line in input:\n \n if line[0] == '>':\n output.append([name, sequence])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates file that can be used as an input of RNA structures visualization | def create_forna_file(output_folder, origin, name, seq, structure):
if origin == "Real":
forna_file = '{}/{}_(Real).txt'.format(output_folder, name)
else:
forna_file = '{}/{}_({}_predicted).txt'.format(output_folder, name, origin)
with open(forna_file, 'w') as output:
if origin == "R... | [
"def make_director_file(self):\n y = 0.5 * self.inital_separation.value + 20\n\n self._check_gas()\n\n if self.use_gas is True:\n L = [\"size 1000 1000 \\n\",\n \"clip 0.001 500 \\n\",\n \"render tsc \\n\",\n \"target 0 0 0 \\n\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for create_asset_device_claim | def test_create_asset_device_claim(self):
pass | [
"def test_create_asset_managed_device(self):\n pass",
"def test_delete_asset_device_claim(self):\n pass",
"def test_update_asset_device_registration(self):\n pass",
"def test_patch_asset_device_registration(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for create_asset_managed_device | def test_create_asset_managed_device(self):
pass | [
"def test_create_asset_device_claim(self):\n pass",
"def test_update_asset_managed_device(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_delete_asset_managed_device(self):\n pass",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for delete_asset_device_claim | def test_delete_asset_device_claim(self):
pass | [
"def test_delete_asset_managed_device(self):\n pass",
"def test_delete_asset_device_registration(self):\n pass",
"def test_create_asset_device_claim(self):\n pass",
"def test_delete_entitlement_item(self):\n pass",
"def test_azure_service_api_volume_attachment_delete(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for delete_asset_device_registration | def test_delete_asset_device_registration(self):
pass | [
"def test_delete_asset_device_claim(self):\n pass",
"def test_delete_asset_managed_device(self):\n pass",
"def test_update_asset_device_registration(self):\n pass",
"def test_patch_asset_device_registration(self):\n pass",
"def test_delete_device_group(self):\n pass",
"a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for delete_asset_managed_device | def test_delete_asset_managed_device(self):
pass | [
"def test_delete_asset_device_claim(self):\n pass",
"def test_delete_asset_device_registration(self):\n pass",
"def test_create_asset_managed_device(self):\n pass",
"def test_update_asset_managed_device(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_cluster_member_by_moid | def test_get_asset_cluster_member_by_moid(self):
pass | [
"def test_get_asset_cluster_member_list(self):\n pass",
"def test_get_asset_device_contract_information_by_moid(self):\n pass",
"def test_get_compute_rack_unit_by_moid(self):\n pass",
"def test_coach_cluster():\n c = COACH(unweighted_filename)\n assert len(c.clusters)==0\n c.clus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_cluster_member_list | def test_get_asset_cluster_member_list(self):
pass | [
"def test_get_asset_cluster_member_by_moid(self):\n pass",
"def test_get_list_cluster_admins(self):\n pass",
"def test_api_v1_radar_container_clusters_get(self):\n pass",
"def _cluster_list():\n\n CLUSTER_TABLE = storage.get_cluster_table()\n clusters = []\n cluster_items = CLUST... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_configuration_by_moid | def test_get_asset_device_configuration_by_moid(self):
pass | [
"def test_get_asset_device_registration_by_moid(self):\n pass",
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_get_asset_device_contract_information_by_moid(self):\n pass",
"def test_get_asset_device_configuration_list(self):\n pass",
"def test_get_asset_dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_configuration_list | def test_get_asset_device_configuration_list(self):
pass | [
"def test_get_asset_managed_device_list(self):\n pass",
"def test_get_asset_device_registration_list(self):\n pass",
"def test_get_asset_device_contract_information_list(self):\n pass",
"def test_get_asset_device_configuration_by_moid(self):\n pass",
"def test_get_asset_device_co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_connector_manager_by_moid | def test_get_asset_device_connector_manager_by_moid(self):
pass | [
"def test_get_asset_device_connector_manager_list(self):\n pass",
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_get_asset_device_configuration_by_moid(self):\n pass",
"def test_get_asset_device_contract_information_by_moid(self):\n pass",
"def test_get_asse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_connector_manager_list | def test_get_asset_device_connector_manager_list(self):
pass | [
"def test_get_asset_device_connector_manager_by_moid(self):\n pass",
"def test_get_asset_managed_device_list(self):\n pass",
"def test_get_asset_device_configuration_list(self):\n pass",
"def test_get_asset_device_contract_information_list(self):\n pass",
"def test_get_asset_devi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_contract_information_by_moid | def test_get_asset_device_contract_information_by_moid(self):
pass | [
"def test_get_asset_device_configuration_by_moid(self):\n pass",
"def test_get_asset_device_contract_information_list(self):\n pass",
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_get_asset_device_registration_by_moid(self):\n pass",
"def test_get_compute_r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_contract_information_list | def test_get_asset_device_contract_information_list(self):
pass | [
"def test_get_asset_device_contract_information_by_moid(self):\n pass",
"def test_get_asset_device_configuration_list(self):\n pass",
"def test_get_asset_managed_device_list(self):\n pass",
"def test_update_asset_device_contract_information(self):\n pass",
"def test_get_asset_dev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_registration_by_moid | def test_get_asset_device_registration_by_moid(self):
pass | [
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_get_asset_device_configuration_by_moid(self):\n pass",
"def test_get_asset_device_registration_list(self):\n pass",
"def test_get_asset_device_contract_information_by_moid(self):\n pass",
"def test_update_asset_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_device_registration_list | def test_get_asset_device_registration_list(self):
pass | [
"def test_get_asset_device_configuration_list(self):\n pass",
"def test_get_asset_managed_device_list(self):\n pass",
"def test_get_asset_device_registration_by_moid(self):\n pass",
"def test_get_asset_device_contract_information_list(self):\n pass",
"def test_update_asset_device... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_managed_device_by_moid | def test_get_asset_managed_device_by_moid(self):
pass | [
"def test_get_asset_managed_device_list(self):\n pass",
"def test_create_asset_managed_device(self):\n pass",
"def test_get_asset_device_registration_by_moid(self):\n pass",
"def test_get_asset_device_connector_manager_by_moid(self):\n pass",
"def test_get_asset_device_configurat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for get_asset_managed_device_list | def test_get_asset_managed_device_list(self):
pass | [
"def test_get_asset_device_configuration_list(self):\n pass",
"def test_get_asset_managed_device_by_moid(self):\n pass",
"def test_get_asset_device_connector_manager_list(self):\n pass",
"def test_get_asset_device_registration_list(self):\n pass",
"def test_create_asset_managed_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for patch_asset_device_configuration | def test_patch_asset_device_configuration(self):
pass | [
"def test_update_asset_device_configuration(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
"def test_patch_asset_device_registration(self):\n pass",
"def test_patch_asset_device_contract_information(self):\n pass",
"def test_update_asset_device_registration(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for patch_asset_device_contract_information | def test_patch_asset_device_contract_information(self):
pass | [
"def test_update_asset_device_contract_information(self):\n pass",
"def test_patch_asset_device_configuration(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
"def test_patch_asset_device_registration(self):\n pass",
"def test_update_asset_device_configuration... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for patch_asset_device_registration | def test_patch_asset_device_registration(self):
pass | [
"def test_update_asset_device_registration(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
"def test_patch_asset_device_configuration(self):\n pass",
"def test_update_asset_device_configuration(self):\n pass",
"def test_patch_asset_device_contract_information... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for patch_asset_managed_device | def test_patch_asset_managed_device(self):
pass | [
"def test_update_asset_managed_device(self):\n pass",
"def test_create_asset_managed_device(self):\n pass",
"def test_patch_asset_device_configuration(self):\n pass",
"def test_patch_asset_device_registration(self):\n pass",
"def test_patch_asset_device_contract_information(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for update_asset_device_configuration | def test_update_asset_device_configuration(self):
pass | [
"def test_patch_asset_device_configuration(self):\n pass",
"def test_update_asset_managed_device(self):\n pass",
"def test_update_asset_device_registration(self):\n pass",
"def test_update_asset_device_contract_information(self):\n pass",
"def test_patch_asset_device_registration... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for update_asset_device_contract_information | def test_update_asset_device_contract_information(self):
pass | [
"def test_patch_asset_device_contract_information(self):\n pass",
"def test_update_asset_managed_device(self):\n pass",
"def test_update_asset_device_configuration(self):\n pass",
"def test_update_asset_device_registration(self):\n pass",
"def test_get_asset_device_contract_infor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for update_asset_device_registration | def test_update_asset_device_registration(self):
pass | [
"def test_patch_asset_device_registration(self):\n pass",
"def test_update_asset_managed_device(self):\n pass",
"def test_update_asset_device_configuration(self):\n pass",
"def test_patch_asset_managed_device(self):\n pass",
"def test_update_asset_device_contract_information(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for update_asset_managed_device | def test_update_asset_managed_device(self):
pass | [
"def test_patch_asset_managed_device(self):\n pass",
"def test_create_asset_managed_device(self):\n pass",
"def test_update_asset_device_configuration(self):\n pass",
"def test_update_asset_device_registration(self):\n pass",
"def test_update_asset_device_contract_information(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Substitutes each example into the request and sends it | def _send_each_example(self, request):
def _send_request(request_to_send):
self._log("Sending example request: \n"
f"{request_to_send.definition}", print_to_network_log=False)
seq = self._sequence + Sequence(request_to_send)
response, _ = self._render_an... | [
"def start_requests(self):\n with open('examples.csv', 'r') as file:\n fieldnames = []\n for i, l in enumerate(file):\n fieldnames.append(i)\n with open('examples.csv') as csv_file:\n reader = csv.DictReader(csv_file)\n urls = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new webhook. | def create(self, webhook):
raise NotImplementedError('create webhook is not implemented') | [
"def create_webhook(self, account_id, webhook):\n response = self.client.post(f'/{account_id}/webhooks', data=webhook.to_json())\n return Response(response, Webhook)",
"def webhook_create(self, full_name, hook_url, events=None):\n if events is None:\n events = self.WEBHOOKS\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new template. | def create(self, template):
raise NotImplementedError('Create Template not implemented') | [
"def add_template(self, template, label, units='counts'):\n\n if units == 'flux':\n assert (len(self.exposure_map) != 0), \\\n \"Must provide exposure map before adding a flux template\"\n assert (len(self.exposure_map) == len(template)), \\\n \"Template mu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new event. | def create(self, event):
raise NotImplementedError('create event is not implemented') | [
"def createEvent(self):\n\n raise NotImplementedError( \"Should have implemented this\" )",
"def create_event(self, *args, **kwargs):\n return asyncio.Event(*args, **kwargs)",
"def create_event(neo_event,segment):\n event = models.Event()\n if neo_event.name is not None:\n event.name ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update an existing event. | def update(self, event):
raise NotImplementedError('update event is not implemented') | [
"def update(self, event: MispEvent) -> None:\n event.timestamp = datetime.datetime.now()\n event.published=0\n raw_evt = event.to_xml()\n self.server.POST('/events/%d' % event.id, raw_evt)",
"def update_event(event_id):\n\n event = Event.query.get(event_id)\n\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new graph snapshot. | def create(self, graph_snapshot):
raise NotImplementedError('create graph snapshot not implemented') | [
"def create_snapshot(self, snapshot, share_server):",
"def snapshot_create():\n destroy()\n setup()\n create()",
"def create_snapshot(request, storage):\n self = request.node.cls\n\n self.snapshot_description = getattr(\n self, 'snapshot_description',\n storage_helpers.create_unique... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a graph snapshot. | def update(self, graph_snapshot):
raise NotImplementedError('update graph snapshot not implemented') | [
"def updateSceneGraph(self, *args):\r\n return _osgDB.DatabasePager_updateSceneGraph(self, *args)",
"def graph(self, new_graph):\n self._graph = new_graph",
"def __updateGraph(self, newURI):\n self.artistURI = newURI\n self.artistGraph.parse(newURI)",
"def snapshot_update(self, arc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete all graph snapshots taken until timestamp. | def delete(self):
raise NotImplementedError('delete graph snapshots not implemented') | [
"def delete_all_snapshots(self):\r\n for snap in self.list_snapshots():\r\n snap.delete()",
"def remove_all(self):\n for snapshot in self._get_snapshot_list():\n task_ = snapshot.RemoveSnapshot_Task()\n self._wait_for_task_to_complete(task=task_)",
"def cleanup_sna... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logs the message if the level is below the specified level | def log_if_level(level, message):
if logger.getEffectiveLevel() <= level:
logger.log(level, message) | [
"def log(self, msg=\"\", level=1):\n\n if self.log_level >= level:\n print(\"[%s] %s\" % (time.strftime(\"%I:%M.%S\"), msg))",
"def log(msg,level=1):\n _level = None\n try:\n _level = BuiltIn().get_variable_value('${DEBUG}')\n except:\n pass\n if _level is None: _level=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that highlights were applied correctly. This test can only be implemented once the neovim API provides a way to retrieve the currently | def test_highlights():
raise NotImplementedError() # TODO | [
"def whatsNewHighlight(highlightColor=float, highlightOn=bool, showStartupDialog=bool):\n pass",
"def _highlight_composition(self):\n\n self._line.setUpdatesEnabled(False)\n ################# UPDATES DISABLED #################\n\n # clear any existing text colors\n self._color_clear... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When CursorMoved is triggered before BufEnter, switch the buffer. | def test_cursormoved_before_bufenter(vim, tmp_path):
vim.command('edit %s' % (tmp_path / 'foo.py'))
vim.command('new %s' % (tmp_path / 'bar.py'))
vim.command('q')
assert vim.host_eval('plugin._cur_handler._buf_num') == 1 | [
"def accept_and_keep_cursor(event: KeyPressEvent):\n buffer = event.current_buffer\n old_position = buffer.cursor_position\n suggestion = buffer.suggestion\n if suggestion:\n buffer.insert_text(suggestion.text)\n buffer.cursor_position = old_position",
"def on_cursormoved(self, bufnum):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tests the help quit | def test_help_quit(self):
out = "exits when typing quit"
with patch("sys.stdout", new=StringIO()) as f:
self.assertFalse(HBNBCommand().onecmd("help quit"))
self.assertEqual(out, f.getvalue().strip()) | [
"def help_exit(self):\n print(help_msg.cmds['exit'])",
"def test_help() -> None:\n runner = click.testing.CliRunner()\n result = runner.invoke(sut.main, [\"--help\"])\n assert result.exit_code == 0 # nosec",
"def help_bye(self):\n bye.SppBye.help()",
"def _cmd_help_quit(self, ident, _f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test the create help | def test_help_create(self):
out = """Creates a new instance of BaseModel,
saves it (to the JSON file) and prints the id.
Ex: $ create BaseModel"""
with patch("sys.stdout", new=StringIO()) as f:
self.assertFalse(HBNBCommand().onecmd("help create"))
self.assertEqual... | [
"def help_create(self):\n\n self.__print(\n 'Usage: create CLASS',\n 'Creates a new instance of the given data model class.',\n sep='\\n'\n )",
"def test_build_creation(self):",
"def test_tool_types_create(self):\n pass",
"def test_create_escalation(self):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test only class show | def test_show_class_only(self):
out = "** instance id missing **"
with patch("sys.stdout", new=StringIO()) as f:
self.assertFalse(HBNBCommand().onecmd("show BaseModel"))
self.assertEqual(out, f.getvalue().strip()) | [
"def test_show_no_class(self):\n with patch('sys.stdout', new=StringIO()) as f:\n HBNBCommand().onecmd(\"show\")\n self.assertEqual(f.getvalue(), \"** class name missing **\\n\")",
"def test_show_wrong_class(self):\n with patch('sys.stdout', new=StringIO()) as f:\n HBNBC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Launch debugged program then check IKpdb break at debugger() statement | def test_02_py37debugger_statement(self):
time.sleep(0.5) # allows debugger to start
self.ikpdb.run_script()
i_msg = self.ikpdb.receive()
self.assertEqual(i_msg['command'],
"programBreak",
"Received: %s while expecting 'programBreak'"... | [
"def test_04_set_debugged_thread_ikpdb(self):\n time.sleep(0.5) # allows debugger to start\n self.ikpdb.set_breakpoint(DEBUGGED_PROGRAM, line_number=42)\n self.ikpdb.run_script()\n\n i_msg = self.ikpdb.receive()\n self.assertEqual(i_msg['command'],\n \"pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a view of tensor using the axis semantics defined by dst_axes. (If src_axes matches dst_axes, returns tensor itself) Useful for transferring tensors between different Conv3DSpaces. | def convert(tensor, src_axes, dst_axes):
src_axes = tuple(src_axes)
dst_axes = tuple(dst_axes)
assert len(src_axes) == 5
assert len(dst_axes) == 5
if src_axes == dst_axes:
return tensor
shuffle = [src_axes.index(elem) for elem in dst_axes]
if is_symbol... | [
"def convert(tensor, src_axes, dst_axes):\n src_axes = tuple(src_axes)\n dst_axes = tuple(dst_axes)\n assert len(src_axes) == 4\n assert len(dst_axes) == 4\n\n if src_axes == dst_axes:\n return tensor\n\n shuffle = [src_axes.index(elem) for elem in dst_axes]\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function segements and then finds the contours within an image. These contours are bounded by a rectangle, the largest of which is used for the Grab Cut algorithm in order to extract the foreground of the image. This extracted foreground can later be used to generate a binary mask when used in conjunction with con... | def extract_foreground(image):
img = image.copy()
#kernel for closing edges
kernel = np.ones((5,5))
#Perform color quantizization
quantized = quantize_color(img)
#Threshold the image to segment it. Best results for individual images are
#labeled as such below
#SWANS
#... | [
"def get_Contours(self, img,t1, t2, opp, opp2):\n _, thresh1 = cv2.threshold(img, 122, 51, cv2.THRESH_BINARY)\n contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)\n big_cnt = []\n for cnt in contours:\n area = cv2.contourArea(cnt)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to take an image and apply a painting filter. Applies a bilateral filter with a gaussian pyramid in order to better preserve edges. Utilizes OpenCV's pencilSketch function with a sigma s of 20, sigma r of 0.09 and shade factor of 0.01. The result of this function is then given a weight of 0.6 and added to a bl... | def painting(image, downsample, filter_steps):
img = image.copy()
#Gaussian pyramids with bilateral filter to preserve edges
for i in range(downsample):
img = cv2.pyrDown(img)
for i in range (filter_steps):
img = cv2.bilateralFilter(img, d=5, sigmaColor=5, sigmaSpace=3... | [
"def sketch(image, downsample, filter_steps):\n img = image.copy()\n \n #Gaussian pyramid with bilateral filter to preserve edges\n for i in range(downsample):\n img = cv2.pyrDown(img)\n \n for i in range (filter_steps):\n img = cv2.bilateralFilter(img, d=5, sigmaColor=5, sigmaSp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to take an image and apply a painting filter. Applies a bilateral filter with a gaussian pyramid in order to better preserve edges. Utilizes OpenCV's pencilSketch function with a sigma s of 75, sigma r of 0.09 and shade factor of 0.03. The result of this function is then given a weight of 0.6 and added to a bl... | def painting_gamma(image, downsample, filter_steps, gamma):
img = image.copy()
#Gaussian pyramids with bilateral filter to preserve edges
for i in range(downsample):
img = cv2.pyrDown(img)
for i in range (filter_steps):
img = cv2.bilateralFilter(img, d=5, sigmaColor=5,... | [
"def painting(image, downsample, filter_steps):\n \n img = image.copy()\n \n #Gaussian pyramids with bilateral filter to preserve edges\n for i in range(downsample):\n img = cv2.pyrDown(img)\n \n for i in range (filter_steps):\n img = cv2.bilateralFilter(img, d=5, sigmaColor=5... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to take an image and apply a line drawing filter. The contours in an input image are found and assigned a thickness of 2. An additional background texture image is read in and sized to match the input image. The contoured image is then blurred and added to the background texture image with weights of .35 and .... | def line_draw(image):
img = image.copy()
#read in background for paper appearance
paper = cv2.imread("ink-paper.jpg", cv2.IMREAD_COLOR)
paper = cv2.resize(paper, (img.shape[1], img.shape[0]))
img = cv2.medianBlur(img, 5)
edges = cv2.Canny(img, 100 , 125)
c_img, contours, hierarchy = ... | [
"def line_drawing(image, inverse_image=True):\n threshold = 7\n block_size = 4\n image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)\n\n # Changing last value higher makes lighter, but weird ,changing second to last value makes lines stronger\n if inverse_image:\n image = cv2.adaptiveThreshold(ima... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to take an image and apply a sketch filter. Applies a bilateral filter with a gaussian pyramid in order to better preserve edges. Utilizes OpenCV's pencilSketch function with a sigma s of 20, sigma r of 0.09 and shade factor of 0.01 on the filtered image. The filtered image is also used with a Canny edge detec... | def sketch(image, downsample, filter_steps):
img = image.copy()
#Gaussian pyramid with bilateral filter to preserve edges
for i in range(downsample):
img = cv2.pyrDown(img)
for i in range (filter_steps):
img = cv2.bilateralFilter(img, d=5, sigmaColor=5, sigmaSpace=3)
... | [
"def painting(image, downsample, filter_steps):\n \n img = image.copy()\n \n #Gaussian pyramids with bilateral filter to preserve edges\n for i in range(downsample):\n img = cv2.pyrDown(img)\n \n for i in range (filter_steps):\n img = cv2.bilateralFilter(img, d=5, sigmaColor=5... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the next matchable subgraph. | def __next__(self) -> NSSubgraph:
while len(self.stack) > 0:
cur_end_node = self.stack.pop()
if cur_end_node in self.seen_nodes:
continue
# for subgraphs which are single nodes, start_node == end_node
# for subgraphs with more than one node, start... | [
"def get_next_match():\n pass",
"def next(self):\n if self.is_complete():\n return None\n return self.tree.children[self.dot]",
"def get_next_match(self):\n if not self._not_played_matches:\n return\n\n p1, p2 = self._not_played_matches.pop(0)\n p1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds all of the nodes in this arg to the stack, properly navigating through list, dicts and tuples. | def _recursively_add_node_arg_to_stack(self, arg: Any) -> None:
if isinstance(arg, Node):
self.stack.append(arg)
elif isinstance(arg, torch.fx.immutable_collections.immutable_list) or type(arg) is tuple:
for inner_arg in arg:
self._recursively_add_node_arg_to_stac... | [
"def _recursively_add_node_arg_to_stack(self, arg: Any) -> None:\n if isinstance(arg, Node):\n self.stack.append(arg)\n elif isinstance(arg, torch.fx.immutable_collections.immutable_list) or type(arg) is tuple:\n for inner_arg in arg:\n self._recursively_add_node_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Matches matchable subgraphs of graph_a to graph_b. For a node, "matchable" is defined as a node which is not an observer, fake_quants, quant or dequant. A subgraph can contain one or more nodes. A subgraph is matchable if at least one node inside of it is matchable. Currently, all nodes in a subgraph must be matchable ... | def get_matching_subgraph_pairs(
gm_a: GraphModule,
gm_b: GraphModule,
base_name_to_sets_of_related_ops: Optional[Dict[str, Set[NSNodeTargetType]]] = None,
unmatchable_types_map: Optional[Dict[str, Set[NSNodeTargetType]]] = None,
) -> Dict[str, Tuple[NSSubgraph, NSSubgraph]]:
if unmatchable_types_ma... | [
"def get_matching_subgraph_pairs(\n gm_a: GraphModule,\n gm_b: GraphModule,\n) -> Dict[str, Tuple[NSSubgraph, NSSubgraph]]:\n non_matchable_functions = get_non_matchable_functions()\n non_matchable_modules = get_non_matchable_modules()\n graph_a_iterator = _NSGraphMatchableSubgraphsIterator(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load hour form raw string | def __loadhour(self):
return float(self.__infos[4]) | [
"def get_sample_1940_hh():\n hh_line = \"H19400200024278096700000001000009100000000001198632410100102100000009999000260300026007000840199990012200020999999901223233100110101000000001000900000000100090\"\n return hh_line",
"def setHourFormat(self, string: str) -> None:\n ...",
"def hour(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load score form raw string | def __loadscore(self):
if not self.__infos[5].isdigit():
#The score is showed in char
return self.handleCharScore(self.__infos[5])
return float(self.__infos[5]) | [
"def parse_score(s):\n num_removed = s.count('%') # replace actually illegal tokens\n s = s.replace('%', '')\n try:\n tokens, stats = ltl_parser.tokenize_formula(s, 'network', return_statistics=True)\n except ltl_parser.ParseError as e:\n return None, None, None\n vals = np.array(list(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
drops last row of df | def drop_bottom_row(df: pd.DataFrame) -> pd.DataFrame:
last_row = len(df) - 1
print(last_row)
return df.drop(df.index[last_row]) | [
"def pop(self):\n self.df = self.df[1:]",
"def __remove_last_index(df, drop=False, inplace=False):\n return df.reset_index(\n level=len(df.index.names)-1, \n drop=drop, \n inplace=inplace)",
"def delete_row(self, ind):\n self.df = pd.concat([self.df[:ind], self.df[ind+1:]])... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if given string date is in 'dashed' format ending in 17 or 18 | def dash_matcher(date: str) -> bool:
dash_date = r'(\d{2}|\d{4})-\d?\d-1(7|8)'
z = re.search(dash_date, date)
if z:
return True
return False | [
"def check_date_format(date_txt):\n\n len_dtxt = len(date_txt)\n\n if not(len_dtxt == 19 or len_dtxt == 16 or len_dtxt == 13 or len_dtxt == 10):\n date_format = False\n return date_format\n else:\n if len_dtxt == 19:\n date_format = '%Y-%m-%d_%H:%M:%S'\n return da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds flag columns to indicate format of date of date columns | def create_date_flags(col_names: list, df: pd.DataFrame) -> pd.DataFrame:
for col_name in col_names:
df[col_name + '_slash_flag'] = df[col_name].apply(slash_matcher)
df[col_name + '_dash_flag'] = df[col_name].apply(dash_matcher)
df[col_name + 'is_good_date'] = df[col_name + '_slash_flag'] | ... | [
"def date_features(cls, X):\r\n #X['Y'] = X['date'].dt.year\r\n X['Q'] = X['date'].dt.quarter\r\n X['M'] = X['date'].dt.month\r\n X['D'] = X['date'].dt.day\r\n X['MW'] = X['D'].div(8).apply(np.floor).add(1).astype(int)\r\n X['WD'] = X['date'].dt.weekday\r\n X['WE'] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of SAMLConfiguration class | def __init__(self, configuration_storage, db, metadata_parser):
super(SAMLConfiguration, self).__init__(configuration_storage, db)
self._metadata_parser = metadata_parser
self._identity_providers = None
self._service_provider = None | [
"def init_saml_auth(onelogin_request):\n saml_sp = OneLogin_Saml2_Auth(onelogin_request, custom_base_path=current_app.config['SAML_PATH'])\n return saml_sp",
"def init_saml_auth(onelogin_request):\n onelogin_auth = OneLogin_Saml2_Auth(onelogin_request, custom_base_path=current_app.config['SAML_PATH'])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of federated IdPs corresponding to the entity IDs selected by the admin. | def _get_federated_identity_providers(self, db):
if not self.federated_identity_provider_entity_ids:
return []
federated_identity_provider_entity_ids = json.loads(
self.federated_identity_provider_entity_ids
)
return (
db.query(SAMLFederatedIdentityP... | [
"def get_ids():",
"def get_ids(self):\n return self.multiengine.get_ids()",
"def extract_entity_ids(hass, service):\n entity_ids = []\n\n if service.data and ATTR_ENTITY_ID in service.data:\n group = get_component('group')\n\n # Entity ID attr can be a list or a string\n servic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a dictionary containing SP's and IdP's settings in the OneLogin's SAML Toolkit format | def get_settings(self, db, idp_entity_id):
onelogin_settings = {
self.DEBUG: self._configuration.service_provider_debug_mode,
self.STRICT: self._configuration.service_provider_strict_mode,
}
identity_provider_settings = self.get_identity_provider_settings(
db,... | [
"def prepare_saml_request(request):\n url_data = urlparse(request.url)\n return {\n 'https': 'on' if request.scheme == 'https' else 'off',\n 'http_host': request.host,\n 'server_port': url_data.port,\n 'script_name': request.path,\n 'get_data': request.args.copy(),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize an Influxdb database client | def influx_init(self, url, port, user, pwd, db):
try:
cli = DataFrameClient(url, port, user, pwd, db)
self.influx_cli = cli
except Exception as e:
self.err(e, self.influx_init,
"Can not initialize Influxdb database") | [
"def init_influx():\n # load environment variables from .env file\n load_dotenv()\n\n # InfluxDB settings\n DB_ADDRESS = os.environ.get('INFLUXDB_ADDRESS')\n DB_PORT = int(os.environ.get('INFLUXDB_PORT'))\n DB_USER = os.environ.get('INFLUXDB_USER')\n DB_PASSWORD = os.environ.get('INFLUXDB_PASSW... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs an Influx db query | def influx_query_(self, q):
if self.influx_cli is None:
self.err(
self.influx_query_,
"No database connected. Please initialize a connection")
return
try:
return self.influx_cli.query(q)
except Exception as e:
self.e... | [
"def sql_query(dbname, query):\n ...",
"def query(self, sql):",
"def _run_query (self, query):\n self._login()\n return self.api_obj.query(query)",
"def run_query(query):\n db_connection = connect_to_db()\n cursor = db_connection.cursor()\n cursor.execute(query)\n results = cursor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count the number of rows for a measurement | def influx_count_(self, measurement):
try:
q = "select count(*) from " + measurement
self.start("Querying: count ...")
datalen = self.influx_cli.query(q)
self.end("Finished querying")
numrows = int(datalen[measurement][datalen[measurement].keys()[0]])
... | [
"def count_samples(measurement_df):\n return measurement_df.count()",
"def test_num_rows(self):\n df_to_test = functions.invest_dataframe(FILE_NAME)\n rows_to_have = df_to_test.index.nunique()\n self.assertEqual(len(df_to_test), rows_to_have)",
"def NumRows(self):\n return _handle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Batch export data from an Influxdb measurement to csv | def influx_to_csv(self, measurement, batch_size=5000):
if self.autoprint is True:
print("Processing data from InfluxDb to csv")
try:
q = "select count(*) from " + measurement
numrows = self.influx_cli.query(q)[measurement].iloc[0, 0]
self.info("Processing"... | [
"def from_prom_to_csv(url, metrics_query, dataset_id=\"id\", directory=\"./prom-ts\",\n start_time=(dt.utcnow() - timedelta(minutes=10)),\n end_time=dt.utcnow(), resolution=\"1m\"):\n\n time_id_prefix = \"{}-{}\".format(start_time.timestamp(), end_time.timestamp())\n pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether creating a Patch instance works. | def test_create_empty_patch():
_p = Patch('some_patch_name') | [
"def should_skip_creation(self) -> bool:\n return bool(self.create_check())",
"def patchExists(patch):\n\tdb = getDb()\n\tPatch = Query()\n\trows = db.search((Patch.created == patch['created']) \n\t\t& (Patch.username == patch['username']))\n\n\t# if the patch was previously saved\n\tif len(rows) > 0:\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assumes n is to make a haar matrix for signal of size n returns matrix as in w = h x | def haarMatrix(n, level=-1):
if level == -1: level = log2(n)
#level = log2(n)
nc = 1/sqrt(2)
h = array([1])
lp = array([1, 1])
hp = array([1, -1])
for i in arange(level):
fir = kron(h, lp)
sec = kron(eye(h.shape[0]), hp)
h = nc * vstack((fir, sec))
return h | [
"def haar_measure(n):\n\tz = (randn(n,n)+ 1j*randn(n,n))/sqrt(2.0)\n\tq,r = linalg.qr(z)\n\td = diagonal(r)\n\tph = d/absolute(d)\n\tq = multiply(q,ph,q)\n\treturn Matrix(q)",
"def _sample_haar_mtx(size):\n # n by n random complex matrix\n x_mtx = np.random.randn(size,size) + (0+1j)*np.random.randn(size,siz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reshapes an array of pixel values to the values they take. ie, does requires dynamic scope for N > reshapeToPixels(waveletIndexToTime(0, h=h)) >> array([[0, 2], [1, 3]]) we're limited to the secondlowest wavelet term here; a bug I don't feel like fixing | def reshapeToPixels(pix):
a = diff(pix)
b = ones(len(pix)-1)
if len(pix) == N**2: return pix.reshape(N,N).T
elif sum(abs(a-b))==0:
# if pix contains something in the top row...
#i = arange(len(pix)/2, dtype=int)
#one = pix[2*i]
#two = pix[2*i+1]
#done = vstack((on... | [
"def reshape_microbatch(self, x: JaxArray) -> JaxArray:\n s = x.shape\n return x.reshape([s[0] // self.microbatch, self.microbatch, *s[1:]])",
"def flatten_pixel_frame(f):\n return f.reshape(f.size)",
"def reshape_day_hour(hourly_indexed_list, Days_all, Hours):\n return (np.reshape(hourly_in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes in interestedIn and samples at (just) enough locations for that | def sampleInDetail(interestedIn, sampleAt, h=None):
for i in interestedIn:
time = waveletIndexToTime(i, h=h)
time = reshapeToPixels(time)
halfwayH = time[0,:].size/2
halfwayV = time[:,0].size/2
sampleAt = hstack((sampleAt, \
time[0,0], time[0,halfway... | [
"def begin_read_samples(self):",
"def sample(self, size):",
"def _create_samples(self):\n sa_args = [merge_dicts([s,\n {\"quality_threshold\": self.args.filter_reads, \"workers\": self.args.job_count,\n \"ambig_model\": self.args.ambig_model}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add log parser to this reader. | def add_parsers(
self,
pattern: typing.Pattern,
parser: LivyLogParser,
) -> None:
if not isinstance(pattern, typing.Pattern):
raise livy.exception.TypeError("pattern", "regex pattern", pattern)
if not callable(parser):
raise livy.exception.TypeError("p... | [
"def add_logger(self, l):\n self.logger.children.append(l)",
"def parse_log(cls, log_file):\n if isinstance(log_file, basestring):\n infile = open(log_file, 'r')\n else:\n infile = log_file\n\n try:\n listener, timestamp = cls._read_header(infile)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
estimate the cost of setting up solar panels for given estimated output from floating solar photovoltaics. The unit of solar power output is in MW; unit of panel type is watts; mean sun light hours is the average annual sun light for the city of bangalore. cost of panel is in Rupee (lower_bound, upper_bound) aim 1. To ... | def cost_estimation(cost_panel=[29,32], solar_power_output= 459, panel_type=335, mean_sun_light_hour=8.825):
# solar power output in kwh
solar_power_output_kwh = solar_power_output*365*24*1000
# number of panels
no_of_panels= solar_power_output_kwh/(365*panel_type*mean_sun_light_hour)
# cost of settin... | [
"def calculate_wing_planform_surface(wing_panels):\n\n x, y = [wing_panels[:, :, :, i] for i in range(2)]\n\n # shoelace formula to calculate flat polygon area (XY projection)\n einsum_str = 'ijk,ijk->ij'\n d1 = np.einsum(einsum_str, x, np.roll(y, 1, axis=2))\n d2 = np.einsum(einsum_str, y, np.roll(x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert markdown ordered list | def ordered(markdown="", html=""):
if markdown == "" or html == "":
return
with open(markdown, 'r') as m, open(html, 'a') as h:
list_open = False
for line in m:
if not line.startswith('* '):
list_open = False
continue
if line.star... | [
"def parse_list(listmd: list, unordered: str = \"\") -> str:\n output = \"\"\n if unordered:\n # Argument must include one of the following characters: -,*,+\n for element in listmd:\n output += unordered + \" \" + str(element) + \"\\n\"\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lemmatize sequence of words with Spacy pipeline. | def old_spacy_lemmatize(
unlem: List[str],
verbose: bool = False,
spacy_version: str = spacy.__version__,
) -> List[str]:
if spacy_version != "2.1.8":
warnings.warn(f"Your results may depend on the version of spacy: {spacy_version}")
nlp = spacy.load("en", disable=["ner", "parser"])
le... | [
"def lemmatize_words(sentence):\n lemmatizer = WordNetLemmatizer()\n wordnet_map = {\"N\": wordnet.NOUN, \"V\": wordnet.VERB, \"J\": wordnet.ADJ, \"R\": wordnet.ADV}\n\n pos_tagged_text = nltk.pos_tag(sentence.split())\n\n return \" \".join(\n [\n lemmatizer.lemmatize(word, wordnet_map... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function just chooses right lemmatizer that is specified by name. | def lemmatize_words(
unlem: List[str],
lemmatizer_name: str,
pos_tag: Union[str, List[str]] = "n",
verbose: bool = False,
) -> List[str]:
if lemmatizer_name == "nltk":
lemmatized = nltk_lemmatize(unlem, pos_tag, verbose)
elif lemmatizer_name == "spacy":
lemmatized = spacy_lemmati... | [
"def lemmatize(word):\n global _lemmatizer\n if _lemmatizer is None:\n _lemmatizer = nltk.WordNetLemmatizer()\n return _lemmatizer.lemmatize(word)",
"def lemmatize_word(word):\n return lemmatizer.lemmatize(word,'v')",
"def lemmatize(word, pos='n'):\n if not pos.strip():\n return wor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wordform2lemma is a dict that maps word forms to its lemmas | def get_wordform2lemma(
vocabulary: List[str],
lemmatizer: str,
pos_tag: str = "n",
verbose: bool = False
) -> Dict[str, str]:
lemmatized = lemmatize_words(vocabulary, lemmatizer, pos_tag, verbose)
return dict(zip(vocabulary, lemmatized)) | [
"def lemma(word) -> 'lemma':\n lemmas = wn.lemmas(word['value'])\n return [{'value': f\"{l.synset().name()}.{l.name()}\"} for l in lemmas]",
"def generate_lemma_mapping(self):\n m = {'wf': {'type': 'text',\n 'fielddata': True,\n 'analyzer': 'wf_analyzer'},\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function for simulating from the zi(n, M, params) model, a graph with n vertices and M edges and edgeweight function wt. Paramaters | def zi_nm(n, M, wt=1, directed=False, loops=False, **kwargs):
if type(M) is not int:
raise TypeError("M is not of type int.")
if type(n) is not int:
raise TypeError("n is not of type int.")
if type(directed) is not bool:
raise TypeError("directed is not of type bool.")
if type(lo... | [
"def zeta_weights():\n zeta = np.array([-0.93246951, -0.66120939, -0.23861918,\n 0.23861918, 0.66120939, 0.93246951], dtype=np.float32)\n\n weigths = np.array([0.17132449, 0.36076157, 0.46791393,\n 0.46791393, 0.36076157, 0.17132449], dtype=np.float32)\n\n # Create vectors of size 1 x 36 for the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
plots the data points with + for the positive examples and o for the negative examples. X is assumed to be a Mx2 matrix. | def plotData(X, y):
plt.figure()
# Find Indices of Positive and Negative Examples
pos = np.where(y==1, True, False).flatten()
neg = np.where(y==0, True, False).flatten()
# Plot Examples
plt.plot(X[pos,0], X[pos, 1], 'k+', linewidth=1, markersize=7)
plt.plot(X[neg,0], X[neg, 1], 'ko', color='y', ma... | [
"def plot_data(X, y):\n\n pos = y == 1\n neg = y == 0\n plt.scatter( X[pos,0], X[pos,1], marker='+', c='b')\n plt.scatter( X[neg,0], X[neg,1], c='y')\n return plt",
"def plot_regression_data():\n # Create some data for the regression\n rng = np.random.RandomState(1)\n X = rng.randn(200, 2)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |