query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Generate a ``gnsstime`` object from a year, the day of year, and optionally second of day. | def fromdoy(cls, year, doy=1, sod=0):
# Find the day and month
month = 1
while month <= 12 and doy - calendar.monthrange(year, month)[1] > 0:
doy -= calendar.monthrange(year, month)[1]
month += 1
day = doy
# Find the hour, minute, second, microsecond (if ... | [
"def greenwich_sidereal_time(year,doy):\n year_from_1966 = year-1966\n dt = (year_from_1966*365 + int((year_from_1966 + 1)/4.) + int(doy)-1)/36525.\n dst = 0.278329562 + (8640184.67*dt+0.0929*dt**2)/86400\n gst0 = dst % 1 # GST on Jan. 0 of current year\n return 24*(gst0 + (doy % 1)/0.997269566) % 24",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a ``gnsstime`` object from a Julian Day. | def fromjd(cls, jd):
return gnsstime.frommjd(jd - JD) | [
"def _fromJulian(self, j):\n days = j - 40587 # From Jan 1 1900\n sec = days * 86400.0\n return time.gmtime(sec)",
"def JulianDay():",
"def get_JD(year, month, day, h, m, s):\n return get_JDN(year, month, day) + (float(h) - 12) / float(24) + float(m) / 1440 + float(s) / 86400",
"def fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a ``gnsstime`` object from a Julian Day at 1950. | def fromjd50(cls, jd50):
jd = jd50 + JD_1950
return gnsstime.fromjd(jd) | [
"def fromjd(cls, jd):\n return gnsstime.frommjd(jd - JD)",
"def _fromJulian(self, j):\n days = j - 40587 # From Jan 1 1900\n sec = days * 86400.0\n return time.gmtime(sec)",
"def greenwich_sidereal_time(year,doy):\n year_from_1966 = year-1966\n dt = (year_from_1966*365 + int((year_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a ``gnsstime`` object from a numpy datetime64. | def fromdatetime64(cls, datetime64):
return gnsstime.utcfromtimestamp(datetime64.astype('O') / 1e9) | [
"def datetime64_to_datetime(np_datetime64: datetime64) -> datetime.datetime:\n\n return datetime.datetime.utcfromtimestamp((np_datetime64 - datetime64(0, 's')) / timedelta64(1, 's'))",
"def get_obs_datetime_obj(cls):\n obs_time = []\n #SAMPLE: '2014-06-04T06:00:00.000000000'\n year = np.ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the trigger sound. A trigger sound is played when the status is 'listening' to indicate that the assistant is actively listening to the user. The trigger_sound_wave argument should be the path to a valid wave file. If it is None, the trigger sound is disabled. | def set_trigger_sound_wave(self, trigger_sound_wave):
if trigger_sound_wave and os.path.exists(os.path.expanduser(trigger_sound_wave)):
self.trigger_sound_wave = os.path.expanduser(trigger_sound_wave)
else:
if trigger_sound_wave:
logger.warning(
... | [
"def set_midi_sound(self, s):\n if midi.test_rtmidi():\n \n midi.set_midi_sound(s)\n midi.set_midi_callback(midi.simple_midi_callback)\n \n self.scheduler.unschedule(midi.midi_port_handler)\n self.scheduler.schedule_interval(midi.midi_port_han... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute lower left ``xy`` pixel position. This is used for the conversion to matplotlib in ``as_artist``. Taken from | def _lower_left_xy(self):
hw = self.width / 2.
hh = self.height / 2.
sint = np.sin(self.angle)
cost = np.cos(self.angle)
dx = (hh * sint) - (hw * cost)
dy = -(hh * cost) - (hw * sint)
x = self.center.x + dx
y = self.center.y + dy
return x, y | [
"def _coord(self,x):\n return self.inset + self.dotwidth/2 + self.fieldwidth*x",
"def get_left_top_of_field(self, fieldy, fieldx):\n left_top_Xcoord = (fieldx * self.field_size) + self.ymargin\n left_top_Ycoord = (fieldy * self.field_size) + self.xmargin\n return (left_top_Ycoord, left... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests to see that assembly_parameter set_value works properly | def test_assembly_parameter_set_value():
sim = M68K()
ap = AssemblyParameter(EAMode.IMM, 123)
mv = MemoryValue(OpSize.WORD)
mv.set_value_unsigned_int(1234)
# immediate set should throw assertion error
with pytest.raises(AssertionError):
ap.set_value(sim, mv)
# test data register... | [
"def setValue(self, parameterValue: cern.japc.value.ParameterValue) -> None:\n ...",
"def test_build_param_access(self):\n bps = self.BuildParams()\n assert bps.x is None\n assert getattr(bps, \"x\") is None\n assert not hasattr(bps, \"_BuildParam__x\")\n\n bps.x = 1\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves a dissimilarity or vector size measure from a string or a float. Passes through values that are already callable. Raises an exception for invalid values. Floats are resolved as Minkowski size with corresponding value for `p`. | def resolve_dissimilarity(dissimilarity, scale_by_dimensionality=False):
if callable(dissimilarity):
return dissimilarity
if isinstance(dissimilarity, str):
dissimilarity = dissimilarity.lower()
if dissimilarity in ['hamming', ]:
p = 0
unrooted = True
elif... | [
"def parse_size(size_as_string, dpi=72, sep=\"x,;\"):\n if size_as_string is None:\n size_as_string = \"\"\n\n if \"x\" in sep:\n # If we have a pixel measure somewhere, we have to be careful\n size_as_string = size_as_string.replace(\"px\", \"PX\")\n size_as_string = size_as_strin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
21. Test checks if default value of colorbar is assigned | def test_default_colorbar(self):
result = self.plotter_pca_LOGS.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True)
self.assertNotIsInstance(result.get_legend(), type(None))
self.assertEqual(len(result.figure.axes), 1)
pyplot.close() | [
"def test_default_colorbar(self):\n result = self.plotter_tailored_LOGS.umap(n_neighbors=15, random_state=None, min_dist=0.9, kind='scatter', size=20, remove_outliers=False, is_colored=True)\n self.assertNotIsInstance(result.get_legend(), type(None))\n self.assertEqual(len(result.figure.axes), ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
22. Test checks if colorbar is assigned when target type is R and therefore legend removed | def test_colorbar_R_remove_legend(self):
result = self.plotter_pca_LOGS.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)
self.assertIsInstance(result.get_legend(), type(None))
pyplot.close() | [
"def test_colorbar_C_keep_legend(self):\n result = self.plotter_pca_BBBP.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)\n self.assertNotIsInstance(result.get_legend(), type(None))\n pyplot.close()",
"def test_default_colorbar(self):\n res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
23. Test checks if colorbar is ignored when target type is C and therefore legend kept | def test_colorbar_C_keep_legend(self):
result = self.plotter_pca_BBBP.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)
self.assertNotIsInstance(result.get_legend(), type(None))
pyplot.close() | [
"def test_colorbar_C_ignore_colorbar(self):\n result = self.plotter_pca_BBBP.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)\n self.assertTrue(len(result.figure.axes)==1)\n pyplot.close()",
"def test_default_colorbar(self):\n result = self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
24. Test checks if colorbar is assigned when target type is R | def test_colorbar_R_add_colorbar(self):
result = self.plotter_pca_LOGS.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)
self.assertTrue(len(result.figure.axes)>=1)
pyplot.close() | [
"def is_colorbar(ax):\n return (ax.get_data_ratio() == 1.0 and not ax.get_navigate())",
"def test_colorbar_C_ignore_colorbar(self):\n result = self.plotter_tailored_BBBP.umap(n_neighbors=15, random_state=None, min_dist=0.9, kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
25. Test checks if colorbar is ignored when target type is C | def test_colorbar_C_ignore_colorbar(self):
result = self.plotter_pca_BBBP.visualize_plot(kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)
self.assertTrue(len(result.figure.axes)==1)
pyplot.close() | [
"def test_colorbar_C_ignore_colorbar(self):\n result = self.plotter_tailored_BBBP.umap(n_neighbors=15, random_state=None, min_dist=0.9, kind='scatter', size=20, remove_outliers=False, is_colored=True, colorbar=True)\n self.assertTrue(len(result.figure.axes)==1)\n pyplot.close()",
"def is_colo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
29. Test checks if the default value of filename is assigned with scatter | def test_default_filename_scatter(self):
try:
os.remove("scatter_test.png")
except FileNotFoundError:
pass
expected = len([name for name in os.listdir('.') if os.path.isfile(name)])
self.plotter_pca_BBBP.visualize_plot(kind='scatter')
result = len([name fo... | [
"def test_filename_scatter(self):\n try:\n os.remove(\"scatter_test.png\")\n except FileNotFoundError:\n pass\n expected = len([name for name in os.listdir('.') if os.path.isfile(name)])\n self.plotter_pca_BBBP.visualize_plot(kind='scatter', filename=\"scatter_test.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
30. Test checks if the value of filename is assigned with scatter | def test_filename_scatter(self):
try:
os.remove("scatter_test.png")
except FileNotFoundError:
pass
expected = len([name for name in os.listdir('.') if os.path.isfile(name)])
self.plotter_pca_BBBP.visualize_plot(kind='scatter', filename="scatter_test.png")
... | [
"def test_default_filename_scatter(self):\n try:\n os.remove(\"scatter_test.png\")\n except FileNotFoundError:\n pass\n expected = len([name for name in os.listdir('.') if os.path.isfile(name)])\n self.plotter_pca_BBBP.visualize_plot(kind='scatter')\n result ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
31. Test checks if the default value of filename is assigned with hex | def test_default_filename_hex(self):
try:
os.remove("hex_test.png")
except FileNotFoundError:
pass
expected = len([name for name in os.listdir('.') if os.path.isfile(name)])
self.plotter_pca_BBBP.visualize_plot(kind='hex')
result = len([name for name in os... | [
"def test_bytename_set_non_bytes():\n sfn = EightDotThree()\n for n in ['FILENAME.TXT', 1234, bytearray('FILENAME.TXT', 'ASCII')]:\n with pytest.raises(TypeError) as e:\n sfn.set_byte_name(n)\n assert e.errno == errno.EINVAL",
"def test__make_filename__index() -> None:\n int_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
32. Test checks if the value of filename is assigned with hex | def test_filename_hex(self):
try:
os.remove("hex_test.png")
except FileNotFoundError:
pass
expected = len([name for name in os.listdir('.') if os.path.isfile(name)])
self.plotter_pca_BBBP.visualize_plot(kind='hex', filename="hex_test.png")
result = len([na... | [
"def test_crc32(self):\n self.assertEqual(\"4B8E39EF\", self.file_path.crc32)",
"def test_adler32(self):\n self.assertEqual(\"081e0256\", self.file_path.adler32)",
"def test_unique_filename_format(self):\n # Confirm that the format of the filename is correct\n result = uniqify_filena... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Third test with the PyTorchClassifier. | def test_ptclassifier(self):
# Build PyTorchClassifier
ptc = get_classifier_pt()
# Get MNIST
(_, _), (x_test, _) = self.mnist
x_test = np.swapaxes(x_test, 1, 3).astype(np.float32)
# Attack
nf = NewtonFool(ptc, max_iter=5, batch_size=100)
x_test_adv = nf.... | [
"def test_5_pytorch_classifier(self):\n self.x_train_mnist = np.reshape(self.x_train_mnist, (self.x_train_mnist.shape[0], 1, 28, 28)).astype(np.float32)\n\n # Build PyTorchClassifier\n victim_ptc = get_image_classifier_pt()\n\n # Create the thieved classifier\n thieved_ptc = get_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds noise to the 'data_raw'. This could be useful for testing the sensitivity to noisy measurements. | def addNoiseData(self, noise_amp):
noise = np.random.normal(0, noise_amp, self.data_to_fit.shape)
self.data_to_fit = self.data_to_fit + noise | [
"def add_noise(self, noise):\n self.noise_level = noise\n self.K = self.K + (noise * np.identity(self.X.size))",
"def add_noise(SNR_db,audio):\r\n ex1 = puissance(audio)\r\n snr = 10**(SNR_db/10)\r\n ex2 = ex1/snr\r\n noise = np.random.normal(loc = 0, scale = ex2**(1/2), size = audio.sha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take an entry and format it for output | def format_entry(entry):
separator = '-' * 80
return """
{separator}
{entry}
{separator}""".format(separator=separator, entry=describe_entry(entry)) | [
"def save_entry(f, entry):\n f.write('entry(\\n')\n f.write(' index = {0:d},\\n'.format(entry.index))\n f.write(' label = \"{0}\",\\n'.format(entry.label))\n\n if isinstance(entry.item, Molecule):\n f.write(' molecule = \\n')\n f.write('\"\"\"\\n')\n f.write(entry.item.to_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returs a list of (id, num_of_entries) of the users whose entries in maillog surpase the threshold. | def detected_from_entries(self):
entrygroup = [list(e) for k, e in groupby(sorted(self.entries),
lambda x: x.id)]
result = [(x[0].id, len(x)) for x in entrygroup
if len(x) >= self.threshold]
return result | [
"def get_log_entries_by_user(session, user, limit=20):\n return AuditLog.get_entries(session, involve_user_id=user.id, limit=limit)",
"def get_num_emails(self, number=10, folder=\"inbox\"):\n try:\n emails = []\n count = 0\n for item in self._victim_account.inbox.all():\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return list of new entries read from logfile. | def _get_new_entries(self):
lines = self.logfile.read().splitlines()
new_entries = [self._entry_from_line(line)
for line in lines
if self._filter_line(line)]
return new_entries | [
"def update(self):\n p = Popen([\"journalctl\", \"-n\", \"1000\", \"-o\", \"json\"], stdout=PIPE)\n\n logs = []\n for i, line in enumerate(reversed(p.stdout.readlines())):\n obj = json.loads(line.decode(\"utf-8\").strip())\n if os.path.basename(obj.get(\"_EXE\", \"\")) != ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a logfile line in an entry. | def _entry_from_line(self, line):
raise NotImplemented() | [
"def parse_log_line(line: str) -> LogEntry:\n match = LOGPAT.match(line)\n if not match:\n # we could catch that error and skip the line\n raise ValueError(f'incorrect log format: {line}')\n\n entry = match.groups()\n parsed_time = parse(entry[3][:11] + ' ' + entry[3][12:])\n size = int... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purge entries older than the TTL | def _purge_old_entries(self, now=None):
if now is None:
now = time()
self.entries = [x for x in self.entries if x.expire > now] | [
"def purge(self):\n for key, (expiry, _) in list(self._items.items()):\n if expiry < time():\n self._log.debug('Purging expired item %s', key)\n self._items.pop(key, None)",
"def clean_expired(self):\n\t\tl_time = datetime.datetime.now() - datetime.timedelta(seconds... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a dict of counts for items in iterable. | def counter(iterable):
counts = defaultdict(int)
for item in iterable:
counts[item] += 1
return counts | [
"def count(iterable, x):\n contagem = {}\n for x in iterable:\n if x in iterable:\n contagem[x] = contagem.get(x, 0) + 1\n else:\n contagem[x] = 1\n\n return contagem",
"def count(list_counted: list[str]) -> dict[str, int]:\n counter: dict[str, int] = dict()\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes integer size_of_game returns filenamethe best available checkpoint for this size | def get_checkpoint_filename(size_of_game):
path = "neat-checkpoints"
filenames = os.listdir(path)
filenames = [name.split("-") for name in filenames]
check_size = lambda x: x[2] == str(size_of_game)
filenames = list(filter(check_size, filenames))
filenames = [int(name[3]) for name in filenames]
name = str... | [
"def get_latest_checkpoint(ckpt_dir):\n\n listfiles = os.listdir(ckpt_dir)\n\n if len(listfiles) == 0:\n return None\n else:\n file_split = listfiles[0].split('_')\n extension = file_split[-1].split('.')[-1]\n\n basename = ''\n for i in range(len(file_split) - 1):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`omnibus` context processor provides the correct api endpoint and an auth token, if possible (user needs to be logged in). | def omnibus(request):
auth_token = ''
if hasattr(request, 'user') and request.user.is_authenticated():
auth_token = '{0}:{1}'.format(
request.user.pk, UserAuthenticator.get_auth_token(request.user.pk))
return {
'OMNIBUS_ENDPOINT': u'{0}://{1}:{2}{3}'.format(
ENDPOINT... | [
"def user_endpoint(self):\n pass",
"def __init__(self, token_introspect_endpoint, client_authentication=None):\n super(IntrospectionClient, self).__init__(client_authentication)\n self._token_introspect_endpoint = token_introspect_endpoint",
"def run(self) -> AsyncContextManager[\"EndpointAPI\"]:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds new piece of PLAIN TEXT message str message bool newLine whether to prepend message with new line return MessageBuilder | def add_text(self, message, newLine=True):
if newLine and len(self.txt) > 0:
self.txt += "\r\n"
self.txt += message
return self | [
"def add_html(self, message, newLine=True):\n if newLine and len(self.html) > 0:\n self.html += \"<br />\"\n self.html += message\n return self",
"def create_plaintext_message(self, text):\n plain_text_maxcols = 72\n textout = cStringIO.StringIO()\n formtext = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds new piece of HTML message str message bool newLine whether to prepend message with new line return MessageBuilder | def add_html(self, message, newLine=True):
if newLine and len(self.html) > 0:
self.html += "<br />"
self.html += message
return self | [
"def add_text(self, message, newLine=True):\n if newLine and len(self.txt) > 0:\n self.txt += \"\\r\\n\"\n self.txt += message\n return self",
"def create_notification_line(msg):\n local_time = util.format_date(msg[\"time\"])\n message_line = click.style(\"{} : {} from {}\\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns message. Caches build message for further retrival. bool includeImage whether include image in response or not return str | def build(self, includeImage=False):
if self.response is None:
self.response = self._build(includeImage)
return self.response | [
"def create_message(self):\n request = self.create_request()\n headers = self.create_header_str()\n data = self.body\n return \"%s%s\\r\\n%s\" % (request, headers, data)",
"def build_warm_email_body(self):\n self.html_body = render_to_string('email/warm_temp_mail.html',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Figure out which reactions in our set have no proteins associated with them. | def reactions_with_no_proteins(reactions, verbose=False):
nopegs = set()
for r in reactions:
if reactions[r].number_of_enzymes() == 0:
nopegs.add(r)
if verbose:
sys.stderr.write("REACTIONS WITH NO PROTEINS: {} reactions have no pegs associated ".format(len(nopegs)) +
... | [
"def reactions_with_proteins(reactions, verbose=False):\n\n pegs = set()\n for r in reactions:\n if reactions[r].number_of_enzymes() != 0:\n pegs.add(r)\n\n if verbose:\n sys.stderr.write(\"REACTIONS WITH PROTEINS: {} reactions have pegs associated \".format(len(pegs)) +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Figure out which reactions in our set have proteins associated with them. | def reactions_with_proteins(reactions, verbose=False):
pegs = set()
for r in reactions:
if reactions[r].number_of_enzymes() != 0:
pegs.add(r)
if verbose:
sys.stderr.write("REACTIONS WITH PROTEINS: {} reactions have pegs associated ".format(len(pegs)) +
... | [
"def reactions_with_no_proteins(reactions, verbose=False):\n\n nopegs = set()\n for r in reactions:\n if reactions[r].number_of_enzymes() == 0:\n nopegs.add(r)\n\n if verbose:\n sys.stderr.write(\"REACTIONS WITH NO PROTEINS: {} reactions have no pegs associated \".format(len(nopegs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting org_id. | def org_id(self, value):
if isinstance(value, str):
self._org_id = value
else:
raise ValueError("org_id must be a string") | [
"def set_organization_id(self, organization_id):\n raise NotImplementedError",
"def external_org_id(self, external_org_id):\n\n self._external_org_id = external_org_id",
"def test_organization_id_put(self):\n pass",
"def org_name(self, value):\n if value != None:\n if not isinstan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting org_name. | def org_name(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("Org_name must be a string")
self._org_name = value | [
"def csr_org_name(self, csr_org_name):\n\n self._csr_org_name = csr_org_name",
"def org_id(self, value):\n if isinstance(value, str):\n self._org_id = value\n else:\n raise ValueError(\"org_id must be a string\")",
"def make_org_id(organisation_name: str) -> str:\n\n return organisatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting train_memory_quota. | def train_memory_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("train_memory_quota must be a string")
unit = value[-1:]
float_value = value[:-1]
if unit not in constant.CLOUDML_MEMORY_UNITS:
raise ValueError("train_memory_quota unit mus... | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def model_memory_quota(self, value):\n if value != None:\n if not isinstance(value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting train_cpu_quota. | def train_cpu_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("train_cpu_quota must be a string!")
if not value.replace(".", "", 1).isdigit():
raise ValueError("train_cpu_quota must be a number!")
self._train_cpu_quota = value | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def set_cpu_quota(self, new_cpu_quota):\n try:\n requests.post(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting train_gpu_quota. | def train_gpu_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("train_gpu_quota must be a postive integer!")
self._train_gpu_quota = value | [
"def model_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"model_gpu_quota must be a postive integer!\")\n self._model_gpu_quota = value",
"def dev_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting train_count_quota. | def train_count_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("train_count_quota must be a postive integer!")
self._train_count_quota = value | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def model_count_quota(self, value):\n if value != None:\n if not (isinstance(value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting model_memory_quota. | def model_memory_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("model_memory_quota must be a string")
unit = value[-1:]
float_value = value[:-1]
if unit not in constant.CLOUDML_MEMORY_UNITS:
raise ValueError("model_memory_quota unit mus... | [
"def set_memlimit(self, value):\n value = value * 1024 * 1024\n self.set_int(\"memory.limit_in_bytes\", value)",
"def train_memory_quota(self, value):\n if value != None:\n if not isinstance(value, str):\n raise ValueError(\"train_memory_quota must be a string\")\n unit = value[-1:]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting model_cpu_quota. | def model_cpu_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("model_cpu_quota must be a string!")
if not value.replace(".", "", 1).isdigit():
raise ValueError("model_cpu_quota must be a number!")
self._model_cpu_quota = value | [
"def train_cpu_quota(self, value):\n if value != None:\n if not isinstance(value, str):\n raise ValueError(\"train_cpu_quota must be a string!\")\n if not value.replace(\".\", \"\", 1).isdigit():\n raise ValueError(\"train_cpu_quota must be a number!\")\n self._train_cpu_quota = value"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting model_gpu_quota. | def model_gpu_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("model_gpu_quota must be a postive integer!")
self._model_gpu_quota = value | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def dev_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting model_count_quota. | def model_count_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("model_count_quota must be a postive integer!")
self._model_count_quota = value | [
"def train_count_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_count_quota must be a postive integer!\")\n self._train_count_quota = value",
"def dev_count_quota(self, value):\n if value != None:\n if not (isinstance(v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting dev_memory_quota. | def dev_memory_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("dev_memory_quota must be a string")
unit = value[-1:]
float_value = value[:-1]
if unit not in constant.CLOUDML_MEMORY_UNITS:
raise ValueError("dev_memory_quota unit must be o... | [
"def set_memlimit(self, value):\n value = value * 1024 * 1024\n self.set_int(\"memory.limit_in_bytes\", value)",
"def model_memory_quota(self, value):\n if value != None:\n if not isinstance(value, str):\n raise ValueError(\"model_memory_quota must be a string\")\n unit = value[-1:]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting dev_cpu_quota. | def dev_cpu_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("dev_cpu_quota must be a string!")
if not value.replace(".", "", 1).isdigit():
raise ValueError("dev_cpu_quota must be a number!")
self._dev_cpu_quota = value | [
"def set_cpu_quota(self, new_cpu_quota):\n try:\n requests.post(\n 'http://%s:5000' %\n (self.actuator.api_address),\n data='{\\\"cpu_quota\\\":\\\"' +\n str(new_cpu_quota) +\n '\\\"}')\n except Exception as ex:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting dev_gpu_quota. | def dev_gpu_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("dev_gpu_quota must be a postive integer!")
self._dev_gpu_quota = value | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def model_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting dev_count_quota. | def dev_count_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("dev_count_quota must be a postive integer!")
self._dev_count_quota = value | [
"def model_count_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"model_count_quota must be a postive integer!\")\n self._model_count_quota = value",
"def _request_quota(self) -> int:",
"def set_quota_value(self, quota):\n\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting total_memory_quota. | def total_memory_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("total_memory_quota must be a string")
unit = value[-1:]
float_value = value[:-1]
if unit not in constant.CLOUDML_MEMORY_UNITS:
raise ValueError("total_memory_quota unit mus... | [
"def dev_memory_quota(self, value):\n if value != None:\n if not isinstance(value, str):\n raise ValueError(\"dev_memory_quota must be a string\")\n unit = value[-1:]\n float_value = value[:-1]\n if unit not in constant.CLOUDML_MEMORY_UNITS:\n raise ValueError(\"dev_memory_quota... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting total_cpu_quota. | def total_cpu_quota(self, value):
if value != None:
if not isinstance(value, str):
raise ValueError("total_cpu_quota must be a string!")
if not value.replace(".", "", 1).isdigit():
raise ValueError("total_cpu_quota must be a number!")
self._total_cpu_quota = value | [
"def set_cpu_quota(self, new_cpu_quota):\n try:\n requests.post(\n 'http://%s:5000' %\n (self.actuator.api_address),\n data='{\\\"cpu_quota\\\":\\\"' +\n str(new_cpu_quota) +\n '\\\"}')\n except Exception as ex:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting total_gpu_quota. | def total_gpu_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("total_gpu_quota must be a postive integer!")
self._total_gpu_quota = value | [
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"train_gpu_quota must be a postive integer!\")\n self._train_gpu_quota = value",
"def dev_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for setting tensorboard_quota. | def tensorboard_quota(self, value):
if value != None:
if not (isinstance(value, int) and value > 0):
raise ValueError("tensorboard_quota must be a postive integer!")
self._tensorboard_quota = value | [
"def model_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, int) and value > 0):\n raise ValueError(\"model_gpu_quota must be a postive integer!\")\n self._model_gpu_quota = value",
"def train_gpu_quota(self, value):\n if value != None:\n if not (isinstance(value, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SF reference circuit for gate tests | def SF_gate_reference(sf_op, cutoff_dim, wires, *args):
eng = sf.Engine("fock", backend_options={"cutoff_dim": cutoff_dim})
prog = sf.Program(2)
with prog.context as q:
sf.ops.S2gate(0.1) | q
sf_op(*args) | [q[i] for i in wires]
state = eng.run(prog).state
return state.mean_photon(0... | [
"def test_gate_multimode(self):\n xir_prog = xir.Program()\n xir_prog.add_statement(xir.Statement(\"BSgate\", {\"theta\": 0.54, \"phi\": np.pi}, (0, 2)))\n\n sf_prog = io.to_program(xir_prog)\n\n assert len(sf_prog) == 1\n assert sf_prog.circuit\n assert sf_prog.circuit[0].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SF reference circuit for expectation tests | def SF_expectation_reference(sf_expectation, cutoff_dim, wires, *args):
eng = sf.Engine("fock", backend_options={"cutoff_dim": cutoff_dim})
prog = sf.Program(2)
with prog.context as q:
sf.ops.Dgate(0.1) | q[0]
sf.ops.S2gate(0.1) | q
state = eng.run(prog).state
return sf_expectation(... | [
"def test_fock_state(self, tol):\n arg = 1\n wires = [0]\n\n gate_name = \"FockState\"\n operation = qml.FockState\n\n cutoff_dim = 10\n dev = qml.device(\"strawberryfields.fock\", wires=2, cutoff_dim=cutoff_dim)\n\n sf_operation = dev._operation_map[gate_name]\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the fock plugin requires correct arguments | def test_fock_args(self):
with pytest.raises(TypeError, match="missing 1 required positional argument: 'wires'"):
dev = qml.device("strawberryfields.fock")
with pytest.raises(
TypeError, match="missing 1 required keyword-only argument: 'cutoff_dim'"
):
dev = ... | [
"def test_Tucker_args():\n testing_function_with_args('tucker')",
"def test_function_args(self):\n reporter = SimpleReporter(\n pkgs=[PackageAPI(BASE_PACKAGE), PackageAPI(PACKAGE_WITH_DIFFERENT_ARGS)],\n errors_allowed=100,\n )\n reporter._check_function_args()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the fock plugin provides correct result for simple circuit | def test_fock_circuit(self, tol):
dev = qml.device("strawberryfields.fock", wires=1, cutoff_dim=10)
@qml.qnode(dev)
def circuit(x):
qml.Displacement(x, 0, wires=0)
return qml.expval(qml.NumberOperator(0))
assert np.allclose(circuit(1), 1, atol=tol, rtol=0) | [
"def test_fock_state(self):\n self.logTestName()\n\n a = 0.54321\n r = 0.123\n\n hbar = 2\n dev = qml.device('strawberryfields.gaussian', wires=2, hbar=hbar)\n\n # test correct number state expectation |<n|a>|^2\n @qml.qnode(dev)\n def circuit(x):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the GaussianState gate works correctly | def test_gaussian_state(self, tol):
V = np.array([[0.5, 0], [0, 2]])
r = np.array([0, 0])
wires = [0]
gate_name = "GaussianState"
operation = qml.GaussianState
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
sf... | [
"def test_gaussian(self):\n self.logTestName()\n res = self.H.is_gaussian()\n self.assertTrue(res)",
"def test_gaussian(self):\n self.logTestName()\n res = self.H.is_gaussian()\n self.assertFalse(res)",
"def test_gaussian_circuit(self):\n self.logTestName()\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the Interferometer gate works correctly | def test_interferometer(self, tol):
U = np.array(
[
[0.83645892 - 0.40533293j, -0.20215326 + 0.30850569j],
[-0.23889780 - 0.28101519j, -0.88031770 - 0.29832709j],
]
)
wires = [0, 1]
gate_name = "Interferometer"
operation =... | [
"def test_imu_sensor(self):\n # Create an engine: no controller and no internal dynamics\n engine = jiminy.Engine()\n setup_controller_and_engine(engine, self.robot)\n\n # Run simulation and extract log data\n x0 = np.array([0.1, 0.1])\n tf = 2.0\n time, gyro_jiminy,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the DisplacedSqueezedState gate works correctly | def test_displaced_squeezed_state(self, tol):
a = 0.312
b = 0.123
c = 0.532
d = 0.124
wires = [0]
gate_name = "DisplacedSqueezedState"
operation = qml.DisplacedSqueezedState
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cuto... | [
"def test_correct_state(self, rep, tol):\n\n dev = qml.device(\"default.tensor.tf\", wires=2, representation=rep)\n\n state = dev._state()\n\n expected = np.array([[1, 0], [0, 0]])\n assert np.allclose(state, expected, atol=tol, rtol=0)\n\n @qml.qnode(dev)\n def circuit():\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the FockState gate works correctly | def test_fock_state(self, tol):
arg = 1
wires = [0]
gate_name = "FockState"
operation = qml.FockState
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
sf_operation = dev._operation_map[gate_name]
assert dev.supp... | [
"def test_fock_state(self):\n self.logTestName()\n\n a = 0.54321\n r = 0.123\n\n hbar = 2\n dev = qml.device('strawberryfields.gaussian', wires=2, hbar=hbar)\n\n # test correct number state expectation |<n|a>|^2\n @qml.qnode(dev)\n def circuit(x):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the FockStateVector gate works correctly | def test_fock_state_vector(self, tol):
args = psi
wires = [0]
gate_name = "FockStateVector"
operation = qml.FockStateVector
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
sf_operation = dev._operation_map[gate_name]
... | [
"def test_qubit_state_vector(self, init_state, tol, rep):\n dev = DefaultTensorTF(wires=1, representation=rep)\n state = init_state(1)\n\n dev.execute([qml.QubitStateVector(state, wires=[0])], [], {})\n\n res = dev._state().numpy().flatten()\n expected = state\n assert np.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the FockDensityMatrix gate works correctly | def test_fock_density_matrix(self, tol):
dm = np.outer(psi, psi.conj())
wires = [0]
gate_name = "FockDensityMatrix"
operation = qml.FockDensityMatrix
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
sf_operation = dev._... | [
"def test_pragma_get_densitymatrix_pyquest() -> None:\n op = ops.PragmaGetDensityMatrix\n test_dict: Dict[str, List[complex]] = {'ro': [0, 0, 0, 0]}\n operation = op(readout='ro',\n circuit=Circuit()\n )\n env = utils.createQuestEnv()()\n qubits = utils.createQureg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the CatState gate works correctly | def test_cat_state(self, tol):
a = 0.312
b = 0.123
c = 0.532
wires = [0]
gate_name = "CatState"
operation = qml.CatState
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
sf_operation = dev._operation_map[... | [
"def test_new_state(self):\n self.new_helper(\"State\")",
"def test_covid_data_is_for_correct_state(self):\n self.assertEqual(self.state,\n self.data_processor.agg_data_frame['State'].\n values.all())",
"def test_CatFedAfterEating(self):\r\n n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the expectation value of the NumberOperator observable yields the correct result | def test_number_operator(self, tol):
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
gate_name = "NumberOperator"
assert dev.supports_observable(gate_name)
op = qml.NumberOperator
sf_expectation = dev._observable_map[gate_name]... | [
"def test_tensor_number_operator(self, tol):\n cutoff_dim = 10\n\n dev = qml.device(\"strawberryfields.fock\", wires=2, cutoff_dim=cutoff_dim)\n\n gate_name = \"TensorN\"\n assert dev.supports_observable(gate_name)\n\n op = qml.TensorN\n sf_expectation = dev._observable_map... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the expectation value of the TensorN observable yields the correct result | def test_tensor_number_operator(self, tol):
cutoff_dim = 10
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
gate_name = "TensorN"
assert dev.supports_observable(gate_name)
op = qml.TensorN
sf_expectation = dev._observable_map[gate_name]
... | [
"async def test_multiple_numeric_observations(hass: HomeAssistant) -> None:\n\n config = {\n \"binary_sensor\": {\n \"platform\": \"bayesian\",\n \"name\": \"Test_Binary\",\n \"observations\": [\n {\n \"platform\": \"numeric_state\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that the expectation for the generalized quadrature observable yields the correct result | def test_quad_operator(self, tol):
cutoff_dim = 10
a = 0.312
dev = qml.device("strawberryfields.fock", wires=2, cutoff_dim=cutoff_dim)
op = qml.QuadOperator
gate_name = "QuadOperator"
assert dev.supports_observable(gate_name)
sf_expectation = dev._observable_ma... | [
"def _quadrature_expectation(p, obj1, feature1, obj2, feature2, num_gauss_hermite_points):\n num_gauss_hermite_points = 40 if num_gauss_hermite_points is None else num_gauss_hermite_points\n\n if obj2 is None:\n eval_func = lambda x: get_eval_func(obj1, feature1)(x)\n mu, cov = p.mu[:-1], p.cov[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that PolyXP works as expected | def test_polyxp(self, tol):
cutoff_dim = 12
a = 0.14321
nbar = 0.2234
hbar = 2
dev = qml.device("strawberryfields.fock", wires=1, hbar=hbar, cutoff_dim=cutoff_dim)
Q = np.array([0, 1, 0]) # x expectation
@qml.qnode(dev)
def circuit(x):
qml.D... | [
"def test_polyxp(self):\n self.logTestName()\n\n a = 0.54321\n nbar = 0.5234\n\n hbar = 2\n dev = qml.device('strawberryfields.gaussian', wires=1, hbar=hbar)\n Q = np.array([0, 1, 0]) # x expectation\n\n @qml.qnode(dev)\n def circuit(x):\n qml.Displ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that FockStateProjector works as expected | def test_fock_state_projector(self, tol):
cutoff_dim = 12
a = 0.54321
r = 0.123
hbar = 2
dev = qml.device("strawberryfields.fock", wires=2, hbar=hbar, cutoff_dim=cutoff_dim)
# test correct number state expectation |<n|a>|^2
@qml.qnode(dev)
def circuit(x)... | [
"def test_fock_state(self):\n self.logTestName()\n\n a = 0.54321\n r = 0.123\n\n hbar = 2\n dev = qml.device('strawberryfields.gaussian', wires=2, hbar=hbar)\n\n # test correct number state expectation |<n|a>|^2\n @qml.qnode(dev)\n def circuit(x):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that variance for PolyXP measurement works | def test_polyxp_variance(self, tol):
dev = qml.device("strawberryfields.fock", wires=1, cutoff_dim=15)
@qml.qnode(dev)
def circuit(r, phi):
qml.Squeezing(r, 0, wires=0)
qml.Rotation(phi, wires=0)
return qml.var(qml.PolyXP(np.array([0, 1, 0]), wires=0))
... | [
"def test_polyuq_prescribed(self):\n # Generate data\n dim = 1\n n = 5\n N = 100\n our_function = lambda x: 0.3*x**4 -1.6*x**3 +0.6*x**2 +2.4*x - 0.5\n X = np.linspace(-1,1,N)\n y = our_function(X)\n\n # Array of prescribed variances at each training data poi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for api_v1_authenticate_identity_redirect_url_get | def test_api_v1_authenticate_identity_redirect_url_get(self):
pass | [
"def test_login_url(self):\n request = self.create_request()\n response = self.middleware.process_request(request)\n self.assert_redirect_url(response, '/login/?next=url/')",
"def get_authorization_url(self, callback_url, **kwargs):",
"def get_authorization_url(self):\n (status, token, e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for api_v1_authenticate_post | def test_api_v1_authenticate_post(self):
pass | [
"def test_authentication_challenge_authenticate_post(self):\n pass",
"def test_authentication_challenge_get_post(self):\n pass",
"def test_post_authentication_duo_verify_success_with_passcode(self):\n\n url = reverse('authentication_duo_verify')\n\n data = {\n 'token': sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for api_v1_authenticate_renew_get | def test_api_v1_authenticate_renew_get(self):
pass | [
"def renew(self):\n \n self.check_auth()\n response = self.oauth.get(self.renew_token_url)\n response.raise_for_status()\n return True",
"def _renew_token(self):\n self.token = self._api_auth()",
"def test_token_refresh_retry(self, requests_mock):\n first_request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract trending topics from Twitter response. | def extract_twitter_trends(resp):
trend_list = [trend['name'] for trend in resp[0]['trends']]
return trend_list | [
"def trendingTweets():\n api = twitter.Api(consumer_key=key,consumer_secret=secret,access_token_key=access_key,access_token_secret=access_secret)\n trending_topics = api.GetTrendsWoeid(BOSTON_WOEID)\n for tweet in trending_topics:\n util.safe_print(tweet.GetText())",
"def trendingTopics():\n ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates the next logical pk based on the current contents of the DataSet | def next_pk(self):
pk = 0
while True:
while pk in [obj.pk for obj in self.dset]:
pk += 1
yield pk | [
"def next_primary_key(cls):\n tb_name = cls._meta.db_table\n cls_db = cls._meta.database\n cursor = cls_db.execute_sql(\"SELECT `AUTO_INCREMENT` AS `next` \"\n \"FROM information_schema.`TABLES` \"\n \"WHERE TABLE_SCHEMA = %... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new DataObj to a DataSet. To use, pass each attribute and its desired value as kwargs | def create(self, pk=None, **kwargs):
pk = pk or next(self.pk_gen)
obj = self.cls(**kwargs)
dobj = self.DataObj(obj, pk)
self.dset.add(dobj) | [
"def add(self, **kwargs: dict):\n\n # all keys are mandatory for references\n reference_keys = set(['from_object_uuid', 'from_object_class_name', 'from_property_name',\\\n 'to_object_uuid'])\n\n if kwargs.keys() == reference_keys: \n with self._commit_lock:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the median of two sorted arrays a and b. | def findMedianSortedArrays(self, a, b):
n = len(a) + len(b)
if n % 2 == 0:
# If the total length is even, take the average of the two medians.
return (self._findKth(a, 0, b, 0, n // 2) +
self._findKth(a, 0, b, 0, n // 2 + 1)) / 2.0
else:
re... | [
"def findMedianSortedArrays(self, nums1, nums2):\n pass",
"def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n n1 = len(nums1)\n n2 = len(nums2)\n if n1 > n2: #this is required because partition is one extra index and if we are running bsearch on larger ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads a JSON file and returns a Dict representing the file | def read_json_file(file_path: str) -> Dict:
with open(file_path, 'r') as file:
data = file.read()
return json.loads(data) | [
"def get_json_dict(json_file_name: str) -> dict:\n with open(json_file_name, 'r') as JSON:\n return json.load(JSON)",
"def read_json_file(path_):\n with open(path_, \"r\") as f:\n return json.loads(f.read(), object_pairs_hook=OrderedDict)",
"def get_json_dict(filepath):\n with open(fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets dict of team names and team Id numbers from league page. | def _getTeamDict(self):
teamIds = self.html.xpath('//ul[@id="games-tabs1"]/li/a/@href')
teamIds = [re.findall('teamId=(\d+)', i)[0] for i in teamIds]
teamNames = self.html.xpath('//ul[@id="games-tabs1"]/li/a/text()')
teamNames = [name.strip().upper().replace(' ', ' ') for name in
... | [
"def team_ids():\n response = json_response('https://fantasy.premierleague.com/drf/teams/')\n teams = {}\n for team in response:\n teams[team['code']] = team['name']\n return teams",
"def parse(self, html):\n team = dict()\n soup = BeautifulSoup(html)\n\n if soup.find(text=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format html draft table string to pandas dataframe. | def _formatDraftTable(self, html):
rnd = df[0].ix[0].replace('ROUND ', '')
df.drop([0], inplace=True)
df['ROUND'] = rnd
df['PICK'] = pd.to_numeric(df[0])
df['MANAGER'] = df[2]
df = self._formatAuctionDraftTable(df)
df = df[['ROUND', 'PICK', 'MANAGER', 'PLAYER', 'T... | [
"def parse_table(table_el):\n table_dict = {\"header\": [], \"value\": []}\n for tr in table_el.find_all(\"tr\"):\n th = None\n td = None\n if tr.find(\"th\"):\n th = tr.th.text\n if tr.find(\"td\"):\n td = tr.td.text\n\n table_dict[\"header\"].append(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format active stats html table to data frame. | def _formatActiveStatsTable(self, df):
df.drop(df.shape[0]-1, inplace=True)
if df.iloc[:, 2].dtype == 'object':
rows = df[df.iloc[:, 2] == '--'].index
df.iloc[rows] = df.iloc[rows].replace(to_replace='--',
value=np.nan)
df... | [
"def _formatDraftTable(self, html):\n rnd = df[0].ix[0].replace('ROUND ', '')\n df.drop([0], inplace=True)\n df['ROUND'] = rnd\n df['PICK'] = pd.to_numeric(df[0])\n df['MANAGER'] = df[2]\n df = self._formatAuctionDraftTable(df)\n df = df[['ROUND', 'PICK', 'MANAGER', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download team "Active Stats" page. | def _downloadActiveStatsTable(self, teamId, batter=True):
assert str(teamId) in self.teamDict
teamName = self.teamDict[teamId]
teamId = ('teamId', teamId)
activeStatsUrl = ('http://games.espn.com/flb/activestats?' +
urlencode((self.leagueId, self.seasonId, teamI... | [
"def output_team_info(session, league_id, team_id):\n response = session.get(tm.url('nba', league_id, team_id))\n league = tm.league(response.text)\n team = tm.team(response.text)\n print(\"Success!\")\n print('League Name: %s \\nTeam Name: %s\\n' % (league, team))",
"def _get_page(player_name):\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format standings table to dataframe | def _formatStandingsTable(self, df, columns):
df.columns = columns
df.drop(df[df.iloc[:, 0].isnull()].index, inplace=True)
df = df.select(lambda x: not re.search('1\d', str(x)), axis=1)
return df | [
"def table(data):\n return pd.DataFrame(json_normalize(data))",
"def __format(self, df):\n df = self.__numerics_to_strings(df)\n df = self.__roads_to_columns(df)\n return df",
"def _formatDraftTable(self, html):\n rnd = df[0].ix[0].replace('ROUND ', '')\n df.drop([0], i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download league official "Standings" table. There are two tables within the page, roto and season stats. | def _downloadStandingsTable(self):
standingsUrl = ('http://games.espn.com/flb/standings?view=official&' +
urlencode((self.leagueId, self.seasonId)))
html = self._getHTML(standingsUrl, login=self.login)
tables = html.xpath('//table[@class="tableBody"]')
dfs = []
... | [
"def get_standings(self, season_id, wnba_season):\n path = \"wnba/trial/v4/en/seasons/{season_id}/{wnba_season}/standings\".format(\n season_id=season_id, wnba_season=wnba_season)\n print(path)\n return self._make_request(path)",
"def get_league_standings(self):\n return sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return league active stats dataframe | def getLeagueActiveStatsTable(self, batter=True):
activeTable = pd.DataFrame()
for teamId in self.teamDict:
df = self._downloadActiveStatsTable(teamId, batter=batter)
activeTable = pd.concat([activeTable, df])
return activeTable | [
"def get_home_advantage_vars(games_stats):\n # write query to create df containing teams, and wins by location per game\n game_location_data = sqldf(\"\"\"\n SELECT h.game_id,\n h.team AS home_team,\n a.team AS away_team,\n h.PTS AS home_points,\n a.PTS AS away_points,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format transaction tables. In order to properly parse text in Date and Detail columns, we need to parse HTML outside of pandas. | def _formatTransactionTable(self, htmlStr, tds):
df = pd.read_html(htmlStr, header=1)[0]
dates = [' '.join(i.itertext()) for i in tds[::4]]
df['DATE'] = dates
details = [' '.join(i.itertext()).replace(' ', ' ').replace(' ,', ',')
for i in tds[2::4]]
df['DETAIL... | [
"def format_table(row):\n shelter_name = row[\"FacilityName\"]\n last_report = row[\"timestamp_local\"]\n district = integrify(row[\"CouncilDistrict\"])\n occupied_beds = integrify(row[\"occupied_beds_computed\"])\n aval_beds = integrify(row[\"open_beds_computed\"])\n male_tot = integrify(row[\"To... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This functions generate SQL statement for selecting groups and perms. Sadly, Django doesn't support join in ORM Should not select users that hasn't got any role Should select perms that assigned to any role | def get_permission_owners_query():
owners_query = """
{group_table_name!s} gug
LEFT JOIN {owner_table_name!s} op
ON gug.group_id = op.owner_object_id
AND gug.group_content_type_id = op.owner_content_type_id
AND (gug.roles & op.roles) != 0
... | [
"def generate_query(self):\n self.query = self._add_select_statement() +\\\n self._add_case_statement() +\\\n self._add_from_statement() +\\\n self._add_group_by_statement()\n\n return self.query",
"def _sql_gen_add_gammas(\n settings: d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new instance of City before each test | def setUp(self):
self.c1 = City() | [
"def setUp(self):\n name = \"SANFRANCISCO\"\n colour = \"blue\"\n connections = ['TOKYO', 'MANILA', 'LOSANGELES', 'CHICAGO']\n self.testCity = City(name=name,colour=colour,connections=connections)",
"def test_new_city(self):\n self.new_helper(\"City\")",
"def test_save_city(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make sure state_id is str data type | def test_state_id_type(self):
self.assertEqual(type(City.state_id), str) | [
"def create_state_id(self):\n for key, value in config.fips_dict.iteritems():\n if key == self.state.lower():\n state_num = value\n if state_num <=9:\n state_num = '0' + str(state_num)\n else:\n state_num = str(stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test passing kwargs to City instantation | def test_kwargs(self):
json_dict = self.c1.to_dict()
c2 = City(**json_dict)
self.assertEqual(self.c1.id, c2.id)
self.assertEqual(self.c1.created_at, c2.created_at)
self.assertEqual(self.c1.updated_at, c2.updated_at)
self.assertNotEqual(self.c1, c2) | [
"def test_new_city(self):\n self.new_helper(\"City\")",
"def __init__(self, city: str, postoffice: int):\n self.city = city\n self.postoffice = postoffice",
"def setUp(self):\n name = \"SANFRANCISCO\"\n colour = \"blue\"\n connections = ['TOKYO', 'MANILA', 'LOSANGELES',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read nearEarth object information from a CSV file. | def load_neos(neo_csv_path="data/neos.csv"):
neos = []
with open(neo_csv_path, 'r') as infile:
reader = csv.DictReader(infile)
for line in reader:
neos.append(line)
print('loaded NEO data')
neo_collection = []
for neo in neos:
neo_collection.append(NearEarthObject... | [
"def load_neos(neo_csv_path):\n\n \"\"\" A list for keeping all the `NearEarthObject`s created from each CSV row \"\"\"\n neo_list = []\n\n with open(neo_csv_path, 'r') as neo_file_obj:\n reader = csv.DictReader(neo_file_obj)\n\n \"\"\" Reading each row in the CSV file, creating `NearEarthObj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse artist name for url insertion. | def parse_artist_name(artist_name: str) -> str:
split_artist_name = artist_name.split(" ")
if len(split_artist_name) > 1:
parsed_artist_name = "+".join(split_artist_name)
return parsed_artist_name
else:
return artist_name | [
"def _artisturl(self):\n if self.metadata[\"albumartist\"] <> \"Various Artists\":\n self.album._requests += 1\n #sys.stderr.write(self.cfg['abetterpath_http_echonest_host'] + \":\" + self.cfg['abetterpath_http_echonest_port'] + self.urls['echonest_artist_url'] + \"\\n\")\n self.album.tagger.xmlws.get(self.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The core assumption for simplest cases is that one system will be featurized as a single tensor, and that all the tensors will be of the same shape across systems. | def test_datasetprovider_exporter_single_tensor_same_shape():
from kinoml.core.ligands import Ligand
from kinoml.features.ligand import MorganFingerprintFeaturizer
from kinoml.features.core import Concatenated
conditions = AssayConditions()
systems = [LigandSystem([Ligand(smiles=smiles)]) for smile... | [
"def __infer_existing_tensors(self, F) -> None:\n for attr_name, types_with_attr in F.get_feature_list().items():\n for vt in types_with_attr:\n attr_dtype = F.get_data(np.array([0]), vt, attr_name).dtype\n self.create_named_tensor(\n attr_name=attr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bad Checksum Detection Should Raise Exception. | def badChecksumDetection(self):
liten = Liten(spath='testData')
badChecksumAttempt = liten.createChecksum('fileNotFound.txt') | [
"def _get_error_bad_checksum(self):\n return self.__error_bad_checksum",
"def RxTcpChecksumError(self):\n if self.force_auto_sync:\n self.get('RxTcpChecksumError')\n return self._RxTcpChecksumError",
"def RxUdpChecksumError(self):\n if self.force_auto_sync:\n self.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test checksum of duplicate files | def testDupeFileDetection(self):
liten = Liten(spath='testData')
checksumOne = liten.createChecksum(self.dupeFileOne)
checksumTwo = liten.createChecksum(self.dupeFileTwo)
self.assertEqual(checksumOne, checksumTwo) | [
"def checksum_matches(content, filename):\n with open(filename, \"rb\") as f:\n content_hash = hashlib.md5(content)\n file_hash = hashlib.md5(f.read())\n return content_hash.digest() == file_hash.digest()",
"def test_checksum(self):",
"def test_check_files_md5(self):\n table_err =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test checksum of Nonduplicate files | def testDupeFileDetectionError(self):
liten = Liten(spath='testData')
checksumOne = liten.createChecksum(self.dupeFileOne)
checksumThree= liten.createChecksum(self.nonDupeFile)
self.assertNotEqual(checksumOne, checksumThree) | [
"def checksum_matches(content, filename):\n with open(filename, \"rb\") as f:\n content_hash = hashlib.md5(content)\n file_hash = hashlib.md5(f.read())\n return content_hash.digest() == file_hash.digest()",
"def test_checksum(self):",
"def test_check_files_md5(self):\n table_err =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current patch with underscores instead of periods Uses only the first 2 parts of the patch name | def get_format_underscore_current_patch(cls) -> str:
current_patch = cls.get_current_patch()
return "_".join(current_patch.split(".")[:2]) | [
"def get_format_underscore_previous_patch(cls) -> str:\n\n previous_patch = cls.get_all_patches()[1]\n return \"_\".join(previous_patch.split(\".\")[:2])",
"def get_next_patch_filename():\r\n last_patch = sorted(glob.glob(os.path.join(PATCHES_PATH, \"patch_*.sql\")))[-1]\r\n patch_number = int... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the previous patch with underscores instead of periods Uses only the first 2 parts of the patch name | def get_format_underscore_previous_patch(cls) -> str:
previous_patch = cls.get_all_patches()[1]
return "_".join(previous_patch.split(".")[:2]) | [
"def get_format_underscore_current_patch(cls) -> str:\n\n current_patch = cls.get_current_patch()\n return \"_\".join(current_patch.split(\".\")[:2])",
"def get_next_patch_filename():\r\n last_patch = sorted(glob.glob(os.path.join(PATCHES_PATH, \"patch_*.sql\")))[-1]\r\n patch_number = int(re.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(Re)Load the package database. | def load(self):
self.db = info() | [
"def reload(self):\n with self.lock:\n self.db = _load_json(self.path, driver=self.driver)",
"def rebuild():\n raise NotImplementedError\n import config\n # First let's get a list of all the packages in the database.\n # TODO: create the session.\n logger.debug(\"Getting database ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Query the install status of a port. | def status(self, port):
pstatus = ABSENT
if port.origin in self.db:
portname = port.attr['pkgname'].rsplit('-', 1)[0]
for pkgname in self.db[port.origin]:
if pkgname.rsplit('-', 1)[0] == portname:
pstatus = max(pstatus,
... | [
"def check_port_status(self, port):\n # check existing ports dbqp has created\n dbqp_ports = self.check_dbqp_ports()\n if port not in dbqp_ports and not self.is_port_used(port):\n return 1\n else:\n return 0",
"def getPortStatus(self, timeout = 100):\n\t\treturn s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produces a matplotlib plot of the ratio between the sensors. If running from a csv file, pass the name of the file to this function. If no filename is provided, will attempt to read data live from sensors. A lot of the plotting code is magic from various tutorials. | def liveplot(filename=0):
ratio = None
if filename: # if plotting from CSV
with open(filename) as f:
for i in range(0, 480): # number of slightly-more-than-quarter-seconds to run for
oldratio = ratio
a, b, ratio = read(f)
print(ratio)
... | [
"def plot(self, filename:str=None):\n if not filename:\n filename = max(Saver.data_files())\n df = pd.read_csv(filename)\n print('DATAFRAME:')\n print(df)\n plot = self.plotter(df, self.config_change_steps)\n plt.show()",
"def analyze_file(file):\n\n data = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to check if a given cell (row, col) can be included in DFS | def isSafe(self, i, j, visited, l):
# row number is in range, column number is in range and value is 1 and not yet visited
return (i >= 0 and i < self.nrows and
j >= 0 and j < self.ncols and
not visited[i][j] and self.graph[i][j]==l) | [
"def DFS(r,c,r0,c0):\n if r >=0 and r <= rows-1 and c >= 0 and c <= cols-1 and grid[r][c] != 'V' and grid[r][c] != 0:\n shape.add((r-r0,c-c0)) # Get shape of current cell wrt base coordinates r0 and c0\n grid[r][c] = 'V'\n DFS(r+1,c,r0,c0)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A utility function to do DFS for a 2D boolean matrix. It only considers the 4 neighbours as adjacent vertices. | def DFS(self, i, j, visited, current_score, l, safe_path):
# These arrays are used to get row and column numbers of 4 neighbours of a given cell
rowNbr = [-1, 0, 0, 1];
colNbr = [0 ,-1, 1, 0];
# Mark this cell as visited
visited[i][j] = True
current_score+=1
... | [
"def DFS(graph, vertex, vertex2):\r\n\r\n # Initializing the flag of path and all vertices visited or not to false\r\n path = False\r\n for key in graph.booleanVerticeTraversed:\r\n graph.booleanVerticeTraversed[key][0] = False\r\n\r\n def DFSHelper(graph, vertex, vertex2):\r\n \"\"\"Helpe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |