query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Initialize this rule with two subrules. | def __init__(self, left_rule, right_rule):
Rule.__init__(self)
self.__subrules = [left_rule, right_rule] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, *args):\n this = _libsbml.new_Rule(*args)\n try: self.this.append(this)\n except: self.this = this",
"def __init_... | [
"0.8192767",
"0.6681427",
"0.652496",
"0.6522933",
"0.64795053",
"0.64060706",
"0.6398595",
"0.6194084",
"0.61270493",
"0.61270493",
"0.61270493",
"0.61270493",
"0.61270493",
"0.6122999",
"0.61093825",
"0.5918334",
"0.5820725",
"0.57879496",
"0.5769483",
"0.5753444",
"0.57277... | 0.83911604 | 0 |
Return a human readable representation of that rule. | def __str__(self):
return "(%s)" % ' | '.join(map(str, self.__subrules)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def rule(self) -> str:\n if self._rule:\n return self._rule\n return self._make... | [
"0.8322443",
"0.82964164",
"0.8117276",
"0.77377653",
"0.7387597",
"0.7335432",
"0.73148626",
"0.7236931",
"0.71779567",
"0.7062998",
"0.7062998",
"0.7027069",
"0.6867322",
"0.6867322",
"0.6867322",
"0.6841116",
"0.68342084",
"0.6812577",
"0.6810033",
"0.66390747",
"0.6566647... | 0.7118718 | 9 |
Initialize the rule with a subrule. | def __init__(self, rule):
Rule.__init__(self)
self.__rule = rule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, subrule):\n self.__rule = subrule",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrul... | [
"0.7870763",
"0.7811575",
"0.7656956",
"0.7160753",
"0.653307",
"0.633517",
"0.6283239",
"0.62805295",
"0.6202936",
"0.61941767",
"0.6168416",
"0.60362005",
"0.59076303",
"0.5903812",
"0.5889583",
"0.5883609",
"0.58822775",
"0.58275986",
"0.57896584",
"0.57666296",
"0.573136"... | 0.7061991 | 7 |
Return a string representation of this rule. | def __str__(self):
return "[ %s ]" % str(self.__rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\n\t\t\ttext_rule += \"\\nRULE \" + key + \" = [\\n\\t\"\n\t\t\trule_in... | [
"0.85909235",
"0.81206566",
"0.80404353",
"0.77661765",
"0.7577172",
"0.75398356",
"0.73718196",
"0.7260761",
"0.7252544",
"0.71422875",
"0.7057961",
"0.70452917",
"0.70162964",
"0.6860555",
"0.6827189",
"0.68119884",
"0.6804846",
"0.67445683",
"0.67385304",
"0.67276466",
"0.... | 0.84542835 | 1 |
Initialize the rule with the appropriate subrule. | def __init__(self, rule):
Rule.__init__(self)
self.__rule = rule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, rule):\... | [
"0.78390574",
"0.77369565",
"0.7450065",
"0.74388546",
"0.65822154",
"0.6437838",
"0.64023703",
"0.63629377",
"0.6348731",
"0.63186395",
"0.6317418",
"0.6142772",
"0.61134976",
"0.6110916",
"0.6009934",
"0.5976162",
"0.5971592",
"0.59707004",
"0.5966584",
"0.59623295",
"0.593... | 0.7325903 | 4 |
Return a humanreadable representation of the rule. | def __str__(self):
return "{ %s }1" % str(self.__rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def rule(self) -> str:\n if self._rule:\n return self._rule\n return self._make_rule(member_param=self._member_param,\n ... | [
"0.8239602",
"0.8204346",
"0.7525029",
"0.73244405",
"0.7213955",
"0.71983397",
"0.7147793",
"0.70862406",
"0.6992377",
"0.6991684",
"0.69406426",
"0.678836",
"0.678836",
"0.6702712",
"0.6663996",
"0.66255194",
"0.65530753",
"0.65530753",
"0.65530753",
"0.6526857",
"0.6489685... | 0.7937641 | 2 |
Initialize this rule with a subrule. The subrule is transformed to a Optional(OneOrMore(rule)) construct. | def __init__(self, rule):
Rule.__init__(self)
self.__rule = Optional(OneOrMore(rule)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, subrule):\n self.__rule = subrule",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrul... | [
"0.7645435",
"0.7058177",
"0.69865906",
"0.6089792",
"0.607409",
"0.60388577",
"0.59379935",
"0.59379935",
"0.59379935",
"0.59379935",
"0.59379935",
"0.5818215",
"0.56057984",
"0.5555649",
"0.5497652",
"0.54584336",
"0.5446193",
"0.5444033",
"0.54076636",
"0.5373307",
"0.5352... | 0.7242198 | 1 |
Return a human readable representation of the rule. | def __str__(self):
return "{ %s }" % str(self.__rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def rule(self) -> str:\n if self._rule:\n return self._rule\n return self._make_rule(member_param=self._member_param,\n ... | [
"0.83096594",
"0.80169153",
"0.7593279",
"0.7319496",
"0.7264386",
"0.7223886",
"0.72137034",
"0.72088915",
"0.70570076",
"0.6972947",
"0.6946455",
"0.6925757",
"0.6925757",
"0.6782774",
"0.67298824",
"0.66754603",
"0.66754603",
"0.66754603",
"0.66463554",
"0.65674514",
"0.65... | 0.83138204 | 0 |
Initialize the rule with a subrule. | def __init__(self, rule):
Rule.__init__(self)
self.__rule = rule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, subrule):\n self.__rule = subrule",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrul... | [
"0.78689665",
"0.7810713",
"0.76565856",
"0.7162156",
"0.65335506",
"0.63353163",
"0.628398",
"0.62814015",
"0.6204327",
"0.61953646",
"0.61662525",
"0.60366786",
"0.59085375",
"0.5901915",
"0.58901626",
"0.5885288",
"0.588308",
"0.5827859",
"0.5788963",
"0.5767066",
"0.57278... | 0.7061513 | 6 |
Return a humanreadable representation of this rule. | def __str__(self):
return "IgnoreWhite(%s)" % str(self.__rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\... | [
"0.82423717",
"0.82108533",
"0.7932339",
"0.7440846",
"0.73357606",
"0.7311912",
"0.7280985",
"0.7167941",
"0.6995803",
"0.6820977",
"0.6805586",
"0.67758435",
"0.6759987",
"0.6733812",
"0.66440535",
"0.6638224",
"0.66086507",
"0.6599608",
"0.6599608",
"0.6576451",
"0.6566146... | 0.6180306 | 58 |
Match the input against this rule. The input reader is set to 'ignore whitespace' mode, the subrule is matched, the ignore state of the input reader is reset and the result of the subrule is returned. | def match(self, input_reader):
ignore = input_reader.getIgnoreState()
input_reader.setIgnoreState(True)
try:
result = self.__rule.match(input_reader)
except:
input_reader.setIgnoreState(ignore)
raise
input_reader.setIgnoreState(ignore)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, input_reader):\n ignore = input_reader.getIgnoreState()\n input_reader.setIgnoreState(False)\n # skip the trailing whitespace before the subrule matches.\n input_reader.skipWhite()\n try:\n result = self.__rule.match(input_reader)\n except:\n ... | [
"0.77873796",
"0.68763804",
"0.67593026",
"0.6706511",
"0.6550207",
"0.64838886",
"0.6457052",
"0.64352405",
"0.5735446",
"0.5357137",
"0.5324095",
"0.523473",
"0.52233666",
"0.51236165",
"0.51083946",
"0.46980855",
"0.46103334",
"0.45892873",
"0.4580705",
"0.45536798",
"0.44... | 0.64982086 | 5 |
Initialize this rule with a subrule. | def __init__(self, rule):
Rule.__init__(self)
self.__rule = rule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, subrule):\n self.__rule = subrule",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__autorule = None\n self.__subrul... | [
"0.79039633",
"0.7704556",
"0.7528489",
"0.699352",
"0.6592053",
"0.63668275",
"0.62795544",
"0.6239927",
"0.6207873",
"0.6145243",
"0.6114184",
"0.5912805",
"0.58564174",
"0.583741",
"0.5819303",
"0.58177894",
"0.58096725",
"0.5768838",
"0.5738289",
"0.5711264",
"0.5708828",... | 0.6882542 | 8 |
Match this rule against the input. The rule sets the input reader into 'match whitespace' mode, matches the subrule, resets the ignore state and returns the results of the subrule. | def match(self, input_reader):
ignore = input_reader.getIgnoreState()
input_reader.setIgnoreState(False)
# skip the trailing whitespace before the subrule matches.
input_reader.skipWhite()
try:
result = self.__rule.match(input_reader)
except:
input... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, input_reader):\n input_reader.checkPoint()\n for rule in self.__subrules:\n try:\n rule_match = rule.match(input_reader)\n input_reader.deleteCheckpoint()\n return self.returnToken(self.callAction(rule_match))\n except... | [
"0.64872694",
"0.6347668",
"0.61450136",
"0.59545195",
"0.57682425",
"0.56623787",
"0.56563044",
"0.5379188",
"0.5329485",
"0.47243404",
"0.4703115",
"0.4687174",
"0.46170026",
"0.45409277",
"0.44982916",
"0.44837525",
"0.44732395",
"0.44385293",
"0.44295108",
"0.4390456",
"0... | 0.72763103 | 0 |
mark a rule as definitive (i.e. fail nonrecoverably if that rule does not match | def definitive(rule,msg):
return rule | error(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoRule(self, rule):\n self.__autorule = rule\n return self",
"def __init__(self, rule):\n Rule.__init__(self)\n self.__rule = Optional(OneOrMore(rule))",
"def allow_allreduce(self):\n assert self._trigger is not None, \"StepControl does not have an attached trigger\"\n ... | [
"0.6098144",
"0.5746041",
"0.56196755",
"0.5569634",
"0.5473827",
"0.5473827",
"0.5473827",
"0.5473827",
"0.5473827",
"0.53956914",
"0.5384982",
"0.5349471",
"0.53090274",
"0.5247847",
"0.523161",
"0.52108085",
"0.51964575",
"0.5193712",
"0.5176003",
"0.51646626",
"0.5144124"... | 0.65730274 | 0 |
Fetch an image if it isn't already present. This works like ``docker pull`` and will pull the tag ``latest`` if no tag is specified in the image name. | def fetch_image(client, name):
try:
image = client.images.get(name)
except docker.errors.ImageNotFound:
name, tag = _parse_image_tag(name)
tag = 'latest' if tag is None else tag
log.info("Pulling tag '{}' for image '{}'...".format(tag, name))
image = client.images.pull(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_image_if_not_exists(self, tag):\n image_name = self.build_image_name(tag)\n try:\n # Check if exists\n image = self.client.images.get(image_name)\n except Exception as ex:\n print('Image does not exist: {}'.format(str(ex)))\n # Pull if doesn... | [
"0.77883637",
"0.72762054",
"0.7259427",
"0.7089663",
"0.69282615",
"0.69218105",
"0.6881295",
"0.6839927",
"0.68272954",
"0.6657196",
"0.6514073",
"0.6437116",
"0.641478",
"0.6252873",
"0.6102983",
"0.6100666",
"0.60909176",
"0.6073103",
"0.6069691",
"0.60605085",
"0.6058441... | 0.82496524 | 0 |
blur the image with Gaussian Smoothing technique | def gaussianBlur(img,ksize=(5,5),sigma=10):
#kernel = cv2.getGaussianKernel(ksize,sigma)
dst = np.zeros_like(img)
cv2.GaussianBlur(src=img,dst=dst,ksize=ksize,sigmaX=0)
return dst | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_blur(self,img):\n return cv2.GaussianBlur(img, (self.kernel_size, self.kernel_size), 0)",
"def __gaussian_blur(self, img, kernel_size=3):\n return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)",
"def reblur(inp_img):\n\n img = np.array(inp_img)\n kernel_deviation = 1.5\n... | [
"0.82777363",
"0.8166307",
"0.8049771",
"0.8022641",
"0.7986579",
"0.79467",
"0.7919809",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0.7864901",
"0... | 0.77062833 | 24 |
Make a buffered stream to replace a standard stream. | def _makeBufferedStdStream(self):
# The returned stream needs to have a 'buffer' attribute, since
# some tests may expect that to exist on standard streams, and a
# 'getvalue' method for the convenience of _restoreStdStreams.
# This requires some care.
class BufferedStandardStrea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buffer_stream(stream, batch_size):\n return pescador.buffer_streamer(stream, batch_size)",
"def copy_to(self, stream, bufsize=None):\n bufsize = bufsize or PRETZEL_BUFSIZE\n if isinstance(stream.write(b''), int):\n # destination stream is synchronous python stream\n try... | [
"0.6521658",
"0.65028507",
"0.6383464",
"0.63824195",
"0.6368981",
"0.63611394",
"0.6230266",
"0.6159378",
"0.60959303",
"0.595737",
"0.5943116",
"0.58953375",
"0.5860859",
"0.58579403",
"0.57731515",
"0.56645817",
"0.5641117",
"0.56121635",
"0.5608719",
"0.5594284",
"0.55903... | 0.76684594 | 0 |
Order the layers from least to most specific (bottom to top). Puts unit tests first. Groups layers with common base layers together. Sorts the rest alphabetically. Removes duplicates. | def order_by_bases(layers):
layers = sorted(layers, key=layer_sort_key, reverse=True)
gathered = []
for layer in layers:
gather_layers(layer, gathered)
gathered.reverse()
seen = {}
result = []
for layer in gathered:
if layer not in seen:
seen[layer] = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_sort_key(layer):\n seen = set()\n key = []\n\n # Note: we cannot reuse gather_layers() here because it uses a\n # different traversal order.\n binding = {} # hack to avoid recursion -- for PY2\n\n def _gather(layer):\n seen.add(layer)\n # We make the simplifying assumptio... | [
"0.72557485",
"0.61393195",
"0.6110427",
"0.6099585",
"0.6058314",
"0.58652484",
"0.58304536",
"0.5776012",
"0.5615117",
"0.5409117",
"0.53811884",
"0.5356623",
"0.5350355",
"0.53319776",
"0.53131324",
"0.53084964",
"0.52880484",
"0.52390236",
"0.52353954",
"0.52314645",
"0.5... | 0.70932984 | 1 |
check whether diff of two dicts is below a threshold value | def CompareValuesDict(dic1, dic2, accepteddiff=0.04, debug =False):
identical = True
for key in dic1:
val1 = dic1[key]
val2 = dic2.get(key,None)
if val2:
diff = np.abs(val1-val2)
if debug:
print (key, diff)
if diff > accepteddi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dict_contains(dict_a, dict_b):\n return dict_a.items() >= dict_b.items()",
"def check_dict_almost_equal(dict_a: Dict[Any, float],\n dict_b: Dict[Any, float],\n decimal: int = 7) -> bool:\n if set(dict_a.keys()) != set(dict_b.keys()):\n retur... | [
"0.72842747",
"0.72117233",
"0.70431817",
"0.69072974",
"0.6649591",
"0.64962804",
"0.6409543",
"0.6300027",
"0.6273857",
"0.6260392",
"0.62418437",
"0.6211319",
"0.61546403",
"0.6105012",
"0.6094948",
"0.608859",
"0.6074446",
"0.60705775",
"0.6053892",
"0.60341907",
"0.60238... | 0.7277438 | 1 |
Return the type of a schema definition. | def deduce_type(obj: Dict[str, Any]) -> str:
data_type: str = obj.get("type", None)
if data_type is not None:
return data_type
if "items" in obj:
return "array"
if "properties" in obj:
return "object"
return "any" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schema_type(arg_schema: Dict[str, Any]) -> str:\n return arg_schema['schema']['type']",
"def _schema_type(self) -> Optional[type]:\n pass",
"def _schema_type(self) -> Optional[type]:\n return AdBreakSchema",
"def _schema_type(self) -> Optional[type]:\n return IndexSchema",
"... | [
"0.78456223",
"0.74964964",
"0.7451609",
"0.7370395",
"0.73280346",
"0.72159594",
"0.721293",
"0.71189207",
"0.7115734",
"0.6983264",
"0.69754624",
"0.68222225",
"0.6746487",
"0.67367923",
"0.66829956",
"0.66754174",
"0.6661009",
"0.6586401",
"0.6571678",
"0.65432495",
"0.652... | 0.0 | -1 |
This function open a file and return a list with all the lines | def readfile(filename):
try:
with open(filename, "r") as file:
text = file.readlines()
for i in range(len(text)):
text[i] = text[i].rstrip()
return text
except:
print("Error readfile()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_lines_from_file(fname):\n return []",
"def _get_lines_from_file(path: str) -> List[str]:\n if os.path.isfile(path):\n with open(path, 'r') as f:\n lines = f.readlines()\n else:\n raise InputError(f'Could not find file {path}')\n return lines",
"def read_file(path: ... | [
"0.8215437",
"0.8143381",
"0.79937214",
"0.7973599",
"0.79373413",
"0.792495",
"0.7894134",
"0.788836",
"0.78295815",
"0.78291285",
"0.78277344",
"0.78065425",
"0.78043866",
"0.7792632",
"0.7789453",
"0.7776489",
"0.7765143",
"0.77507305",
"0.7745484",
"0.77178514",
"0.770732... | 0.0 | -1 |
Seperates all the words and only keep the alpha's | def get_words(line):
try:
alphabet = "abcdefghijklmnopqrstuvwqyz "
lineL = list(line.lower())
for word in lineL:
if word not in alphabet:
lineL.remove(word)
lineS = "".join(lineL)
lineL = lineS.split(" ")
for word in lineL:
if w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_word( s ):\n words = ''\n for i in s:\n if i.isalpha():\n words += i\n else:\n words = words\n return words",
"def cleanWord(word):\r\n newWord = [letter.lower() for letter in word if letter.isalpha()]\r\n return \"\".join(newWord)",
"def clean_text(... | [
"0.76532423",
"0.73436373",
"0.7261825",
"0.71635145",
"0.7021406",
"0.6942679",
"0.69128907",
"0.6875195",
"0.6828132",
"0.6812344",
"0.6788839",
"0.6744104",
"0.67233056",
"0.67043823",
"0.6683897",
"0.66524",
"0.665145",
"0.66373426",
"0.66227764",
"0.66203386",
"0.6612778... | 0.0 | -1 |
Renders the about page. | def about():
return render_template(
'about.html',
title='About',
year=datetime.now().year,
message='Your application description page.'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82680845",
"0.8243358",
"0.8239194",
"0.8224137",
"0.82079816",
"0.8204868",
"0.8173699",
"0.8172736",
"0.80967313",
"0.80501616",
"0.80501616",
"0.80501616",
"0.80501616",
"0.80501616",
"0.... | 0.82709616 | 13 |
Returns the depth of brackets surrounding a character at a given index | def indent(s, i):
return sum([1 if c == "(" else 0 for c in s[:i+1]]) - sum([1 if c == ")" else 0 for c in s[:i]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _match_brackets(text: str, index_of_open_bracket: int) -> int:\n if text[index_of_open_bracket] != \"[\":\n raise SyntaxError(\n \"Index {} in 'text' is not an open bracket '['. It is {}\".format(\n index_of_open_bracket,\n text[index_of_open_bracket],\n ... | [
"0.6441032",
"0.6278467",
"0.622806",
"0.6077319",
"0.598753",
"0.58589983",
"0.57255167",
"0.56981266",
"0.5690461",
"0.5681209",
"0.56341326",
"0.56204003",
"0.5599084",
"0.559601",
"0.55728364",
"0.5522096",
"0.55196637",
"0.5511052",
"0.54834247",
"0.5483365",
"0.54785883... | 0.56290966 | 11 |
Apply the "add" operation between "self" and "y". | def add(
self, y: Union[int, float, torch.Tensor, np.ndarray, "ShareTensor"]
) -> "ShareTensor":
new_share = self.apply_function(y, "add")
return new_share | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, y):\n return circuit.add(self, y)",
"def add(\n self, y: Union[int, float, np.ndarray, torch.tensor, MPCTensor]\n ) -> MPCTensor:\n res = self.__apply_op(y, \"add\")\n return res",
"def add(self, x, y):\n pass",
"def add_y(self, y, add):\n return (y ... | [
"0.7918664",
"0.77989084",
"0.76901156",
"0.7479248",
"0.7461794",
"0.7456274",
"0.7386558",
"0.71532017",
"0.71426934",
"0.71313065",
"0.7127516",
"0.7123588",
"0.7049094",
"0.7049094",
"0.69804054",
"0.69662297",
"0.6939465",
"0.6914432",
"0.6895164",
"0.6886773",
"0.686751... | 0.6957926 | 16 |
Apply the "ne" operation between "y" and "self". | def ne(self, y: Union[ShareTensor, np.ndarray]) -> "ShareTensor":
# raise ValueError(
# "It should not reach this point since we generate SMPCAction for this"
# )
new_share = ShareTensor.apply_function(self, y, "ne")
return new_share | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ne(self, y):\n difference = self - y\n difference = type(difference).stack([difference, -difference])\n return difference._ltz().sum(0)",
"def ne(self, y):\n if comm.get().get_world_size() == 2:\n return 1 - self.eq(y)\n\n difference = self - y\n difference.share = to... | [
"0.76962197",
"0.75823",
"0.7163024",
"0.70322347",
"0.6981256",
"0.6828718",
"0.6739267",
"0.66849077",
"0.6684868",
"0.6641086",
"0.6613917",
"0.6591961",
"0.6572852",
"0.65726185",
"0.6561855",
"0.6558564",
"0.65503263",
"0.651594",
"0.6512535",
"0.6500138",
"0.6493888",
... | 0.72291166 | 2 |
Equal operator. Check if "self" is equal with another object given a set of attributes to compare. | def eq(self, other: Any) -> bool:
# TODO: Rasswanth: Fix later after the comparison operation
# relative
# from .... import Tensor
# if (
# isinstance(self.child, Tensor)
# and isinstance(other.child, Tensor)
# and (self.child != other.child).child.an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n\t\treturn all((getattr(self, attr, None) == getattr(other, attr, None) for attr in self.attrs))",
"def __eq__(self, other):\n for attr in self._attrs_to_save:\n try:\n if getattr(self, attr) != getattr(other, attr):\n return False\n except Att... | [
"0.80915666",
"0.7883474",
"0.7869786",
"0.78263706",
"0.77317244",
"0.77148974",
"0.76727086",
"0.76222324",
"0.76140815",
"0.75810045",
"0.7578767",
"0.754383",
"0.7525018",
"0.7431048",
"0.74228346",
"0.7411746",
"0.74100983",
"0.74100983",
"0.74100983",
"0.74100983",
"0.7... | 0.0 | -1 |
Export dataframe to csv | def export_csv(self, df, filename):
df.to_csv(str(pathlib.PurePosixPath(self.config.csv_path, filename)) , sep=";") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv(self, outpath):\n\n\t\tself.df.to_csv(outpath)",
"def info2csv(df, csv_path):\n df.to_csv(csv_path, index=False)",
"def output_csv(df):\n # remove existing plot\n if os.path.exists(\"files/converted.csv\"):\n os.remove(\"files/converted.csv\")\n # save csv\n df.to_csv('file... | [
"0.8214005",
"0.80662256",
"0.80164874",
"0.79617006",
"0.7870546",
"0.7838557",
"0.7804871",
"0.7638591",
"0.7635488",
"0.7539306",
"0.7532738",
"0.7509236",
"0.745987",
"0.7436494",
"0.7425089",
"0.74161136",
"0.7415337",
"0.7407006",
"0.74038106",
"0.7396205",
"0.7342415",... | 0.79972094 | 3 |
Get DayNumber of learning contents of today | def GetDayNumber(self, StartDay, Today):
DayFrom = datetime.strptime(StartDay, '%Y-%m-%d %H:%M:%S')
DayNumber = int((Today - DayFrom).days) + 1
return DayNumber | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day(self):\n return 0",
"def day(self):\n return 0",
"def day(self) -> int:\n return pulumi.get(self, \"day\")",
"def day(self) -> int:\r\n return self._day",
"def get_current_day() -> int:\n return datetime.now().day",
"def get_number_days(self):\r\n return ... | [
"0.7798329",
"0.7798329",
"0.7489059",
"0.71689075",
"0.7120513",
"0.6802395",
"0.66543585",
"0.66543585",
"0.66543585",
"0.66440374",
"0.6641695",
"0.66215473",
"0.6617596",
"0.6599652",
"0.65666425",
"0.6525604",
"0.65029633",
"0.6400517",
"0.6384666",
"0.6381159",
"0.63740... | 0.6959223 | 5 |
Return instance with empty route table | def __init__(self) -> None:
#: The underlying route table config file
self._route_table = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.routingTable = dict()",
"def normalise(self) -> \"Route\":\n pass",
"def none(self):\n clone = self._chain()\n clone.query.set_empty()\n return clone",
"def route_table(self) -> Optional['outputs.RouteTableResponse']:\n return pulumi.get(se... | [
"0.65733296",
"0.5729816",
"0.5729083",
"0.56232995",
"0.559553",
"0.5592199",
"0.5582291",
"0.5438003",
"0.5402465",
"0.53540665",
"0.5324479",
"0.532169",
"0.53139406",
"0.5310441",
"0.52688175",
"0.5248669",
"0.5230781",
"0.5230781",
"0.52281135",
"0.5202834",
"0.5201653",... | 0.6245626 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 33 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006"
] | 0.0 | -1 |
Convert iterator to tuple consuming iterator. Infinite operators do not terminate. | def tuple(self) -> tuple:
return tuple(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterator_peek(iterator: Iterator[T], count: int) -> tuple[list[T], Iterator[T]]:\n\n ret = []\n for _ in range(count):\n try:\n ret.append(next(iterator))\n except StopIteration:\n break\n\n return ret, chain(ret, iterator)",
"def __wrap_with_tuple(self) -> tuple:... | [
"0.67213917",
"0.6246168",
"0.6223528",
"0.61159706",
"0.6114643",
"0.5974625",
"0.5889041",
"0.587703",
"0.5868912",
"0.5861463",
"0.5847689",
"0.5846035",
"0.58127433",
"0.58053035",
"0.5778345",
"0.57466847",
"0.5736377",
"0.57002926",
"0.5660141",
"0.5630925",
"0.56304145... | 0.51493484 | 79 |
Convert iterator to tuple consuming iterator. Infinite operators do not terminate. | def set(self) -> set:
return set(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterator_peek(iterator: Iterator[T], count: int) -> tuple[list[T], Iterator[T]]:\n\n ret = []\n for _ in range(count):\n try:\n ret.append(next(iterator))\n except StopIteration:\n break\n\n return ret, chain(ret, iterator)",
"def __wrap_with_tuple(self) -> tuple:... | [
"0.67213917",
"0.6246168",
"0.6223528",
"0.61159706",
"0.6114643",
"0.5974625",
"0.5889041",
"0.587703",
"0.5868912",
"0.5861463",
"0.5847689",
"0.5846035",
"0.58127433",
"0.58053035",
"0.5778345",
"0.57466847",
"0.5736377",
"0.57002926",
"0.5660141",
"0.5630925",
"0.56304145... | 0.0 | -1 |
Convert iterator to tuple consuming iterator. Infinite operators do not terminate. | def frozenset(self) -> frozenset:
return frozenset(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterator_peek(iterator: Iterator[T], count: int) -> tuple[list[T], Iterator[T]]:\n\n ret = []\n for _ in range(count):\n try:\n ret.append(next(iterator))\n except StopIteration:\n break\n\n return ret, chain(ret, iterator)",
"def __wrap_with_tuple(self) -> tuple:... | [
"0.67213917",
"0.6246168",
"0.6223528",
"0.61159706",
"0.6114643",
"0.5974625",
"0.5889041",
"0.587703",
"0.5868912",
"0.5861463",
"0.5847689",
"0.5846035",
"0.58127433",
"0.58053035",
"0.5778345",
"0.57466847",
"0.5736377",
"0.57002926",
"0.5660141",
"0.5630925",
"0.56304145... | 0.0 | -1 |
Convert iterator to string consuming iterator and concatenating elements. Infinite operators do not terminate. | def str(self) -> str:
return "".join(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_itr_str(iterable) -> str:\n\treturn str([str(i) for i in iterable])",
"def join(self, iterable) -> String:\n pass",
"def __iter__(self):\n current = self._head\n while current is not None:\n yield str(current.value)\n current = current.next",
"def stringiter_com... | [
"0.6877523",
"0.6295069",
"0.62733",
"0.62333494",
"0.6108198",
"0.595061",
"0.5861102",
"0.579971",
"0.57859546",
"0.5760205",
"0.5671514",
"0.5637667",
"0.5631004",
"0.56074494",
"0.5573592",
"0.55373716",
"0.5528665",
"0.55286384",
"0.55237156",
"0.5516453",
"0.54973495",
... | 0.0 | -1 |
Return a copy of iterator. Consuming the copy do not consume the original iterator. Internally, this method uses itertools.tee to perform the copy. If you known that the iterator will be consumed, it is faster and more memory efficient to convert it to a list and produce multiple iterators. | def copy(self) -> "Iter":
self._iterator, other = itertools.tee(self._iterator, 2)
return Iter(other, self._size_hint) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterator_copy(thing):\n # Even though normal copies are discouraged they should be possible.\n # Cannot do \"list\" because it may be infinite :-)\n next(copy.copy(thing))",
"def duplicate(self):\n return _StreamIterator(self.stream)",
"def copy(self):\n return _libsbml.SwigPyIterato... | [
"0.72656935",
"0.68923855",
"0.6761833",
"0.6761548",
"0.63712066",
"0.63046026",
"0.6209446",
"0.61299926",
"0.5897998",
"0.58560836",
"0.57955503",
"0.57805204",
"0.5762725",
"0.57585883",
"0.575578",
"0.57505137",
"0.5748371",
"0.57342494",
"0.568583",
"0.5684148",
"0.5663... | 0.7977475 | 0 |
Split iterator into n additional copies. The copy method is simply an alias to iter.tee(1)[0] | def tee(self, n=1) -> Tuple["Iter", ...]:
self._iterator, *rest = itertools.tee(self._iterator, n + 1)
n = self._size_hint
return tuple(Iter(it, n) for it in rest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split_iterators(iterator, n=None):\n #if n is None:\n # item, iterator = cytoolz.peek(iterator)\n # n = len(item)\n iterators = itertools.tee(iterator, n)\n #iterators = ((sample[i] for sample in iterator) for i, iterator in enumerate(iterators))\n # Above does not work?!\n\n out = ... | [
"0.75784266",
"0.7021175",
"0.68646735",
"0.67921853",
"0.67796403",
"0.668581",
"0.668581",
"0.66818815",
"0.66728866",
"0.66728866",
"0.6652125",
"0.6647717",
"0.6629733",
"0.6627989",
"0.6616667",
"0.6611353",
"0.66104007",
"0.6602548",
"0.6597106",
"0.65915716",
"0.655782... | 0.6903771 | 2 |
Peek the first n elements without consuming the iterator. | def peek(self, n: int) -> Tuple:
data = tuple(itertools.islice(self._iterator, n))
self._iterator = itertools.chain(data, self._iterator)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(iterable, n):\n return list(itertools.islice(iterable, n))",
"def take(self, n): # noqa: N805\n return List(_islice(self, n))",
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def firstn... | [
"0.7319678",
"0.7244791",
"0.7181097",
"0.7181097",
"0.71591604",
"0.71557003",
"0.7149305",
"0.7149305",
"0.709483",
"0.7090996",
"0.7090393",
"0.7042699",
"0.70163965",
"0.7016073",
"0.70048064",
"0.6987776",
"0.6971278",
"0.6952081",
"0.6891563",
"0.68764496",
"0.6714728",... | 0.75589246 | 0 |
returns x,y,z coordinates for a random point on the top face of this BoxWorld. Note that the x,y position could lie on the edge of the topface So could hardcode each side... or figure out some more general way | def _get_random_pos_on_top(self):
# z = self._top_position() - self.offset
z = self.upper_vertex[2] - self.offset
x_lower, x_upper = self._shrink_range_by_padding(self._x_range())
y_lower, y_upper = self._shrink_range_by_padding(self._y_range())
x = random.uniform(x_lower, x_uppe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_random_pos_on_back(self):\n y = self.lower_vertex[1] + self.offset\n x_lower, x_upper = self._shrink_range_by_padding(self._x_range())\n z_lower, z_upper = self._shrink_range_by_padding(self._z_range())\n x = random.uniform(x_lower, x_upper)\n z = random.uniform(z_lower,... | [
"0.7753852",
"0.70544726",
"0.694856",
"0.68321854",
"0.66540754",
"0.6548021",
"0.64968663",
"0.6435214",
"0.64236414",
"0.64184046",
"0.6413016",
"0.6374515",
"0.6368178",
"0.6367819",
"0.63565135",
"0.63506675",
"0.63060147",
"0.626413",
"0.62516063",
"0.62347925",
"0.6223... | 0.8272292 | 0 |
return true if particle is inside world, not including boundary return false otherwise | def particle_is_inside(self, particle):
return self.in_box_bounds(particle.position) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_coll(self, particle):\r\n \r\n r1, r2 = self.radius, particle.radius\r\n x1, x2 = self.position, particle.position\r\n di = x2-x1\r\n norm = np.linalg.norm(di)\r\n if norm-(r1+r2)*1.1 < 0:\r\n return True\r\n else:\r\n return False",
... | [
"0.67653185",
"0.66510534",
"0.65469086",
"0.65294206",
"0.6528931",
"0.6470833",
"0.636595",
"0.63649243",
"0.63321924",
"0.63179636",
"0.62686884",
"0.6250902",
"0.6248409",
"0.6241183",
"0.6239418",
"0.62240016",
"0.620523",
"0.61916804",
"0.61729515",
"0.6151877",
"0.6145... | 0.74749047 | 0 |
return true if test_vec (position) is inside the rectangular box defined by lower and upper vertex note if the tes_vec lies exaclty on the box boundary this returns False | def in_box_bounds(self, test_vec):
above_min = np.greater(test_vec, self.lower_vertex).all()
below_max = np.greater(self.upper_vertex, test_vec).all()
return above_min and below_max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_box(coords, box):\n\tif box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n\t\treturn True\n\treturn False",
"def in_box(coords, box):\n if box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n return True\n return False",
"def within(point: tuple... | [
"0.71500015",
"0.7109482",
"0.6874244",
"0.6803979",
"0.6774042",
"0.66210306",
"0.6605447",
"0.65268016",
"0.6501898",
"0.64960843",
"0.64061993",
"0.63766164",
"0.6372194",
"0.6361059",
"0.63103426",
"0.62946266",
"0.6291716",
"0.6268863",
"0.6254483",
"0.6241384",
"0.61883... | 0.7877781 | 0 |
Loop through a persons legs, creating a geopandas GeoDataFrame defining travel for plotting. | def build_person_travel_geodataframe(person, from_epsg=None, to_epsg=None):
df = pd.DataFrame()
for leg in person.legs:
if (leg.start_location.loc is None) or (leg.end_location.loc is None):
raise AttributeError('To create a geopandas.DataFrame you need specific locations. Make sure Legs hav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_geoseries(self, dataframe):\n geo_list = []\n with click.progressbar(dataframe.iterrows(), label='Pulling site plans and geographic title data', length=len(dataframe)) as d:\n for index, row in d:\n geo_list.append(self.map_property(row['linc']))\n\n geo_ser... | [
"0.59152794",
"0.5809195",
"0.5771426",
"0.5729179",
"0.57111984",
"0.56684035",
"0.56364685",
"0.55500686",
"0.55306983",
"0.5511304",
"0.5481631",
"0.5470723",
"0.54607356",
"0.54538083",
"0.5450142",
"0.5364091",
"0.53513706",
"0.53503865",
"0.53410184",
"0.5319222",
"0.52... | 0.68375707 | 0 |
Return dictionary version of this TraceElement. | def as_dict(self) -> dict[str, Any]:
result: dict[str, Any] = {"path": self.path, "timestamp": self._timestamp}
if self._child_key is not None:
domain, _, item_id = self._child_key.partition(".")
result["child_id"] = {
"domain": domain,
"item_id": ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asdict(self):\n return attr.asdict(self)",
"def as_dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"... | [
"0.7330137",
"0.7227759",
"0.72126085",
"0.72126085",
"0.72126085",
"0.72126085",
"0.72126085",
"0.72126085",
"0.72126085",
"0.7182175",
"0.7139755",
"0.7124223",
"0.71171707",
"0.71171707",
"0.71171707",
"0.71171707",
"0.71171707",
"0.71171707",
"0.71096116",
"0.7049303",
"0... | 0.0 | -1 |
Set id of the current trace. | def trace_id_set(trace_id: tuple[str, str]) -> None:
trace_id_cv.set(trace_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trace_id(self, trace_id):\n\n self._trace_id = trace_id",
"def trace_id(self, trace_id):\n\n self._trace_id = trace_id",
"def set_id(self, id):\n self.id = id\n print(\"self id = \" + str(self.id))",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\... | [
"0.79803056",
"0.79803056",
"0.78365254",
"0.7786556",
"0.7663365",
"0.7644304",
"0.74390364",
"0.7406895",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.7386496",
"0.73657537"... | 0.77529997 | 4 |
Get id if the current trace. | def trace_id_get() -> tuple[str, str] | None:
return trace_id_cv.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trace_id(self) -> str:\n return self._trace_id",
"def get_current_id(self):\n\n id = self.ids[-1]\n\n if id is None:\n raise KeyError()\n\n return id",
"def getIdent (self) :\n return self.id",
"def getid(self):\n return self.__id",
"def get_parent_id_from_trace_id():... | [
"0.8014743",
"0.74045295",
"0.73533785",
"0.70272356",
"0.70003533",
"0.69937176",
"0.6979188",
"0.69667906",
"0.69667906",
"0.6963296",
"0.6917849",
"0.6878042",
"0.6862111",
"0.6860533",
"0.6860533",
"0.6853552",
"0.6827013",
"0.680593",
"0.6800737",
"0.6795696",
"0.6795463... | 0.0 | -1 |
Returns a POSITIVE value correlated with self affinity (e.g. hairpin affinity) | def self_affinity(self, sequence):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n return self.affinity",
"def mp_corr(self):\n a, c, d, b = self.to_ccw()\n p1, q1 = a + b, c + d\n p2, q2 = a + c, b + d\n n = p1 + q1\n\n if n == 0:\n return np.nan\n elif a == n or d == n:\n # only one (diagonal) cell is n... | [
"0.6526385",
"0.6048305",
"0.6011742",
"0.5867784",
"0.58175176",
"0.5807887",
"0.56873167",
"0.5636081",
"0.56255007",
"0.5620146",
"0.5588096",
"0.5567723",
"0.55443287",
"0.551946",
"0.5496809",
"0.5492681",
"0.54883826",
"0.5459819",
"0.54476845",
"0.5446598",
"0.5439716"... | 0.62203825 | 1 |
return the first index of item in array or None if item is not found | def linear_search(array, item):
# implement linear_search_iterative and linear_search_recursive below, then
# change this to call your implementation to verify it passes all tests
# return linear_search_iterative(array, item)
return linear_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np_index_of(array, item):\n where = np.where(array == item)\n if len(where) == 0:\n raise ValueError(\"{0} not found in array\".format(item))\n return where[0][0] # where is a 2d array",
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n e... | [
"0.7654498",
"0.76485795",
"0.73254657",
"0.7152995",
"0.70068246",
"0.6965024",
"0.6964481",
"0.6916574",
"0.6872765",
"0.6827316",
"0.67693734",
"0.6750015",
"0.66990155",
"0.668622",
"0.66723377",
"0.6657315",
"0.66358805",
"0.66342586",
"0.661365",
"0.6607807",
"0.6569612... | 0.60730076 | 59 |
return the index of item in sorted array or None if item is not found | def binary_search(array, item):
# implement binary_search_iterative and binary_search_recursive below, then
# change this to call your implementation to verify it passes all tests
return binary_search_iterative(array, item)
# return binary_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val",
"def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1",
"def binary_search(elem: int, arr:... | [
"0.79116553",
"0.7231691",
"0.70945144",
"0.70503265",
"0.702492",
"0.7014106",
"0.6975659",
"0.693756",
"0.69133765",
"0.69059515",
"0.688041",
"0.6863463",
"0.6828841",
"0.6823668",
"0.676312",
"0.67249036",
"0.6687773",
"0.66777045",
"0.66451496",
"0.65669006",
"0.6558889"... | 0.59163046 | 91 |
Delete word from document/text which are exceptions > word and ngrams, e.g., good morning (for sentiment analysis). | def remove_words_and_ngrams(self, document):
for w in self.words_and_ngrams_exceptions:
document = re.sub(w, '', document)
return document | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_search_words(self,\r\n index,\r\n entrytext):\r\n\r\n for a_temp in DELETECHARACTERS:\r\n entrytext = entrytext.replace(a_temp, BLANK)\r\n\r\n for w in set(entrytext.split()):\r\n w = w.strip()\r\n\r\n i... | [
"0.68724984",
"0.68354917",
"0.6804807",
"0.6611424",
"0.6542991",
"0.6523532",
"0.6520232",
"0.6468677",
"0.6457957",
"0.6452957",
"0.6408865",
"0.64012027",
"0.63989145",
"0.63737524",
"0.63294595",
"0.63109434",
"0.6289858",
"0.62712455",
"0.62269074",
"0.62057954",
"0.619... | 0.80366737 | 0 |
Delete word tokens from token list. | def remove_stop_words(self, document_tokens=None, sentences=None):
if sentences is not None or (
sentences is not None and document_tokens is not None):
sentences_ = []
for sentence in sentences:
sentences_.append(
[word for wor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_words(self, words=None):\n\n if words is None:\n words = self.stopwords\n\n self.__corpora = [\n sub(r' ({0}) '.format('|'.join(words)), ' ', string) for string in self.__corpora\n ]",
"def delete_stop_words(list, wordset):\n for word in wordset:\n ... | [
"0.7096367",
"0.69165164",
"0.6830647",
"0.68254703",
"0.6766411",
"0.66559064",
"0.6621373",
"0.6612332",
"0.6584032",
"0.65676814",
"0.6552788",
"0.6535444",
"0.6535132",
"0.6524928",
"0.6499072",
"0.6463791",
"0.64597",
"0.6448889",
"0.64395803",
"0.6433568",
"0.6427211",
... | 0.0 | -1 |
Returns document with Parts of Speech tags in a given text | def parts_of_speech_tags(self, tokenized_doc):
return [(token.text, token.pos_) for token in self.parser(
tokenized_doc)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part_of_speech(text):\n temp = nltk.pos_tag(text)\n return [word for word, tag in temp if \n (tag == \"NN\") or \n (tag == \"NNS\") or\n (tag == \"NNP\") or \n (tag == \"NNPS\")]",
"def part_of_speech_tag(cls, text: str) -> List[List[Tuple[str, str, str]]]:\n... | [
"0.73714256",
"0.68547326",
"0.6704113",
"0.60886097",
"0.6041821",
"0.60402524",
"0.60180575",
"0.59991455",
"0.5969165",
"0.59427476",
"0.5871523",
"0.5814639",
"0.5789967",
"0.5773782",
"0.5743357",
"0.57129043",
"0.57118714",
"0.567669",
"0.5629352",
"0.5622485",
"0.56064... | 0.6078136 | 4 |
Returns the native representation of a location. Parameter | def to_representation(self, object):
measurement_serializer = MeasurementSerializer(
object.measurements.all(),
many=True,
context=self.context
)
return {
'type': 'Feature',
'geometry': json.loads(object.geometry.geojson),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_str_location(location):\n lng, lat = get_ob_value_primitive(location, 'Longitude'), get_ob_value_primitive(location, 'Latitude')\n try:\n if lat is not None and lng is not None:\n return 'POINT(' + str(float(lng)) + ', ' + str(float(lat)) + ')'\n return None\n except Value... | [
"0.67817235",
"0.6594787",
"0.6380633",
"0.6380633",
"0.6380633",
"0.6339287",
"0.62203634",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"0.62094927",
"... | 0.0 | -1 |
Returns the distance between two coordinate objects in km. | def distance_to(self, other):
# Radius of earth in km
R = 6373.0
lat1r = radians(self.lat)
lon1r = radians(self.lon)
lat2r = radians(other.lat)
lon2r = radians(other.lon)
dlon = lon2r - lon1r
dlat = lat2r - lat1r
a = sin(dlat / 2)**2 + cos(lat1r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_in_meters(coord1, coord2):\n return vincenty(coord1, coord2).meters",
"def distance(a, b):\n return vincenty((float(a.longitude), float(a.latitude)),\n (float(b.longitude), float(b.latitude))).km",
"def distance(self,coord_1, coord_2):\n return np.sqrt(np.sum((np.ar... | [
"0.8051288",
"0.79348004",
"0.7788026",
"0.77765715",
"0.7691137",
"0.76901793",
"0.7650926",
"0.7577333",
"0.7540705",
"0.75210804",
"0.7493669",
"0.74866456",
"0.7473405",
"0.745904",
"0.7451204",
"0.7446073",
"0.7441101",
"0.740201",
"0.73963153",
"0.73922384",
"0.73879385... | 0.7292985 | 33 |
Checks if n is a likely prime | def is_prime(n):
if n in CONSTANTS.LOW_PRIMES:
return True
for prime in CONSTANTS.LOW_PRIMES:
if n % prime == 0:
return False
if n == 2:
return True
if n % 2 == 0:
return False
s = 0
d = n - 1
while d % 2 == 0:
d //= 2
s += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n return mr_prime(n)",
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def isprime(n=936):\n if n < 3: return False\n for i in range(2, n):\n if n % i == 0:\n return False\n return True",
"def isprime(n):\n if n % 2 == 0... | [
"0.86100894",
"0.8549585",
"0.8497745",
"0.8327665",
"0.83145165",
"0.82603663",
"0.8257912",
"0.8223411",
"0.8163759",
"0.81603",
"0.81514114",
"0.81469554",
"0.8141185",
"0.81365263",
"0.81346416",
"0.8133244",
"0.8131642",
"0.8128567",
"0.81272894",
"0.81272227",
"0.811681... | 0.7810433 | 65 |
Retrieves a list of servers that are one network hop away from a specified server. | def list_server_neighbors(configurationId=None, portInformationNeeded=None, neighborConfigurationIds=None, maxResults=None, nextToken=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reachable_servers(self) -> List[Server]:\n pass",
"def get_obstacles(self, map_server):\n\n self.obstacle_list = []\n for index, element in enumerate(map_server):\n if element > 0:\n self.obstacle_list.append(index)\n return(self.obstacle_list)",
"d... | [
"0.6096589",
"0.539442",
"0.53565305",
"0.5214673",
"0.51836854",
"0.51060176",
"0.5105207",
"0.5073576",
"0.50621295",
"0.5012144",
"0.49895746",
"0.4980681",
"0.49637452",
"0.49430192",
"0.49276602",
"0.48799416",
"0.487861",
"0.4858674",
"0.48568508",
"0.4854281",
"0.48425... | 0.5057142 | 9 |
OnlyFans message and post object A post is just a message on a profile with different options made available. | def __init__(self):
# universal message variables
self.text = None
self.files = []
self.keywords = []
self.performers = []
self.hasPerformers = False # used to flag files from performer folders
## message only variables
self.price = None # $3 - $100
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_post(post):\n\n return True",
"def check_can_post(self, user):\n if not user.is_active or user.is_anonymous():\n return False\n\n membership = self.check_membership(user)\n\n if ((self.type != 'O' or self.post_membership_required or self.post_admin_required) and\n ... | [
"0.6294471",
"0.6096382",
"0.57876694",
"0.5637613",
"0.54932237",
"0.5444871",
"0.54138577",
"0.5391253",
"0.5391253",
"0.5391253",
"0.53675765",
"0.534802",
"0.53474534",
"0.5330138",
"0.5319291",
"0.53144807",
"0.5302794",
"0.52920157",
"0.52882993",
"0.526606",
"0.5254162... | 0.0 | -1 |
Gets the expiration value if not none else sets it from args or prompts. Returns int The expiration as an int | def get_expiration(self):
if str(self.expiration) == "unset": return None
if self.expiration: return self.expiration
# retrieve from args and return if exists
expires = Settings.get_expiration() or None
if expires:
self.expiration = expires
return expire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_expiration_from_args(self):\n current_block = self.ident.w3.eth.blockNumber\n\n rez = self._expiration_str_to_blocks(\n self.args.expiration, current_block)\n if (rez > current_block + 1036800 and not self.args.force):\n d = (rez - current_block) // (4 * 60 * 24)... | [
"0.7221468",
"0.6600862",
"0.6535",
"0.6421469",
"0.6364731",
"0.6276764",
"0.6257086",
"0.6118342",
"0.59883857",
"0.59631664",
"0.587537",
"0.587537",
"0.5874246",
"0.5874246",
"0.5853365",
"0.5833243",
"0.5831946",
"0.58008593",
"0.57944626",
"0.5755136",
"0.57501376",
"... | 0.8165807 | 0 |
By default just the __dict__ object, but it can be any dict that is used by from_serial() to recreate the object. | def serial(self) -> dict:
return self.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_dict(self):\n return self.obj.__dict__",
"def getDict(cls, obj):\n\t\treturn obj.__dict__",
"def dict(self) -> Dict:\r\n return super().dict()",
"def dict(self) -> Dict:\r\n return super().dict()",
"def asdict():\n pass",
"def jsonDefault(object):\n return obje... | [
"0.7479205",
"0.7342976",
"0.71993434",
"0.71993434",
"0.7120848",
"0.71144575",
"0.7074079",
"0.70686454",
"0.70568293",
"0.70568293",
"0.70568293",
"0.70568293",
"0.70568293",
"0.70568293",
"0.70568293",
"0.7046885",
"0.70070577",
"0.6950686",
"0.6940097",
"0.6905968",
"0.6... | 0.6897759 | 20 |
Returns the list of projects owned by user. | def list_projects(self):
data = self._run(
url_path="projects/list"
)
projects = data['result'].get('projects', [])
return [self._project_formatter(item) for item in projects] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re... | [
"0.8127993",
"0.80589867",
"0.7886394",
"0.7752247",
"0.7542613",
"0.7458167",
"0.73387235",
"0.7320738",
"0.7290209",
"0.7221527",
"0.7211879",
"0.69697744",
"0.6905874",
"0.68395156",
"0.6835008",
"0.6823343",
"0.6793209",
"0.6752021",
"0.6726572",
"0.67107296",
"0.6662894"... | 0.6453762 | 34 |
Tests case with inconsistent relatives list during uploading data to database. In this case application should return code 400 bad request | def test_import_inconsistent_relatives():
with TestClient(app) as client:
response = client.post(
"/imports",
json={
"citizens": [
{"citizen_id": 1,
"town": "Москва",
"street": "Льва Толстого",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_pc_invalid_relations_should_fail(client, json_headers, invalids,\n status_code=400):\n api_endpoint_documents = \"invenio_app_ils_relations.docid_relations\"\n api_endpoint_series = \"invenio_app_ils_relations.serid_relations\"\n\n for invalid in invalid... | [
"0.6830475",
"0.63989544",
"0.62755007",
"0.6055775",
"0.604101",
"0.5997165",
"0.5979455",
"0.58839077",
"0.58476835",
"0.57885313",
"0.5781706",
"0.5781285",
"0.5777492",
"0.5714338",
"0.5710533",
"0.56785196",
"0.5676274",
"0.5673572",
"0.5650872",
"0.5636228",
"0.56328315... | 0.70209146 | 0 |
Tests case when citizen_id is duplicated Application should return 400 bad request | def test_import_duplicated_citizen_id():
duplicated_citizen = deepcopy(CITIZEN_EXAMPLE)
with TestClient(app) as client:
response = client.post(
"/imports",
json={
"citizens": [duplicated_citizen, duplicated_citizen]
}
)
assert respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_one(self):\n \n citizen_ids = list()\n\n for citizen in self.citizen_datas:\n # Create the citize in the database.\n body = dict(zip(self.citizen_fields, citizen))\n person = Citizen.objects.create(**body)\n\n # Get the citizen from it's... | [
"0.6562904",
"0.61345273",
"0.6127231",
"0.6095707",
"0.6037455",
"0.60111654",
"0.59925836",
"0.5986262",
"0.597864",
"0.59755456",
"0.5970561",
"0.5951405",
"0.592065",
"0.59175",
"0.58882916",
"0.5881769",
"0.5866906",
"0.58504623",
"0.58494836",
"0.5817049",
"0.58101296",... | 0.76026064 | 0 |
Tests case with negative apartment data to import Application should return 400 bad request | def test_import_negative_apartment_data():
citizen_with_negative_apartment_number = deepcopy(IMPORT_ENDPOINT_QUERY_BODY_EXAMPLE)
citizen_with_negative_apartment_number["apartment"] = -7
with TestClient(app) as client:
import_response = client.post(
"/imports",
json={
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_request(self):\n self._error_test(fitbit_exceptions.HTTPBadRequest)",
"def test_05d_get_nonexistant_app_import(self):\r\n self.register()\r\n # GET\r\n res = self.app.get('/app/noapp/import', follow_redirects=True)\r\n assert res.status == '404 NOT FOUND', res.stat... | [
"0.66912436",
"0.66043574",
"0.651658",
"0.64461005",
"0.6432346",
"0.6391101",
"0.63124573",
"0.62964845",
"0.62365",
"0.62264824",
"0.6182074",
"0.61784625",
"0.6178036",
"0.61773044",
"0.6140831",
"0.61082345",
"0.6084675",
"0.60600036",
"0.6039167",
"0.60385376",
"0.60360... | 0.7032422 | 0 |
Tests case with clear data during uploading citizens Application should return 201 created | def test_import_clean_data():
citizen_ok = deepcopy(CITIZEN_EXAMPLE)
with TestClient(app) as client:
import_response = client.post(
"/imports",
json={
"citizens": [citizen_ok]
}
)
response_body = import_response.json()
assert im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(self):\n for citizen in self.citizen_datas:\n # Request the citizen creation.\n body = dict(zip(self.citizen_fields, citizen))\n\n resp = self.client.post(self.url, data=json.dumps(body), content_type='application/json')\n\n # Ensure estatus 201\n ... | [
"0.70885545",
"0.664109",
"0.65769213",
"0.65382135",
"0.6481995",
"0.64710593",
"0.63751465",
"0.63638794",
"0.6355579",
"0.63371086",
"0.633277",
"0.6318242",
"0.6260361",
"0.62297404",
"0.6228588",
"0.62266564",
"0.6226162",
"0.6212264",
"0.62031895",
"0.61737925",
"0.6154... | 0.61977947 | 19 |
Tests case when citizen has empty name. Application should return 400 bad request | def test_import_with_empty_name():
citizen_with_empty_name = deepcopy(CITIZEN_EXAMPLE)
citizen_with_empty_name["name"] = ""
with TestClient(app) as client:
import_response = client.post(
"/imports",
json={
"citizens": [citizen_with_empty_name]
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_name(self):\n\n request = service.get_request('GET', {u'taxon': u'Nosuchtaxonia'})\n x = self.start_request_tests(request)\n m = x.json().get(u'message')\n self.assertTrue(x.status_code >= 200)\n self.assertTrue('No Taxon matched\" in \"%s\"' % m)",
"def test_name_... | [
"0.71808416",
"0.6820732",
"0.6768667",
"0.67415255",
"0.6740986",
"0.6716541",
"0.66805494",
"0.66759586",
"0.6660001",
"0.66271734",
"0.65985286",
"0.65190065",
"0.64537364",
"0.64157885",
"0.6404135",
"0.6398813",
"0.63957465",
"0.6360216",
"0.63522834",
"0.62960654",
"0.6... | 0.7168115 | 1 |
Takes a set of quantities and returns a ND compound model. | def _generate_compound_model(*lookup_tables, mesh=True):
model = _generate_tabular(lookup_tables[0])
for lt in lookup_tables[1:]:
model = model & _generate_tabular(lt)
if mesh:
return model
# If we are not meshing the inputs duplicate the inputs across all models
mapping = list(ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_compound_model(in_map):\n model_list = []\n for model_name in in_map[MODEL_NAME]:\n model_list.append(_build_single_model(in_map[MODEL_NAME], model_name=model_name))\n\n formula = in_map[EXPRESSION_NAME]\n\n return Spectrum1DRefModelLayer.from_formula(model_list, formula), formula",
... | [
"0.5617668",
"0.48673904",
"0.48190278",
"0.47939715",
"0.47839302",
"0.47308376",
"0.46767762",
"0.46760845",
"0.46410432",
"0.45981696",
"0.45957872",
"0.45893383",
"0.45665416",
"0.4519607",
"0.44923538",
"0.44730675",
"0.44724914",
"0.4464731",
"0.44638607",
"0.44638607",
... | 0.44171023 | 25 |
Generate the Frame for this LookupTable. | def frame(self):
return _generate_generic_frame(len(self.table), self.unit, self.names, self.physical_types) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genFrame(self):\n # generate frame-specific data\n frameData = self._genFrameData()\n\n # call parent function to create the complete frame (as bytearray)\n frame = self._genDigiMeshFrame(frameData)\n\n # OBS: never escape-sequence local msg\n return frame",
"def con... | [
"0.6434752",
"0.6180054",
"0.6155493",
"0.59975594",
"0.5943447",
"0.5767762",
"0.56899947",
"0.5617523",
"0.5417426",
"0.54099184",
"0.5361642",
"0.53606784",
"0.53533196",
"0.5338265",
"0.53322446",
"0.5325618",
"0.5269758",
"0.52665067",
"0.52659786",
"0.5231993",
"0.52211... | 0.7234186 | 0 |
Generate the Frame for this LookupTable. | def frame(self):
sc = self.table
components = tuple(getattr(sc.data, comp) for comp in sc.data.components)
ref_frame = sc.frame.replicate_without_data()
units = list(c.unit for c in components)
# TODO: Currently this limits you to 2D due to gwcs#120
return cf.CelestialFr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame(self):\n return _generate_generic_frame(len(self.table), self.unit, self.names, self.physical_types)",
"def genFrame(self):\n # generate frame-specific data\n frameData = self._genFrameData()\n\n # call parent function to create the complete frame (as bytearray)\n fra... | [
"0.7234186",
"0.6434752",
"0.6180054",
"0.59975594",
"0.5943447",
"0.5767762",
"0.56899947",
"0.5617523",
"0.5417426",
"0.54099184",
"0.5361642",
"0.53606784",
"0.53533196",
"0.5338265",
"0.53322446",
"0.5325618",
"0.5269758",
"0.52665067",
"0.52659786",
"0.5231993",
"0.52211... | 0.6155493 | 3 |
Generate the Frame for this LookupTable. | def frame(self):
return cf.TemporalFrame(self.reference_time,
unit=u.s,
axes_names=self.names,
name="TemporalFrame") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame(self):\n return _generate_generic_frame(len(self.table), self.unit, self.names, self.physical_types)",
"def genFrame(self):\n # generate frame-specific data\n frameData = self._genFrameData()\n\n # call parent function to create the complete frame (as bytearray)\n fra... | [
"0.7234186",
"0.6434752",
"0.6180054",
"0.6155493",
"0.59975594",
"0.5943447",
"0.5767762",
"0.56899947",
"0.5617523",
"0.5417426",
"0.54099184",
"0.5361642",
"0.53606784",
"0.53533196",
"0.5338265",
"0.53322446",
"0.5325618",
"0.5269758",
"0.52659786",
"0.5231993",
"0.522111... | 0.52665067 | 18 |
Given a path to an image, this function returns the correspondent imagellabel and the probability. | def predict_image(self, image_paths):
predictions = list()
for image_path in image_paths:
img = ImageHelper.get_image_by_path(image_path, self.target_size)
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = self.preprocess_input(x)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_img_label(self, path):\n food_items = self.annotations[path]\n tomato_items = [\n item for item in food_items\n if item['id'] in self.tomato_label_ids\n ]\n return 1 if len(tomato_items) > 0 else 0",
"def get_label(img_path):\n img_name = img_path.ste... | [
"0.6711599",
"0.668798",
"0.6571617",
"0.6465738",
"0.6402621",
"0.63812155",
"0.63676625",
"0.6265226",
"0.62385076",
"0.62149966",
"0.62032956",
"0.6181277",
"0.6179898",
"0.6166821",
"0.6116504",
"0.6101865",
"0.60762835",
"0.5992696",
"0.5988719",
"0.5973193",
"0.5969917"... | 0.55545616 | 51 |
Returns index of layer by name | def get_layer_index(self, layer_name):
for i, layer in enumerate(self.tmx_data.layers):
if layer.name == layer_name:
return i
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_feature_layer_index(feature_layer_collection, layer_name):\r\n for index, url in zip(range(len(feature_layer_collection.layers)),\r\n feature_layer_collection.layers):\r\n if layer_name in feature_layer_collection.layers[index].properties.name:\r\n layer_index ... | [
"0.7996738",
"0.7802015",
"0.74902654",
"0.7171761",
"0.7109368",
"0.70090896",
"0.695713",
"0.69054514",
"0.68818766",
"0.67920667",
"0.66681933",
"0.6661268",
"0.6636005",
"0.6561659",
"0.6536994",
"0.64992607",
"0.6496359",
"0.6485548",
"0.6478516",
"0.64709496",
"0.646497... | 0.841849 | 0 |
Generate the current time string in the given format. | def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
return datetime.utcnow().replace(
tzinfo=pytz.utc
).strftime(format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_current_time():\n return strftime(\"%Y_%m_%d_%H_%M_%S_%Z\", gmtime())",
"def get_time() -> str:\r\n return time.strftime(TIMEFORMAT)",
"def get_time_str():\n return time.strftime(time_fmt)",
"def get_time_stamp_str() -> str:\n return datetime.datetime.now().strftime(DateFormat)",
"def n... | [
"0.7800666",
"0.7791926",
"0.77246135",
"0.768357",
"0.7666125",
"0.7492711",
"0.74671257",
"0.74315697",
"0.73868525",
"0.73808515",
"0.7360322",
"0.73458177",
"0.7324255",
"0.726497",
"0.7220429",
"0.71909183",
"0.7188707",
"0.7165597",
"0.71552765",
"0.71087134",
"0.709666... | 0.74780095 | 6 |
Delete empty pair of brackets or quotes | def delete_brackets_or_quotes(event):
buffer = event.cli.current_buffer
before = buffer.document.char_before_cursor
after = buffer.document.current_char
if any(
[before == b and after == a for (b, a) in ["()", "[]", "{}", "''", '""']]
):
buffer.delete(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_between_square_brackets(text):\n return re.sub('\\[[^]]*\\]', '', text)",
"def strip_brackets_and_quotes(text: str) -> str:\n\t\tpieces = [\n\t\t\t\t('(', ')'), ('[', ']'), ('[', ']'), ('{', '}'), ('<', '>'),\n\t\t\t\t(Chars.lshell, Chars.rshell), (Chars.langle, Chars.rangle),\n\t\t\t\t('`', '`')... | [
"0.73116446",
"0.69998604",
"0.69612",
"0.6879773",
"0.6701139",
"0.66006684",
"0.64825934",
"0.6476704",
"0.62560916",
"0.62547684",
"0.6043075",
"0.6022011",
"0.5990816",
"0.5984995",
"0.5984214",
"0.5983669",
"0.5897691",
"0.5893092",
"0.58461803",
"0.58235973",
"0.5821752... | 0.72485125 | 1 |
Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None | def __init__(self):
super().__init__()
import sklearn
import sklearn.linear_model
self.model = sklearn.linear_model.LogisticRegression | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, learning_rate=0.1):\n self.learning_rate = learning_rate\n self._b = 0.0 # y-intercept\n self._w = None # weights assigned to input features\n # count of errors during each iteration\n self.misclassified_samples = []",
"def __init__(self, initialLearnRate):... | [
"0.7502457",
"0.73741865",
"0.7322712",
"0.7293263",
"0.7251718",
"0.71864325",
"0.7184399",
"0.7160075",
"0.7129084",
"0.7111028",
"0.7106927",
"0.70859164",
"0.70628464",
"0.70461",
"0.7045854",
"0.70244485",
"0.7023777",
"0.70198345",
"0.70055443",
"0.69822884",
"0.6962856... | 0.0 | -1 |
Sets the groups of this IpAddress. Array of network groups. One IP address can belong to zero or more network groups. The idea is that containers can only reach containers with which they share at least one network group. | def groups(self, groups):
self._groups = groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self, groups):\n if groups is None:\n raise ValueError(\"Invalid value for `groups`, must not be `None`\") # noqa: E501\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
... | [
"0.6820827",
"0.68131316",
"0.68131316",
"0.68131316",
"0.68131316",
"0.6680913",
"0.6052488",
"0.5972752",
"0.5858702",
"0.58459705",
"0.5714285",
"0.56974185",
"0.5652323",
"0.5639126",
"0.56090516",
"0.5597123",
"0.55514175",
"0.5535449",
"0.54975796",
"0.5493158",
"0.5466... | 0.69100964 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80891633",
"0.80891633",
"0.8055254",
"0.7983334",
"0.79617655",
"0.79617655",
"0.79438007",
"0.7931164",
"0.7925355",
"0.7896319",
"0.7882993",
"0.7882993",
"0.7881245",
"0.7871271",
"0.7868767",
"0.78655475",
"0.7826755",
"0.78200424",
"0.7816593",
"0.7808374",
"0.780745... | 0.7967544 | 37 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return the shape of the input layer | def get_input_shape(self):
return self.network.inputs[self.input_blob].shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputShape(self):\n return self.input_shape",
"def get_input_tensor_shape(self):\n return self._engine.get_input_tensor_shape()",
"def input_shape(self) ->torch.Size:\n pass",
"def input_shape(self):\n return self._ipt_shape",
"def get_input_shape(self):\n return self.__x... | [
"0.8402058",
"0.8355697",
"0.8337721",
"0.8325848",
"0.8238402",
"0.7934952",
"0.77886987",
"0.77642214",
"0.77642214",
"0.77642214",
"0.7740415",
"0.76266253",
"0.7602957",
"0.7574955",
"0.7574392",
"0.7574392",
"0.7574392",
"0.752494",
"0.75243163",
"0.7518224",
"0.7465026"... | 0.8525483 | 0 |
Subsamples point and normal images together to make a pointcloud. | def _get_world_pts_from_idx(idx,
depth,
world_xyz_im,
world_n_im,
target_point_count=10000):
# TODO(kgenova) Consider computing validity directly from the normals.
is_invalid = np.squeeze(depth[idx, ...] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_sample(img_meta,\n img_features,\n points,\n proj_mat,\n coord_type,\n img_scale_factor,\n img_crop_offset,\n img_flip,\n img_pad_shape,\n img_shape,\n ... | [
"0.61468166",
"0.5933107",
"0.5790048",
"0.57663506",
"0.57492685",
"0.56877905",
"0.5617135",
"0.55431855",
"0.5511504",
"0.5507595",
"0.5473116",
"0.5453639",
"0.54291683",
"0.5399812",
"0.5397617",
"0.5396986",
"0.53910935",
"0.5366428",
"0.53335804",
"0.5311184",
"0.53111... | 0.0 | -1 |
The camera space > world space transformations for 3DR2N2's images. | def r2n2_cam2world(self):
if not hasattr(self, '_r2n2_cam2world'):
ms = []
for i in range(24):
cam2v1 = assert_is_4x4(self.r2n2_cam2v1[i, ...])
v12occnet = assert_is_4x4(self.v12occnet)
occnet2gaps = assert_is_4x4(self.occnet2gaps)
cam2occnet = np.matmul(v12occnet, cam2v1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera_to_object_transform(self):\n # form the full object to camera transform\n T_stp_camera = self.stp_to_camera_transform()\n T_obj_stp = self.object_to_stp_transform()\n T_obj_camera = T_stp_camera.dot(T_obj_stp)\n return T_obj_camera",
"def cameraToWorld(self, p):\n ... | [
"0.71491575",
"0.68242604",
"0.6652678",
"0.66506696",
"0.66103756",
"0.6593101",
"0.65548307",
"0.6542289",
"0.6486432",
"0.6349775",
"0.6263718",
"0.62477255",
"0.6236834",
"0.6208736",
"0.619022",
"0.61879474",
"0.61247206",
"0.6115837",
"0.6064184",
"0.6055148",
"0.601838... | 0.64209074 | 9 |
Returns config dict for config named name, or None | def load_config_dict_by_name(name):
full_name = os.path.join(BBCONFIG_DIR, name)
for x in name, full_name:
if os.path.exists(x):
return yaml.load(open(x))
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, name):\n return self.configs[name][0]",
"def get_module_config(name):\n return _CONFIGS[name]",
"def lookup(self, name):\n for config in self._config:\n if name in config:\n return config[name]\n raise AttributeError(\"%s not found\" % name... | [
"0.8112903",
"0.76578987",
"0.7598784",
"0.7595054",
"0.7462654",
"0.74604625",
"0.74595714",
"0.74066675",
"0.7238232",
"0.71924603",
"0.71497434",
"0.7142942",
"0.71370447",
"0.7124198",
"0.7098333",
"0.7031816",
"0.702659",
"0.6936357",
"0.6887363",
"0.6885351",
"0.6850402... | 0.7431031 | 7 |
Gets the image filenames of all supported extensions in path recursively | def get_fnames_predict(path):
SUPPORTED_EXTENSIONS = ['png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG']
fnames = []
for se in SUPPORTED_EXTENSIONS:
fnames.extend(sorted(glob.glob(join(path, '*.' + se), recursive=True)))
return fnames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_img_files(pth: pathlib.Path) -> typing.List[pathlib.Path]:\n patterns = [glob.iglob(os.path.join(pth, \"*.\" + e)) for e in _img_extensions]\n de_nested = [f for f_ in patterns for f in f_]\n return de_nested",
"def _fetch_all_images(self, path) -> List[str]:\n files_all = []\n\n f... | [
"0.7354717",
"0.72468555",
"0.72390723",
"0.7143023",
"0.71109056",
"0.70520085",
"0.7011753",
"0.69906175",
"0.69906175",
"0.6946403",
"0.69423187",
"0.6908008",
"0.6879424",
"0.6871302",
"0.6865926",
"0.68629724",
"0.6857112",
"0.6850749",
"0.6830371",
"0.6810504",
"0.68070... | 0.7107039 | 5 |
Test behavior of unknown notification type events. | async def test_unknown_notification(
hass: HomeAssistant, hank_binary_switch, integration, client
) -> None:
# just pick a random node to fake the notification event
node = hank_binary_switch
# We emit the event directly so we can skip any validation and event handling
# by the lib. We will use a c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown_event(self, event):\r\n pass",
"def can_trigger_notification(self, event_type):\n if event_type in self.DISALLOWED_NOTIFICATION_EVENTS:\n return False\n else:\n return True",
"def assert_job_notification_events(self, processor, expected_events):\n def e... | [
"0.6863927",
"0.62766373",
"0.62369984",
"0.61935943",
"0.61261356",
"0.60875875",
"0.60205805",
"0.6019773",
"0.59766316",
"0.5962833",
"0.58951354",
"0.5840666",
"0.5833325",
"0.5833278",
"0.58042413",
"0.57814574",
"0.5780729",
"0.57481545",
"0.5730766",
"0.5730766",
"0.57... | 0.69076717 | 0 |
Add Vertex one by one in object. | def CreateVertices(TrajectoryPoints, Graph):
setOfNodes = NodesSetCreate(TrajectoryPoints)
nodes = dict()
for index, point in enumerate(setOfNodes):
Graph.add_node(index)
nodes[point] = index
return Graph, nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, vertex):\n\n if isinstance(vertex, Vertex):\n vName = vertex.name\n self._vertices[vName] = vertex",
"def add_vertex(self, key):\n self.vertCount += 1\n addedVertex = vertex.Vertex(key)\n self.vertList[key] = addedVertex\n return addedVer... | [
"0.81383157",
"0.79978436",
"0.7906561",
"0.78734195",
"0.78322124",
"0.779786",
"0.7768442",
"0.77675927",
"0.7759835",
"0.7745804",
"0.76964444",
"0.767006",
"0.75487536",
"0.75348103",
"0.75240993",
"0.74923956",
"0.74676955",
"0.7458286",
"0.7457176",
"0.7437933",
"0.7429... | 0.0 | -1 |
Assuming self is simplified, determines if it contradicts other. | def contradicts(self, other, **kwargs):
if isinstance(other, Not):
return _coconut_tail_call(other.contradicts, self, **kwargs)
else:
return self == Not(other).simplify(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almost_equals(self, other):\n if self.__class__ is other.__class__ and len(self) == len(other):\n for a, b in zip(self, other):\n if not a.almost_equals(b):\n return False\n return True\n else:\n return False",
"def matches(self... | [
"0.7266841",
"0.72428024",
"0.69000554",
"0.68585575",
"0.6821754",
"0.67874783",
"0.67853856",
"0.6759279",
"0.6752405",
"0.6751537",
"0.67436504",
"0.6735092",
"0.6723788",
"0.66613793",
"0.66499966",
"0.66483843",
"0.6644348",
"0.66192764",
"0.66159",
"0.66139436",
"0.6600... | 0.7468499 | 0 |
Initializing a new MyNeuralNetwork object | def __init__(self, n_layers, layers_sizes, activation='sigmoid', learning_rate=0.1, weight_init='normal', batch_size=1000, num_epochs=100):
self.layers_sizes=layers_sizes[1:]
self.activation=activation
self.learning_rate=learning_rate
self.weight_init=weight_init
self.batch_size=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, layerNeurons, initialWeights = None, layerTypes=None, **kwargs):\r\n \r\n # Ensure that there is at-least one input and one output layer in the network\r\n assert len(layerNeurons)>1, \"At least one input layer and one output layer is needed\"\r\n \r\n # Get th... | [
"0.7545396",
"0.7426693",
"0.7167557",
"0.7107544",
"0.7096283",
"0.7089189",
"0.708272",
"0.7076714",
"0.7012968",
"0.69739914",
"0.694551",
"0.6927077",
"0.6921911",
"0.6921543",
"0.6916723",
"0.6906071",
"0.6896721",
"0.6888619",
"0.6888153",
"0.6866676",
"0.68417376",
"... | 0.0 | -1 |
Calculating the ReLU activation for a particular layer | def relu(self, X):
return np.maximum(0,X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _relu(layer):\n return tf.nn.relu(layer)",
"def lrelu(self):\n return self.add_layer(lrelu)",
"def test_relu_activation(self):\n self.assertEqual([0, 0.5], list(\n af.Relu().output(np.array([-0.5, 0.5]))))\n self.assertEqual([0, 1], list(\n af.Relu().deriva... | [
"0.7353521",
"0.7147479",
"0.71449244",
"0.71317196",
"0.71317196",
"0.70889777",
"0.69938266",
"0.69599354",
"0.6939261",
"0.69106865",
"0.69011444",
"0.687028",
"0.687028",
"0.68674093",
"0.67837435",
"0.6782436",
"0.67801505",
"0.6777842",
"0.67647547",
"0.6763368",
"0.675... | 0.602947 | 100 |
Calculating the Sigmoid activation for a particular layer | def sigmoid(self, X):
return 1.0/(1.0+np.exp(-X)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def activation_sigmoid(self):\n self.value = ... | [
"0.79400456",
"0.79030704",
"0.76987255",
"0.7669779",
"0.76689607",
"0.7664263",
"0.7664263",
"0.76393104",
"0.7596771",
"0.7568096",
"0.75558746",
"0.75409496",
"0.75298035",
"0.7524496",
"0.7524496",
"0.7524496",
"0.7524496",
"0.7524496",
"0.7524496",
"0.752282",
"0.751700... | 0.0 | -1 |
Calculating the Linear activation for a particular layer | def linear(self, X):
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate(self, input_layer, funcname=None):\n if isinstance(funcname, tuple):\n funcname = funcname[0]\n params = funcname[1:]\n if funcname is None:\n funcname = self.activation_func\n if funcname == 'LINEAR':\n return input_layer\n activ... | [
"0.77767956",
"0.7368473",
"0.73011523",
"0.7298871",
"0.7228388",
"0.71988434",
"0.7141863",
"0.70519197",
"0.70519197",
"0.70368415",
"0.7030007",
"0.702429",
"0.7012038",
"0.7012038",
"0.6989962",
"0.6980219",
"0.69734335",
"0.68947136",
"0.6893372",
"0.6888704",
"0.687637... | 0.0 | -1 |
Calculating the Tanh activation for a particular layer | def tanh(self, X):
return (np.exp(X)-np.exp(-X))/(np.exp(X)+np.exp(-X)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation(h):\n\n if(h > 0):\n return 1\n\n else:\n return 0",
"def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)",
"def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))",
"def activationFunction(self, z):\n if self.__activation == '... | [
"0.7439941",
"0.7293983",
"0.70956755",
"0.7068426",
"0.70597136",
"0.69614685",
"0.69550496",
"0.6817669",
"0.67893445",
"0.67893445",
"0.67700267",
"0.67403233",
"0.6679506",
"0.6668397",
"0.6634016",
"0.6632738",
"0.6619426",
"0.6587372",
"0.6555486",
"0.65309596",
"0.6504... | 0.0 | -1 |
Calculating the ReLU activation for a particular layer | def softmax(self, Z):
expZ=np.exp(Z-np.max(Z))
return expZ/expZ.sum(axis=0,keepdims=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _relu(layer):\n return tf.nn.relu(layer)",
"def lrelu(self):\n return self.add_layer(lrelu)",
"def test_relu_activation(self):\n self.assertEqual([0, 0.5], list(\n af.Relu().output(np.array([-0.5, 0.5]))))\n self.assertEqual([0, 1], list(\n af.Relu().deriva... | [
"0.7353521",
"0.7147479",
"0.71449244",
"0.71317196",
"0.71317196",
"0.70889777",
"0.69938266",
"0.69599354",
"0.6939261",
"0.69106865",
"0.69011444",
"0.687028",
"0.687028",
"0.68674093",
"0.67837435",
"0.6782436",
"0.67801505",
"0.6777842",
"0.67647547",
"0.6763368",
"0.675... | 0.0 | -1 |
Calculating the initial weights after Zero Activation for a particular layer | def zero_init(self, shape):
return np.zeros((shape[0],shape[1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(layer):\n if isinstance(layer, (nn.Conv2d, nn.Linear)):\n torch.nn.init.xavier_uniform_(layer.weight)\n try:\n # Some layers may not have biases, so catch the exception and pass.\n layer.bias.data.fill_(0.0)\n except AttributeError:\n pass",
... | [
"0.7199983",
"0.7189707",
"0.7073406",
"0.7073406",
"0.70630974",
"0.7059666",
"0.705427",
"0.7015832",
"0.7015612",
"0.69929886",
"0.6991316",
"0.6989899",
"0.69845915",
"0.69845915",
"0.69845915",
"0.6961928",
"0.6961928",
"0.6961928",
"0.6906712",
"0.6906557",
"0.69031775"... | 0.0 | -1 |
Calculating the initial weights after Random Activation for a particular layer | def random_init(self, shape):
return np.random.randn(shape[0],shape[1])*0.01 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_layer(self) :\n inputsWithBias = self.input_count + 1\n self.weights = np.random.rand(inputsWithBias, self.node_count)\n self.weights_and_activations = (self.weights, self.activations)",
"def init_weights(n_input_layer, n_hidden_layer, n_hidden_layer_2, n_output_layer, xavier_init)... | [
"0.752402",
"0.710488",
"0.7067337",
"0.7017896",
"0.7010868",
"0.69397944",
"0.69347376",
"0.6875742",
"0.68726015",
"0.685449",
"0.685449",
"0.685449",
"0.6834855",
"0.6834855",
"0.6824546",
"0.6819534",
"0.6807273",
"0.6805697",
"0.6805697",
"0.6790158",
"0.67868",
"0.67... | 0.0 | -1 |
Calculating the initial weights after Normal(0,1) Activation for a particular layer | def normal_init(self, shape):
return np.random.normal(size=(shape[0],shape[1]))*0.01 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(layer):\r\n layer_name = layer.__class__.__name__\r\n if layer_name.find(\"Conv\") != -1:\r\n layer.weight.data.normal_(0.0, 0.02)\r\n elif layer_name.find(\"BatchNorm\") != -1:\r\n layer.weight.data.normal_(1.0, 0.02)\r\n layer.bias.data.fill_(0)",
"def init_weight... | [
"0.7217052",
"0.71774477",
"0.71129817",
"0.70694095",
"0.70694095",
"0.70694095",
"0.70123243",
"0.70123243",
"0.6923158",
"0.68948615",
"0.6873916",
"0.6836172",
"0.679649",
"0.6790076",
"0.67897534",
"0.6783015",
"0.67636096",
"0.6744967",
"0.67419356",
"0.6732998",
"0.673... | 0.0 | -1 |
Template filter that converts ISO format to meaningful month format | def str_day_month(s):
# TODO: Fix the -06:00 time zone offset
if s:
d = convert_from_iso(s)
return datetime.datetime.strftime(d, "%B %d|%A").strip("0")
else:
# Couldn't parse, return original.
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_unit(unit):\n return 'M' if unit.lower() == 'month' else unit[0].lower()",
"def date_split_to_iso(year, month, day):\n year=int(year)\n month=int(month)\n day=int(day)\n if month>12:\n #month and day are reversed\n temp=month\n month=day\n day=temp\n return... | [
"0.6048462",
"0.600731",
"0.59994864",
"0.5976099",
"0.5935384",
"0.59016734",
"0.58927846",
"0.5830167",
"0.5828197",
"0.5782717",
"0.5774366",
"0.56779075",
"0.5676818",
"0.56371236",
"0.55902004",
"0.5581634",
"0.5560593",
"0.55586493",
"0.5518952",
"0.5509603",
"0.5506264... | 0.5765347 | 11 |
Creates a dict mapping namespace strings to EntityTypeFolder objects. Sets the self.namespace_folder_map attribute of the class. | def _BuildNamespaceFolderMap(self, type_folders):
for folder in type_folders:
self.namespace_folder_map[folder.local_namespace.namespace] = folder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_folders(self):\n # Trying to store the folder hierarchy in the name...\n self.folder0 = Folder.objects.get(id=1)\n self.folder00 = Folder.objects.get(id=2)\n self.folder000 = Folder.objects.get(id=3)\n self.folder0000 = Folder.objects.get(id=4)",
"def _load_namespaces(... | [
"0.57040155",
"0.54969805",
"0.5485643",
"0.5372858",
"0.5361929",
"0.53140885",
"0.5188675",
"0.5166968",
"0.5126444",
"0.51210916",
"0.510987",
"0.50415236",
"0.49872518",
"0.49788287",
"0.49729413",
"0.49666166",
"0.49348497",
"0.49018043",
"0.48804158",
"0.48653322",
"0.4... | 0.76269114 | 0 |
Returns `OptWrapper` provided string validates against the entity. Accepts a field name as written in a configuration file referencing this type. The method applies all shorthanding rules to identify the field regardless of the namespace and syntax variation. | def GetFieldFromConfigText(self,
fieldname_as_written: str,
run_unsafe: bool = False) -> Optional[OptWrapper]:
try:
# Check the field as if it's fully qualified.
return self.GetField(fieldname_as_written, run_unsafe)
except TypeError:
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetField(self,\n fully_qualified_fieldname: str,\n run_unsafe: bool = False) -> Optional[OptWrapper]:\n # Throws an error in the case that this isn't a fully qualified field\n _, _ = SeparateFieldNamespace(fully_qualified_fieldname)\n return self._GetField(fully_qualified_f... | [
"0.5500152",
"0.51827466",
"0.513214",
"0.512757",
"0.50815696",
"0.5010431",
"0.49993762",
"0.49632555",
"0.49260765",
"0.491559",
"0.49042773",
"0.4874086",
"0.48701552",
"0.48540843",
"0.48115796",
"0.48017633",
"0.4788271",
"0.47868136",
"0.47674528",
"0.47656196",
"0.476... | 0.60614806 | 0 |
Given a time and date in string form, format the | def format_datetime(self, date_string, time_string):
split_date = date_string.split()
month = datetime.strptime(split_date[-2], "%B").strftime("%m")
number_day = split_date[-1][:-2] #numeric day. e.g. 13
year = datetime.now().strftime("%Y")
#convert time into military time
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatTime(time):\n\n return datetime.strptime(time, \"%d/%m/%Y %H:%M:%S\").strftime(\"%a, %d/%m/%Y %H:%M:%S\")",
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_date(date, time_format=\"23:5... | [
"0.7343375",
"0.7018157",
"0.7008155",
"0.6982577",
"0.6927828",
"0.6917183",
"0.68507874",
"0.67687386",
"0.67626935",
"0.67538905",
"0.67245615",
"0.6711309",
"0.6687785",
"0.66651946",
"0.6654727",
"0.6650881",
"0.663178",
"0.6630319",
"0.6581239",
"0.6545936",
"0.6535283"... | 0.8002302 | 0 |
Gets the plan_id of this SystemPricingPlan. | def plan_id(self) -> str:
return self._plan_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plan(self):\n sub = self.get_subscription()\n return sub.plan",
"def commitment_plan_id(self) -> Optional[str]:\n return pulumi.get(self, \"commitment_plan_id\")",
"def pricing_plan(self) -> str:\n return pulumi.get(self, \"pricing_plan\")",
"def _get_schedule_policy_id(se... | [
"0.6234852",
"0.61627215",
"0.60116327",
"0.5827784",
"0.5674323",
"0.5661412",
"0.56060135",
"0.56060135",
"0.55860883",
"0.5558735",
"0.55491835",
"0.55486786",
"0.5532562",
"0.5423251",
"0.54145765",
"0.53864974",
"0.5365958",
"0.53648233",
"0.5360409",
"0.5347775",
"0.534... | 0.78002596 | 0 |
Sets the plan_id of this SystemPricingPlan. | def plan_id(self, plan_id: str):
if plan_id is None:
raise ValueError("Invalid value for `plan_id`, must not be `None`") # noqa: E501
self._plan_id = plan_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plan(self, plan):\n\n self._plan = plan",
"def update(cls, plan_id, **kwargs):\n return cls().requests.put(f\"plan/{plan_id}\", data=kwargs,)",
"def plan_id(self) -> str:\n return self._plan_id",
"def scheduled_plan(self, scheduled_plan):\n\n self._scheduled_plan = scheduled_p... | [
"0.6427912",
"0.63176936",
"0.621292",
"0.59321284",
"0.5826718",
"0.5820588",
"0.5607611",
"0.5491661",
"0.54452693",
"0.53306454",
"0.5306179",
"0.5248907",
"0.5195259",
"0.5195259",
"0.5157259",
"0.5156914",
"0.5060873",
"0.50445294",
"0.50445294",
"0.5042738",
"0.50048935... | 0.719962 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.