query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Get constraint data dict from nodes | def get_data(nodes=[]):
# get nodes
if not nodes:
nodes = mc.ls(sl=1)
# decipher if the nodes are constraints themselves or are driven by constraints
nodes = mc.ls(nodes)
constraints = [n for n in nodes if mc.nodeType(n) in constraint_types]
non_con_nodes = [n for n in nodes if n not i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constraintData(self):\n pass",
"def parameter_constraint_to_dict(\n parameter_constraint: ParameterConstraint,\n) -> Dict[str, Any]:\n return {\n \"__type\": parameter_constraint.__class__.__name__,\n \"constraint_dict\": parameter_constraint.constraint_dict,\n \"bound\": pa... | [
"0.70437974",
"0.6072568",
"0.60038877",
"0.5939663",
"0.59330326",
"0.58190125",
"0.57398844",
"0.5689007",
"0.56521726",
"0.5619958",
"0.55545074",
"0.5500483",
"0.54879296",
"0.5443988",
"0.542784",
"0.5423717",
"0.5393943",
"0.5377367",
"0.53503394",
"0.5332884",
"0.53328... | 0.7480415 | 0 |
Createa constraint based on skin weights for the closest vert | def weighted_constraint(mesh=None, nodes=None, values=[]):
if not mesh and not nodes:
nodes = mc.ls(sl=1)[:-1]
mesh = mc.ls(sl=1)[-1]
nodes = mc.ls(nodes)
cpom = mc.createNode('closestPointOnMesh')
shape = utils.get_shapes(mesh)[0]
mc.connectAttr(shape+'.outMesh', cpom+'.inMesh')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(w):\n shape = w.shape\n if len(shape) == 4:\n i, o, u, v = shape\n k = np.sqrt(6 / (i * u * v + o * u * v))\n w.data.uniform_(-k, k)\n elif len(shape) == 2:\n k = np.sqrt(6 / sum(shape))\n w.data.uniform_(-k, k)\n elif len(shape) == 1:\n w.data.zero_()",
"def constrain(v2,w,... | [
"0.6125937",
"0.59955776",
"0.5916796",
"0.57224923",
"0.54969424",
"0.54876375",
"0.54403734",
"0.5395376",
"0.53930336",
"0.5391932",
"0.53790885",
"0.5378257",
"0.53729653",
"0.5357594",
"0.5354269",
"0.5343198",
"0.5334002",
"0.53318983",
"0.5300531",
"0.5278909",
"0.5277... | 0.67353326 | 0 |
Function which decides the input method for Robot. Compatible to accept commands as input string or from yaml file. This function calls the main function of Robot class. | def test_robo():
print(
"Choose the option of input:\n"
"1. Enter the command string\n"
"2. Select from input file"
)
option = input("Enter 1 or 2 to select the input method:")
# Wait till the right option is chosen.
while not (option == "1" or option == "2"):
print("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n user_interaction()",
"def handle_input(self):\n\n\t\tline = sys.stdin.readline().strip()\n\n\t\tif line == '':\n\t\t\t# print('')\n\t\t\tself.print_prompt()\n\t\t\treturn\n\n\t\tcommand_name, *parts = line.split()\n\n\t\tif command_name in self.commands:\n\t\t\t# Call given command and unpack pa... | [
"0.6349772",
"0.6335408",
"0.6316384",
"0.6315123",
"0.6307902",
"0.62155265",
"0.6192327",
"0.61520827",
"0.61512583",
"0.6110814",
"0.610062",
"0.60681754",
"0.6027492",
"0.6017538",
"0.60056025",
"0.59385794",
"0.59364855",
"0.5922404",
"0.59193003",
"0.59154475",
"0.59010... | 0.73557687 | 0 |
Resets epsilon to start value. | def reset(self):
self.epsilon = self.epsilon_start | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.epsilon = self.start",
"def reset_exploration(self, epsilon = None):\n self.epsilon=epsilon if epsilon is not None else self.initial_epsilon",
"def set_epsilon(self,epsilon):\r\n\t\tself.epsilon = epsilon",
"def set_epsilon(value):\n global _EPSILON\n _EPSILON = value"... | [
"0.88655156",
"0.8027763",
"0.7377494",
"0.6969341",
"0.6963807",
"0.6912402",
"0.65995467",
"0.64882356",
"0.6456382",
"0.6421832",
"0.6214608",
"0.6184602",
"0.6158076",
"0.6067639",
"0.6064254",
"0.6030352",
"0.602945",
"0.60098165",
"0.5997421",
"0.5994664",
"0.59726125",... | 0.87964314 | 1 |
Generates plots and results table. | def generate_results(self, test_no, test_dict):
g_s = gridspec.GridSpec(4, 2, wspace=0.2, hspace=1.5)
fig = plt.figure(figsize=(20, 6))
fig.suptitle('Experiment Results', y=0.93)
x_val = np.arange(1, self.iters+1)
ax1 = plt.subplot(g_s[0:3, :1], label = 'Mean Rewards')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resultPlots(record):\n record.createDataFrames()\n \n atmPlot(record)\n clientPlot(record)\n transactionPlot(record)",
"def generate(self):\n\n # Load the required datapoints into memory.\n self._load_results()\n\n # Calculate datapoints statistics, like min. and max. valu... | [
"0.7053643",
"0.7040948",
"0.6688554",
"0.66333634",
"0.6588418",
"0.6542565",
"0.6527027",
"0.6511612",
"0.65061325",
"0.6497761",
"0.64887476",
"0.6440931",
"0.64290524",
"0.6418763",
"0.6348328",
"0.6322188",
"0.6316364",
"0.6314798",
"0.62652737",
"0.62249535",
"0.6214492... | 0.7241356 | 0 |
executes a git command in a shell. Default for cwd is self.checkoutDir() | def __git(self, command, args=None, logCommand=False, **kwargs):
parts = ["git"]
if "stdout" not in kwargs and "stderr" not in kwargs and CraftCore.settings.getboolean("General", "AllowAnsiColor", True):
parts += ["-c", "color.ui=always"]
if command in ("clone", "checkout", "fetch", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git(ctx, commands):\n\n # create local copies of ctx vaiables for easy access\n gitCommand = ctx.obj[\"gitCommand\"]\n\n system(gitCommand + \" \".join(commands))",
"def run(self, command):\n cmd = ['git', '--git-dir=' + self.repo_path] + command\n print cmd if self.debug else ''\n ... | [
"0.7360717",
"0.73109037",
"0.71119916",
"0.70915276",
"0.6989071",
"0.6986336",
"0.69762886",
"0.69558525",
"0.6945554",
"0.68844825",
"0.6875995",
"0.6858946",
"0.6827908",
"0.68192035",
"0.6735062",
"0.66058344",
"0.6594448",
"0.6534932",
"0.6516921",
"0.65023637",
"0.6460... | 0.7572365 | 0 |
create patch file from git source into the related package dir. The patch file is named autocreated.patch | def createPatch(self):
CraftCore.debug.trace("GitSource createPatch")
patchFileName = os.path.join(
self.packageDir(),
"%s-%s.patch" % (self.package.name, str(datetime.date.today()).replace("-", "")),
)
CraftCore.log.debug("git diff %s" % patchFileName)
wi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_patch(self, patch):\n # Remove Chromium WPT directory prefix.\n patch = patch.replace(RELATIVE_WPT_TESTS, '')\n try:\n self.run(['git', 'apply', '-'], input=patch)\n self.run(['git', 'add', '.'])\n except ScriptError as error:\n return error.me... | [
"0.6360771",
"0.6336102",
"0.63334274",
"0.6012245",
"0.5874859",
"0.57950914",
"0.57748085",
"0.5766588",
"0.57510704",
"0.5739213",
"0.5696181",
"0.5687508",
"0.5686197",
"0.5678546",
"0.56740576",
"0.56015205",
"0.5573377",
"0.5567003",
"0.5558287",
"0.5543148",
"0.5530956... | 0.6997215 | 0 |
The dimensions of precisionrecall pairs and the threshold array as returned by the precision_recall_curve do not match. See | def precision_recall_curve_padded_thresholds(*args, **kwargs):
precision, recall, thresholds = precision_recall_curve(*args, **kwargs)
pad_threshholds = len(precision) - len(thresholds)
return np.array(
[
precision,
recall,
np.pad(
thresholds.ast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_recall(conf_matrix):\n tp_count, fp_count, fn_count, tn_count = conf_matrix[0][0], conf_matrix[0][1], conf_matrix[1][0], conf_matrix[1][1]\n\n precision = tp_count / (tp_count + fp_count)\n recall = tp_count / (tp_count + fn_count)\n\n return precision, recall",
"def get_recall_precisio... | [
"0.7177185",
"0.7045364",
"0.7026384",
"0.6845471",
"0.68372846",
"0.6829216",
"0.6818164",
"0.67471033",
"0.6685049",
"0.6655031",
"0.64583284",
"0.6440449",
"0.6434439",
"0.64254624",
"0.6418355",
"0.63954383",
"0.63170344",
"0.6279185",
"0.6272634",
"0.62675256",
"0.625429... | 0.7098985 | 1 |
Make targets strictly positive | def _require_positive_targets(y1, y2):
offset = abs(min(y1.min(), y2.min())) + 1
y1 += offset
y2 += offset
return y1, y2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def positive_only(self):\n return True",
"def positive_only(self):\n return True",
"def positive_only(self):\n return True",
"def valid(self, target):",
"def targets(self):\n\n # Targets that fail but shouldn't\n known_failing_targets = [\n # The following two targets lose o... | [
"0.59984267",
"0.59984267",
"0.59984267",
"0.58637863",
"0.5815451",
"0.5749692",
"0.5749692",
"0.57089037",
"0.5687763",
"0.56191564",
"0.5577372",
"0.55345124",
"0.5507527",
"0.5447105",
"0.5383453",
"0.53730214",
"0.5350992",
"0.52590424",
"0.52590424",
"0.52262294",
"0.51... | 0.64070714 | 0 |
check that classification metrics raise a message mentioning the occurrence of nonfinite values in the target vectors. | def test_classification_inf_nan_input(metric, y_true, y_score):
if not np.isfinite(y_true).all():
input_name = "y_true"
if np.isnan(y_true).any():
unexpected_value = "NaN"
else:
unexpected_value = "infinity or a value too large"
else:
input_name = "y_pred"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_values():\n print('Missings in the train data:', train_data.isnull().sum())",
"def test_finite(self):\n \n Number_of_tests = 1000\n low = -1000\n high = 1000\n for i in range(Number_of_tests):\n x = np.random.rand(100) * (high - low) + low\n ... | [
"0.6438101",
"0.6411278",
"0.62651026",
"0.6160963",
"0.6084372",
"0.60842276",
"0.60797584",
"0.60657775",
"0.60273814",
"0.6019546",
"0.59126544",
"0.589477",
"0.58779985",
"0.58508164",
"0.5836745",
"0.58350015",
"0.5830911",
"0.5821118",
"0.58208275",
"0.5768468",
"0.5766... | 0.65006435 | 0 |
check that classification metrics raise a message of mixed type data with continuous/binary target vectors. | def test_classification_binary_continuous_input(metric):
y_true, y_score = ["a", "b", "a"], [0.1, 0.2, 0.3]
err_msg = (
"Classification metrics can't handle a mix of binary and continuous targets"
)
with pytest.raises(ValueError, match=err_msg):
metric(y_true, y_score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_classification_targets(y):\n y_type = type_of_target(y, input_name=\"y\")\n if y_type not in [\n \"binary\",\n \"multiclass\",\n \"multiclass-multioutput\",\n \"multilabel-indicator\",\n \"multilabel-sequences\",\n ]:\n raise ValueError(\n f\"... | [
"0.6594545",
"0.64862955",
"0.62285316",
"0.60964245",
"0.60808975",
"0.60102844",
"0.59003997",
"0.5853006",
"0.58280003",
"0.5825424",
"0.57894194",
"0.5788618",
"0.5787642",
"0.5773951",
"0.5771396",
"0.56868845",
"0.5620121",
"0.5615081",
"0.56033576",
"0.5603051",
"0.559... | 0.7111422 | 0 |
Return a callable which creates a person object that can be updated. Supports user defined fields and sets a default keyword if `keywords` is not in the parameters of the call. | def UpdateablePersonFactory(FullPersonFactory):
def create_updateable_person(address_book, **kw):
kw.setdefault('keywords', [KEYWORD])
kw.setdefault('last_name', u'Tester')
return FullPersonFactory(address_book, **kw)
return create_updateable_person | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyword(name=None, tags=(), types=()):\n if callable(name):\n return keyword()(name)\n def decorator(func):\n func.robot_name = name\n func.robot_tags = tags\n func.robot_types = types\n return func\n return decorator",
"def create_new_user_data(**kwargs):\n def... | [
"0.5400883",
"0.53153026",
"0.53041524",
"0.53041524",
"0.5276233",
"0.52353495",
"0.5226128",
"0.5195242",
"0.5155661",
"0.507684",
"0.50046766",
"0.4962522",
"0.49387676",
"0.48240638",
"0.48214936",
"0.47685045",
"0.47537813",
"0.47447437",
"0.47405836",
"0.4734416",
"0.47... | 0.68439317 | 0 |
Callable to create an address on a person with a user defined field. | def AddressWithUserdefinedFieldFactory(
FieldFactory, UpdateablePersonFactory, PostalAddressFactory):
def _create_user_defined_field(address_book, field_type, field_value):
"""Create a user defined field."""
field_name = FieldFactory(
address_book, IPostalAddress, field_type, u'd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user_defined_field(address_book, field_type, field_value):\n field_name = FieldFactory(\n address_book, IPostalAddress, field_type, u'distance').__name__\n return PostalAddressFactory(\n UpdateablePersonFactory(address_book),\n **{field_name: field_value, ... | [
"0.7393865",
"0.7069152",
"0.682421",
"0.631667",
"0.6210216",
"0.6196198",
"0.61848956",
"0.6167021",
"0.61465275",
"0.6129168",
"0.6079628",
"0.5980542",
"0.58793825",
"0.58434254",
"0.58158636",
"0.57581687",
"0.5749973",
"0.57140684",
"0.5684215",
"0.5676395",
"0.5659123"... | 0.71297646 | 1 |
Update a field using the update search result handler. | def _update_field_value(browser, field_name, operator, value):
browser.login('mgr')
browser.keyword_search(KEYWORD, apply='Update')
browser.getControl('field').displayValue = [field_name]
browser.getControl('Next').click()
assert '' == browser.getControl('new value', index=0).value
browser.getCo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_field(\n self, field, value,\n ):\n temp_cursor = user_db.cursor()\n\n sql = \"UPDATE users\"\n sql += \" SET \" + field + \"=\" + str(value)\n\n sql += \" WHERE user_id=\" + str(self.user_id)\n\n temp_cursor.execute(sql)\n user_db.commit()",
"def up... | [
"0.6401106",
"0.60057586",
"0.59916824",
"0.5973628",
"0.5966384",
"0.5964902",
"0.5928277",
"0.58825725",
"0.585317",
"0.583106",
"0.5822529",
"0.5819091",
"0.5819091",
"0.5819091",
"0.5806329",
"0.57792884",
"0.57773316",
"0.5771272",
"0.57196146",
"0.5705538",
"0.56900096"... | 0.6470587 | 0 |
Testing updating selected persons end to end. The `update` search result handler allows to update a single field on each selected person. | def test_update__endtoend__1(search_data, browser):
# The `searchDataS` fixture defines some persons. When user searches for
# them all persons are selected by default so he only has to select the
# `update` search handler to perform a multi-update:
browser.login('mgr')
browser.keyword_search('famil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update__endtoend__11(address_book, UpdateablePersonFactory, browser):\n UpdateablePersonFactory(address_book)\n browser.login('mgr')\n browser.keyword_search(KEYWORD, apply='Update')\n assert browser.SEARCH_MULTI_UPDATE_URL == browser.url\n browser.getLink('New value').click()\n # 'choos... | [
"0.7430819",
"0.69998205",
"0.6998001",
"0.6983694",
"0.68675244",
"0.68042016",
"0.6523261",
"0.64835125",
"0.6449616",
"0.6244706",
"0.6011932",
"0.5998935",
"0.58157665",
"0.5808363",
"0.58065355",
"0.5791431",
"0.57354134",
"0.5734665",
"0.5731401",
"0.5726929",
"0.565496... | 0.7768187 | 0 |
Read 4 bytes from bytestream as an unsigned 32bit integer. | def read32(bytestream):
dt = np.dtype(np.uint32).newbyteorder('>')
return np.frombuffer(bytestream.read(4), dtype=dt)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_uint32(self):\n bytes = self.data[:4]\n value = struct.unpack('!I',bytes)[0]\n self.data = self.data[4:]\n return value",
"def unpack_uint32(data):\n value = unpack(DecodeUtils.UINT32_BYTE_FORMAT, data[:4])[0]\n return value, 4",
"def read_unsigned_integer(str... | [
"0.7764733",
"0.7361928",
"0.7304455",
"0.6996784",
"0.68899184",
"0.67665434",
"0.6765091",
"0.6747844",
"0.6713622",
"0.6712828",
"0.67116296",
"0.6684468",
"0.6629096",
"0.6596656",
"0.65930814",
"0.65405184",
"0.6491143",
"0.6475231",
"0.6475231",
"0.6444568",
"0.64432913... | 0.81424654 | 0 |
Validate that filename corresponds to images for the MNIST dataset. | def check_image_file_header(filename):
with tf.gfile.Open(filename, 'rb') as f:
magic = read32(f)
read32(f) # num_images, unused
rows = read32(f)
cols = read32(f)
if magic != 2051:
raise ValueError('Invalid magic number %d in MNIST file %s' % (magic,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_filename(self, imageNode):\r\n src = self.parser.getAttribute(imageNode, attr='src')\r\n\r\n if not src:\r\n return False\r\n\r\n if self.badimages_names_re.search(src):\r\n return False\r\n\r\n return True",
"def mnist_load_data(filename):\n if o... | [
"0.6571455",
"0.62567854",
"0.6208449",
"0.6137936",
"0.6122926",
"0.6114612",
"0.61064625",
"0.60818136",
"0.6076604",
"0.60707283",
"0.6031662",
"0.59970605",
"0.5982299",
"0.5933079",
"0.5903147",
"0.5903147",
"0.5902522",
"0.5882424",
"0.58823997",
"0.5865337",
"0.5864556... | 0.6859351 | 0 |
Validate that filename corresponds to labels for the MNIST dataset. | def check_labels_file_header(filename):
with tf.gfile.Open(filename, 'rb') as f:
magic = read32(f)
read32(f) # num_items, unused
if magic != 2049:
raise ValueError('Invalid magic number %d in MNIST file %s' % (magic,
f.name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_labels(labels, path):\n for labels_ in labels.values():\n for label in labels_:\n for ann in label['annotations']:\n assert len(ann['segmentation']) == 1\n assert len(ann['segmentation'][0]) % 2 == 0\n\n label['annotations'] = [\n ... | [
"0.686314",
"0.64928204",
"0.6462075",
"0.6462075",
"0.6413076",
"0.63884455",
"0.63049984",
"0.62967056",
"0.62794524",
"0.60648185",
"0.6048848",
"0.60412973",
"0.60336256",
"0.6025829",
"0.6025829",
"0.60169697",
"0.6010687",
"0.6005794",
"0.60035473",
"0.5995454",
"0.5992... | 0.7116731 | 0 |
return interpolated value at x_value. | def return_interpolated(self, x_value):
return(self.interpolator(x_value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, x):\n if isinstance(x, (float,int)):\n return self._values[x >= self._boundaries[:-1]][-1]\n else:\n a = array([self._values[xi >= self._boundaries[:-1]][-1]\n for xi in x])\n return a",
"def forward(self, x):\n\n x, _ = ... | [
"0.62994534",
"0.62738",
"0.625843",
"0.62478894",
"0.6244222",
"0.60957986",
"0.6045555",
"0.60391104",
"0.59283876",
"0.59247386",
"0.5880117",
"0.587197",
"0.5866072",
"0.5864174",
"0.58335346",
"0.5822205",
"0.5817974",
"0.57609636",
"0.5758676",
"0.5747015",
"0.57192165"... | 0.8097388 | 0 |
Helper function to make a panel in a coplanar array with each panel size 1/3 that of a reference panel | def make_panel_in_array(array_elt, reference_panel):
px_size = tuple((e / 3.0) for e in reference_panel.get_pixel_size())
ref_panel_size = reference_panel.get_image_size_mm()
x_shift = array_elt[0] * ref_panel_size[0] / 3.0
y_shift = array_elt[1] * ref_panel_size[1] / 3.0
origin = (
matrix.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crops(fields, anchor, crop, pad, size):\n ndim = len(size)\n assert all(len(x) == ndim for x in [anchor, crop, pad, size]), 'inconsistent ndim'\n new_fields = []\n for x in fields: #loop over channel dim\n ind = []\n for d, (a, c, (p0, p1), s) in enumerate(zip(anchor, crop, pad, size)... | [
"0.6044476",
"0.5521001",
"0.5500463",
"0.5488002",
"0.54320145",
"0.5386694",
"0.5289494",
"0.52782965",
"0.52524984",
"0.52480334",
"0.5247042",
"0.5242243",
"0.52119774",
"0.5211629",
"0.52066433",
"0.5182709",
"0.51787245",
"0.5156228",
"0.5142947",
"0.51313376",
"0.51187... | 0.6294305 | 0 |
Parse quicklook key and return dictionary with relevant fields. | def parse_quicklook_key(key: str) -> Dict[str, Any]:
# Example input
# CBERS4/AWFI/155/135/CBERS_4_AWFI_20170515_155_135_L2/CBERS_4_AWFI_20170515_155_135.jpg
match = re.search(
r"(?P<satellite>\w+)/(?P<camera>\w+)/"
r"(?P<path>\d{3})/(?P<row>\d{3})/(?P<scene_id>\w+)/",
key,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_key(self): # type: () -> Key\n if self._current in \"\\\"'\":\n return self._parse_quoted_key()\n else:\n return self._parse_bare_key()",
"def massage_key(key):\n return {\n 'fingerprint': key['key_fingerprint'].lower(),\n 'bundle': key['bundle']\n... | [
"0.6082025",
"0.5916208",
"0.590867",
"0.58471656",
"0.57777387",
"0.5753092",
"0.5669977",
"0.5489895",
"0.548438",
"0.54202235",
"0.5391612",
"0.5371063",
"0.53602976",
"0.5334239",
"0.5333832",
"0.53004164",
"0.5277448",
"0.5248655",
"0.5242493",
"0.52137",
"0.52116174",
... | 0.74221236 | 0 |
Get S3 keys associated with quicklook key parameter. | def get_s3_keys(quicklook_key: str) -> Dict[str, Any]:
qdict = parse_quicklook_key(quicklook_key)
stac_key = "%s/%s/%s/%s/%s.json" % ( # pylint: disable=consider-using-f-string
qdict["satellite"],
qdict["camera"],
qdict["path"],
qdict["row"],
qdict["scene_id"],
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_s3_keys(bucket, user_keys = None):\n keys = []\n if user_keys is None:\n \t\t\t\ts3 = boto3.client('s3')\n else:\n s3 = boto3.client('s3', \n aws_access_key_id = user_keys[\"AWS_ACCESS_KEY_ID\"], \n aws_secret_access_key = user_keys[\"AWS_SECRET_... | [
"0.7384405",
"0.7163892",
"0.71329665",
"0.701475",
"0.6726322",
"0.67005897",
"0.6663235",
"0.65278846",
"0.65127945",
"0.6482005",
"0.6465305",
"0.6387323",
"0.6341063",
"0.6307114",
"0.6284778",
"0.62729806",
"0.61814356",
"0.61357737",
"0.61347544",
"0.6128975",
"0.608652... | 0.7384762 | 0 |
Generator for SQS messages. | def sqs_messages(queue: str) -> Generator[Dict[str, Any], None, None]:
while True:
response = get_client("sqs").receive_message(QueueUrl=queue)
if "Messages" not in response:
break
msg = json.loads(response["Messages"][0]["Body"])
records = json.loads(msg["Message"])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve(self) -> Iterator[SQSMessage]:\n while True:\n try:\n sqs = SQSClientFactory(boto3).from_env()\n\n res = sqs.receive_message(\n QueueUrl=self.queue_url,\n WaitTimeSeconds=3,\n MaxNumberOfMessages=1... | [
"0.6854295",
"0.6330741",
"0.61476904",
"0.6069466",
"0.6009515",
"0.59055346",
"0.58809954",
"0.58128715",
"0.57569534",
"0.5734821",
"0.5725298",
"0.57091045",
"0.5602781",
"0.54929364",
"0.54734814",
"0.54486865",
"0.5429155",
"0.54232424",
"0.5422562",
"0.5416486",
"0.541... | 0.73161376 | 0 |
Builds SNS message attributed from stac_item dictionary | def build_sns_topic_msg_attributes(stac_item):
message_attr = {
"properties.datetime": {
"DataType": "String",
"StringValue": stac_item["properties"]["datetime"],
},
"bbox.ll_lon": {"DataType": "Number", "StringValue": str(stac_item["bbox"][0])},
"bbox.ll_lat"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_msg(self, tr_id, payload, confirm, expire_time, encoding):\n tmp = [\"<SSAP_message><transaction_type>INSERT</transaction_type>\",\n \"<message_type>REQUEST</message_type>\"]\n tmp.extend([\"<transaction_id>\", str(tr_id), \"</transaction_id>\"])\n tmp.extend([\"<node... | [
"0.56322813",
"0.5456081",
"0.5316687",
"0.5304099",
"0.5295282",
"0.5092808",
"0.5092808",
"0.50609946",
"0.49418822",
"0.4935344",
"0.4931676",
"0.48930132",
"0.4885954",
"0.48583606",
"0.4842466",
"0.4825038",
"0.48026422",
"0.47572228",
"0.46984693",
"0.46895206",
"0.4685... | 0.8534924 | 0 |
Process a single message. Generate STAC item, send STAC item to SNS topic, write key into DynamoDB table and, optionally, send key to queue for further processing. | def process_message(
msg: Dict[str, Any],
buckets,
sns_target_arn: str,
catalog_update_queue: str,
catalog_update_table: str,
) -> None:
LOGGER.info(msg["key"])
metadata_keys = get_s3_keys(msg["key"])
thumbnail_extension = msg["key"].split(".")[-1]
assert metadata_keys["quicklook_k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process( self, message ) :\n try:\n spot_request_msg = SpotRequestMsg( raw_json=message.get_body() )\n spot_request_uuid = spot_request_msg.spot_request_uuid\n spot_master_uuid = spot_request_msg.spot_master_uuid\n logger.info( fmt_request_uuid_msg_hdr( spot_r... | [
"0.58600473",
"0.574615",
"0.5664267",
"0.56185806",
"0.5555636",
"0.55499625",
"0.55150265",
"0.5389813",
"0.5378645",
"0.5377866",
"0.5342999",
"0.5342999",
"0.5334736",
"0.53345",
"0.5312959",
"0.52982527",
"0.52956015",
"0.5295587",
"0.5269281",
"0.52507263",
"0.5239697",... | 0.64904517 | 0 |
Generate a catalog structure update request by recording register into DynamoDB table. | def catalog_update_request(table_name: str, stac_item_key: str):
get_client("dynamodb").put_item(
TableName=table_name,
Item={
"stacitem": {"S": stac_item_key},
"datetime": {"S": str(datetime.datetime.now())},
},
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_update(stmt, schema, path, rpc=None):\n if path:\n path_params = get_input_path_parameters(path)\n put = {}\n generate_api_header(stmt, put, 'Update', path)\n # Input parameters\n if path:\n put['parameters'] = create_parameter_list(path_params)\n else:\n put['pa... | [
"0.54146343",
"0.5265244",
"0.48694953",
"0.48038402",
"0.4802406",
"0.46908852",
"0.4679895",
"0.4667081",
"0.46571997",
"0.46475652",
"0.4600768",
"0.45413363",
"0.45384893",
"0.45382532",
"0.45070976",
"0.4487436",
"0.44852868",
"0.44800204",
"0.44756076",
"0.44588524",
"0... | 0.53720206 | 1 |
Load band gap dataset. Contains 4604 experimentally measured band gaps for inorganic crystal structure compositions. In benchmark studies, random forest models achieved a mean average error of 0.45 eV during fivefold nested cross validation on this dataset. For more details on the dataset see [1]_. For more details on ... | def load_bandgap(
featurizer: Union[dc.feat.Featurizer,
str] = dc.feat.ElementPropertyFingerprint(),
splitter: Union[dc.splits.Splitter, str, None] = 'random',
transformers: List[Union[TransformerGenerator, str]] = ['normalization'],
reload: bool = True,
data_dir: Optional[str]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testViewGapData(self):\n try:\n entryD = self.__mU.doImport(self.__instanceSavePath, fmt=\"pickle\")\n gapCountList = []\n gapLengthList = []\n entryCountD = {}\n for entryId in entryD:\n for _, eD in entryD[entryId][\"selected_polyme... | [
"0.5837059",
"0.5821639",
"0.5614",
"0.5585024",
"0.5576678",
"0.5471827",
"0.5462196",
"0.5414216",
"0.5394205",
"0.52827525",
"0.5206792",
"0.5154001",
"0.5131162",
"0.5118587",
"0.51135844",
"0.5110508",
"0.50871795",
"0.5086589",
"0.5083591",
"0.50760514",
"0.5073628",
... | 0.6001082 | 0 |
A function that executes the bisection method to approximate the zero/s of a function f. | def BisectionMethod(f, a=0, b=1, tol=1e-10):
start = time()
f_a = f(a)
f_b = f(b)
# Initialization of errors and iters
errs = []
i = 0
if f_a == 0:
return a
elif f_b == 0:
return b
elif f_a*f_b > 0:
print("The function values have the same sign!")
else:
error = b-a
while error > tol:
c = (b+a)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_zero(f, df):\n def near_zero(x):\n return approx_eq(f(x), 0)\n return improve(newton_update(f, df), near_zero)",
"def bdq1(f, x, h=1e-5):\n return (f(x)-f(x-h))/h\n raise NotImplementedError(\"Problem 2 Incomplete\")",
"def bisection(f, fu, point_a, point_b, point_c, point_d, lower_... | [
"0.68654835",
"0.6779906",
"0.66963404",
"0.660246",
"0.6566855",
"0.65348035",
"0.643856",
"0.6368674",
"0.6322992",
"0.63222665",
"0.63208354",
"0.6286574",
"0.6280882",
"0.6278825",
"0.6246738",
"0.6246427",
"0.6243104",
"0.6170038",
"0.6124475",
"0.6091833",
"0.60551023",... | 0.72263765 | 0 |
A function that executes the Secant Method to approximate the zero/s of a function f. | def SecantMethod(f, x_0=0.0, x_1=0.75, tol=1e-10):
start = time()
f_0 = f(x_0)
f_1 = f(x_1)
error = np.abs(x_0-x_1)
i = 0
errs = []
while error > tol:
errs.append(error)
slope = (f_1 - f_0) / (x_1 - x_0)
x_0 = x_1
x_1 = x_1 - f_1 / slope
error = np.abs(x_0-x_1)
f_0 = f_1
f_1 = f(x_1)
i = i+1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secant1d(f, df, x0, x1, niter=10):\n for i in xrange(niter):\n x_new = x1 - df(x1)*(x1 - x0)/(df(x1)-df(x0))\n x0 = x1\n x1 = x_new\n return x_new",
"def test_secant(testFunctions, tol, printFlag): \n pass",
"def f(x):\n return N.sqrt(N.power(N.cos(x),2)+1.0)",
"def st... | [
"0.64645636",
"0.62523824",
"0.6146415",
"0.6103178",
"0.5933578",
"0.5925966",
"0.5870014",
"0.58368474",
"0.58084965",
"0.5804595",
"0.57733136",
"0.5770187",
"0.5759598",
"0.5740796",
"0.5734575",
"0.57217515",
"0.57199854",
"0.5698126",
"0.56895137",
"0.56786126",
"0.5671... | 0.71922964 | 0 |
A function that executes the Chord Method to approximate the zero/s of a function f. | def ChordMethod(f, a=0.0, b=1.0, x=0.75, tol=1e-10):
start = time()
# Initialization of function values and error
f_a = f(a)
f_b = f(b)
f_x = f(x)
error = np.abs(f_x)
# Initialization of iter number and array of error values
i = 0
errs = []
if f_a*f_b<0:
while error > tol:
errs.append(error)
if f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_zero(f, df):\n def near_zero(x):\n return approx_eq(f(x), 0)\n return improve(newton_update(f, df), near_zero)",
"def func(f,c):\n return(f**2+c)",
"def find_zero(f,p1,d):\n if p1 > 10:\n p1 = 0.5\n c = p1 - f(p1)*d/(f(p1+d)-f(p1)) # simple\n \n # we can do this in c... | [
"0.65362054",
"0.6326016",
"0.6305559",
"0.61990756",
"0.614827",
"0.6144713",
"0.6101831",
"0.60515314",
"0.6049322",
"0.60349864",
"0.60319513",
"0.5936287",
"0.593589",
"0.58508027",
"0.5838018",
"0.58205414",
"0.5809855",
"0.58056784",
"0.5784838",
"0.578146",
"0.57671094... | 0.63724005 | 1 |
A function that executes the RegulaFalsi Method to approximate the zero/s of a function f. | def RegulaFalsiMethod(f, a=0.0, b=0.75, tol=1e-10):
start = time()
f_a = f(a)
f_b = f(b)
error = tol + 1
errs = []
i = 0
while error > tol:
x = (a*f_b - b*f_a) / (f_b - f_a)
f_x = f(x)
errs.append(error)
if f_a*f_x > 0:
a = x
f_a = f_x
elif f_b*f_x > 0:
b = x
f_b = f_x
else:
break... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def func(x, f, fp):\n\n return np.sqrt((1+fp(x)**2) / (2 * g * f(x)))",
"def test_figure34(self):\n star = 0.1\n current = 1.37\n func = lambda x: x**6 + 3 * x - 4\n\n logging.info(\"\\nCONFIRMING FIGURE 3.4\")\n rf_results = undertest.regula_falsi(func, star, current, 100)"... | [
"0.6784728",
"0.66193694",
"0.6568859",
"0.6506474",
"0.6454057",
"0.64324284",
"0.63983434",
"0.63296384",
"0.6309018",
"0.6296353",
"0.6273379",
"0.6271817",
"0.6256678",
"0.6256678",
"0.62533724",
"0.62439734",
"0.6224079",
"0.6183517",
"0.6157636",
"0.61439276",
"0.610912... | 0.7485726 | 0 |
Check if the doctype is allowed to be customized. | def validate_doctype(self, meta):
if self.doc_type in core_doctypes_list:
frappe.throw(_("Core DocTypes cannot be customized."))
if meta.issingle:
frappe.throw(_("Single DocTypes cannot be customized."))
if meta.custom:
frappe.throw(_("Only standard DocTypes are allowed to be customized from Customize ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_delicious_format(soup, can_handle, delicious_doctype):\r\n if (soup.contents and\r\n soup.contents[0] == delicious_doctype and\r\n not soup.find('h3')):\r\n can_handle = True\r\n\r\n return can_handle",
"def doctype(self):\n response = self.re... | [
"0.6320607",
"0.5973421",
"0.58701515",
"0.5838562",
"0.579999",
"0.5710973",
"0.5615481",
"0.5564937",
"0.5557485",
"0.5533022",
"0.54637307",
"0.5405814",
"0.5374656",
"0.5342539",
"0.5334748",
"0.52937686",
"0.52657187",
"0.51748496",
"0.5148412",
"0.5148041",
"0.5063798",... | 0.71986717 | 0 |
Create auto repeat custom field if it's not already present | def create_auto_repeat_custom_field_if_required(self, meta):
if self.allow_auto_repeat:
all_fields = [df.fieldname for df in meta.fields]
if "auto_repeat" in all_fields:
return
insert_after = self.fields[len(self.fields) - 1].fieldname
create_custom_field(
self.doc_type,
dict(
fieldname... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_fields_unique(self, fields):\n ...",
"def add_new_item_field(*fields, **keywords):\n\n for field in fields:\n print \"Creating {0} custom field...\".format(field)\n doc = frappe.get_doc({\n \"doctype\": \"Custom Field\",\n \"dt\": \"Item\",\n \"fi... | [
"0.6465171",
"0.60588455",
"0.5938122",
"0.5883545",
"0.58138573",
"0.5808797",
"0.57614344",
"0.5674013",
"0.56631845",
"0.56387407",
"0.56318414",
"0.5615604",
"0.55969214",
"0.55964833",
"0.5587424",
"0.55869734",
"0.5583441",
"0.55226415",
"0.5509235",
"0.5498406",
"0.549... | 0.7872079 | 0 |
Get translation object if exists of current doctype name in the default language | def get_name_translation(self):
return frappe.get_value(
"Translation",
{"source_text": self.doc_type, "language": frappe.local.lang or "en"},
["name", "translated_text"],
as_dict=True,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_translation(obj, language_code):\n if not obj or not hasattr(obj, \"get_translation\"):\n return None\n return obj.get_translation(language_code)",
"def init_translations():\n if \"@lang\" in input.load_input():\n lang = input.get_lang()\n try:\n trad = gettext.GN... | [
"0.59360456",
"0.5792992",
"0.57575065",
"0.56885016",
"0.56644005",
"0.56176317",
"0.55142736",
"0.5459571",
"0.54325974",
"0.5424203",
"0.5416389",
"0.54139394",
"0.53813535",
"0.5326954",
"0.53157514",
"0.5311335",
"0.52795213",
"0.52775705",
"0.5246359",
"0.5244642",
"0.5... | 0.5794797 | 1 |
Apply property setters or create custom records for DocType Action and DocType Link | def set_property_setters_for_actions_and_links(self, meta):
for doctype, fieldname, field_map in (
("DocType Link", "links", doctype_link_properties),
("DocType Action", "actions", doctype_action_properties),
("DocType State", "states", doctype_state_properties),
):
has_custom = False
items = []
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_docfields(app):\n\n transform_node = partial(_transform_node, app)\n\n def get_data_structure(entries, types, field_object):\n \"\"\"\n Get a proper docfx YAML data structure from the entries & types\n \"\"\"\n\n data = {\n 'parameters': [],\n 'vari... | [
"0.5846482",
"0.5740216",
"0.5380344",
"0.53581184",
"0.534346",
"0.5282596",
"0.51322585",
"0.5113775",
"0.50603217",
"0.5053952",
"0.5024413",
"0.4953291",
"0.49466267",
"0.49425358",
"0.49305502",
"0.49226514",
"0.4906751",
"0.48865965",
"0.48767254",
"0.48593536",
"0.4857... | 0.6898675 | 0 |
Clear rows that do not appear in `items`. These have been removed by the user. | def clear_removed_items(self, doctype, items):
if items:
frappe.db.delete(doctype, dict(parent=self.doc_type, custom=1, name=("not in", items)))
else:
frappe.db.delete(doctype, dict(parent=self.doc_type, custom=1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\n self._last_item = None\n self._connected_items = []\n\n for item in self._items:\n item.deleteLater()\n\n self._items = []\n self._row_index = 1",
"def trim_items(self, items):\r\n\t\tlogger.debug(\"Enter\")\r\n\t\t\r\n\t\tif self.transactions:\r\n... | [
"0.7145246",
"0.70406383",
"0.69615793",
"0.6825989",
"0.6781078",
"0.67580163",
"0.6522498",
"0.6480106",
"0.64699674",
"0.64281803",
"0.6402019",
"0.6392454",
"0.6390491",
"0.63391846",
"0.63161075",
"0.625902",
"0.6254275",
"0.61904377",
"0.6179518",
"0.6166497",
"0.615914... | 0.7503716 | 0 |
allow type change, if both old_type and new_type are in same field group. field groups are defined in ALLOWED_FIELDTYPE_CHANGE variables. | def allow_fieldtype_change(self, old_type: str, new_type: str) -> bool:
def in_field_group(group):
return (old_type in group) and (new_type in group)
return any(map(in_field_group, ALLOWED_FIELDTYPE_CHANGE)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_type_converter(self, old_type):\n\n if old_type == 'String':\n new_type = 'Text'\n elif old_type == 'Integer':\n new_type = 'Short'\n elif old_type == 'Date':\n new_type = 'Date'\n elif old_type == 'GlobalID':\n new_type = 'GUID'\n ... | [
"0.65599185",
"0.6197091",
"0.6054592",
"0.59098697",
"0.588222",
"0.58448344",
"0.5736298",
"0.57311046",
"0.57240963",
"0.5658206",
"0.56201833",
"0.55765665",
"0.5571626",
"0.5490895",
"0.54692274",
"0.54396904",
"0.54384816",
"0.54310703",
"0.53796595",
"0.5313075",
"0.52... | 0.8666816 | 0 |
Test case for search_organizations_post | def test_search_organizations_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_postorgs(self):\n pass",
"def test_post_foods_search(self):\n pass",
"def test_search_systems_post(self):\n pass",
"def test_organizations_list(self):\n pass",
"def test_getorganizations_item(self):\n pass",
"def test_post_chain_search(self):\n pass",
... | [
"0.7212994",
"0.7087828",
"0.6805042",
"0.6703513",
"0.66138864",
"0.658349",
"0.6568859",
"0.64567155",
"0.6421231",
"0.64173543",
"0.6383049",
"0.6365612",
"0.6305603",
"0.6289635",
"0.62297076",
"0.6203771",
"0.6173493",
"0.6162905",
"0.61140364",
"0.6108049",
"0.6108049",... | 0.8962697 | 0 |
Test case for search_systems_post | def test_search_systems_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_systemusers_post(self):\n pass",
"def test_post_foods_search(self):\n pass",
"def test_post_chain_search(self):\n pass",
"def test_get_systems(self):\n pass",
"def test_search_organizations_post(self):\n pass",
"def test_search(self):\n pass",
"... | [
"0.71712273",
"0.7045634",
"0.69426954",
"0.6605926",
"0.6453511",
"0.63317007",
"0.63317007",
"0.63317007",
"0.6126776",
"0.61055505",
"0.5979648",
"0.5967675",
"0.59621555",
"0.5905499",
"0.58833885",
"0.5874589",
"0.5815586",
"0.5814693",
"0.5767794",
"0.57667536",
"0.5765... | 0.89539254 | 0 |
Test case for search_systemusers_post | def test_search_systemusers_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_12_admin_user_search(self):\r\n # Create two users\r\n self.register()\r\n self.signout()\r\n self.register(fullname=\"Juan Jose\", name=\"juan\",\r\n email=\"juan@juan.com\", password=\"juan\")\r\n self.signout()\r\n # Signin with admin user\... | [
"0.7286149",
"0.7046566",
"0.67024404",
"0.6474498",
"0.6474498",
"0.6397837",
"0.61862546",
"0.6166175",
"0.6130819",
"0.6113265",
"0.6099272",
"0.60692793",
"0.60559034",
"0.5975969",
"0.5956663",
"0.5937071",
"0.5932967",
"0.5926542",
"0.5924846",
"0.59239036",
"0.59209263... | 0.8976146 | 0 |
Gets the cflags needed to use glib | def get_glib_cflags():
pkgcmd = os.popen(pkg_config_path +
' pkg-config --cflags glib-2.0', 'r')
pkgcmd_text = pkgcmd.read()
pkgcmd.close()
includes = pkgcmd_text.split()
for x in range(len(includes)):
includes[x] = includes[x][2:]
return includes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gcc_flags(exe=\"gcc\"):\n gcc_ver = get_gcc_ver(exe=exe)\n cc_flags = ['-g']\n cc_flags += ['-D_GLIBCXX_USE_CXX11_ABI=0']\n if (gcc_ver[0] > 0):\n # yes, we use GCC\n # avoid the error \"undefined symbol: _ZdlPvm\" with newer GCCs\n if ((gcc_ver[0] == 4) and (gcc_ver[1] == ... | [
"0.6527354",
"0.6513135",
"0.642064",
"0.60894686",
"0.5968694",
"0.5766138",
"0.5690297",
"0.56683534",
"0.566661",
"0.5645139",
"0.5621267",
"0.56070346",
"0.5593679",
"0.55753845",
"0.5570383",
"0.555791",
"0.549578",
"0.5483062",
"0.5460786",
"0.54476184",
"0.54403955",
... | 0.7839654 | 0 |
Check for requried version using pkgconfig | def check_pkgcfg_ver(reqver_text, pkgname):
reqver = map(int, reqver_text.split('.'))
pkgcmd = os.popen(pkg_config_path +
' pkg-config --modversion ' + pkgname, 'r')
pkgcmd_text = pkgcmd.read()
pkgcmd.close()
match = re.search(r'^([0-9]+)\.([0-9]+)\.([0-9]+)', pkgcmd_text)
if match:
pk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_configurator_version():\n if settings.CONFIGURATOR_MODULE == \"bootmachine.contrib.configurators.salt\":\n pkgver = settings.SALT_AUR_PKGVER\n pkgrel = settings.SALT_AUR_PKGREL\n response = urllib2.urlopen(\"https://aur.archlinux.org/packages/sa/salt/PKGBUILD\")\n for li... | [
"0.6951821",
"0.68131226",
"0.6677972",
"0.65681666",
"0.654089",
"0.6484356",
"0.6481366",
"0.6476971",
"0.64619726",
"0.6410117",
"0.6325642",
"0.63114643",
"0.6219762",
"0.6203963",
"0.6139611",
"0.6139611",
"0.6127152",
"0.61229306",
"0.60995054",
"0.6088901",
"0.60879666... | 0.7547514 | 0 |
Check for required glib version | def check_glibver(reqver_text):
return check_pkgcfg_ver(reqver_text, 'glib-2.0') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_rvsdg_supported():\n # Only support Python 3.11.\n if PYVERSION != (3, 11):\n raise ImportError(\"rvsdg_frontend is only supported on python 3.11\")\n # Require that numba_rvsdg to be installed.\n try:\n import numba_rvsdg\n except ImportError:\n raise ImportError(\"... | [
"0.68988824",
"0.6385503",
"0.6302598",
"0.612517",
"0.6088921",
"0.60879606",
"0.59348226",
"0.59324014",
"0.5885295",
"0.58382124",
"0.574964",
"0.57388675",
"0.57307184",
"0.5713803",
"0.56747913",
"0.5674144",
"0.5645987",
"0.5599",
"0.5586719",
"0.55718887",
"0.55711806"... | 0.8285599 | 0 |
Check for required OpenHPI version | def check_openhpiver(reqver_text):
return check_pkgcfg_ver(reqver_text, 'openhpi') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_os_version():\n if not version.is_supported_version():\n supported_releases = []\n for rel in version.SUPPORTED_VERSIONS:\n for ver in version.SUPPORTED_VERSIONS[rel]:\n supported_releases.append(rel.upper() + ' ' + ver)\n reporting.create_report([\n ... | [
"0.67450356",
"0.65728945",
"0.6567854",
"0.63686246",
"0.6125975",
"0.61080354",
"0.60829085",
"0.60295486",
"0.6009181",
"0.59631354",
"0.5929281",
"0.5925445",
"0.59149694",
"0.59035957",
"0.58955795",
"0.58694214",
"0.583806",
"0.58019847",
"0.57803047",
"0.57790995",
"0.... | 0.79263175 | 0 |
Check for required SWIG version | def check_swigver(reqver_text):
reqver = map(int, reqver_text.split('.'))
swigcmd = os.popen('PATH=$PATH:/usr/local/bin swig -version', 'r')
swigcmd_text = swigcmd.read()
swigcmd.close()
match = re.search(r'\sSWIG\sVersion\s([0-9]+)\.([0-9]+)\.([0-9]+)',
swigcmd_text)
if match:
swigver_str = match.groups()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_version () -> None:\n py_version_info: typing.Tuple = sys.version_info[:2]\n\n if py_version_info < MIN_PY_VERSION:\n error_msg = \"This version of pytextrank requires Python {} or later ({} detected)\\n\"\n raise RuntimeError(error_msg.format(_versify(MIN_PY_VERSION), _versify(py_ve... | [
"0.6561663",
"0.64204293",
"0.63679105",
"0.63679105",
"0.63679105",
"0.6290911",
"0.61567146",
"0.6095388",
"0.6076505",
"0.5989393",
"0.5987515",
"0.59100944",
"0.5876462",
"0.5847742",
"0.58452326",
"0.57924986",
"0.5776507",
"0.576822",
"0.5759951",
"0.57593083",
"0.57572... | 0.7484617 | 0 |
Adds noise of the given type to all the images at the specified location and stores them at the specified output path together with a copy of the annotations file. | def add_noise_to_images(images_path, annotations_path, output_path, noise_type, param_1, param_2):
assert os.path.exists(images_path)
assert os.path.exists(annotations_path)
if not os.path.exists(output_path):
os.makedirs(output_path)
image_file_names = util.get_images_at_path(images_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_images(self, epoch):\n synth_data = self.generator(self.constNoise)\n utils.vector_to_img(synth_data, \"./outputs/trial{}/gan{}/epoch{}.jpg\".format(self.trial, self.id, epoch))",
"def generate_image(noise_list, save_path):\n check_points_path = os.path.join(save_path, 'check_poin... | [
"0.6277843",
"0.58297175",
"0.57903993",
"0.5708613",
"0.554494",
"0.55090994",
"0.5475805",
"0.54411316",
"0.5416086",
"0.5401583",
"0.5400116",
"0.5388386",
"0.5383494",
"0.5370789",
"0.53432417",
"0.5330687",
"0.5330448",
"0.5323396",
"0.5309509",
"0.53088146",
"0.5306742"... | 0.77102387 | 0 |
Augments the images at the specified path by cropping and resizing them and stores the results together with the annotations file at the specified location. | def crop_and_resize_images(images_path, annotations_path, output_path):
assert os.path.exists(images_path)
assert os.path.exists(annotations_path)
if not os.path.exists(output_path):
os.makedirs(output_path)
image_file_names = util.get_images_at_path(images_path)
# Filename of annotations... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_augment_images(input_path, output_path, extension, augmentation, label_type, label_threshold=-1):\n for dir_path, dir_names, filenames in os.walk(input_path):\n structure = os.path.join(output_path, dir_path[len(input_path) + 1:])\n for file in filenames:\n if file.endswith(ext... | [
"0.653733",
"0.64505523",
"0.6103153",
"0.60980916",
"0.5917796",
"0.58918315",
"0.5845233",
"0.58115834",
"0.57925504",
"0.5757139",
"0.5726867",
"0.5719489",
"0.5718309",
"0.5716689",
"0.57079375",
"0.5684475",
"0.5682924",
"0.5674255",
"0.5668028",
"0.5666905",
"0.5641592"... | 0.72213864 | 0 |
Get the nth smallest element in a list | def nth_smallest_element(input_list, n):
if n <= 0:
raise Exception("Invalid argument")
deduped_sorted_list = list(sorted(set(input_list)))
return deduped_sorted_list[n - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(list):\n return find_value_at(list, -1)",
"def find_smallest(list):\n smallest_index = 0\n smallest_number = list[0]\n for index, number in enumerate(list):\n if number < smallest_number:\n smallest_index = index\n smallest_number = number\n del list[small... | [
"0.7554011",
"0.7532092",
"0.74100167",
"0.7317434",
"0.7281789",
"0.7240822",
"0.7237998",
"0.7200444",
"0.71922356",
"0.71782553",
"0.71696824",
"0.71653455",
"0.71365726",
"0.712637",
"0.7062124",
"0.7028294",
"0.70136917",
"0.6978228",
"0.6911104",
"0.68354064",
"0.682367... | 0.79797745 | 0 |
Fetch news codes from all sources | def fetch_all_news_codes():
response = requests.get(SOURCE_URL)
json = response.json()
global news_codes
for source in json['sources']:
news_codes.append(source['id']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_sources_all():\n response = requests.get(SOURCE_URL)\n json = response.json()\n for source in json['sources']:\n print(u\"{0}: <{1}> {2}\".format(\"News Code\", source['id'], source['name']))",
"def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980... | [
"0.7312531",
"0.7235354",
"0.67702496",
"0.6769892",
"0.64788336",
"0.63162",
"0.6261335",
"0.6132239",
"0.61279416",
"0.60592633",
"0.6023624",
"0.60100716",
"0.5961051",
"0.5901868",
"0.58603406",
"0.58554935",
"0.583776",
"0.5781199",
"0.57741106",
"0.57324433",
"0.5714543... | 0.87176025 | 0 |
Load api key on a global api key and validate it | def load_config_key():
try:
global api_key
api_key = os.environ['IN_API_KEY']
if len(api_key) == 32:
try:
int(api_key, 16)
except ValueError:
print("Invalid API key")
except KeyError:
print('No API Token detected. '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_api_key(api_key):\n api.get(api_key)",
"def a_valid_api_key(configuration):\n configuration.api_key[\"apiKeyAuth\"] = os.getenv(\"DD_TEST_CLIENT_API_KEY\", \"fake\")",
"def test_validate_api_key(app, seed_data, key, result):\n user_id, api_key = seed_data\n if key == 'use-valid-key':\n ... | [
"0.7356725",
"0.72628504",
"0.7197038",
"0.7164273",
"0.70202374",
"0.70057046",
"0.6950112",
"0.6931113",
"0.6884803",
"0.686948",
"0.6864031",
"0.684874",
"0.6844894",
"0.68439084",
"0.6840495",
"0.6819313",
"0.67881346",
"0.6756211",
"0.6738623",
"0.6729753",
"0.67251015",... | 0.80965376 | 0 |
Validate choice for yes or no | def check_choice(choice):
return choice == 'y' or choice == 'n' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_choice(value):\n try:\n values = ['y', 'n', 'Y', 'N']\n if value not in values:\n raise ValueError\n except ValueError:\n print(f\"Invalid selection, you typed '{value}'. Please try again.\\n\")\n return False\n else:\n return True",
"def _yes_n... | [
"0.73738766",
"0.72979355",
"0.70919514",
"0.7069778",
"0.6974338",
"0.68605596",
"0.6825182",
"0.6751053",
"0.67286277",
"0.67117643",
"0.66679806",
"0.6636728",
"0.6621181",
"0.6619607",
"0.661616",
"0.6591429",
"0.6549654",
"0.6539098",
"0.6538831",
"0.65351325",
"0.653080... | 0.79227203 | 0 |
Display news codes by category | def show_sources_category(category):
if category not in NEWS_CATEGORIES:
print("Invalid category")
sys.exit(1)
url = "?category={category_type}"
response = requests.get((SOURCE_URL+url).format(category_type=category))
json = response.json()
for source in json['sources']:
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_categories():\n for category in NEWS_CATEGORIES:\n print(category)",
"def getCategory():",
"def category(request, slug):\n categry = get_object_or_404(Category,slug=slug)\n story_list = Story.objects.filter(category=category)\n heading = \"Category: %s\" % category.label\n return... | [
"0.70257425",
"0.6215113",
"0.61999434",
"0.6129186",
"0.5977927",
"0.58913344",
"0.5888405",
"0.5876348",
"0.5876188",
"0.5859375",
"0.5856243",
"0.5834483",
"0.582594",
"0.5823871",
"0.581973",
"0.58054405",
"0.58006597",
"0.580001",
"0.5794173",
"0.57904506",
"0.5766992",
... | 0.6710089 | 1 |
Display all news categories | def show_categories():
for category in NEWS_CATEGORIES:
print(category) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_categories(request, slug=None):\n c = {\"categories\": Node.objects.filter(kind=\"C\")}\n return render_to_response(\"categories.html\", c)",
"def showCategories():\n\n categories = session.query(Category).order_by(asc(Category.name))\n if 'user_id' in login_session:\n return render_te... | [
"0.7213374",
"0.7189133",
"0.7146557",
"0.708202",
"0.7002809",
"0.69792753",
"0.68869466",
"0.678613",
"0.6767044",
"0.67392415",
"0.67317635",
"0.6731566",
"0.6652679",
"0.6649969",
"0.66368955",
"0.65972126",
"0.6525207",
"0.651799",
"0.64926684",
"0.6421396",
"0.64003974"... | 0.7693149 | 0 |
Test network connection, then parse arguments | def main():
test_network_connection()
parser() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_connectiom(self, mock_execute, mock_parse):\n mock_parse.return_value = ARGS_INPUT\n result = CONNECTION1\n mock_execute.return_value = result\n actual_result = connection_to_server()\n self.assertIs(actual_result.error, \"\")\n self.assertIs(actual_result... | [
"0.63528",
"0.63014454",
"0.6176197",
"0.6120487",
"0.6105555",
"0.60542977",
"0.60487413",
"0.59804666",
"0.59533066",
"0.5942822",
"0.5924107",
"0.589276",
"0.5877955",
"0.587294",
"0.5868004",
"0.5827267",
"0.5827258",
"0.5807035",
"0.58040553",
"0.5781465",
"0.57570696",
... | 0.68614507 | 0 |
Overriding mousePressEvent of QtWidgets.QGraphicsRectItem. | def mousePressEvent(self, mouse_event):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mousePressEvent(self, event):\n if event.button() is not QtCore.Qt.MouseButton.LeftButton:\n self.open_menu(event)\n return QtGui.QGraphicsScene.mousePressEvent(self, event)\n sel_items = self.selectedItems()\n item_at = self.itemAt(event.scenePos().x(), event.scenePo... | [
"0.74440217",
"0.7267638",
"0.7250607",
"0.721052",
"0.718017",
"0.7070356",
"0.7020155",
"0.69926757",
"0.6948346",
"0.68904895",
"0.6816735",
"0.67867243",
"0.6688076",
"0.6668764",
"0.6658437",
"0.6648628",
"0.6648509",
"0.66200304",
"0.6599639",
"0.65940744",
"0.6589846",... | 0.77438134 | 0 |
Adding playhead to slider. | def add_playhead(self, play_head):
self._playhead = play_head
self._playhead.setX(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParentItem(self, slider):\r\n slider.add_playhead(self)\r\n super(PlayHead, self).setParentItem(slider)",
"def slider(self):\n\n if self.count >= len(self.txt):\n self.count = -1\n self.text = ''\n self.heading.config(text=self.text)\n\n else:\n... | [
"0.76178265",
"0.6027804",
"0.5802557",
"0.5734548",
"0.5688203",
"0.56244296",
"0.55659217",
"0.5465505",
"0.5422321",
"0.5408269",
"0.53934205",
"0.53666455",
"0.5317971",
"0.5281184",
"0.5235672",
"0.51840335",
"0.5162078",
"0.51118904",
"0.51062256",
"0.5081117",
"0.50119... | 0.71376884 | 1 |
Updating playhead bar with respect track height. | def update_playhead(self, height):
self.playhead_bar.setLine(0, 0, 0, -height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateBar(self):\n pass",
"def update_health_bar(self):\n\t\tself.health_bar.centerx = self.rect.centerx\n\t\tself.health_bar.bottom = self.rect.top - 2",
"def update_H(self):",
"def updateBar(self):\n self.mixer = alsaaudio.Mixer()\n volumes = self.mixer.getvolume()\n mutes =... | [
"0.62880385",
"0.6234888",
"0.59489954",
"0.59424555",
"0.59357613",
"0.58541876",
"0.57661647",
"0.5760284",
"0.5623438",
"0.5601741",
"0.55907434",
"0.5520884",
"0.5488962",
"0.54878265",
"0.53975445",
"0.53789574",
"0.5375613",
"0.5352712",
"0.53141266",
"0.5259321",
"0.52... | 0.79497933 | 0 |
Performs the backtracking search for the given csp. If there is a solution, this method returns True; otherwise, it returns False. | def backtrack(csp):
# Base case
if (is_complete(csp)):
return True
# Get first unassigned variable
var = select_unassigned_variable(csp)
# Iterate through domain
for value in order_domain_values(csp, var):
# Inference
if is_consistent(csp, var, value):
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backtracking_search(csp):\n if backtrack(csp):\n return csp.assignment\n else:\n return None",
"def backtracking_search(csp):\n if backtrack(csp):\n return csp.assignment\n else:\n return None",
"def is_solution(self, csp):\n return self.is_consistent(csp.get_... | [
"0.70147717",
"0.70147717",
"0.6700603",
"0.6361194",
"0.62891144",
"0.61269",
"0.58801705",
"0.58801705",
"0.57543176",
"0.5702628",
"0.55685586",
"0.55055106",
"0.5478674",
"0.5365975",
"0.5365327",
"0.5333312",
"0.5313013",
"0.53117764",
"0.5255904",
"0.5253789",
"0.524553... | 0.71068275 | 0 |
Exit the same way as `status`. If the status field says it was killed by a signal, then we'll do that to ourselves. Otherwise we'll exit with the exit code. | def exit_as_status(status: int):
exit_status = os.WEXITSTATUS(status)
if os.WIFSIGNALED(status):
# Kill ourselves with the same signal.
sig_status = os.WTERMSIG(status)
pid = os.getpid()
os.kill(pid, sig_status)
time.sleep(0.1)
# Still here? Maybe the signal wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit(status):\n if isinstance(status, int):\n if status < 0:\n # Use the bash convention for signals\n status = 0x80 - status\n status &= 0xff\n\n sys.exit(status)",
"def exit(status=None): # real signature unknown; restored from __doc__\n pass",
"def exit(self,... | [
"0.79824376",
"0.76335555",
"0.72073627",
"0.72073627",
"0.6782127",
"0.6638904",
"0.6636332",
"0.66207033",
"0.65599215",
"0.65069294",
"0.65069294",
"0.65069294",
"0.64921975",
"0.6489194",
"0.6485885",
"0.64800984",
"0.6408313",
"0.64050716",
"0.63859844",
"0.6359765",
"0.... | 0.7923571 | 1 |
A LogMaster or LogReadWrite object must be specified. The resulting handler object will have a 'database_name' attribute that can be used to identify the handler's destination. | def __init__(self, database):
logging.Handler.__init__(self)
if (not(isinstance(database,LogMaster)) and not(isinstance(database,LogReadWrite))):
raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database)))
self.database_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, database):\n logging.Handler.__init__(self)\n if (not(isinstance(database,LogMaster)) and not(isinstance(database,LogReadWrite))):\n raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database)))\n self.... | [
"0.72741073",
"0.6806233",
"0.59495974",
"0.58026487",
"0.56110245",
"0.5594406",
"0.55488443",
"0.5457721",
"0.5335911",
"0.5335644",
"0.5300879",
"0.5256535",
"0.5252541",
"0.52428263",
"0.5241591",
"0.5206425",
"0.516586",
"0.5164633",
"0.5131747",
"0.51229393",
"0.5120764... | 0.72209847 | 1 |
A LogMaster or LogReadWrite object must be specified. The resulting handler object will have a 'database_name' attribute that can be used to identify the handler's destination. | def __init__(self, database):
logging.Handler.__init__(self)
if (not(isinstance(database,LogMaster)) and not(isinstance(database,LogReadWrite))):
raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database)))
self.database_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, database):\n logging.Handler.__init__(self)\n if (not(isinstance(database,LogMaster)) and not(isinstance(database,LogReadWrite))):\n raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database)))\n self.... | [
"0.72209847",
"0.6806233",
"0.59495974",
"0.58026487",
"0.56110245",
"0.5594406",
"0.55488443",
"0.5457721",
"0.5335911",
"0.5335644",
"0.5300879",
"0.5256535",
"0.5252541",
"0.52428263",
"0.5241591",
"0.5206425",
"0.516586",
"0.5164633",
"0.5131747",
"0.51229393",
"0.5120764... | 0.72741073 | 0 |
Get shape of specifed variable, as list | def get_shape(self, variable):
shape = self.dataset[variable].shape
shape_list = []
if len(shape) > 1:
for val in shape:
shape_list.append(val)
else:
shape_list.append(shape[0])
return shape_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape_list(x):\n static = x.get_shape().as_list()\n shape = tf.shape(x)\n ret = []\n for i, static_dim in enumerate(static):\n dim = static_dim or shape[i]\n ret.append(dim)\n return ret",
"def sh... | [
"0.78838855",
"0.7726531",
"0.76103044",
"0.75261146",
"0.7375839",
"0.7375839",
"0.73525876",
"0.7282462",
"0.7195266",
"0.70427763",
"0.6963798",
"0.6927519",
"0.68826026",
"0.6878222",
"0.6864412",
"0.68253404",
"0.6781977",
"0.67250735",
"0.67223966",
"0.672088",
"0.67196... | 0.7967759 | 0 |
Detect whether or not specified variable is a y coord | def is_y(self, var):
y_list = ['lat', 'latitude', 'LATITUDE', 'Latitude', 'y']
if self.get_units(var) == 'degrees_north' or self.get_name(var) in y_list:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_y(self):\n return any(map(lambda s: s.is_y, self))",
"def userToPlotY(y): \n return dislin.nyposn(y)",
"def is_longitude_var(obj):\n if (obj.name =='longitude'):\n return True\n else:\n return False",
"def coordinateY(self, x):\n if self.ch > 2:\n y1... | [
"0.7466321",
"0.6503047",
"0.6355577",
"0.625832",
"0.6254018",
"0.6238812",
"0.6220844",
"0.6201852",
"0.61672837",
"0.61533606",
"0.61459816",
"0.6123715",
"0.61134374",
"0.6088244",
"0.60857356",
"0.60723877",
"0.60672545",
"0.606352",
"0.6055709",
"0.6045797",
"0.6019309"... | 0.80324894 | 0 |
Detect whether or not specified variable is an x coord | def is_x(self, var):
x_list = ['lon', 'longitude', 'LONGITUDE', 'Longitude', 'x']
if self.get_units(var) == 'degrees_east':
return True
if self.get_name(var) in x_list:
return True
if self.get_description(var) in x_list:
return True
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_x(self):\n return any(map(lambda s: s.is_x, self))",
"def ispoint(x):\n if isvect(x) and x[3] > 0.0:\n return True\n return False",
"def validate_in(self, xcoord, ycoord):\r\n x = int(xcoord/(self.tr.bd.TILE_WIDTH + self.tr.bd.LINE_WIDTH))\r\n y = int(ycoord/(self.tr.b... | [
"0.6974673",
"0.6772765",
"0.6447687",
"0.6379581",
"0.62121505",
"0.61843705",
"0.6170087",
"0.61460006",
"0.6120451",
"0.60937387",
"0.60902226",
"0.60441315",
"0.6043747",
"0.604344",
"0.59576946",
"0.5953106",
"0.59199286",
"0.59199286",
"0.5904794",
"0.59003794",
"0.5889... | 0.80547154 | 0 |
Return dimension of specified variable. | def get_dimensions(self, variable):
try:
var_dimension = self.dataset[variable].dims
return var_dimension
except:
print("Error Occurred: No Dimensions detected... Exiting. ")
exit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions(self, varname):\n if self.handle == None: return None\n try:\n var = self.handle.variables[varname]\n except KeyError:\n return None\n return var.dimensions",
"def ndims(self, varname):\n if self.handle == None: return None\n try:\n ... | [
"0.7940497",
"0.75808823",
"0.7443761",
"0.7337081",
"0.71946746",
"0.7184168",
"0.7120874",
"0.70509535",
"0.70245737",
"0.69893956",
"0.68883854",
"0.6878039",
"0.6874018",
"0.6874018",
"0.6874018",
"0.6874018",
"0.6844169",
"0.6823547",
"0.680347",
"0.6788622",
"0.67481434... | 0.83897287 | 0 |
Return units of specified variable. | def get_units(self, variable):
try:
units = self.dataset[variable].units
return units
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self.var_units",
"def _getunits(x):\n if pb.units.has_units(x):\n \n units = x.units\n \n else:\n \n units = None\n \n return units",
"def get_units(self):\r\n msg = struct.pack('>2B', 56, 14)\r\n re... | [
"0.7666415",
"0.75455564",
"0.7527258",
"0.7400487",
"0.7400487",
"0.7316881",
"0.72193277",
"0.7182783",
"0.7133254",
"0.7118664",
"0.7106427",
"0.7068166",
"0.704543",
"0.70454174",
"0.70454174",
"0.7027823",
"0.7013358",
"0.69866467",
"0.6952707",
"0.69405085",
"0.6938584"... | 0.848812 | 0 |
Returns metadata for a specified variable. | def get_metadata(self, variable):
return self.dataset[variable] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def var_metadata(self, index):\n if index is not None:\n metadata = []\n for m in self.primary_header['variables'][index]['metadata']:\n meta = {\n 'value': m['Value'] / 10**m['Value precision'],\n 'code': m['Variable-specific code']... | [
"0.72872794",
"0.67378074",
"0.6593407",
"0.6518412",
"0.6496709",
"0.6387094",
"0.63413256",
"0.6340406",
"0.6305639",
"0.6231935",
"0.6222925",
"0.60228664",
"0.6019177",
"0.5926394",
"0.58925664",
"0.58867776",
"0.5885494",
"0.5884447",
"0.58724195",
"0.5872027",
"0.586777... | 0.85926974 | 0 |
Return group which specified variable belongs to. | def get_var_group(self, variable):
return self.dataset[variable].group() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self):\n\t\treturn self.variables.get('group')",
"def get_group(self, group_name):\n\n return self._group[group_name]",
"def what_is(self, _id):\n for g in self.groups:\n if _id in self.h_group_ids[g]:\n return g\n return None",
"def getGroup(self, index):\n index = ... | [
"0.7664513",
"0.69495916",
"0.6586702",
"0.65188766",
"0.6496122",
"0.64858675",
"0.6438629",
"0.6420008",
"0.6369306",
"0.6363457",
"0.6362466",
"0.6318557",
"0.6317046",
"0.6288889",
"0.6288889",
"0.6288889",
"0.6219791",
"0.6209329",
"0.6189676",
"0.6157111",
"0.61287713",... | 0.8086381 | 0 |
try to purge atoms that are not in the ring(s) | def purgeTrp(atoms):
for a in atoms:
found = False
if getAtype(a) == "N":
for c in atoms:
if not c == a and dist(c,a) < COVALENT_BOND_DIST:
found = True
if not found:
atoms.remove(a)
return atoms
if DEBUG... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purgeHis(atoms):\n for a in atoms:\n if getAtype(a) == \"N\" or getAtype(a) == \"NA\":\n found = 0\n for c in atoms:\n if not c == a and dist(c,a) < COVALENT_BOND_DIST:\n found = 1\n break\n if not found:\n ... | [
"0.754443",
"0.72462857",
"0.6930731",
"0.69183415",
"0.62684757",
"0.6043529",
"0.60152406",
"0.59497243",
"0.58619726",
"0.5860603",
"0.5797768",
"0.5775996",
"0.5759408",
"0.5744152",
"0.57357746",
"0.57297707",
"0.5717624",
"0.5685005",
"0.56770265",
"0.5671171",
"0.56682... | 0.7382943 | 1 |
try to purge atoms that are not in the ring(s) | def purgeHis(atoms):
for a in atoms:
if getAtype(a) == "N" or getAtype(a) == "NA":
found = 0
for c in atoms:
if not c == a and dist(c,a) < COVALENT_BOND_DIST:
found = 1
break
if not found:
atoms.remov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purgeTrp(atoms):\n for a in atoms:\n found = False\n if getAtype(a) == \"N\":\n for c in atoms:\n if not c == a and dist(c,a) < COVALENT_BOND_DIST:\n found = True\n if not found:\n atoms.remove(a)\n return at... | [
"0.7382943",
"0.72462857",
"0.6930731",
"0.69183415",
"0.62684757",
"0.6043529",
"0.60152406",
"0.59497243",
"0.58619726",
"0.5860603",
"0.5797768",
"0.5775996",
"0.5759408",
"0.5744152",
"0.57357746",
"0.57297707",
"0.5717624",
"0.5685005",
"0.56770265",
"0.5671171",
"0.5668... | 0.754443 | 0 |
a very simple ring detection algorightm to identify 5 and 6 member aromatic rings A < head / \ B C < tier 1 | | D E < tier 2 \ / F < tier 3, ring closure (6 memberring) A < head / \ B C < tier 1 | | DE < tier 2, ring closure (5member ring) A < head | B < tier 1 / \ CD < tier 2 | def findRings(graph):
# TODO add a planarity check?
rings5 = []
rings6 = []
if DEBUG: print "- starting ring detection..."
for head in graph.keys():
tier1 = graph[head]
tier2 = []
tier3 = []
# populate tier2
for node1 in tier1:
for tmp in graph[no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RingPartition(ringsize, z, r, beta):\n # divide the ring into segments and initialise the coordinate of the segments\n location = list(range(ringsize))\n assert ringsize<=16 and ringsize>=5, \"Ring size greater than 16 or smaller than 5 is not supported\"\n if ringsize<=7 and ringsize>=5:\n ... | [
"0.63587976",
"0.62547547",
"0.6145447",
"0.59253526",
"0.5815323",
"0.5706652",
"0.56514144",
"0.5619886",
"0.5492256",
"0.54898196",
"0.5462132",
"0.54358155",
"0.54230624",
"0.53979135",
"0.5367869",
"0.535749",
"0.53514963",
"0.53369653",
"0.5333041",
"0.5290168",
"0.5288... | 0.76121163 | 0 |
Do the `brew update` command | def brew_update():
subprocess.run(["brew", "update"], check=True, capture_output=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maint_brew():\n os.system('brew update')",
"def pipupdate():\n\n packages = [d for d in pkg_resources.working_set]\n subprocess.call('pip install --upgrade ' + ' '.join(packages))",
"def update():\n call('git -C ~/norminette+ pull', shell=True)",
"def command(self) -> None:\n plug.echo... | [
"0.87774324",
"0.65771073",
"0.61744916",
"0.5892653",
"0.5884185",
"0.57034117",
"0.56833243",
"0.56825686",
"0.56319",
"0.55970806",
"0.55339605",
"0.5503416",
"0.54844725",
"0.54748815",
"0.5439954",
"0.54381526",
"0.5424778",
"0.5410216",
"0.54058474",
"0.5403897",
"0.539... | 0.9242965 | 0 |
Load outdated formulas from a file | def load_formula_list(file_path):
try:
with open(file_path, mode="r") as json_file:
return [OutdatedFormuala(**tap) for tap in json.load(json_file)]
except FileNotFoundError:
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importBrainstormEquationsFile(filename):\n #init the list with all bricks in the file\n allEquations = []\n \n #open the brainstorming words file and read the lines\n with open(filename, 'r') as fp:\n lines = fp.readlines()\n \n #cycle strip and clean the lines and add them to the s... | [
"0.56248",
"0.55864024",
"0.55311346",
"0.5516956",
"0.55136317",
"0.5425013",
"0.5423856",
"0.54158723",
"0.5414742",
"0.5404354",
"0.53420854",
"0.53120947",
"0.53088176",
"0.53083575",
"0.52615845",
"0.52555454",
"0.5249265",
"0.5191003",
"0.51845586",
"0.5131297",
"0.5125... | 0.6887365 | 0 |
Store reported taps to file | def update_reported_taps(taps):
store_formula_list(formula_list=taps, file_path=REPORTED_TAPS_FILE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reportingThread(self):\n with open(self.filename, 'w') as file:\n while self.active:\n\n # Pop next event from the queue\n event = self.queue.get()\n\n # None event exits the thread\n if event is None:\n break\n\n # Write down the event to file\n file.... | [
"0.57179314",
"0.55778414",
"0.5498755",
"0.5452354",
"0.54247355",
"0.53608876",
"0.5340175",
"0.53185236",
"0.5314374",
"0.53070515",
"0.529223",
"0.52759284",
"0.5244435",
"0.52431744",
"0.5238585",
"0.5232786",
"0.52260303",
"0.5161602",
"0.5158707",
"0.5132782",
"0.51277... | 0.6358965 | 0 |
Store reported casks to file | def update_reported_casks(casks):
store_formula_list(formula_list=casks, file_path=REPORTED_CASKS_FILE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveUsage(self, filePath):\n message = time.strftime('%c') + ' : '\n for spot in self.getParkingSpots():\n message += str(spot.id) + ', ' + spot.status + '; '\n with open(filePath, 'a+') as outfile:\n outfile.write(message + '\\n')\n pass",
"def mark_done(cf)... | [
"0.5707347",
"0.5692806",
"0.5460288",
"0.5433661",
"0.53604317",
"0.5354768",
"0.53382784",
"0.5316571",
"0.52975196",
"0.5284974",
"0.52592534",
"0.5213032",
"0.5171343",
"0.51432586",
"0.5108863",
"0.51078176",
"0.5106674",
"0.5100017",
"0.5085634",
"0.50722456",
"0.506654... | 0.6381582 | 0 |
Send notification about the provided taps and casks | def notify_taps_and_casks(*, taps, casks, always_notify):
def get_notification_string(num_items, item_name):
if num_items < 1:
return None
output = f"{num_items} {item_name}"
if num_items > 1:
output += "s"
return output
# Don't notify if there are no up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tap():\n return \"I have clicked on the elements\"",
"def onTrayIconActivated(self, reason):\n # if reason == self.DoubleClick:\n # self.open_notepad()\n # # if reason == self.Trigger:\n # # self.open_notepad()",
"def notify(*, text, title=None, subtitle=None):\n i... | [
"0.5372925",
"0.5251254",
"0.5233127",
"0.5231048",
"0.51878476",
"0.5137459",
"0.5070544",
"0.5068205",
"0.5058522",
"0.5044214",
"0.5044214",
"0.5036521",
"0.50359136",
"0.49933636",
"0.49924493",
"0.4974981",
"0.4934755",
"0.49343637",
"0.48742324",
"0.48500574",
"0.480804... | 0.7441125 | 0 |
Send notification about formula that are outdated | def notify_outdated_formula(*, always_notify=True):
brew_update()
outdated_taps = brew_outdated()
outdated_casks = brew_cask_outdated()
need_to_notify = always_notify
if not always_notify:
reported_taps = get_reporeted_taps()
reported_casks = get_reporeted_casks()
need_to_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outdated(self, arguments):\n puts_err(colored.red(\"Not implemented!\"))",
"def check_updates(self):\n try:\n if not common.latest_version(version):\n self.update_notify()\n except:\n self.neterror()",
"def notify_solution(self, sol):\n pass ... | [
"0.57013017",
"0.5536619",
"0.55131626",
"0.5410803",
"0.54061776",
"0.54023784",
"0.53475785",
"0.5319691",
"0.53175247",
"0.5303838",
"0.5303838",
"0.52825916",
"0.5252339",
"0.5213609",
"0.52072716",
"0.51936203",
"0.5177898",
"0.516171",
"0.5160793",
"0.51571876",
"0.5140... | 0.65521204 | 0 |
Get list of current crontab lines | def get_current_crontab():
return subprocess.run(["crontab", "-l"], check=True, capture_output=True, text=True).stdout.splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\n # Calling config file\n cf = config.ReadFile(config_file)\n user = cf[\"authentication\"][\"user\"]\n\n l = []\n for job in cron:\n l.append(job)\n return l",
"def _getcrontab(self):\n\t\twith os.popen(\"crontab -l 2>/dev/null\") as f:\n\t\t\tself.crontab = f.read()",
"de... | [
"0.70708716",
"0.6516903",
"0.6487967",
"0.6189038",
"0.6137725",
"0.59420645",
"0.5913949",
"0.58207613",
"0.57958406",
"0.57827336",
"0.5756434",
"0.5682499",
"0.5675228",
"0.56524414",
"0.56427205",
"0.56387657",
"0.56141067",
"0.5613561",
"0.56097656",
"0.559112",
"0.5550... | 0.74003303 | 0 |
Remove lines from crontab based on pattern matching | def remove_pattern_from_crontab(*, crontab, pattern):
new_crontab = [line for line in crontab if pattern not in line]
return len(crontab) != len(new_crontab), new_crontab | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_homebrew_notifier_from_crontab(crontab):\n return remove_pattern_from_crontab(crontab=crontab, pattern=\".homebrew-notifier/notifier.sh\")",
"def remove_self_from_crontab(crontab):\n return remove_pattern_from_crontab(crontab=crontab, pattern=str(SCRIPT_INSTALL_LOCATION))",
"def _remove_all_jo... | [
"0.667454",
"0.65811265",
"0.5809851",
"0.56893253",
"0.5631481",
"0.55824685",
"0.5575397",
"0.5529661",
"0.5441865",
"0.5385215",
"0.5381065",
"0.5370147",
"0.5311959",
"0.52612764",
"0.5259705",
"0.52369356",
"0.52067155",
"0.51321685",
"0.5076998",
"0.5070716",
"0.5069608... | 0.80879885 | 0 |
Remove homebrewnotifier (the Ruby script) from crontab | def remove_homebrew_notifier_from_crontab(crontab):
return remove_pattern_from_crontab(crontab=crontab, pattern=".homebrew-notifier/notifier.sh") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uninstall():\n def remove_install_directory():\n import shutil\n shutil.rmtree(path=INSTALL_DIR)\n\n _, crontab = remove_self_from_crontab(get_current_crontab())\n update_crontab(crontab)\n remove_install_directory()",
"def remove_self_from_crontab(crontab):\n return remove_patte... | [
"0.6907032",
"0.6542932",
"0.64555603",
"0.60314995",
"0.58913344",
"0.5769639",
"0.5669873",
"0.5604646",
"0.5599259",
"0.5589618",
"0.5563835",
"0.55407965",
"0.5533113",
"0.5531636",
"0.54419595",
"0.537305",
"0.5366244",
"0.53260916",
"0.53217715",
"0.5301724",
"0.52944",... | 0.8344401 | 0 |
Replace crontab with new crontab | def update_crontab(new_crontab):
subprocess.run(["crontab", "-"], check=True, capture_output=True, text=True, input="\n".join(new_crontab)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cronjobs():\n cj.update_cronjob_db()",
"def add_cron_job(nondated_url, curr_date):\n user = os.environ.get('USER', '')\n if user == '':\n usage(\"no USER env var set.\")\n api_key = os.environ.get('MTA_API_KEY', '')\n if api_key == '':\n usage(\"no MTA_API_KEY env var set. Please... | [
"0.66788566",
"0.6488192",
"0.6463645",
"0.6107158",
"0.5948615",
"0.58374834",
"0.58335304",
"0.5827472",
"0.5813535",
"0.5790113",
"0.57056165",
"0.5613475",
"0.5506297",
"0.54975075",
"0.54443944",
"0.53525746",
"0.53508437",
"0.52750874",
"0.52696747",
"0.5246223",
"0.523... | 0.81265134 | 0 |
Copy script to home directory and install it in the crontab | def install():
def copy_file():
import shutil
INSTALL_DIR.mkdir(parents=True, exist_ok=True)
# TODO: Warn on an update once there's logging
shutil.copy(src=__file__, dst=SCRIPT_INSTALL_LOCATION)
def setup_crontab():
# Remove any entries that would duplicate functionality... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _install():\n\tprint \"Preparing to install {} script.\".format(SCRIPT_NAME)\n\t\n\t#make sure there is a place to install the script to.\n\tif not \"SCRIPTS\" in os.environ:\n\t\tprint \"Please set SCRIPTS environment variable.\"\n\t\tsys.exit(1)\n\t\n\tscript_dir = os.environ[\"SCRIPTS\"]\n\t\n\t#check to se... | [
"0.7050048",
"0.6715579",
"0.637645",
"0.6353307",
"0.63423145",
"0.617079",
"0.58513004",
"0.5827972",
"0.5780357",
"0.575971",
"0.57513195",
"0.5686237",
"0.56686085",
"0.565418",
"0.5632885",
"0.559099",
"0.5587477",
"0.55595005",
"0.55501425",
"0.55359906",
"0.55287355",
... | 0.7800942 | 0 |
Create a onehot encoding of x of size k. | def one_hot(x, k, dtype=np.float32):
return np.array(x[:, None] == np.arange(k), dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(z, K):\n z_one_hot = np.zeros((z.size, K))\n z_one_hot[np.arange(z.size), z] = 1\n return z_one_hot",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dty... | [
"0.80434245",
"0.79738784",
"0.789764",
"0.78884685",
"0.7798938",
"0.7713476",
"0.75701195",
"0.7564563",
"0.74274504",
"0.74171615",
"0.7357122",
"0.73545736",
"0.73471665",
"0.7343507",
"0.72914994",
"0.72856927",
"0.7204719",
"0.720342",
"0.71893036",
"0.7163224",
"0.7161... | 0.8009584 | 1 |
Return table of counts for each possible unique combination in ``args``. When ``len(args) > 1``, the array computed by this function is often referred to as a contingency table [1]_. The arguments must be sequences with the same length. The second return value, `count`, is an integer array with ``len(args)`` dimensions... | def crosstab(*args, levels=None, sparse=False):
nargs = len(args)
if nargs == 0:
raise TypeError("At least one input sequence is required.")
len0 = len(args[0])
if not all(len(a) == len0 for a in args[1:]):
raise ValueError("All input sequences must have the same length.")
if spars... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tran_count(df, *args):\n # Compute the count\n df_res = DataFrame(\n df.groupby([*args]).size()\n ).reset_index()\n # Change column name\n col = list(df_res.columns)\n col[-1] = \"n\"\n df_res.columns = col\n\n return df_res",
"def count_entries(df, *args):\n \n #Initiali... | [
"0.5560133",
"0.55132025",
"0.52664083",
"0.5257217",
"0.51046395",
"0.50943494",
"0.5057547",
"0.50450355",
"0.5031963",
"0.4995303",
"0.4980206",
"0.49744844",
"0.49640438",
"0.4947663",
"0.49241897",
"0.49151492",
"0.4894178",
"0.48739162",
"0.48726124",
"0.48219833",
"0.4... | 0.5758026 | 0 |
Construct an embedding layer. You should define a variable for the embedding matrix, and initialize it using tf.random_uniform_initializer to values in [init_scale, init_scale]. | def embedding_layer(self):
with tf.name_scope("Embedding_Layer"):
V_size = len(self.vocab)
embed_dim = len(self.embed[0])
W_embed_ = tf.get_variable("W_embed",shape=[V_size, embed_dim],trainable=False).assign(np.asarray(self.embed))
W_analogy_embed_ = tf.get_vari... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_embedding_layer(inputs_, vocab_size, embed_size):\n embedding = tf.Variable(tf.random_uniform((vocab_size, embed_size), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, inputs_)\n \n return embed",
"def instantiate_weights(self):\n with tf.variable_scope(\"embedding_projection\"),... | [
"0.76497585",
"0.7213567",
"0.7143344",
"0.707056",
"0.70582664",
"0.70497805",
"0.7034895",
"0.68603516",
"0.6824398",
"0.6802359",
"0.6691309",
"0.66816825",
"0.6654323",
"0.6598954",
"0.6585243",
"0.6572197",
"0.6534168",
"0.65056247",
"0.64883417",
"0.64868903",
"0.647689... | 0.73863053 | 1 |
Modularized ball sprite creation. | def create_ball_sprite(x,y):
ball_img = pyglet.resource.image('football100.png')
ball_img.anchor_x = ball_img.width/2
ball_img.anchor_y = ball_img.height/2
mass = 10
radius = ball_img.width/2
ball_sprite = pyglet.sprite.Sprite(ball_img)
ball_sprite.body = pymunk.Body(mass, pymunk.moment_fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(Ball, self).__init__(*args, **kwargs)\n self.speed = kwargs.get('speed', 5)\n self.ball_image = pyglet.image.load(os.path.join(config.ASSETS_DIR, 'ball.png'))\n self.width = self.ball_image.width\n self.height = self.ball_image.height\... | [
"0.75574994",
"0.69608325",
"0.69047207",
"0.6866954",
"0.6805215",
"0.6794108",
"0.6776917",
"0.67611754",
"0.67406934",
"0.67173463",
"0.6680281",
"0.6657195",
"0.66546553",
"0.6641468",
"0.6641468",
"0.66106087",
"0.65859044",
"0.65527314",
"0.6543756",
"0.6513494",
"0.651... | 0.79002166 | 0 |
Modularized outer wall creation. | def create_outer_walls(space,width,height):
static_lines = [pymunk.Segment(space.static_body, (0.0, 0.0), (width, 0.0), 0.0),
pymunk.Segment(space.static_body, (width, 0.0), (width, height), 0.0),
pymunk.Segment(space.static_body, (width, height), (0.0, height), 0.0),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_walls(self):\n for x in range(self.width):\n self.add_thing(Wall(), (x, 0))\n self.add_thing(Wall(), (x, self.height - 1))\n\n for y in range(self.height):\n self.add_thing(Wall(), (0, y))\n self.add_thing(Wall(), (self.width - 1, y))",
"def west_... | [
"0.7323278",
"0.72507095",
"0.7249747",
"0.7209114",
"0.70915794",
"0.70527476",
"0.69921476",
"0.6977186",
"0.6925983",
"0.6841943",
"0.68371457",
"0.66737133",
"0.6627183",
"0.6624451",
"0.6617864",
"0.6572329",
"0.6486268",
"0.6456965",
"0.64444566",
"0.64444566",
"0.64273... | 0.7797422 | 0 |
Raise an error if lookup returns something that isn't a function | def test_get_non_function(self):
with pytest.raises(InvalidTypeError):
get_func_in_module(__name__, 'NOT_A_FUNCTION') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found(error):\n pass",
"def lookup():",
"def lookup(self, *args, **kwargs): # real signature unknown\n pass",
"def lookup(self, *args, **kwargs): # real signature unknown\n pass",
"def _lookup_method(self, call):\n raise Exception(\"_lookup_method must be implemented by subc... | [
"0.66560423",
"0.6524419",
"0.6241248",
"0.6241248",
"0.62305504",
"0.62257624",
"0.62257624",
"0.6011729",
"0.5937731",
"0.58628696",
"0.58469963",
"0.5795517",
"0.579273",
"0.5778699",
"0.57026833",
"0.56646657",
"0.5609881",
"0.5583844",
"0.5519559",
"0.5504477",
"0.549170... | 0.6617872 | 1 |
Invert the Proxy visibility int the current view | def switchVisibility(Proxy):
ProxyRep = smp.GetRepresentation(Proxy)
ProxyRep.Visibility = not ProxyRep.Visibility | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide():\r\n\tfor proxyWrapper in vizconnect.getToolsWithMode('Proxy'):\r\n\t\tproxyWrapper.getRaw().clear()\r\n\tvp.remove(vizconnect.getDisplay())",
"def toggle_culling(self):\n self.view['cull'] = not self.view['cull']\n self.update_flags()",
"def set_view_false(self) -> None:\n\n se... | [
"0.66574347",
"0.641474",
"0.6067122",
"0.60042304",
"0.5975065",
"0.59032947",
"0.5865573",
"0.5746693",
"0.5679609",
"0.5647768",
"0.56093764",
"0.56046623",
"0.5570701",
"0.5563511",
"0.5541751",
"0.5503486",
"0.5503365",
"0.5491101",
"0.5490954",
"0.5485276",
"0.54832155"... | 0.75097 | 0 |
This method encrypts file, publish it to remote server and wait for the result. | def publish(self, filename):
# 1) Encrypt file
# 2) Publish to remote cloud server
# 3) Wait for the result
# 4) Store results in files located inside RAM folder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(file, key, encrypt, host, username, password):\n ssh = SSHClient()\n ssh.load_system_host_keys()\n if password != '-':\n ssh.connect(host, username=username, password=password)\n else:\n ssh.connect(host, username=username)\n \n scp = SCPClient(ssh.get_transport())\n\n i... | [
"0.6911275",
"0.6584395",
"0.6239221",
"0.62208897",
"0.61127234",
"0.61034817",
"0.5915389",
"0.5854406",
"0.5743248",
"0.57029104",
"0.5691345",
"0.560064",
"0.5548157",
"0.5528777",
"0.55166465",
"0.5437776",
"0.54336643",
"0.5431925",
"0.53724897",
"0.53412825",
"0.529338... | 0.83875114 | 0 |
remove unreferenced asset folders from a notebook, and clean up its notes' unreferenced assets; does not delete unless `execute` is specified | def clean(notebook, execute):
nb = select_notebook(notebook)
nb.clean_assets(delete=execute) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cleanup(self):\n os.system(\"rm -r %s/*\" %(self._snippet_index_dir))\n os.system(\"rm %s/*\" %(self._para_dir))\n os.system(\"rm %s/*\" %(self._temp_dir))\n os.system(\"rm %s/*\" %(self._snippet_result_dir))",
"def clean():\n for f in [f for f in os.listdir() if f.endswith... | [
"0.6262598",
"0.5884696",
"0.5882877",
"0.5848111",
"0.57352066",
"0.57286",
"0.57213616",
"0.57178867",
"0.56988084",
"0.56973225",
"0.5665844",
"0.56373435",
"0.56366813",
"0.56301904",
"0.5605748",
"0.559028",
"0.5580692",
"0.5576105",
"0.5570401",
"0.55579203",
"0.5556510... | 0.7726591 | 0 |
view a note in the browser, recompiling when changed | def view(note):
# convert to abs path; don't assume we're in the notes folder
outdir = '/tmp'
note = os.path.join(os.getcwd(), note)
n = Note(note)
compile.compile_note(n, outdir=outdir, templ='default')
click.launch('/tmp/{title}/{title}.html'.format(title=n.title))
f = partial(compile.comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_note(self):\r\n names = [note.__str__() for note in self.source.notes]\r\n \r\n selected = self.notes_list.get(tk.ACTIVE)\r\n dex = names.index(selected) \r\n reading = self.source.notes[dex]\r\n \r\n self.session = tk.Toplevel(self.master, **jt.bfr... | [
"0.64143395",
"0.62181026",
"0.6065372",
"0.6054175",
"0.5997281",
"0.5920192",
"0.58907306",
"0.5850277",
"0.58390784",
"0.5815144",
"0.58038074",
"0.5793946",
"0.57927233",
"0.5763378",
"0.5749729",
"0.5696723",
"0.56300414",
"0.56210726",
"0.55619556",
"0.55562246",
"0.553... | 0.83954215 | 0 |
export a note to html | def export(note, outdir, watch):
# convert to abs path; don't assume we're in the notes folder
note = os.path.join(os.getcwd(), note)
n = Note(note)
f = partial(compile.compile_note, outdir=outdir, templ='default')
watch_note(n, f) if watch else f(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_note(note: str) -> str:\n note = emojize(note)\n note = markdown(note, extensions=['nl2br'])\n return note",
"def outputHtml(s):\n htmlFile.write(s + \"\\n\")",
"def export_notebook():\n #system(\"jupyter nbconvert --to HTML \\\"Look At Enron data set.ipynb\\\"\")\n system(\"jupyte... | [
"0.61508167",
"0.6000263",
"0.5958092",
"0.5904686",
"0.5867675",
"0.58630216",
"0.58230644",
"0.5815483",
"0.5772308",
"0.57648975",
"0.57414436",
"0.5726663",
"0.57081807",
"0.57020766",
"0.5676912",
"0.56564254",
"0.5627281",
"0.56260777",
"0.56156",
"0.55861926",
"0.55697... | 0.6377626 | 0 |
Create a wiki page and attach a file | def runTest(self):
# TODO: this should be split into multiple tests
pagename = self._tester.create_wiki_page()
self._tester.attach_file_to_wiki(pagename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, request, slug):\n try:\n wiki = Wiki.objects.get(slug=slug)\n except Wiki.DoesNotExist:\n error_msg = \"Wiki not found.\"\n return api_error(status.HTTP_404_NOT_FOUND, error_msg)\n\n # perm check\n username = request.user.username\n ... | [
"0.63581324",
"0.61415595",
"0.6099128",
"0.60791373",
"0.6033471",
"0.60205585",
"0.59900564",
"0.5862128",
"0.5857593",
"0.5835423",
"0.58190024",
"0.5717008",
"0.57140315",
"0.5699172",
"0.5675967",
"0.56560063",
"0.5644442",
"0.56422204",
"0.56316394",
"0.5628773",
"0.562... | 0.6485819 | 0 |
Test for simple wiki rename | def runTest(self):
pagename = self._tester.create_wiki_page()
attachment = self._tester.attach_file_to_wiki(pagename)
base_url = self._tester.url
page_url = base_url + "/wiki/" + pagename
def click_rename():
tc.formvalue('rename', 'action', 'rename')
tc.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testRename(self):\n def _check(results):\n self.assertEqual(results[0], b'')\n self.assertEqual(results[1], b'testfile2')\n return self.runCommand('rename testfile2 testfile1')\n\n d = self.runScript('rename testfile1 testfile2', 'ls testfile?')\n d.addCall... | [
"0.6920664",
"0.6617456",
"0.65531",
"0.6531732",
"0.65223765",
"0.65223765",
"0.64893097",
"0.6452853",
"0.6420282",
"0.6409968",
"0.6374237",
"0.63675034",
"0.62798595",
"0.6264456",
"0.62244725",
"0.6170722",
"0.6167493",
"0.6142022",
"0.60847604",
"0.60724974",
"0.6010951... | 0.73085314 | 0 |
Prepare a pd.Series to have index name 'ds' and name 'y' for fbprophet | def prepare_ts(s):
s = s.rename_axis('ds')
out = s.rename('y').reset_index()
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_series(x, y, **options):\n underride(options, name='values')\n if isinstance(y, pd.Series):\n y = y.values\n series = pd.Series(y, index=x, **options)\n series.index.name = 'index'\n return series",
"def SweepSeries(*args, **kwargs):\n if args or kwargs:\n underride(kwarg... | [
"0.6690365",
"0.604914",
"0.59210664",
"0.5716614",
"0.5714259",
"0.5645975",
"0.55709183",
"0.55097264",
"0.54514444",
"0.5447877",
"0.5445783",
"0.5433292",
"0.53704065",
"0.5333938",
"0.5248205",
"0.5228824",
"0.51874447",
"0.51725984",
"0.5138263",
"0.5120638",
"0.5120434... | 0.7258808 | 0 |
Add markers for significant changepoints to prophet forecast plot. | def add_changepoints_to_plot(
ax, m, fcst, threshold=0.01, cp_color='r', cp_linestyle='--', trend=True,
cp_vlines=True
):
artists = []
if trend:
artists.append(ax.plot(fcst['ds'], fcst['trend'], c=cp_color, label='Trend Line'))
signif_changepoints = m.changepoints[
np.abs(np.nanmean(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_series(series, label, marker):\n plt.plot(series, label=label, marker=marker, linestyle=':', linewidth=0.5,\n markersize=4)",
"def visualize(dcf_prices, current_share_prices, regress = True):\n # TODO: implement\n return NotImplementedError",
"def plot_scatter_points(self):\n ... | [
"0.61098194",
"0.57847476",
"0.5627548",
"0.5546444",
"0.54808706",
"0.54679525",
"0.5380747",
"0.5367611",
"0.53632945",
"0.53625846",
"0.53283507",
"0.5324233",
"0.53228515",
"0.53215396",
"0.53140384",
"0.53131163",
"0.52688366",
"0.524576",
"0.5241937",
"0.5238661",
"0.52... | 0.6652998 | 0 |
Serialize the given value to bytes. | def serialize(self, value) -> bytes:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, value: VALUE) -> bytes:\n raise NotImplementedError",
"def _encode_value(self, value):\n return pickle.dumps(value)",
"def ToBytes(self, value) -> bytes:\n pass",
"def Encode(cls,\n value: Any) -> bytes:\n return cls._EncodeWithBytesLength(value, 1)",... | [
"0.86625844",
"0.80213034",
"0.7893365",
"0.75971025",
"0.7589772",
"0.756076",
"0.74937105",
"0.74790907",
"0.7266634",
"0.72655505",
"0.72195184",
"0.7066501",
"0.70149356",
"0.70096254",
"0.6979257",
"0.69207627",
"0.69086206",
"0.6866596",
"0.68343914",
"0.68304944",
"0.6... | 0.8803652 | 0 |
Deserialize a value from the given byte representation. | def deserialize(self, byte: bytes):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialize(self, value: bytes) -> VALUE:\n raise NotImplementedError",
"def loads(value):\n return unpackb(value)",
"def _deserialize(data: bytes) -> Any:\n\n val = data.decode()\n obj_dict = json.loads(val)\n\n return obj_dict['value']",
"def deserialize(self, value):\n ... | [
"0.7907933",
"0.69602466",
"0.6896948",
"0.6858795",
"0.6852222",
"0.6815948",
"0.67662305",
"0.6716619",
"0.67092776",
"0.6652221",
"0.65849435",
"0.6567658",
"0.6567658",
"0.6567658",
"0.65535814",
"0.65222174",
"0.6518216",
"0.6502182",
"0.64887995",
"0.6478273",
"0.647294... | 0.7755854 | 1 |
Parse a TypeName string into a namespace, type pair. | def parse_typename(typename):
if typename is None:
raise ValueError("function type must be provided")
idx = typename.rfind("/")
if idx < 0:
raise ValueError("function type must be of the from namespace/name")
namespace = typename[:idx]
if not namespace:
raise ValueError("func... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(type_str: str) -> \"ConfigurationVariable\":\n try:\n return ConfigurationVariable[type_str.upper()]\n except KeyError as e:\n raise ValueError(f\"Unknown configuration variable: {type_str}. {e}\")",
"def _parse_type(type_name):\n tokens = findall(\"[^<>,]+|<|... | [
"0.5802963",
"0.5641203",
"0.557939",
"0.55530167",
"0.5501704",
"0.5500206",
"0.5446302",
"0.5431461",
"0.5365711",
"0.53213555",
"0.5304136",
"0.5232452",
"0.5222151",
"0.5150982",
"0.5132931",
"0.51070774",
"0.5081898",
"0.5067492",
"0.50619596",
"0.50502354",
"0.50498694"... | 0.64384335 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.