query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Return the Stripe customer for the given user. | def get_customer(self, user):
if not user.stripe_customer_id:
return None
return stripe.Customer.retrieve(user.stripe_customer_id) | [
"def get_customer(self):\n\t\tif self.request.user.is_authenticated:\n\t\t\treturn self.request.user.stripe_customer",
"def getone(self, user_id):\n url = self._url(\"/customer/{}/\".format(user_id))\n return self._handle_request('getone', 'GET', url)",
"def create_customer(self, user, card_token,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all plans available to be subscribed to. | def get_plans(self):
return stripe.Plan.all() | [
"def plans(self) -> Sequence['outputs.PlanNotificationDetailsResponse']:\n return pulumi.get(self, \"plans\")",
"def plans(self):\r\n return pl.Plans(self)",
"def plans(self) -> Optional[Sequence['outputs.PlanNotificationDetailsResponse']]:\n return pulumi.get(self, \"plans\")",
"def list... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a subscription. changes a current customer's subscription to a new one. | def update_subscription(self, plan, customer=None, user=None):
if not customer and not user:
raise UnboundLocalError('customer or user required')
if not customer:
customer = self.get_customer(user)
return customer.update_subscription(
plan=plan,
... | [
"def update(self, **kwargs):\n sub_id = kwargs.pop('sub_id', None)\n uri = f\"/v1/svc-subscription/subscriptions/{sub_id}\"\n return self._make_request(uri=uri, method='PUT', **kwargs)",
"def setSubscription(self, cid, sub):\n con = DB()\n c = con.cursor()\n c.execute(\"U... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method handles all steps of the job pipeline to produce a dataframe, or error if the job fails. From a client's request, this method will start a job, and repeatedly check its status until it finishes, fails, or the maximum wait time expires. If the job completes, this method will download the resulting dataframe ... | def load_df_from_job_pipeline(self,
model_id: str,
geolevel: Optional[str] = None,
response_format: str = 'csv',
portfolio_id: Optional[str] = None,
m... | [
"def download_job_to_dataframe(self) -> pandas.DataFrame:\n self._assert_job_created()\n\n r = requests.post(\n f'https://{cc.ROUTE_PREFIX}.stratodem.com/jobs/download',\n headers=dict(\n Authorization=f'Bearer {get_api_token()}',\n ),\n json=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method will handle the API request to download the job related to an instance of this class, and return the dataframe Returns pandas.DataFrame | def download_job_to_dataframe(self) -> pandas.DataFrame:
self._assert_job_created()
r = requests.post(
f'https://{cc.ROUTE_PREFIX}.stratodem.com/jobs/download',
headers=dict(
Authorization=f'Bearer {get_api_token()}',
),
json=dict(job_id=s... | [
"def download_and_get_data_frame(self) -> None:\n self._create_download_obj_and_download_file()\n\n if self._download_process.successfully_downloaded:\n self._json_process = read_parquet.ReadParquet(self._download_process.destination_path,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot Model predictions vs. target and print MSE and R2 | def check_model_performances(X,Y, model,show=False):
#model.fit(X, Y)
predictions = model.predict(X)
predictions = predictions#.reshape(-1,1)
# ######## Computes MSE #######
MSE = mean_squared_error(Y, predictions)
print(f'\nMSE : {MSE}')
# ######## Computes R2 #######
... | [
"def plot(self) -> None:\n cw_l2_data_list = list(); cw_linf_data_list = list()\n\n for model in self.model_list:\n cw_l2_data_list.append(joblib.load(model + \"/stat/mse-rmse-si-mae-cw_l2_1.pkl\"))\n\n cw_l2_attack = list(zip(self.model_list, cw_l2_data_list))\n\n for model i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test _get_faker when anonymize is a tuple | def test__get_faker_anonymize_tuple(self):
# Setup
# Run
transformer = Mock()
transformer.anonymize = ('email',)
result = CategoricalTransformer._get_faker(transformer)
# Asserts
self.assertEqual(
result.__name__,
'faker',
"E... | [
"def test__get_faker_anonymize_not_tuple_or_list(self):\n # Run\n transformer = Mock()\n transformer.anonymize = 'email'\n\n result = CategoricalTransformer._get_faker(transformer)\n\n # Asserts\n self.assertEqual(\n result.__name__,\n 'faker',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test _get_faker when anonymize is a list | def test__get_faker_anonymize_list(self):
# Run
transformer = Mock()
transformer.anonymize = ['email']
result = CategoricalTransformer._get_faker(transformer)
# Asserts
self.assertEqual(
result.__name__,
'faker',
"Expected faker funct... | [
"def test__get_faker_anonymize_not_tuple_or_list(self):\n # Run\n transformer = Mock()\n transformer.anonymize = 'email'\n\n result = CategoricalTransformer._get_faker(transformer)\n\n # Asserts\n self.assertEqual(\n result.__name__,\n 'faker',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test _get_faker when anonymize is neither a typle or a list | def test__get_faker_anonymize_not_tuple_or_list(self):
# Run
transformer = Mock()
transformer.anonymize = 'email'
result = CategoricalTransformer._get_faker(transformer)
# Asserts
self.assertEqual(
result.__name__,
'faker',
"Expected ... | [
"def test__get_faker_anonymize_list(self):\n # Run\n transformer = Mock()\n transformer.anonymize = ['email']\n\n result = CategoricalTransformer._get_faker(transformer)\n\n # Asserts\n self.assertEqual(\n result.__name__,\n 'faker',\n \"Exp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test _get_faker with a category that don't exist | def test__get_faker_anonymize_category_not_exist(self):
# Run & assert
transformer = Mock()
transformer.anonymize = 'SuP3R-P1Th0N-P0w3R'
with self.assertRaises(ValueError):
CategoricalTransformer._get_faker(transformer) | [
"def test_dashboard_recipe_created_with_category(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.login('Bo_theo5@example.com', 'Bo1995')\n self.dashboard()\n self.category('JunkFood')\n self.dashboard()\n rv = self.recipe_dashboard()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test fit with a pandas.Series, don't anonymize | def test_fit_series_no_anonymize(self):
# Setup
data = pd.Series(['bar', 'foo', 'foo', 'tar'])
# Run
transformer = Mock()
transformer.anonymize = None
CategoricalTransformer.fit(transformer, data)
# Asserts
expect_anonymize_call_count = 0
expect... | [
"def test_transform_series_when_applied_to_serie_with_different_name_than_the_one_used_to_fit():\n training_series = pd.Series([1.16, -0.28, 0.07, 2.4, 0.25, -0.56, -1.42, 1.26, 1.78, -1.49],\n name = 'y')\n input_series = pd.Series([1.16, -0.28, 0.07, 2.4, 0.25, -0.56, -1.42, 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test fit with a pandas.Series, anonymize | def test_fit_series_anonymize(self):
# Setup
data = pd.Series(['bar', 'foo', 'foo', 'tar'])
data_anonymized = pd.Series(['bar', 'foo', 'foo', 'tar'])
# Run
transformer = Mock()
transformer.anonymize = 'email'
transformer._anonymize.return_value = data_anonymized
... | [
"def test_transform_series_when_applied_to_serie_with_different_name_than_the_one_used_to_fit():\n training_series = pd.Series([1.16, -0.28, 0.07, 2.4, 0.25, -0.56, -1.42, 1.26, 1.78, -1.49],\n name = 'y')\n input_series = pd.Series([1.16, -0.28, 0.07, 2.4, 0.25, -0.56, -1.42, 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test normalize data with clip=True | def test__normalize_clip(self):
# Setup
data = pd.Series([-0.43, 0.1234, 1.5, -1.31])
transformer = Mock()
transformer.clip = True
# Run
result = CategoricalTransformer._normalize(transformer, data)
# Asserts
expect = pd.Series([0.0, 0.1234, 1.0, 0.0], ... | [
"def test__normalize_clip(self):\n # Setup\n transformer = CategoricalTransformer(clip=True)\n\n # Run\n data = pd.Series([-0.43, 0.1234, 1.5, -1.31])\n result = transformer._normalize(data)\n\n # Asserts\n expect = pd.Series([0.0, 0.1234, 1.0, 0.0], dtype=float)\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test reverse_transform a numpy.array | def test_reverse_transform_array(self):
# Setup
data = np.array([-0.6, 0.2, 0.6, -0.2])
normalized_data = pd.Series([0.4, 0.2, 0.6, 0.8])
intervals = {
'foo': (0, 0.5),
'bar': (0.5, 0.75),
'tar': (0.75, 1),
}
# Run
transformer... | [
"def test_reverse_transform_array(self):\n # Setup\n data = np.array(['foo', 'bar', 'bar', 'foo', 'foo', 'tar'])\n rt_data = np.array([-0.6, 0.5, 0.6, 0.2, 0.1, -0.2])\n transformer = CategoricalTransformer()\n\n # Run\n transformer.fit(data)\n result = transformer.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a DOM tree to a "native" Python object | def domToPyObj(domNode, keepContainers=0, objPattern=None, objParentClass=None):
objPattern = objPattern or '_XO_'
objParentClass = objParentClass or objPattern
# does the tag-named class exist, or should we create it?
# klass = '_XO_'+py_name(domNode.nodeName)
klass = objPattern + py_name(domNo... | [
"def convert_etree(tree):\n return objectify.fromstring(etree.tostring(tree))",
"def xml2obj(self, src):\n\n\t\tclass DataNode(object):\n\t\t\tdef __init__(self):\n\t\t\t\tself._attrs = {} # XML attributes and child elements\n\t\t\t\tself.data = None # child text data\n\n\t\t\tdef __len__(self):\n\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build a virtual filesystem | def virtual(**kwds):
# get the virtual filesystem factory
from .Filesystem import Filesystem
# make one and return it
return Filesystem(**kwds) | [
"def build_filesystem(proj, devkit, script_args, crypto_key, build_output_folder):\n\n devkit_root = devkit.devkit_dirname\n register_pylib_path(devkit_root)\n working_dir = proj.proj_dirname\n try:\n workspace_file = script_args.workspace_file\n except AttributeError:\n # For a time th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempt to build a zip filesystem out of {root}, which is expected to be a zip archive | def zip(root, **kwds):
# ensure {root} is an absolute path, just in case the application changes the current
# working directory
root = primitives.path(root).resolve()
# check whether the location exists
if not root.exists():
# and if not, complain
raise MountPointError(uri=root, err... | [
"def make_zip(archive, rootdir=None, basedir=None, mode=\"w\"):\n cwd = os.getcwd()\n if rootdir is not None:\n os.chdir(rootdir)\n try:\n if basedir is None:\n basedir = os.curdir\n log(\"Creating %s with %s ...\" % (archive, basedir))\n zip = ZipFile(archive, mode, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Support for debugging the filesystem package | def debug():
# print(" ++ debugging 'pyre.filesystem'")
# attach {Extent} as the metaclass of Node and Filesystem so we can verify that all
# instances of these classes are properly garbage collected
from ..patterns.Extent import Extent
global _metaclass_Node
_metaclass_Node = Extent
# all ... | [
"def debug():",
"def debug():\n\n return",
"def debug_file(tmp_path):\n return tmp_path.joinpath('pytest-plugin.log')",
"def set_fs_verbose(mode: bool = True):\n global _fs_verbose\n _fs_verbose = mode",
"def info(path):\n fs.info(path)",
"def out_for_debug(df_input, fname, modus=''):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The data structure is a list of dictionaries. Each dictionary keys are connectivity check commands and values are the commands' results. max_num_of_rounds_to_retain maximum maintained length of the results list | def __init__(self, max_num_of_rounds_to_retain=100, num_of_last_check_rounds_consider=2):
self.data = list()
self.max_num_of_rounds_to_retain = max_num_of_rounds_to_retain
self.num_of_last_check_rounds_consider = num_of_last_check_rounds_consider | [
"def test(self):\n\n resultdict = {}\n for server in self.server_list:\n resultdict.update(**{server: self.fetch(server)})\n\n ips = sorted(resultdict.values())\n ips_set = set(ips)\n print(\"\\nNumber of servers: {}\".format(len(self.server_list)))\n\n for ip, o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return True, False based on num_of_last_check_rounds_consider rounds evaluations. All checks (items of dictionaries) have the same weight. All results must be nonzero in order to pronounce offline status. if any results in the considered rounds is 0, the online status is still maintained. | def am_i_offline(self):
# -num_of_last_check_rounds_consider won't raise IndexError when len(self.data) is smaller
logger.debug("called am_i_offline and data is: %s" % self.data)
if not self.data:
return False
for dict_check_results in self.data[-self.num_of_last_check_rounds... | [
"def checkWinAll(self, model, previousWin):\r\n previous = self.__render\r\n self.__render = Render.NOTHING # avoid rendering anything during execution of the check games\r\n\r\n win = 0\r\n lose = 0\r\n \r\n cellsRanking = {}\r\n sumForProb = 0\r\n for cell ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop over all check_cmds commands and acquire results. | def _checker_worker(self):
results = {}
for cmd in self.check_cmds:
res = subprocess.call(cmd.split(), stdout=open('/dev/null', 'w'))
self.log("'%s' finished, result: %s" % (cmd, res))
results[cmd] = res
if rospy.is_shutdown():
return
... | [
"def perform_checks(self):\n retval = []\n retval.extend(self.check_slick_status())\n retval.extend(self.check_java_processes())\n retval.extend(self.check_firefox_processes())\n retval.extend(self.check_disk_space())\n return retval",
"def check_commands(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bfsSample(G, source=None, k=50) Start a BFS from source node, return nodeinduced subgraph of the first k nodes discovered. DEPRECATED. This function (and the networkit.sampling module) will be removed in future updates. | def bfsSample(G, source=None, k = 50):
warn("networkit.sampling.bfsSample is deprecated, will be removed in future updates.")
if not source:
source = GraphTools.randomNode(G)
n = G.numberOfNodes()
visited = [False]*n
Q = [source]
closest = set([source])
global found
found = 0
while len(Q) > 0 and found < k:
... | [
"def bfs(self, source):\n \n if self.is_empty():\n raise Exception(\"Cannot perform BFS on an empty graph!\")\n \n if not source in self.verteces():\n raise Exception(\"Can't find vertex:\" + str(source))\n \n visit = Visit() \n \n queue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Preprocess text for BERT embedding | def bert_preprocess(raw_text):
nlp = English()
nlp.add_pipe(nlp.create_pipe('sentencizer')) # updated
doc = nlp(raw_text)
sentences = [sent.string.strip() for sent in doc.sents][0:2]
new_sentences = []
for i, sentence in enumerate(sentences):
if i==0:
new_sentences.append("... | [
"def preprocess(\n self,\n text: 'str',\n ) -> 'str':",
"def preprocess(text):\n text = remove_space(text)\n text = clean_special_punctuations(text)\n text = handle_emojis(text)\n text = clean_number(text)\n text = spacing_punctuation(text)\n text = clean_repeat_words(text)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates BERT features for one 8K | def create_bert_features(raw_text, tokenizer, model):
# Load pre-trained model tokenizer (vocabulary)
text_preprocessed = bert_preprocess(raw_text)
# tokenize
#tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
tokenized_text = tokenizer.tokenize(text_preprocessed)[:512]
# ... | [
"def gen_features(self, X):",
"def create_features(verbose=True):\n\n def print_if_verbose(msg):\n \"\"\"This method prints a message only if verbose was set to True, otherwise does nothing.\n Args:\n msg: The message to print.\n \"\"\"\n if verbose:\n print(ms... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of all files of an extension in a path. path {str} Initial path to the directory we want to crawl. [ext=".pyc"] {str} what file extensions to look for. This is a literal match and must contain the dot. | def findfiles(path, ext=".pyc"):
results = []
regex = re.compile(re.escape(ext)+"$", re.I)
tree = os.walk(path)
for d in tree:
# Each element of a walker represents a directory and its contents.
# Diagnostic, if you wish.
#print(d)
if d[2]:
# Are there files ... | [
"def search_extension(path, ext):\n output = []\n for root, dirs, files in os.walk(path, topdown=True):\n for file in files:\n if file.endswith(ext):\n path = os.path.join(root, file)\n output.append(path)\n\n return output",
"def get_files(path, extension)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the needed history/changelog changes Every history heading looks like '1.0 b4 (19721225)'. Extract them, check if the first one matches the version and whether it has a the current date. | def _grab_history(self):
self.data['history_lines'] = []
self.data['history_file'] = None
self.data['history_encoding'] = None
self.data['headings'] = []
self.data['history_last_release'] = ''
self.data['history_insert_line_here'] = 0
default_location = None
... | [
"def getVersionHistory(self, text):\n #if self.group == \"Core\":\n # import pdb; pdb.set_trace()\n extractor =r'.*\\+node\\S+?\\<\\< %s \\>\\>.*?\\#\\@\\+at(.*)\\#\\@\\-at.*\\-node.*?\\<\\< %s \\>\\>.*'\n for name in (\"version history\", \"change log\"):\n searcher = re.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Look for 'Nothing changed yet' under the latest header. Not nice if this text ends up in the changelog. Did nothing happen? | def _check_nothing_changed(self):
if self.data['history_file'] is None:
return
nothing_yet = self.data['nothing_changed_yet']
if nothing_yet not in self.data['history_last_release']:
return
# We want quotes around the text, but also want to avoid
# printin... | [
"def test_commit_guessing_fail(self):\n repo = self.init_test_repo('gbp-test-native')\n\n # Add \"very old\" header to changelog\n with open('packaging/gbp-test-native.changes', 'w') as ch_fp:\n ch_fp.write('* Sat Jan 01 2000 User <user@host.com> 123\\n- foo\\n')\n # rpm-ch sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write previouslycalculated history lines back to the file | def _write_history(self):
if self.data['history_file'] is None:
return
contents = '\n'.join(self.data['history_lines'])
history = self.data['history_file']
write_text_file(
history, contents, encoding=self.data['history_encoding'])
logger.info("History fil... | [
"def __write_history(self):\n hfile = open(self.basedir + \"/history\", 'w')\n for entry in self.history:\n hfile.write(entry + \"\\n\")\n hfile.close()",
"def exit(self):\n print(\"Thanks for using Symi ! See you later !\")\n path = join(dirname(abspath(__file__)), \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show diff and offer commit. commit_msg is optional. If it is not there, we get the commit_msg from self.data. That is the usual mode and is at least used in prerelease and postrelease. If it is not there either, we ask. | def _diff_and_commit(self, commit_msg=''):
if not commit_msg:
if 'commit_msg' not in self.data:
# Ask until we get a non-empty commit message.
while not commit_msg:
commit_msg = utils.get_input(
"What is the commit message? ... | [
"def test_option_commit_msg(self):\n repo = self.init_test_repo('gbp-test2')\n\n eq_(mock_ch(['--commit', '--since=HEAD^', '--commit-msg=Foo']), 0)\n eq_(repo.get_commit_info('HEAD')['subject'], 'Foo')\n\n # Unknown key in format string causes failure\n eq_(mock_ch(['--commit', '-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle whether dots or text are shown in password box | def _toggle_password(self, event):
if self.showText.IsChecked():
self.password_txt.Show(True)
self.password.Show(False)
self.password_txt.SetValue(self.password.GetValue())
else:
self.password.Show(True)
self.password_txt.... | [
"def show_password(self, state):\n if state == Qt.Checked:\n self.pass_entry.setEchoMode(QLineEdit.Normal)\n else:\n self.pass_entry.setEchoMode(QLineEdit.Password)",
"def show_password(self):\n if not self.show_state:\n self.entry_pw[\"show\"] = \"\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the progress bar showing password strength | def _update_strength(self, event):
if self.showText.IsChecked():
password = self.password_txt.Value
else:
password = self.password.Value
nd = calc_password_strength(password)
self.strength.UpdateStrength(nd) | [
"def _update_strength(self, event=None):\n password = self.password.GetValue()\n nd = calc_password_strength(password, WEB_SPEED)\n self.strength.UpdateStrength(nd)",
"def on_encryptionKeyEdit_textChanged(self, txt):\n self.passwordMeter.checkPasswordStrength(txt)\n self.__updat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open the random password generator dialog | def _open_password_gen(self, event):
# Generate passwords suitable for resistance to local cracking
dlg = PasswordGenerator(self, LOCAL_SPEED)
if dlg.ShowModal() == wx.ID_OK:
newPass = dlg.password.GetValue()
if newPass:
# ok... | [
"def _open_password_gen(self, event):\n dlg = PasswordGenerator(self, WEB_SPEED)\n \n if dlg.ShowModal() == wx.ID_OK:\n newPass = dlg.password.GetValue()\n \n if newPass:\n # ok to overwrite?\n if self.password.Value:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle whether password fields show dots or text | def _toggle_password(self, event):
if self.showText.IsChecked():
self.password_txt.Show(True)
self.password.Show(False)
self.password_txt.SetValue(self.password.GetValue())
self.password2_txt.Show(True)
self.password2.Show(False)
s... | [
"def show_password(self, state):\n if state == Qt.Checked:\n self.pass_entry.setEchoMode(QLineEdit.Normal)\n else:\n self.pass_entry.setEchoMode(QLineEdit.Password)",
"def show_password(self):\n if not self.show_state:\n self.entry_pw[\"show\"] = \"\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that entries are valid before allowing ok button press | def _check_entries(self, event):
# First check the password fields
passwordEmpty = not self.password.Value
passwordMatch = (self.password.Value == self.password2.Value)
if not passwordMatch or passwordEmpty:
if passwordEmpty:
msg = 'Password... | [
"def check_entries(self):\n print(self.password)\n\n valid_entries = False\n if self.temporary_label:\n self.forget_temporary_label()\n\n # Empty entry field\n if (not self.school or not self.email or not self.password\n or not self.verify_password):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select a file to save the password database | def _get_file(self, event):
dlg = wx.FileDialog(None, "Select a file",
wildcard="Password Files (*.*)|*.*",
defaultDir=os.getcwd(),
style=wx.FD_SAVE)
if dlg.ShowModal() == wx.ID_OK:
newpath = dlg.G... | [
"def save_password_file(file_name):\r\n pickle.dump((entries, encryption_key), open(file_name, \"wb\"))",
"def save_credentials():\n yesno = raw_input(\"Save password in %s file (Y/n)? \" % PASSWORD_FILENAME)\n yesno = yesno.strip().lower() or 'y'\n if yesno.startswith('y'):\n credentials = '%s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the progress bar showing password strength | def _update_strength(self, event=None):
password = self.password.GetValue()
nd = calc_password_strength(password, WEB_SPEED)
self.strength.UpdateStrength(nd) | [
"def _update_strength(self, event):\n if self.showText.IsChecked():\n password = self.password_txt.Value\n else:\n password = self.password.Value\n \n nd = calc_password_strength(password)\n self.strength.UpdateStrength(nd)",
"def on_encryptionKeyEdit_textChang... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open the random password generator in 'web' mode | def _open_password_gen(self, event):
dlg = PasswordGenerator(self, WEB_SPEED)
if dlg.ShowModal() == wx.ID_OK:
newPass = dlg.password.GetValue()
if newPass:
# ok to overwrite?
if self.password.Value:
dlg2 = ... | [
"def passwordGen() :\n\treturn __randomString(12)",
"def _open_password_gen(self, event):\n \n # Generate passwords suitable for resistance to local cracking\n dlg = PasswordGenerator(self, LOCAL_SPEED)\n \n if dlg.ShowModal() == wx.ID_OK:\n newPass = dlg.password.Get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open a file Read the message from the file return that message | def get_message():
# TODO: Daniel
my_file = open("C:/Users/Triqk/github/RSAProject1/TestFile.txt", "r")
test_message = my_file.readlines()
return test_message | [
"def read_message_from_file(filename):\n with open(filename, 'r') as f:\n return bytes(f.read(), \"ASCII\")",
"def open_file():\n try:\n file_in = open(\"data_full.txt\", \"r\")\n return file_in\n\n except:\n return \"ThisIsAnErrorMessage\"",
"def read_file(self, filename):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take in a chunk of a string and then convert it into a number using UTF8 encoding. return that number | def convert_chunk_into_number(chunk_of_string):
# TODO: Daniel
my_file = open("C:/Users/Triqk/github/RSAProject1/TestFile.txt", "r")
test_message = my_file.readlines()
number = int(text_message)
return number | [
"def dec2int(r: str) -> int:",
"def byte2int(character):\n return character[0]",
"def bin2int(r: str) -> int:",
"def hex2int(r: str) -> int:",
"def zh_num2digit(string):\n for match in zh_nums_iter(string):\n num_str = match.group(0)\n digit_num = parse_zh_num(num_str)\n if digit_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
numbers is a list of numbers. Iterate thru them all and encrypt each number Put the result in a list and then return the list | def rsa_encrypt_numbers(numbers, public_key):
# TODO: Daniel
encrypted_numbers = [1,2,3,4,5]
return encrypted_numbers | [
"def ecb_encrypt(pt_bin_list, keys, rounds):\n enc_result = \"\"\n\n with multiprocessing.Pool() as p:\n enc_result = p.starmap(feistel_encrypt, zip(pt_bin_list, keys, repeat(rounds)))\n return enc_result",
"def encryptEntries(entries):\n logging.info('Encrypting %i entries.', len(entries))\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An agent has been bound | def _bind_agent(self, field, service, svc_ref):
# Tell it to handle remaining components
service.handle(self._remaining)
self._remaining.clear() | [
"def __updateAgentHealth__(self):\n health = self.agent.getHealth()\n if health == None:\n return\n if health < self.currentHealth:\n self.healthLost += self.currentHealth - health\n if health == 0.0:\n self.isAlive = False\n self.currentHealth = h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Installs & starts the requested bundles, if necessary | def _install_bundles(self, bundles):
# Convert to dictionaries, for easier filtering
pre_installed = {
bundle.get_symbolic_name(): Version(bundle.get_version())
for bundle in self._context.get_bundles()}
to_install = {name: Version(version) for name, version in bundles}
... | [
"def run_install():\r\n pass",
"def do(self):\r\n parameters = ParametersParserStr(self.args_parameters).get()\r\n self.core.install(self.product_names, parameters, with_dependencies=True)",
"def run_install():\n pass",
"def setup_installers(self, context: CommandContext):\n cache_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the UID of the isolate hosting this composer | def get_isolate_uid(self):
return self._context.get_property(cohorte.PROP_UID) | [
"def hydrofabric_uid(self) -> str:\n return self._hydrofabric_uid",
"def owner_uuid(self) -> str:\n return pulumi.get(self, \"owner_uuid\")",
"def uuid(self):\n return self._phasset.localIdentifier()",
"def owner_id(self) -> int:\n return pulumi.get(self, \"owner_id\")",
"def own... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an Isolate bean corresponding to this composer | def get_isolate_info(self):
# Language
if sys.version_info[0] >= 3:
language = cohorte.composer.LANGUAGE_PYTHON3
else:
language = cohorte.composer.LANGUAGE_PYTHON
# Make the bean
return beans.Isolate(self._isolate_name, language,
... | [
"def bean( self ):\n return self.fBean",
"def get_class_instance_record(self):\n return self.cir",
"def _get_container(self) -> Container:\n obj = self.get_container()\n return to_container(obj)",
"def get_part(self):\n return self.get_object()",
"def get(cls, context, uuid):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Kills the components with the given names | def kill(self, names):
with self.__lock:
# Update the status storage
self._status.remove(names)
if self._agent is not None:
# An agent can kill the components
for name in names:
try:
# Kill the compo... | [
"def killAll(controller=False):",
"def kill(targets, controller=False):",
"def close_components():\n for name, comp in components.items():\n logging.info(f\"Shutting down component: {name}\")\n if comp is not None:\n comp.close()\n if name != 'Embosser':\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assumes L is a list of integers containing at least 2 elements. Finds the longest run of numbers in L, where the longest run can either be monotonically increasing or monotonically decreasing. In case of a tie for the longest run, choose the longest run that occurs first. Does not modify the list. Returns the sum of th... | def longest_run(L):
# save the current longest length for increasing run
length_inc = []
# save the current longest length for decreasing run
length_dec = []
# set the initial length to 1
length_inc.append(1)
length_dec.append(1)
# save the result
result_sum = 0
# save ... | [
"def longest_run(L):\n\tlongest_length = 1\n\tincreasing_length = 1\n\tdecreasing_length = 1\n\tfor i in range(len(L) - 1):\n\t\tif L[i] >= L[i+1]:\n\t\t\tdecreasing_length += 1\n\t\telse:\n\t\t\tdecreasing_length = 1\n\t\tif L[i] <= L[i+1]:\n\t\t\tincreasing_length += 1\n\t\telse:\n\t\t\tincreasing_length = 1\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new instance of AxisGyroscope. | def __init__(self, mag, deg_per_sec_factor=None):
Gyro.__init__(self)
if mag is None:
raise ArgumentNullException("'mag' param cannot be None.")
if not isinstance(mag, MultiAxisGyro):
msg = "'mag' param must be an instance of "
msg += "raspy.components.gyros... | [
"def setGyroSensor(self, port):\n self.gyroSensor = ev3.GyroSensor(port)",
"def gyro_y(self, gyro_y):\n\n self._gyro_y = gyro_y",
"def CanvasGyroShow() -> None:\n pass",
"def read_and_update_angle(self):\n if self.is_disposed:\n raise ObjectDisposedException(\"AxisGyroscope\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read and update the angle. | def read_and_update_angle(self):
if self.is_disposed:
raise ObjectDisposedException("AxisGyroscope")
self.__multiAxisGyro.read_gyro()
angular_velocity = (((self.__value - self.__offset) / 40) * 40)
if self.__factorSet:
angular_velocity /= self.__degPerSecondFacto... | [
"def update_angle(self, mouse):\n offset = (mouse[1]-self.player.rect.centery, mouse[0]-self.player.rect.centerx)\n self.angle = degrees(atan2(*offset))\n print(\"angle:\", self.angle)",
"def getAngle(self):\n return self.angle",
"def CurrentAngle(self):\r\n return self.Curren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the raw value. | def raw_value(self, value):
if value is None:
value = 0
self.__value = value | [
"def _on_set(self, raw_value, **kwargs):\n return raw_value",
"def raw(self, raw):\n\n self._raw = raw",
"def value(self, value):\n\n\t\tself.__value = value",
"def set_value(self,value):\n\n # safe way of converting into proper type\n if self.datatype == \"int\":\n self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the angular velocity. | def angular_velocity(self):
trig = gyro_trigger_mode.GET_ANGULAR_VELOCITY_TRIGGER_READ
if self.__trigger == trig:
self.read_and_update_angle()
adjusted = (self.__angle - self.__offset)
if self.__factorSet:
return adjusted / self.__degPerSecondFactor
retur... | [
"def angular_velocity(self):\n return self.base_angular_velocity() + (\n self.tidal_rotational_deceleration() * self.star.age()\n )",
"def angularVel(self):\n \n return self._move_cmd.angular.z",
"def angular_vel(self):\n return self.data.qvel[1:]",
"def get_v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the read trigger. | def set_read_trigger(self, trig):
if trig is None:
trig = gyro_trigger_mode.READ_NOT_TRIGGERED
self.__trigger = trig | [
"def trigger(self, trigger):\n\n self._trigger = trigger",
"def __set_read_mode(self):\n self.__selector.modify(self.__socket, selectors.EVENT_READ)",
"def read(self, read):\n \n self._read = read",
"def read(self, read):\n\n self._read = read",
"def set_reload_before_read... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the first line of the given view into a SyntaxTestHeader. Returns `None` if the file doesn't contain syntax tests. | def get_syntax_test_tokens(view):
line = view.line(0)
match = None
if line.size() < 1000: # no point checking longer lines as they are unlikely to match
first_line = view.substr(line)
match = syntax_test_header_regex.match(first_line)
if not match:
return None
else:
... | [
"def on_modified_async(self):\n\n name = self.view.file_name()\n if name and not path.basename(name).startswith('syntax_test'):\n self.header = None\n return\n self.header = get_syntax_test_tokens(self.view)\n # if there is no comment start token, clear the header\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the view has a filename, and that file name starts with the syntax test file prefix, or the view has no filename yet, read the first line to determine the syntax test header. | def on_modified_async(self):
name = self.view.file_name()
if name and not path.basename(name).startswith('syntax_test'):
self.header = None
return
self.header = get_syntax_test_tokens(self.view)
# if there is no comment start token, clear the header
if se... | [
"def get_syntax_test_tokens(view):\n\n line = view.line(0)\n match = None\n if line.size() < 1000: # no point checking longer lines as they are unlikely to match\n first_line = view.substr(line)\n match = syntax_test_header_regex.match(first_line)\n\n if not match:\n return None\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse details of a test assertion at a given position in the view. Always returns a AssertionLineDetails instance, whose fields may be `None`. | def get_details_of_test_assertion_line(self, pos):
tokens = self.header
if not tokens:
return AssertionLineDetails(None, None, None)
line_region = self.view.line(pos)
line_text = self.view.substr(line_region)
test_start_token = re.match(r'^\s*(' + re.escape(tokens.co... | [
"def get_details_of_line_being_tested(self):\n\n if not self.header:\n return (None, None)\n\n lines = []\n pos = self.view.sel()[0].begin()\n first_line = True\n while pos >= 0:\n details = self.get_details_of_test_assertion_line(pos)\n pos = deta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the line at the given character position is a syntax test line. It can optionally treat lines with comment markers but no assertion as a syntax test, useful for while the line is being written. | def is_syntax_test_line(self, pos, must_contain_assertion):
details = self.get_details_of_test_assertion_line(pos)
if details.comment_marker_match:
return not must_contain_assertion or details.assertion_colrange is not None
return False | [
"def is_probably_inside_string_or_comment(line, index):\r\n # Make sure we are not in a string.\r\n for quote in ['\"', \"'\"]:\r\n if quote in line:\r\n if line.find(quote) <= index:\r\n return True\r\n\r\n # Make sure we are not in a comment.\r\n if '#' in line:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starting from the cursor position, work upwards to find all syntax test lines that occur before the line that is being tested. Return a tuple containing a list of assertion line details, along with the region of the line being tested. | def get_details_of_line_being_tested(self):
if not self.header:
return (None, None)
lines = []
pos = self.view.sel()[0].begin()
first_line = True
while pos >= 0:
details = self.get_details_of_test_assertion_line(pos)
pos = details.line_region... | [
"def test_previous_line(self):\n before_b = \"\"\"\\\n a\n\n b\n \"\"\"\n after_b = \"\"\"\\\n a\n\n b\n \"\"\"\n self.run_test(\n before_b=before_b,\n after_b=after_b,\n before_sel=(\"3.0\", \"3.0\"),\n after_sel=(\"2.0\", \"2.0\"),... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update highlighting of what the current line's test assertions point at. | def on_selection_modified_async(self):
if not self.header or len(self.view.sel()) == 0:
return
lines, line = self.get_details_of_line_being_tested()
if not lines or not lines[0].assertion_colrange:
self.view.erase_regions('current_syntax_test')
return
... | [
"def highlight_current_line(self, filename, line):\r\n\t\traise NotImplementedError()",
"def next_highlight(self,val):\n self.highlight = val",
"def highlight_line(self, line, factor=1.5):\n self._checkfigure()\n ld = self._get_linedict(line)\n ld['highlighted'] = True\n ld['h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the (partial) scopes that are common for a list of scopes. | def find_common_scopes(scopes, skip_syntax_suffix):
# we will use the scopes from index 0 and test against the scopes from the further indexes
# as any scopes that doesn't appear in this index aren't worth checking, they can't be common
# skip the base scope i.e. `source.python`
check_scopes = next(it... | [
"def _get_all_scopes(blocks):\n all_scopes = []\n for label, block in blocks.items():\n if not (block.scope in all_scopes):\n all_scopes.append(block.scope)\n return all_scopes",
"def get_matched_scopes(self, protocols):\n return set(m.scope for m in self.matchers if m.protocol i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine extend of token(s) to test and return lenght and scope set. To be precise, increase column as long as the selector wouldn't change and collect the scopes. | def determine_test_extends(self, lines, line, start_col):
view = self.view
col_start, col_end = lines[0].assertion_colrange
scopes = {
view.scope_name(pos)
for pos in range(line.begin() + col_start, line.begin() + col_end)
}
base_scope = path.commonprefix(... | [
"def __len__(self):\n return self.num_tokens",
"def find_mentions(self, tokens):\r\n raise NotImplementedError()",
"def mention_tokens_length(entity: EntitySpan) -> int:\n return len(\n set(\n [\n token_idx\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Como está operación es una simple reasignacion de las propiedades head y next node, entonces toma tiempo constante Adds new Node containing data at head of the list Takes O(1) time | def add(self, data):
new_node = Node(data)
new_node.next_node = self.head # Se guarda la referencia al nodo que era la cabeza, al atributo new_node del nodo recien creado, si no hay nodo en la cabeza new_node = None
self.head = new_node # La nueva cabeza de la lista es el nodo recien añadido | [
"def add(self, data):\n new_node = Node(data)\n new_node.next_node = self.head\n self.head = new_node",
"def add_head(self, data):\r\n new_node = node(data)\r\n new_node.next = self.head\r\n self.head = new_node",
"def insert_at_head(self, data):\n temp_node = Node(data)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for the first node containing data that matches the key Returns the node or 'None' if not found Takes O(n) time | def search(self, key):
current = self.head
while current:
if current.data == key:
return current
else:
current = current.next_node
return None | [
"def find(self, key):\n if self.head is None:\n return\n itr = self.head\n while itr:\n if itr.data == key:\n return itr.data\n itr = itr.next\n return None",
"def find(self, key):\n toReturn = None\n # linear traversal and ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a new Node containing data at index position Insertion takes O(1) time but finding the node at the insertion point takes O(n) time Takes overall O(n) time | def insert(self, data, index):
if index == 0:
self.add(data)
if index > 0:
new = Node(data)
position = index # Cada que se llama a current = current.next_node, se decrementa el valor de position en 1, cuando el valor sea cero, se ha llegado al nodo que está actualmen... | [
"def insert(self, data, index):\n if index == 0:\n self.prepend(data)\n return\n\n current_index = 0\n current = self.head\n previous = None\n\n while current or previous:\n if current_index == index:\n new_node = Node(data)\n new_node.next = current\n previous.nex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove Node at specified index Returns the node or None if the index is greater than the last index in the list Takes O(n) time | def remove_index(self, index):
current = self.head
position = index
if index > (self.size() - 1):
return None
elif index == 0:
self.head = current.next_node
else:
while position >= 1:
previous = current
curre... | [
"def remove(head: Optional[ListNode], index: int) -> Optional[ListNode]:",
"def remove(self, index):\n counter = 0\n n = self\n prev = None\n while n.next:\n if counter >= index:\n n.value = n.next.value\n prev = n\n n = n.next\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the desc_line with the given sample information appended | def getMergeLine(desc_line,CC3_sample,GP2_sample):
return desc_line.strip("\n") + "" + CC3_sample + "" + GP2_sample + "\n" | [
"def summary_line_and_description():",
"def consume_description(self):\n first_description_line = self._lines[1]\n if not first_description_line:\n self.raise_error(\n \"Second line of the documentation file has to contain a short \"\n \"description. For example \\\"Word2vec text embe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
start execution trace of the target app, will block indefinitely | def start_trace(self):
# receive message from agent within app
def on_message(message, data):
"""
receives messages sent from inside the target process
"""
if message["type"] != "error":
self.q.put(message["payload"])
def on_proce... | [
"def __run(self):\n sys.settrace(self.globaltrace)\n self.__run_backup()\n self.run = self.__run_backup",
"def test_benchmark_app_start(self):\n print('\\t\\tHey! I\\'m app-start scenario!')",
"def __run(self):\n try:\n sys.settrace(self.globaltrace)\n self.__run_backup(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate log when process crashes | def on_process_crashed(crash):
print("crash", crash, crash.report) | [
"def show_crash(self):\n print(\"Crash! Oh noes!\")",
"def crashLog(name, fixme_ = True):\n\tglobal lastErrorBody\n\tlogger.error(\"crashlog %s has been written\" % name)\n\tif fixme_:\n\t\tfixme(name)\n\ttry:\n\t\tfile = \"%s/%s.txt\" % (__main__.crashDir, name)\n\t\tif not os.path.exists(__main__.crashDi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
record when process becomes detached | def on_detached(reason, crash):
print("on_detached()")
print("reason:", reason)
print("crash:", crash)
sys.exit() | [
"def _detach(self):",
"def on_terminate(proc):\n logging.debug(\"Process {} terminated with exit code {}\".format(proc, proc.returncode))",
"def detach(ob):",
"def reattach(self, pid):\n #self._control.RemoveEngineOptions(pydbgeng.DEBUG_ENGOPT_INITIAL_BREAK)\n self.attach(pid, DbgEng.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get message from df_behavior_trial Locate the row of 'MSG' and return the next content in the next row | def _get_message(df, MSG):
index_msg = df['MSG'].str.contains(MSG)
if sum(index_msg == True):
return df.loc[df.index[df['MSG'].str.contains(MSG)] + 1, 'MSG']
else:
return None | [
"def getfirstmessage(s,refconvdf):\r\n return refconvdf[(refconvdf.convid==s) & (refconvdf.part_type=='initial')].body.iloc[0]",
"def _next_message(self):\n msg = yield self._read_message()\n message = self._slack_to_chat(msg)\n\n raise gen.Return(message)",
"def get_message(self, i):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to detect if a behavior matlab file is for "delayresponse" or "multitargetlicking" task | def detect_task_type(path):
# distinguishing "delay-response" task or "multi-target-licking" task
mat = spio.loadmat(path.as_posix(), squeeze_me=True, struct_as_record=False)
GUI_fields = set(mat['SessionData'].SettingsFile.GUI._fieldnames)
if ({'X_center', 'Y_center', 'Z_center'}.issubset(GUI_fields)
... | [
"def is_task():\n return False",
"def automated(self):\n return self.plugin in ['shell', 'resource',\n 'attachment', 'local']",
"def CheckMotionTracker() -> bool:\n ...",
"def check_ball_on_target():\n\n pass",
"def get_needs_target(self):\n return se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loading routine for delayresponse task from .mat behavior data | def load_delay_response_matfile(skey, matlab_filepath):
matlab_filepath = pathlib.Path(matlab_filepath)
h2o = skey.pop('h2o')
SessionData = spio.loadmat(matlab_filepath.as_posix(),
squeeze_me=True, struct_as_record=False)['SessionData']
# parse session datetime
sessi... | [
"def load_data(self, task):\n params = self.params\n data = {splt: {} for splt in ['train', 'valid', 'test']}\n dpath = os.path.join(params.data_path, 'eval', task)\n\n self.n_sent = 1 if task in ['SST-2', 'CoLA'] else 2\n\n for splt in ['train', 'valid', 'test']:\n\n #... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find out what items are documented in the given object's docstring. See `get_documented_in_lines`. | def get_documented_in_docstring(name, module=None, filename=None):
try:
obj, real_name = import_by_name(name)
lines = pydoc.getdoc(obj).splitlines()
return get_documented_in_lines(lines, module=name, filename=filename)
except AttributeError:
pass
except ImportError, e:
... | [
"def get_documented_in_docstring(name, module=None, filename=None):\r\n try:\r\n obj, real_name = import_by_name(name)\r\n lines = pydoc.getdoc(obj).splitlines()\r\n return get_documented_in_lines(lines, module=name, filename=filename)\r\n except AttributeError:\r\n pass\r\n exc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of poll data rows, returns the most recent row with the specified pollster and state. If no such row exists, returns None. | def most_recent_poll_row(poll_rows, pollster, state):
temp_poll = poll_rows[:]
i=0
for poll in temp_poll[:]: #removes all polls with pollsters other than input
if poll['Pollster'] != pollster:
del temp_poll[i]
i -=1
i +=1
i=0
for poll in temp_poll[:]: #removes... | [
"def most_recent_poll_row(poll_rows, pollster, state):\n # in order to return None if there is no answer, we initialize res with None.\n most_recent_row = None\n # traverse all rows to find rows with indicated pollster and state\n for row in poll_rows:\n \t# if pollster and state match\n \tif poll... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
测试当访问不存在的 html 文件时返回 404 | def test_return_404_while_html_not_exist(self):
# 确认文件不存在
test_file_name = "{}.html".format(self.get_random_string(10))
self.assertFalse(is_static_file_exist(test_file_name))
# 试图读取该 html
response = self.client.get(self.unique_url.format(test_file_name))
# 返回了 404
... | [
"def test_return_404_while_not_visit_html(self):\n # Y 知道某个文件存在, 但它不是 html 文件, 想试试看能不能通过这个接口访问该文件\n test_file_name = \"{}\".format(self.get_random_string(10))\n test_file_path = os.path.join(const.STATIC_HTMLS_PATH, test_file_name)\n try:\n # Y 确保想要访问的文件是存在的\n with ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests the the default can be passed as an array for an exact 1 as long as there is only one element in the default array | def test_exactly_explicit_default_array_size_1():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
default : [default-value]
... | [
"def test_exactly_explicit_default_array_size_2():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n default : [de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that an attempt to set a default for an exact 1 with a >1 array is disallowed | def test_exactly_explicit_default_array_size_2():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
default : [default1, defaul... | [
"def test_exactly_explicit_default_array_size_1():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n default : [de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
at most, default provided, cmdline args provided, required option | def test_at_most_default_args_required():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
default : [default1, default2]
... | [
"def test_no_limit_default_count_args_required():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n default : [def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
no limit, count, default provided, cmdline args provided, required option | def test_no_limit_default_count_args_required():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
default : [default1, default... | [
"def test_no_limit_count_no_default_no_args_optional():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n multi_type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
no limit, count, no default provided, no cmdline args, optional option | def test_no_limit_count_no_default_no_args_optional():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
multi_type: no-limit
... | [
"def test_no_limit_count_no_default_args_required():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n multi_type: n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
no limit, count, no default provided, cmdline args provided, required option | def test_no_limit_count_no_default_args_required():
class TestCmdLine(CmdLine):
yaml_def = '''
supported_options:
- category:
options:
- name : test_opt
long : test-opt
opt : param
multi_type: no-limit
... | [
"def test_no_limit_count_no_default_no_args_optional():\n class TestCmdLine(CmdLine):\n yaml_def = '''\n supported_options:\n - category:\n options:\n - name : test_opt\n long : test-opt\n opt : param\n multi_type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decorator to write to current log, using the info method. | def info(func):
def decorated(*args, **kwargs):
r"""Decorated method."""
runLog.info(func(*args, **kwargs))
return decorated | [
"def log_info(info):\n log = open(log_path, 'a+')\n log.write(info + '\\n')\n log.close()",
"def info(self, *args):\n return self.logger.info(*args)",
"def logInfo(self, timestamp, info):\n self.logs['messages'].write(','.join([str(i) for i in [\n self.formatTimestamp(timestamp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decorates a method to produce a repeatable warning message. | def warn(func):
def decorated(*args, **kwargs):
"""Decorated method."""
runLog.warning(func(*args, **kwargs))
return decorated | [
"def _add_method_docstring(func=None):\n doc_string = DOCSTRING_TEMPLATE.format(EXPERIMENTAL_METHOD_MESSAGE, EXPERIMENTAL_LINK_MESSAGE)\n if func.__doc__:\n func.__doc__ = _add_note_to_docstring(func.__doc__, doc_string)\n else:\n # '>' is required. Otherwise the note section can't be generat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r"""Decorates a method to produce a warning message only on the root node. | def warn_when_root(func):
return _message_when_root(warn(func)) | [
"def warn_undefined(func):\r\n\r\n def wrapped(self, *args, **kwargs):\r\n print(\"Lexicon [{0}] did not define API method: {1}\"\r\n .format(self.__class__.__name__,\r\n func.__name__))\r\n return func(self, *args, **kwargs)\r\n\r\n return wrapped",
"def __ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drives the process of solving a maze. Takes command line parameters for the maze file and the type of agenda to be used. | def main():
filename = sys.argv[1]
agendaType = sys.argv[2]
maze = Maze(filename)
#Make the right agenda
if agendaType == 's':
agenda = StackAgenda()
elif agendaType == 'q':
agenda = QueueAgenda()
elif agendaType == 'p':
Eval = ManhattanDistanceEvaluator(maze.getGoa... | [
"def solve_maze(self, maze):",
"def solveMaze(self, maze, gui):\n #---Setup---\n\n #Stores tuples representing the locations that \n #have been added to the agenda\n added = []\n for i in range(maze.getNumRows()):\n added.append([0]*maze.getNumColumns())\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the list of excluded warnings for the specified filepath | def get_excluded_warnings(filepath):
exclwarns = list(SHELLCHECK_EXCLUDED_WARNS)
for pattern, warn in SHELLCHECK_SPECIFIC_EXCL_WARNS:
if re.match(pattern, filepath):
exclwarns.append(warn)
# Reorder the warnings
joined_exclwarns = ','.join(exclwarns)
return sorted(joined_exclwar... | [
"def get_warnings(self, path: str,\n is_ancillary: bool = False,\n is_system: bool = False,\n is_removed: bool = False) -> List[str]:",
"def find_bad_ideas(filelist):\n return [name for name in filelist\n if file_matches(name, WARN_ABOUT_FI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implement some custom rules as linting shell script | def custom_lint_rules(filepath):
result = True
with open(filepath, 'r') as stream:
for lineno, line in enumerate(stream, start=1):
# Lines must only include ASCII characters, and no tab
stripped_line = line
if stripped_line.endswith('\n'):
stripped_lin... | [
"def commands_lint():\n lint()",
"def lint(ctx):\r\n print('Running linting...')\r\n ctx.run('pylint metrics')",
"def lint(ctx):\n ctx.run(\"pylint pcf\")",
"def lint(ctx):\n ctx.run('yamllint -c .yamllint *')\n ctx.run('cd plays && yamllint -c ../.yamllint *')\n ctx.run('cd roles && ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run shellcheck on all shell files | def test():
# subprocess.check_output() has been introduced in Python 2.7
if sys.version_info < (2, 7):
print("Python version too old, skipping test.")
return 2
try:
subprocess.check_output(['shellcheck', '--version'])
except OSError as exc:
if exc.errno == errno.ENOENT:... | [
"def test_shellcheck_succeeds_verbose(self):\n stderr = io.StringIO()\n with tempfile.TemporaryDirectory() as tempdir:\n shell = os.path.join(tempdir, \"test.sh\")\n with open(shell, \"w\", encoding=\"utf-8\") as shell_file:\n shell_file.write(\"#!/bin/sh\\n\")\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the latest response given a user ID and a unit ID. | def get_latest_response(db_conn, user_id, unit_id):
query = """
SELECT *
FROM responses
WHERE user_id = %(user_id)s AND unit_id = %(unit_id)s
ORDER BY created DESC
LIMIT 1;
"""
params = {
'user_id': convert_slug_to_uuid(user_id),
'unit_id': convert_slug_to_uuid(unit_id),
}
return ... | [
"def get_last_user_match(self, user):\n\n user_id = self.get_user_id(user)\n endpoint = f\"users/{user_id}/recent\"\n response = self._api_request(endpoint)\n if response is not None and response != []:\n return response",
"def get_latest_user_routine(user_id):\n return (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
processManager manages os processes clientManager manages engine clientsessions | def __init__(self, processManager, clientManager):
self.processManager = processManager
self.clientManager = clientManager
self.engine_types = {}
self.engine_allocations = {}
self.engine_instances = {} | [
"def _spawn_gpu_client_wrapper(server_ip, port, authkey, \n processes_per_gpu, gpu_id, shared_arr):\n logging.debug('Spawning GPU client')\n os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_id) #Only this GPU visible\n\n manager_creds = (server_ip, port, authkey)\n for i in range(processes_per_gpu):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new access id for running engines of given type. return access_id | def allocateEngine(self, engine_type):
if engine_type not in self.engine_types.keys():
raise KeyError("%s is not a recognized engine type" % engine_type)
access_id = uuid.uuid4().hex
self.engine_allocations[access_id] = engine_type
log.msg('Allocated engine access id: %s for ... | [
"def new_id(self, view, response_type):\n\n with self._lock:\n if self._id >= self.MAX_ID:\n self._id = -1\n self._id += 1\n self.request_ids[view.id()][str(self._id)] = response_type\n return str(self._id)",
"def generate_id(self, portal_type, bat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Log frames containing warning chars to pcap file | def log_frame(frame, logfile=PCAP_LOG):
global frame_count
frame_count += 1
pcap_logger = PcapWriter(logfile, append=True)
pcap_logger.write(frame)
pcap_logger.close() | [
"def pcap():",
"def __sniff_callback(self, pkt):\n # append pkt to the packets list\n self.capture_packets.append(pkt)\n if self.verbose:\n self.logger.info(pkt.show())\n else:\n self.logger.info(pkt.summary())",
"def sniffer():\n try:\n sniff(iface=IN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse and print DHCP options parse for malicious chars highlight offending options | def parse_dhcp_opt(options):
char_found = False
print(" - DHCP -")
for option in options:
warn = False
if type(option) is tuple:
opt_name = option[0]
opt_value = format(option[1])
if any((char in WARNCHARS) for char in opt_value):
... | [
"def parse_dhcp_options(stream):\n magic_cookie = stream.read(4)\n if magic_cookie != DHCP_MAGIC_COOKIE:\n print('DHCP Magic cookie is not found!')\n return\n print('=====================================================')\n print('DHCP options')\n print('================================... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse and print BOOTP fields parse for malicious chars highlight offending fields | def parse_bootp_fields(bootp_fields):
char_found = False
print(" - BOOTP -")
for field_name in bootp_fields.keys():
warn = False
field_value = format(bootp_fields[field_name])
if any((char in WARNCHARS) for char in field_value):
char_found, warn = True, True
... | [
"def decode_field(field):\r\n field = field.replace('\\r\\n','')\r\n field = field.replace('\\n','')\r\n\r\n list = email.Header.decode_header (field)\r\n\r\n decoded = \" \".join([\"%s\" % k for (k,v) in list])\r\n\r\n #print \"Decoding [%s] to [%s]\" % (field, decoded)\r\n\r\n return decoded",
"def clean_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse and print DHCP Frames parse sniffed DHCP frames print summary of client requests parse and print server replies log malicious frames | def print_frame(frame):
if 'DHCP' in frame:
bootp_fields = frame[BOOTP].fields
dhcp_options = frame[DHCP].options
type_value = dhcp_options[0][1]
type_name = scapy.layers.dhcp.DHCPTypes[type_value]
print("\n\nFRAME: {}".format(frame.summary()))
print("TYPE: DHCP-{... | [
"def print_packets(pcap):\n # For each packet in the pcap process the contents\n i=0\n for timestamp, buf in pcap:\n\n # Print out the timestamp in UTC\n print '[%d] Timestamp: %s' %(i,str(datetime.datetime.utcfromtimestamp(timestamp)))\n i += 1\n # Unpack the Ethernet frame (ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate scapy sniffer with DHCP filters | def sniffer():
try:
sniff(iface=INTERFACE, prn=print_frame, filter='udp and (port bootps or bootps)', store=0)
except Exception as _e:
print("ERROR - sniffer(): {} {}".format(_e.args, _e.message)) | [
"def detect_parserDhcp(self, pkt):\r\n\t\tif DHCP in pkt:\r\n\t\t\t# Set up base packet\r\n\t\t\tif pkt[IP].src == \"0.0.0.0\":\r\n\t\t\t\traw=Ether()/IP()/UDP(sport=67,dport=68)/BOOTP()/DHCP()\r\n\t\t\t\traw[Ether].src, raw[IP].src = self.myMAC, self.myIP\r\n\t\t\t\traw[Ether].dst, raw[IP].dst = pkt[Ether].src, \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run Genotype Concordance installed in a Docker image. | def run_concordance(reference, eval_file, truth_file, output_file):
user_name = os.path.expanduser('~')
# Give Docker access to local system.
docker_permission = user_name + ':' + user_name
docker_url = 'us.gcr.io/broad-gotc-prod/genomes-in-the-cloud:2.3.2-1510681135'
cmd = ['docker', 'run', '-i', ... | [
"def make_genotype(args, db):\n script_file = \"/{}/{}/Scripts/8_{}_genotype_gvcf.sh\".format(\n db[\"out_dir\"], args.name, args.name\n )\n with open(script_file, \"w\") as fout:\n fout.write(\"#!/bin/bash\\n\")\n fout.write(\"set -e\\n\")\n fout.write(\"##-------------\\n\")\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process Concordance summary TSV output file. | def process_output_tsv(output_tsv, threshold=None, print_dict=False):
# Set default
if threshold is None:
threshold = 0.95
L = [] # list to capture results
try:
with open(output_tsv, newline='') as csvfile:
file_reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
... | [
"def summarize_tsvs(\n self,\n tsv_dir,\n dd,\n prefix=\"\",\n outlier_threshold=10,\n omit_props=[\n \"project_id\",\n \"type\",\n \"id\",\n \"submitter_id\",\n \"case_submitter_id\",\n \"case_ids\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get segmentation masks from mask_pred and bboxes. | def get_seg_masks(self, mask_pred, det_bboxes, det_labels,
ori_shape, scale_factor, rescale):
if isinstance(mask_pred, torch.Tensor):
mask_pred = mask_pred.sigmoid().cpu().numpy()
assert isinstance(mask_pred, np.ndarray)
# when enabling mixed precision training,... | [
"def bg_mask(query_imgs, method):\n print(\"Obtaining masks\")\n segmentation_method = get_method(method)\n return [segmentation_method(img) for img in query_imgs]",
"def generate_segmentation_from_masks(masks,\n detected_boxes,\n im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the mask scores. mask_score = bbox_score mask_iou | def get_mask_scores(self, mask_iou_pred, det_bboxes, det_labels):
inds = range(det_labels.size(0))
mask_scores = 0.3*mask_iou_pred[inds, det_labels +
1] +det_bboxes[inds, -1]
mask_scores = mask_scores.cpu().numpy()
det_labels = det_labels.cpu().numpy()... | [
"def get_mask_bbox_and_score(yolact_net: Yolact, img, threshold=0.0, max_predictions=1):\n with torch.no_grad():\n frame = torch.from_numpy(img).cuda().float()\n batch = FastBaseTransform()(frame.unsqueeze(0))\n preds = yolact_net(batch)\n\n h, w, _ = img.shape\n\n save = cfg.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the decode raises when serialization format not understood. | def test_decode_raises_when_format_unknown(thing):
with pytest.raises(ValueError):
decode(thing) | [
"def test_decode_errors(self):\n nt.assert_raises(ValueError, self.import_cls.decode,\n self._invalid_encoded[0], self.typedef)",
"def test_deserialize_error(self):\n nt.assert_raises(TypeError, self.instance.deserialize, self)",
"def test_decode(self):\n pass # TOD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the index of the first 'x' character | def index_of_x(word: str, position=0):
if word[position] == 'x':
return position
else:
return index_of_x(word, position + 1) | [
"def _get_charindex(self, x, y):\r\n verts = self.shapes[0].buf[0].vertices\r\n x = x - self.x + verts[2][0]\r\n y = y - self.y + verts[0][1]\r\n nv = len(verts)\r\n for i in range(0, nv, 4):\r\n vtr = verts[i] # top right\r\n vbl = verts[i + 2] # bottom left\r\n if x >= vbl[0] and x <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |