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 |
|---|---|---|---|---|---|---|
Check all possible chromosome translations for correct result | def test_chromosome_coordinate_translations(self):
cds_result = [4, 3, 2, 1, 0, None, None]
transcript_result = [5, 4, 3, 2, 1, 0, None]
for i in xrange(7):
self.assertEqual(self.t.chromosome_coordinate_to_cds(i), cds_result[i])
self.assertEqual(self.t.chromosome_coordina... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_chromosome_coordinate_translations(self):\n cds_result = [None, 0, 1, 2, None, None, None]\n transcript_result = [0, 1, 2, 3, 4, 5, None]\n for i in xrange(6):\n self.assertEqual(self.t.chromosome_coordinate_to_cds(i), cds_result[i])\n self.assertEqual(self.t.chr... | [
"0.71365863",
"0.7123192",
"0.71121114",
"0.7103658",
"0.7076491",
"0.70754874",
"0.702512",
"0.657712",
"0.6540573",
"0.6503475",
"0.65028846",
"0.64769745",
"0.6476169",
"0.64734954",
"0.6463151",
"0.6416668",
"0.6416668",
"0.6416668",
"0.6403567",
"0.6403567",
"0.6403004",... | 0.7148265 | 0 |
Test reciprocal translations between coordinate spaces | def test_reciprocal_translations(self):
for i in xrange(-1, 12):
tmp = self.t.chromosome_coordinate_to_transcript(i)
#can't have reciprocal connection once None appears
if tmp is not None:
self.assertEqual(self.t.transcript_coordinate_to_chromosome(tmp), i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reciprocal_translations(self):\n for i in xrange(-1, 7):\n tmp = self.t.chromosome_coordinate_to_transcript(i)\n #can't have reciprocal connection once None appears\n if tmp is not None:\n self.assertEqual(self.t.transcript_coordinate_to_chromosome(tm... | [
"0.66991556",
"0.66991556",
"0.66991556",
"0.66791797",
"0.66791797",
"0.6567611",
"0.64653146",
"0.6450587",
"0.63629913",
"0.62774014",
"0.6205721",
"0.6121747",
"0.6103981",
"0.60183823",
"0.60064435",
"0.59672177",
"0.5932213",
"0.5929806",
"0.58706963",
"0.58441466",
"0.... | 0.6746375 | 1 |
Test reciprocal translations between coordinate spaces | def test_reciprocal_translations(self):
for i in xrange(-1, 12):
tmp = self.t.chromosome_coordinate_to_transcript(i)
#can't have reciprocal connection once None appears
if tmp is not None:
self.assertEqual(self.t.transcript_coordinate_to_chromosome(tmp), i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reciprocal_translations(self):\n for i in xrange(-1, 7):\n tmp = self.t.chromosome_coordinate_to_transcript(i)\n #can't have reciprocal connection once None appears\n if tmp is not None:\n self.assertEqual(self.t.transcript_coordinate_to_chromosome(tm... | [
"0.66991556",
"0.66991556",
"0.66991556",
"0.66791797",
"0.66791797",
"0.6567611",
"0.64653146",
"0.6450587",
"0.63629913",
"0.62774014",
"0.6205721",
"0.6121747",
"0.6103981",
"0.60183823",
"0.60064435",
"0.59672177",
"0.5932213",
"0.5929806",
"0.58706963",
"0.58441466",
"0.... | 0.6746375 | 0 |
Gets the first X, Y, ModelGeneratorBase set and resets the iteration | def _first(self) -> Tuple[np.ndarray, np.ndarray, ModelGeneratorBase]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _next(self) -> Tuple[np.ndarray, np.ndarray, ModelGeneratorBase]:\n pass",
"def __iter__(self):\n yield self._x\n yield self._y",
"def reset(self):\n \n self.env.reset()\n obs, _, done, _ = self.env.step(1)\n if done: \n self.e... | [
"0.6664355",
"0.61231303",
"0.605679",
"0.60045266",
"0.5958198",
"0.59198403",
"0.5851417",
"0.58388704",
"0.58355397",
"0.580867",
"0.580867",
"0.57689434",
"0.5733538",
"0.5686895",
"0.5683591",
"0.56637675",
"0.5637876",
"0.5625095",
"0.5568213",
"0.55525696",
"0.5548958"... | 0.6687949 | 0 |
Increments the iterator and gets the next X, Y, ModelGeneratorBase set | def _next(self) -> Tuple[np.ndarray, np.ndarray, ModelGeneratorBase]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next__(self):\n if self.iterator < len(self.points):\n iterator = self.iterator\n self.iterator += 1\n return self.points[iterator]\n else:\n raise StopIteration",
"def __next__(self):\n if self.iterator < len(self.points):\n self.... | [
"0.7134711",
"0.6966427",
"0.6854117",
"0.667559",
"0.6663741",
"0.66392446",
"0.6636532",
"0.6633817",
"0.6559806",
"0.6549389",
"0.6549389",
"0.65254635",
"0.6509257",
"0.6467999",
"0.6462799",
"0.64623916",
"0.64602697",
"0.64424735",
"0.6439965",
"0.6434426",
"0.64327246"... | 0.7352872 | 0 |
Calculates the transitive closure of the types in _required_types. Returns a tuple containing the list of struct types and the list of enum types. The list of struct types is ordered such that no type depends on a type later in the list. | def _ResolveTypeDependencies(self):
if self._namespace.functions:
for function in self._namespace.functions.itervalues():
self._FindFunctionDependencies(function)
if self._namespace.events:
for event in self._namespace.events.itervalues():
self._FindFunctionDependencies(event)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_types(types: Iterable[UnresolvedType], visited=None):\n visited = visited or set()\n\n for type_ in (t for t in types if t not in visited):\n if isinstance(type_, DeferredType):\n continue\n yield type_\n visited.add(type_)\n next_types = (t for t in chain(\n ... | [
"0.5980984",
"0.5904325",
"0.5802435",
"0.5581048",
"0.5418282",
"0.53662664",
"0.53647286",
"0.5327638",
"0.53140855",
"0.5311773",
"0.53013176",
"0.52911913",
"0.5231217",
"0.5178223",
"0.5151837",
"0.5143022",
"0.50999975",
"0.5081398",
"0.50639147",
"0.5031779",
"0.500837... | 0.6630012 | 0 |
Returns a tuple of the fullyqualified name of an entity. | def _NameComponents(entity):
names = []
while entity:
if (not isinstance(entity, model.Type) or
entity.property_type != model.PropertyType.ARRAY):
names.append(entity.name)
entity = entity.parent
return tuple(reversed(names[:-1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_name(self):\n return self.__entity_name",
"def get_name(name_or_entity):\n if isinstance(name_or_entity, (Subject, SubjectType)):\n return name_or_entity.name\n elif isinstance(name_or_entity, db.Model):\n return name_or_entity.key().name()\n else:\n return name_or... | [
"0.6733021",
"0.6570986",
"0.65258586",
"0.6374253",
"0.6320251",
"0.6320251",
"0.6276718",
"0.60230976",
"0.59314793",
"0.59022224",
"0.5890903",
"0.5877778",
"0.58534896",
"0.5847344",
"0.58435965",
"0.58106023",
"0.5748684",
"0.57383233",
"0.5698698",
"0.568959",
"0.568178... | 0.72255313 | 0 |
Returns a string containing the name of the Pepper C type for |type_|. If array is True, returns the name of an array of |type_|. If optional is True, returns the name of an optional |type_|. If both array and optional are True, returns the name of an optional array of |type_|. | def ToPpapiType(self, type_, array=False, optional=False):
if isinstance(type_, model.Function) or type_.property_type in (
model.PropertyType.OBJECT, model.PropertyType.ENUM):
return self._FormatPpapiTypeName(
array, optional, '_'.join(
cpp_util.Classname(s) for s in self._Nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_type_string(attr_type):\n if isinstance(attr_type, (list, tuple)):\n if len(attr_type) > 1:\n return (\n \", \".join([x.__name__ for x in attr_type[:-1]])\n + \" or \"\n + attr_type[-1].__name__\n )\n return attr_type[0]._... | [
"0.6798284",
"0.6208575",
"0.61560285",
"0.6118705",
"0.603263",
"0.6015443",
"0.59415644",
"0.5903752",
"0.5857458",
"0.5834035",
"0.5829078",
"0.58240837",
"0.57987493",
"0.57529175",
"0.5741216",
"0.56974566",
"0.56773055",
"0.5657199",
"0.5656581",
"0.56545234",
"0.563576... | 0.64665055 | 1 |
Returns True if an optional |type_| is required. | def NeedsOptional(self, type_):
return self._NameComponents(type_) in self._optional_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid_optional(content_type: str) -> bool:\n content_type = content_type.strip()\n\n if not content_type.startswith(\"pt:optional\"):\n return False\n\n if not _has_matched_brackets(content_type):\n return False\n\n if not _has_brackets(content_type):\n return False\n\n ... | [
"0.723862",
"0.6928058",
"0.6731056",
"0.6610195",
"0.64665216",
"0.6466331",
"0.63721937",
"0.63449675",
"0.6337248",
"0.6314173",
"0.6304244",
"0.6241088",
"0.6241088",
"0.62294996",
"0.6092895",
"0.608791",
"0.60751784",
"0.6070337",
"0.605822",
"0.6050811",
"0.6048762",
... | 0.85003793 | 0 |
Returns True if an array of |type_| is required. | def NeedsArray(self, type_):
return self._NameComponents(type_) in self._array_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NeedsOptionalArray(self, type_):\n return self._NameComponents(type_) in self._optional_array_types",
"def is_array(type):\n nake_type = remove_alias(type)\n nake_type = remove_reference(nake_type)\n nake_type = remove_cv(nake_type)\n return isinstance(nake_type, cpptypes.array_t)",
"def is_... | [
"0.82728523",
"0.70219254",
"0.66266537",
"0.6525004",
"0.6523983",
"0.63820577",
"0.6306559",
"0.6290047",
"0.6269066",
"0.6223681",
"0.62179875",
"0.61583006",
"0.6143151",
"0.60992885",
"0.60982627",
"0.60772675",
"0.6002454",
"0.59870887",
"0.592929",
"0.59064114",
"0.587... | 0.837404 | 0 |
Returns True if an optional array of |type_| is required. | def NeedsOptionalArray(self, type_):
return self._NameComponents(type_) in self._optional_array_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NeedsArray(self, type_):\n return self._NameComponents(type_) in self._array_types",
"def NeedsOptional(self, type_):\n return self._NameComponents(type_) in self._optional_types",
"def _is_valid_optional(content_type: str) -> bool:\n content_type = content_type.strip()\n\n if not content_type.... | [
"0.7609094",
"0.74748665",
"0.6302446",
"0.62274206",
"0.5963019",
"0.5944859",
"0.5910404",
"0.58944917",
"0.58723825",
"0.5859879",
"0.58545005",
"0.58494735",
"0.5801532",
"0.5791278",
"0.57562685",
"0.572749",
"0.5722032",
"0.5713737",
"0.56981695",
"0.565166",
"0.5649861... | 0.8654627 | 0 |
Formats the type of a parameter or property. | def FormatParamType(self, param):
return self.ToPpapiType(param.type_, optional=param.optional) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _params_formatter(field, description):\n heads = ['param']\n types = _or_types(field)\n if types:\n heads.append(types)\n heads.append(rst.escape(field['name']))\n tail = description\n return heads, tail",
"def type_name(self):\n return \"%s %s\" % (self.param_type, self.name)... | [
"0.6721866",
"0.67166615",
"0.67160106",
"0.670664",
"0.64922065",
"0.6423277",
"0.61667955",
"0.6131432",
"0.6046694",
"0.58923894",
"0.5867848",
"0.58638537",
"0.58260894",
"0.5823857",
"0.5820997",
"0.5808265",
"0.5772102",
"0.576688",
"0.570222",
"0.5648112",
"0.564018",
... | 0.73090506 | 0 |
Returns a string containing the name for an enum value. | def EnumValueName(self, enum_value, enum_type):
return '%s_%s' % (self.ToPpapiType(enum_type).upper(),
enum_value.name.upper()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enum_name(name):\n name = _strip_enum_name(name)\n return convert_to_camel_case(name)",
"def _case_value(self, enum_name) -> str:\n return self.enum_name_to_value_str[enum_name]",
"def enum(self, name: str) -> str:\n return camel_case(rstrip(lstrip(name, self.strip_prefix.lower() + ... | [
"0.7194853",
"0.7165243",
"0.7112458",
"0.7111647",
"0.6993682",
"0.67851233",
"0.67578965",
"0.6677014",
"0.654952",
"0.64681774",
"0.6304277",
"0.6221868",
"0.6138309",
"0.61033535",
"0.595039",
"0.5937669",
"0.59123695",
"0.5893061",
"0.5865052",
"0.58493173",
"0.5823887",... | 0.8568432 | 0 |
Returns True if the function produces any arrays as outputs. This includes arrays that are properties of other objects. | def HasArrayOuts(self, function):
if function.callback:
for param in function.callback.params:
if self._IsOrContainsArray(param.type_):
return True
return function.returns and self._IsOrContainsArray(function.returns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_array(self):\n return False",
"def is_array(self):\n return len(self.descriptor) > 1",
"def is_array(self, arr):\n return isinstance(arr, np.ndarray)",
"def in_memory(self) -> bool:\n return all(isinstance(x, np.ndarray) for x in self.chunks.values())",
"def NeedsArray(se... | [
"0.72993195",
"0.70264244",
"0.6617377",
"0.65149415",
"0.6500039",
"0.6453068",
"0.6422463",
"0.64218163",
"0.6396683",
"0.63670695",
"0.62847984",
"0.6210942",
"0.6157778",
"0.61497",
"0.6135575",
"0.60912275",
"0.605404",
"0.6042222",
"0.6024875",
"0.60133564",
"0.5987595"... | 0.7884502 | 0 |
Function to generate response time modelling table for supervised model rolling data used | def create_resp_time_model_table(log_df, path):
# IMPORTANT!! - deleting all logs without a response time (errors) - this loses key information but should simplify the problem while preserving the basic relationship
log_df.dropna(inplace=True)
# Feature transformations
log_df.resp_time = log_df.resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OTU_table_ML(OTU_table,metadata,obj_col):\n for ele in OTU_table.index:\n #print(ele)\n X.append(df.loc[ele])\n Y.append(metadata[obj_col][ele])\n precisions = []\n for train_time in range(100): \n X,Y = shuffle(X,Y)\n sample_num = len(X)\n sep_num = int(0.... | [
"0.5781972",
"0.5680243",
"0.56487894",
"0.56029195",
"0.5554776",
"0.5489696",
"0.5406424",
"0.5358575",
"0.5351622",
"0.53511775",
"0.5280897",
"0.5227695",
"0.5218374",
"0.52092546",
"0.5201484",
"0.51891166",
"0.51834995",
"0.5166249",
"0.515652",
"0.5152242",
"0.51513875... | 0.66706955 | 0 |
If the acl migration script is present, then run it for either upgrade or downgrade. That script was introduced in JDP 2.3.4.0 and requires stopping all clickhouse server first. Requires configs to be present. | def run_migration(env, upgrade_type):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upgradedb(ctx):\n path = Path(__file__).resolve().parent.parent\n conf = Config(str(path / \"migrations\" / \"alembic.ini\"))\n conf.set_main_option(\"script_location\", str(path / \"migrations\"))\n command.upgrade(conf, \"heads\")",
"def run_migrations_online():\n # Overload db config on top... | [
"0.58964086",
"0.58806306",
"0.5844946",
"0.5831652",
"0.5816279",
"0.573843",
"0.56441265",
"0.5638328",
"0.5611884",
"0.559761",
"0.5571458",
"0.5553457",
"0.55422837",
"0.55324596",
"0.5529657",
"0.5511022",
"0.5490681",
"0.5481719",
"0.54575187",
"0.5436541",
"0.54033834"... | 0.5928642 | 0 |
Ensure that the requested application IDs exist in the credential store | def _valid_app_ids(app_ids):
for app_id in app_ids:
try:
app_data = KNACK_CREDENTIALS[app_id]
except KeyError:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_application_credentials(self):\n self.create_application_credential()\n self.create_application_credential()\n\n app_creds = self._list_app_creds()\n self.assertEqual(2, len(app_creds))",
"def credentials_exist(cls, application_name):\n for credential in cls.crede... | [
"0.6270161",
"0.61432534",
"0.6059631",
"0.60542804",
"0.60096",
"0.6001399",
"0.5981303",
"0.59135467",
"0.5909259",
"0.5713224",
"0.5706788",
"0.5603459",
"0.55174124",
"0.5372461",
"0.53686315",
"0.53555125",
"0.53390706",
"0.53318244",
"0.53318244",
"0.53318244",
"0.53318... | 0.7131529 | 0 |
Digitally rotates a movie. | def digi_rotate(t0, t1, rpm, path):
# film given
vid = cv2.VideoCapture(path)
# collecting frame values from film
fps = int(vid.get(cv2.CAP_PROP_FPS))
width = int(vid.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(vid.get(cv2.CAP_PROP_FRAME_HEIGHT))
dim = (width, height)
# find the starti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate90(self):",
"def rotate(self):\n pass",
"def rot270(a):\n return rot90(a, 3)",
"def rotate():\n if counter == counter.max - 1:\n rotator.next = concat(rotator[3:], rotator[3])\n counter.next = 0\n else:\n counter.next = counter + 1\n\n ... | [
"0.63065183",
"0.62393856",
"0.59951496",
"0.59612286",
"0.595599",
"0.590411",
"0.5855677",
"0.5835269",
"0.5797633",
"0.57521546",
"0.57329375",
"0.5692951",
"0.5686378",
"0.5683258",
"0.56762296",
"0.5666455",
"0.56300724",
"0.55754495",
"0.55728483",
"0.5563859",
"0.55549... | 0.71536314 | 0 |
Create a map of yyyymmdd date to the effective Firefox version on the release channel. | def create_date_to_version(release_info):
# Combine major and minor releases into a map of day -> version
# Keep only the highest version available for a day range.
observed_dates = set(release_info["major"].values())
observed_dates |= set(release_info["minor"].values())
# Skip old versions.
sd ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_release_info():\n major_info = fetch_json(\n \"https://product-details.mozilla.org/1.0/\" \"firefox_history_major_releases.json\"\n )\n if major_info is None:\n raise Exception(\"Failed to fetch major version info\")\n minor_info = fetch_json(\n \"https://product-details.mo... | [
"0.64789635",
"0.5741884",
"0.557935",
"0.549464",
"0.5401355",
"0.5294197",
"0.5251765",
"0.51889926",
"0.5123242",
"0.5047908",
"0.5033626",
"0.5024878",
"0.5021051",
"0.49921367",
"0.49921367",
"0.49878576",
"0.49814534",
"0.49654284",
"0.4960135",
"0.49502078",
"0.4913153... | 0.66776 | 0 |
Logically compare two Firefox version strings. Split the string into pieces, and compare each piece numerically. Returns 1, 0, or 1 depending on whether a is less than, equal to, or greater than b. | def compare_ver(a, b):
if a == b:
return 0
ap = [int(p) for p in a.split(".")]
bp = [int(p) for p in b.split(".")]
lap = len(ap)
lbp = len(bp)
# min # of pieces
mp = lap
if lbp < mp:
mp = lbp
for i in range(mp):
if ap[i] < bp[i]:
return -1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semver_greater_or_equal_then(self, a, b):\n regex_pattern = r\"^[0-9]+\\.[0-9]+\\.[0-9]+$\"\n if not re.search(regex_pattern, a) or not re.search(regex_pattern, b):\n raise ValueError(\n \"input semver_greater_than not conforming to semver string with three components\"\... | [
"0.6895598",
"0.6743786",
"0.6740128",
"0.66319966",
"0.65628123",
"0.65443957",
"0.64480853",
"0.6446703",
"0.6441994",
"0.64305896",
"0.6421748",
"0.6416959",
"0.6401585",
"0.63995934",
"0.63389623",
"0.62862116",
"0.6275784",
"0.62654954",
"0.6259658",
"0.6259658",
"0.6194... | 0.7151355 | 0 |
Fetch information about Firefox release dates. | def get_release_info():
major_info = fetch_json(
"https://product-details.mozilla.org/1.0/" "firefox_history_major_releases.json"
)
if major_info is None:
raise Exception("Failed to fetch major version info")
minor_info = fetch_json(
"https://product-details.mozilla.org/1.0/"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_date(self):\n for item in self.proto.releaseInfo.item:\n if item.label == 'Released on':\n return item.container.value",
"def get_recent_release_from_product_details() -> int:\n rls_prod_details_json = get(\n \"https://product-details.mozilla.org/1.0/firefox... | [
"0.64530736",
"0.62751865",
"0.61650556",
"0.5973575",
"0.569051",
"0.56405985",
"0.56299275",
"0.5627423",
"0.5545539",
"0.5539282",
"0.54749966",
"0.54701924",
"0.5449492",
"0.5447537",
"0.54006326",
"0.53912765",
"0.53298837",
"0.5321881",
"0.5257921",
"0.5257824",
"0.5241... | 0.739596 | 0 |
Create the effective version table. This will download the Firefox release history and map the date to a particular version. | def create_effective_version_table(spark):
d2v = create_date_to_version(get_release_info())
rows = [Row(date, version) for date, version in d2v.items()]
df = spark.createDataFrame(rows, ["date", "effective_version"])
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMdrizVerHistory(self,build,versions):\n _plist = self.assoc.parlist[0]\n if build == True: _output = _plist['output']\n else: _output = _plist['outdata']\n \n fhdu = pyfits.open(_output,mode='update')\n prihdr = fhdu[0].header\n \n ver_str = \"Multi... | [
"0.59296113",
"0.57643044",
"0.5720029",
"0.57032704",
"0.5642012",
"0.5630682",
"0.55822927",
"0.5467309",
"0.545384",
"0.5448237",
"0.54436135",
"0.53901",
"0.5340493",
"0.530622",
"0.5300927",
"0.52796566",
"0.52493066",
"0.5232649",
"0.5166009",
"0.5144376",
"0.5123442",
... | 0.6685843 | 0 |
Get the predicted taxid of a cluster | def predict_tax_id_of(self, cluster, lowest_predicted_novelty=None):
assert isinstance(cluster, list)
assert isinstance(lowest_predicted_novelty, dict)
list_of_valid_iid, set_of_ncbi_taxid = self.load_lineages(cluster)
root = {"count": 0, "c": {}, 'p': None}
# Build tree based from lineage of known referenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, test_vector):\n return self.find_closest(test_vector)[1].class_id",
"def predict(toPredict=None):\n\tif not toPredict:\n\t\ttoPredict = gc.generate_test_cases(1)[0]\n\ttoPredict = np.asarray(toPredict)\n\ttoPredict = toPredict.reshape(1, -1)\t\n\tclusterer = joblib.load(\"training_data.p... | [
"0.61873776",
"0.59227043",
"0.5879525",
"0.58381927",
"0.5827772",
"0.58084744",
"0.579759",
"0.579388",
"0.5715172",
"0.5692964",
"0.5692964",
"0.5692964",
"0.5692964",
"0.56203836",
"0.56029224",
"0.5600961",
"0.55800897",
"0.557896",
"0.5554138",
"0.5523848",
"0.55089825"... | 0.6975198 | 0 |
Compares the lineages of two ids for inconsistencies | def has_consistent_lineage(self, iid1, iid2):
assert isinstance(iid1, basestring)
assert isinstance(iid2, basestring)
set1 = set(self._iid_to_tid_lineage[iid1])
set2 = set(self._iid_to_tid_lineage[iid2])
if None in set1:
set1.remove(None)
if None in set2:
set2.remove(None)
if len(set2) > len(set1):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issueIdCompare (x, y):\n return int(x) - int(y)",
"def compare_ids(id1_name,id1,id2_name,id2) :\n\tprint(\"*\"*15+\"Comparing {0} and {1} \".format(id1_name,id2_name)+\\\n\t\t\"*\"*15)\n\tprint('{0} and {1} : {3} : {2}'.format(id1_name,id2_name,\\\n\t\t\tset(id1).intersection(id2),len(set(id1).intersectio... | [
"0.7130681",
"0.66294694",
"0.6493316",
"0.6391099",
"0.6199318",
"0.6185603",
"0.61810994",
"0.6171284",
"0.61675423",
"0.6167245",
"0.61553144",
"0.6148317",
"0.6141087",
"0.6117017",
"0.6072346",
"0.60444325",
"0.6043345",
"0.6030135",
"0.5947052",
"0.59452546",
"0.5897413... | 0.66868603 | 1 |
Receives messages through the given socket and upon receiving messages, passes them to the given callback, if provided. | def receive_message(socket, callback = None):
while not exit_flag:
try:
message = socket.recv(1024)
if message:
if callback:
callback(json.loads(message))
except Exception as err:
if err.message == "timed out":
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _receive(self, callback):\n selector = DefaultSelector()\n selector.register(self.socket, EVENT_READ)\n\n while self.socket is not None:\n try:\n val = selector.select(self.SELECT_TIMEOUT_INTERVAL)\n if val:\n with self.socket_loc... | [
"0.6843778",
"0.6792882",
"0.6568508",
"0.6449003",
"0.62893856",
"0.6255029",
"0.61910206",
"0.59970635",
"0.59936166",
"0.59226006",
"0.5834541",
"0.5826315",
"0.58259904",
"0.5811133",
"0.5799723",
"0.5694438",
"0.5686741",
"0.56864834",
"0.5647423",
"0.56437683",
"0.56399... | 0.72988653 | 0 |
Safely sends messages from the given queue through the given socket. | def send_message(socket, queue_lock, message_queue):
while not exit_flag:
queue_lock.acquire() # do we need this because it is the only thread accessing the queue?
if not message_queue.empty():
message = message_queue.get()
socket.send(json.dumps(message))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, sock, message):\r\n try:\r\n sock.send(message)\r\n except:\r\n ip = sock.getpeername()[0]\r\n thread_message = protocol.thread.disconnected(\r\n client=ip)\r\n self.logic_queue.put(thread_message)\r\n del self.socke... | [
"0.66195136",
"0.6453884",
"0.642432",
"0.62488264",
"0.6219386",
"0.61610514",
"0.6111505",
"0.6001638",
"0.58942753",
"0.58779025",
"0.57223344",
"0.5719853",
"0.5707447",
"0.56375396",
"0.56023514",
"0.5561714",
"0.5561005",
"0.5556723",
"0.5528581",
"0.5516578",
"0.551206... | 0.6896618 | 0 |
Converts a RFC 2822 date string to a Python datetime | def rfc2822_to_datetime(rfc_date):
timestamp = mktime_tz(parsedate_tz(rfc_date))
raw_dt = datetime.datetime.utcfromtimestamp(timestamp)
return raw_dt.replace(tzinfo=pytz.utc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2date(s):\n return datetime.strptime(s.decode(), \"%Y-%m-%d %H:%M:%S\")",
"def date_parse(date_string) -> datetime:\n return datetime.strptime(date_string, DATE_FMT)",
"def str2date(date_str, date_format):\n return datetime.strptime(date_str, date_format)",
"def str_to_datetime(datestr):\... | [
"0.75370574",
"0.7524161",
"0.75230426",
"0.7474539",
"0.7380216",
"0.7363937",
"0.7332416",
"0.72434944",
"0.7235556",
"0.72310495",
"0.7218827",
"0.7215087",
"0.7190974",
"0.7150111",
"0.71432346",
"0.7058417",
"0.7016221",
"0.70142514",
"0.69902235",
"0.698518",
"0.6955505... | 0.7587371 | 0 |
Converts a date to an ISO 8601 date | def date_to_iso8601(date):
return '%s-%02d-%02d' % (date.year, date.month, date.day) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertFromISODate(date):\n if date:\n try:\n datetime_object = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%fZ')\n except ValueError:\n return date\n else:\n return datetime_object.strftime('%Y-%m-%d')\n else:\... | [
"0.761873",
"0.7392231",
"0.7306647",
"0.7173363",
"0.7065435",
"0.70450443",
"0.693962",
"0.68908626",
"0.6856698",
"0.6832159",
"0.67990255",
"0.6783756",
"0.6777949",
"0.6719085",
"0.66657495",
"0.66171837",
"0.6608111",
"0.6454436",
"0.6452257",
"0.64465547",
"0.6432734",... | 0.7751069 | 0 |
Converts a date/time to an ISO8601 date string | def datetime_to_iso8601(date_time):
assert not date_time.utcoffset()
return date_time.strftime('%Y-%m-%dT%H:%M:%S.%f') + 'Z' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_iso8601(date):\n dateTimeStr = date.strftime('%Y-%m-%dT%H:%M:%S')\n timeZone_Sign = date.strftime('%z')[0:1]\n timeZone_Str = '%s:%s' % (\n date.strftime('%z')[1:3], date.strftime('%z')[3:5]\n )\n return '{dateTimeStr}{tzsign}{timezone}'.format(\n dateTimeStr=dateTimeStr,\n... | [
"0.74979764",
"0.74902165",
"0.7431974",
"0.7419218",
"0.7412657",
"0.7403743",
"0.7371318",
"0.7325647",
"0.7270622",
"0.7265942",
"0.71070457",
"0.7059399",
"0.70436025",
"0.70258117",
"0.7015273",
"0.6989766",
"0.6948633",
"0.69454974",
"0.6882652",
"0.68742526",
"0.682166... | 0.7737572 | 0 |
Create the recipe_submitters group and add permissions for the recipes models. | def set_groups_and_permissions_for_recipes(apps, schema_editor):
# In a migration from scratch, Django creates all of the models from all of the migrations, then runs
# post-migrate signals that create the matching contenttypes and permissions for those models. So to
# have the permissions available as need... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_permissions(sender, instance, created, **kwargs):\n if created:\n assign_perm('view_strand', instance.owner.group, instance)\n assign_perm('change_strand', instance.saver, instance)\n assign_perm('delete_strand', instance.saver, instance)\n assign_perm('view_strand', insta... | [
"0.5869022",
"0.5664685",
"0.54697114",
"0.5329047",
"0.5266422",
"0.5219528",
"0.5170797",
"0.51487756",
"0.5059055",
"0.50569934",
"0.50397646",
"0.4989145",
"0.49865612",
"0.49759528",
"0.49693114",
"0.49689642",
"0.4890528",
"0.48767957",
"0.48527274",
"0.48459893",
"0.48... | 0.719273 | 0 |
Delete the recipe_submitters group and remove permissions for the recipes models. | def delete_groups_and_permissions_for_recipes(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
Permission = apps.get_model('auth', 'Permission')
# Delete the recipe_submitters group.
recipe_submitters = Group.objects.get(name='recipe_submitters')
recipe_submitters.delete()
# Remove ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_groups_and_permissions_for_recipes(apps, schema_editor):\n # In a migration from scratch, Django creates all of the models from all of the migrations, then runs\n # post-migrate signals that create the matching contenttypes and permissions for those models. So to\n # have the permissions available... | [
"0.6266785",
"0.5591004",
"0.5577398",
"0.546319",
"0.5420757",
"0.53574723",
"0.5347574",
"0.5306062",
"0.5258542",
"0.517935",
"0.5165285",
"0.5147882",
"0.5146139",
"0.5145385",
"0.514538",
"0.5139523",
"0.5134124",
"0.5133454",
"0.51272124",
"0.5104209",
"0.5067102",
"0... | 0.77730346 | 0 |
Write out a LAMMPS input data file from all available held data (particles, bonds, angles, dihedrals) | def writeInput(self, inputName):
n_atoms = len(self.strucC.ptclC) # Obtaining particle size from container
n_bonds = len(self.strucC.bondC) # " "
n_angles = 0
n_dihedrals = 0
n_impropers = 0
ptclTypeInfo = self.strucC.ptclC.getTypeInfoDict() # map of "type":[typeInde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_file_empty_particles( self, fullpath, iteration,\n time, dt, select_nglobal_dict=None ):\n # Create the file (can be done by one proc or in parallel)\n f = self.open_file( fullpath,\n parallel_open=self.write_metadata_parallel )\n\n # Set... | [
"0.6233852",
"0.6049055",
"0.59952754",
"0.5993482",
"0.5989338",
"0.59035194",
"0.5876952",
"0.58192855",
"0.57709455",
"0.57223535",
"0.5669011",
"0.56494737",
"0.5621777",
"0.56035256",
"0.5600126",
"0.5549958",
"0.55436593",
"0.553908",
"0.5513475",
"0.5504689",
"0.549771... | 0.60799 | 1 |
This function returns the similarity functions that can be used for blocking purposes. | def get_sim_funs_for_blocking():
return get_sim_funs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sim_funs_for_matching():\n return get_sim_funs()",
"def get_sim_funs():\n # Get all the functions\n functions = [affine,\n hamming_dist, hamming_sim,\n lev_dist, lev_sim,\n jaro,\n jaro_winkler,\n needleman_wunsch,\n smith_waterman,\n ... | [
"0.7595024",
"0.63673127",
"0.6308711",
"0.5925133",
"0.5899825",
"0.5820802",
"0.5816266",
"0.5762516",
"0.5705619",
"0.5647635",
"0.5613622",
"0.5608324",
"0.5591788",
"0.54945135",
"0.54929453",
"0.54725003",
"0.5399277",
"0.5357441",
"0.53447056",
"0.53207594",
"0.5303963... | 0.6827025 | 1 |
This function returns the similarity functions that can be used for matching purposes. | def get_sim_funs_for_matching():
return get_sim_funs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def support(self, *mass_functions):\n result = 0\n for mass_function in mass_functions:\n result += self.similarity(mass_function)\n return round(result, 6)",
"def get_sim_funs():\n # Get all the functions\n functions = [affine,\n hamming_dist, hamming_sim,\n ... | [
"0.6930342",
"0.6922496",
"0.6651343",
"0.64268017",
"0.6327616",
"0.63262683",
"0.6168023",
"0.6159539",
"0.61535805",
"0.61521906",
"0.6151027",
"0.61504406",
"0.6129659",
"0.6106815",
"0.60337514",
"0.6013572",
"0.6002604",
"0.5994367",
"0.59513664",
"0.59350365",
"0.58982... | 0.7485367 | 0 |
This function returns all the similarity functions supported by py_entitymatching. | def get_sim_funs():
# Get all the functions
functions = [affine,
hamming_dist, hamming_sim,
lev_dist, lev_sim,
jaro,
jaro_winkler,
needleman_wunsch,
smith_waterman,
overlap_coeff, jaccard, dice,
monge_elkan, cosine,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sim_funs_for_matching():\n return get_sim_funs()",
"def matching_function(self):\n return self.matching",
"def support(self, *mass_functions):\n result = 0\n for mass_function in mass_functions:\n result += self.similarity(mass_function)\n return round(result, ... | [
"0.6809313",
"0.5970114",
"0.59289217",
"0.5881862",
"0.5848022",
"0.5700076",
"0.546105",
"0.544144",
"0.5293913",
"0.5225981",
"0.5210986",
"0.5193888",
"0.5184501",
"0.51736575",
"0.5161041",
"0.5153997",
"0.5139561",
"0.51273674",
"0.50873893",
"0.50863755",
"0.50809014",... | 0.6386741 | 1 |
This function computes the affine measure between the two input strings. | def affine(s1, s2):
if s1 is None or s2 is None:
return np.NaN
if pd.isnull(s1) or pd.isnull(s2):
return np.NaN
# Create the similarity measure object
measure = sm.Affine()
# if not isinstance(s1, six.string_types):
# s1 = six.u(str(s1))
#
# if isinstance(s1, bytes)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_ac(str1, str2):\n\n total_letters = len(str1)\n ocr_letters = len(str2)\n if total_letters == 0 and ocr_letters == 0:\n acc_by_char = 1.0\n return acc_by_char\n diff = difflib.SequenceMatcher(None, str1, str2)\n correct_letters = 0\n for block in diff.get_matching_bloc... | [
"0.63553405",
"0.61718947",
"0.5936084",
"0.5796191",
"0.5786991",
"0.56601393",
"0.56586766",
"0.56334126",
"0.5630156",
"0.56203854",
"0.5600835",
"0.55875045",
"0.5516447",
"0.55161786",
"0.5510329",
"0.54970294",
"0.54924995",
"0.548434",
"0.5479686",
"0.54698855",
"0.544... | 0.766846 | 0 |
This function computes the Jaro measure between the two input strings. | def jaro(s1, s2):
if s1 is None or s2 is None:
return np.NaN
if pd.isnull(s1) or pd.isnull(s2):
return np.NaN
# Create the similarity measure object
measure = sm.Jaro()
s1 = gh.convert_to_str_unicode(s1)
s2 = gh.convert_to_str_unicode(s2)
# Call the function to compute th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jaro_winkler(s1, s2):\n\n if s1 is None or s2 is None:\n return np.NaN\n if pd.isnull(s1) or pd.isnull(s2):\n return np.NaN\n\n # Create the similarity measure object\n measure = sm.JaroWinkler()\n\n s1 = gh.convert_to_str_unicode(s1)\n s2 = gh.convert_to_str_unicode(s2)\n\n ... | [
"0.6745757",
"0.6688105",
"0.64389557",
"0.63981867",
"0.62419844",
"0.61086327",
"0.59216213",
"0.59106064",
"0.5902468",
"0.58630276",
"0.5837399",
"0.58354956",
"0.57936925",
"0.5779611",
"0.57716894",
"0.57716894",
"0.57639134",
"0.575739",
"0.57497656",
"0.57397157",
"0.... | 0.694033 | 0 |
This function computes the Jaro Winkler measure between the two input strings. | def jaro_winkler(s1, s2):
if s1 is None or s2 is None:
return np.NaN
if pd.isnull(s1) or pd.isnull(s2):
return np.NaN
# Create the similarity measure object
measure = sm.JaroWinkler()
s1 = gh.convert_to_str_unicode(s1)
s2 = gh.convert_to_str_unicode(s2)
# Call the functio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needleman_wunsch(s1, s2):\n\n if s1 is None or s2 is None:\n return np.NaN\n if pd.isnull(s1) or pd.isnull(s2):\n return np.NaN\n\n # Create the similarity measure object\n measure = sm.NeedlemanWunsch()\n\n s1 = gh.convert_to_str_unicode(s1)\n s2 = gh.convert_to_str_unicode(s2)... | [
"0.6788896",
"0.66081494",
"0.66059947",
"0.6470179",
"0.63263375",
"0.62388",
"0.6173257",
"0.59819245",
"0.59588856",
"0.59431833",
"0.5941848",
"0.5918244",
"0.58945453",
"0.5883886",
"0.5881869",
"0.583687",
"0.58133394",
"0.5812754",
"0.57736623",
"0.5767439",
"0.5761080... | 0.7575979 | 0 |
This function computes the NeedlemanWunsch measure between the two input strings. | def needleman_wunsch(s1, s2):
if s1 is None or s2 is None:
return np.NaN
if pd.isnull(s1) or pd.isnull(s2):
return np.NaN
# Create the similarity measure object
measure = sm.NeedlemanWunsch()
s1 = gh.convert_to_str_unicode(s1)
s2 = gh.convert_to_str_unicode(s2)
# Call the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wer(self, s1, s2):\n\n # build mapping of words to integers\n b = set(s1.split() + s2.split())\n word2char = dict(zip(b, range(len(b))))\n\n # map the words to a char array (Levenshtein packages only accepts\n # strings)\n w1 = [chr(word2char[w]) for w in s1.split()]\n... | [
"0.68239665",
"0.654353",
"0.6511335",
"0.6437355",
"0.6430416",
"0.64249414",
"0.64004254",
"0.6376064",
"0.6336655",
"0.6335249",
"0.6326769",
"0.624123",
"0.6237112",
"0.62366253",
"0.6231296",
"0.6201022",
"0.61789054",
"0.61644095",
"0.6163073",
"0.6162313",
"0.6145308",... | 0.78441447 | 0 |
This function computes the SmithWaterman measure between the two input strings. | def smith_waterman(s1, s2):
if s1 is None or s2 is None:
return np.NaN
if pd.isnull(s1) or pd.isnull(s2):
return np.NaN
# Create the similarity measure object
measure = sm.SmithWaterman()
s1 = gh.convert_to_str_unicode(s1)
s2 = gh.convert_to_str_unicode(s2)
# Call the fun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needleman_wunsch(s1, s2):\n\n if s1 is None or s2 is None:\n return np.NaN\n if pd.isnull(s1) or pd.isnull(s2):\n return np.NaN\n\n # Create the similarity measure object\n measure = sm.NeedlemanWunsch()\n\n s1 = gh.convert_to_str_unicode(s1)\n s2 = gh.convert_to_str_unicode(s2)... | [
"0.64644766",
"0.6360998",
"0.6348814",
"0.6116703",
"0.60223436",
"0.59620124",
"0.59521943",
"0.5895421",
"0.58825564",
"0.5845717",
"0.58400196",
"0.58056986",
"0.57941836",
"0.57353765",
"0.57208973",
"0.5685259",
"0.5653027",
"0.56257683",
"0.5611121",
"0.5603607",
"0.56... | 0.7843239 | 0 |
This function computes the cosine measure between the two input lists/sets. | def cosine(arr1, arr2):
if arr1 is None or arr2 is None:
return np.NaN
if not isinstance(arr1, list):
arr1 = [arr1]
if any(pd.isnull(arr1)):
return np.NaN
if not isinstance(arr2, list):
arr2 = [arr2]
if any(pd.isnull(arr2)):
return np.NaN
# Create cosine ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cosine_sim_collections(a, b):\n setab = sorted(set(a) | set(b))\n countera, counterb = Counter(a), Counter(b)\n veca = [countera[element] if element in a else 0 for element in setab]\n vecb = [counterb[element] if element in b else 0 for element in setab]\n return dot(veca, vecb) / (norm(veca) *... | [
"0.7819704",
"0.7435064",
"0.73457235",
"0.7227552",
"0.7194849",
"0.7180048",
"0.71752626",
"0.7158523",
"0.7141222",
"0.7115908",
"0.71114993",
"0.7092765",
"0.70836025",
"0.70498925",
"0.70376146",
"0.70373344",
"0.70204633",
"0.70120454",
"0.699438",
"0.6991972",
"0.69742... | 0.78729504 | 0 |
This function computes the overlap coefficient between the two input lists/sets. | def overlap_coeff(arr1, arr2):
if arr1 is None or arr2 is None:
return np.NaN
if not isinstance(arr1, list):
arr1 = [arr1]
if any(pd.isnull(arr1)):
return np.NaN
if not isinstance(arr2, list):
arr2 = [arr2]
if any(pd.isnull(arr2)):
return np.NaN
# Create ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap_coefficient(a, b):\n\ta_words, b_words = map(norm.set_clean_tokens, [a,b])\n\n\tintersection = set.intersection(a_words, b_words)\n\tlength_a_words, length_b_words = len(a_words), len(b_words)\n\n\t#empty sets\n\tif length_a_words == 0 or length_b_words == 0: return 0\n\n\t#try to compute overlap_coeff... | [
"0.7548212",
"0.719279",
"0.6959806",
"0.6952675",
"0.6932603",
"0.6737369",
"0.6610187",
"0.65677553",
"0.65582865",
"0.6484214",
"0.64330775",
"0.6415461",
"0.63787776",
"0.6341743",
"0.6341578",
"0.6339345",
"0.63165236",
"0.63165236",
"0.63165236",
"0.63165236",
"0.631153... | 0.75210416 | 1 |
This function computes the Dice score between the two input lists/sets. | def dice(arr1, arr2):
if arr1 is None or arr2 is None:
return np.NaN
if not isinstance(arr1, list):
arr1 = [arr1]
if any(pd.isnull(arr1)):
return np.NaN
if not isinstance(arr2, list):
arr2 = [arr2]
if any(pd.isnull(arr2)):
return np.NaN
# Create Dice obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dices(x,y):\r\n import sets\r\n x = sets.Set(x)\r\n y = sets.Set(y)\r\n common = len(x.intersection(y))\r\n total = float(len(x) + len(y))\r\n return 2*common/total",
"def expected_value(held_dice, num_die_sides, num_free_dice):\n outcomes = [number+1 for number in range(num_die_sides)]\... | [
"0.69111496",
"0.6624183",
"0.6551296",
"0.6535389",
"0.6514628",
"0.6513191",
"0.64580786",
"0.64465994",
"0.6415629",
"0.6398116",
"0.6397053",
"0.635078",
"0.62851",
"0.6278966",
"0.62717193",
"0.62639284",
"0.6182825",
"0.61566865",
"0.613695",
"0.6130918",
"0.60883075",
... | 0.7267112 | 0 |
This function computes the MongeElkan measure between the two input lists/sets. Specifically, this function uses JaroWinkler measure as the secondary function to compute the similarity score. | def monge_elkan(arr1, arr2):
if arr1 is None or arr2 is None:
return np.NaN
if not isinstance(arr1, list):
arr1 = [arr1]
if any(pd.isnull(arr1)):
return np.NaN
if not isinstance(arr2, list):
arr2 = [arr2]
if any(pd.isnull(arr2)):
return np.NaN
# Create Mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needleman_wunsch(s1, s2):\n\n if s1 is None or s2 is None:\n return np.NaN\n if pd.isnull(s1) or pd.isnull(s2):\n return np.NaN\n\n # Create the similarity measure object\n measure = sm.NeedlemanWunsch()\n\n s1 = gh.convert_to_str_unicode(s1)\n s2 = gh.convert_to_str_unicode(s2)... | [
"0.65323305",
"0.64564824",
"0.6258938",
"0.6184763",
"0.6172207",
"0.6148048",
"0.607108",
"0.6066316",
"0.6043116",
"0.6019911",
"0.6016503",
"0.60092545",
"0.5979588",
"0.5979588",
"0.59592575",
"0.5936361",
"0.59341997",
"0.59328926",
"0.59265316",
"0.5908916",
"0.5885796... | 0.6957215 | 0 |
This function computes the relative difference between two numbers | def rel_diff(d1, d2):
if d1 is None or d2 is None:
return np.NaN
if pd.isnull(d1) or pd.isnull(d2):
return np.NaN
try:
d1 = float(d1)
d2 = float(d2)
except ValueError:
return np.NaN
if d1 == 0.0 and d2 == 0.0:
return 0
else:
# Compute the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference(num1, num2):\n\n # Return the calculated value\n return abs(num1 - num2)",
"def relative_change(nr1, nr2):\n\n return float(((nr2 - nr1) / nr1) * 100)",
"def rel_diff (x, y, ord=2):\n return np.linalg.norm (x - y, ord=ord) / np.linalg.norm (y, ord=ord)",
"def subtract(value1, value... | [
"0.78438365",
"0.7366058",
"0.71686053",
"0.715922",
"0.6943712",
"0.68633705",
"0.68463707",
"0.6832445",
"0.68225986",
"0.68112576",
"0.67888916",
"0.6780808",
"0.6780808",
"0.67792785",
"0.6770976",
"0.6770976",
"0.6768049",
"0.67509234",
"0.67287207",
"0.6695316",
"0.6695... | 0.78984976 | 0 |
This function computes the absolute norm similarity between two numbers | def abs_norm(d1, d2):
if d1 is None or d2 is None:
return np.NaN
if pd.isnull(d1) or pd.isnull(d2):
return np.NaN
try:
d1 = float(d1)
d2 = float(d2)
except ValueError:
return np.NaN
if d1 == 0.0 and d2 == 0.0:
return 0
else:
# Compute abso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_similarity(site_a, site_b):\n return np.linalg.norm(site_a - site_b)",
"def euclidean_distance(a, b):\n return np.linalg.norm(a - b)",
"def normalized_distance(_a, _b) -> float:\n b = _b.astype(int)\n a = _a.astype(int)\n norm_diff = np.linalg.norm(b - a)\n norm1 = np.linalg.norm(... | [
"0.7844428",
"0.72325575",
"0.721387",
"0.7073164",
"0.7030838",
"0.7006792",
"0.7000549",
"0.7000549",
"0.6965963",
"0.69434595",
"0.688686",
"0.683027",
"0.6794371",
"0.678851",
"0.67678577",
"0.6676263",
"0.66611373",
"0.6659281",
"0.6642874",
"0.6635989",
"0.66180885",
... | 0.76955205 | 1 |
Get balance from account dictionary | def balance(self, account_number: int):
return self._accounts[account_number][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_balance(self):\n return int(self.request('get', 'fort/accounts')['balance'])",
"def authorized_get_account_balance(self, huid):\n acc = self.request('get', safeformat('fort/accounts/{:hex}', huid))\n return int(acc['balance'])",
"def get_account_balances(self):\n par... | [
"0.7617226",
"0.756246",
"0.74942267",
"0.74375427",
"0.7305308",
"0.7283074",
"0.7199607",
"0.71915734",
"0.7176308",
"0.7148308",
"0.7110653",
"0.7088527",
"0.7058743",
"0.7055952",
"0.70541614",
"0.70382464",
"0.7024502",
"0.7004247",
"0.6982249",
"0.6938625",
"0.69366837"... | 0.80221426 | 0 |
Utility to make sure blocks of some types are not changed by middleware. | def assert_block_does_not_change(
block_type: str, middleware: Middleware, same_instance: Optional[bool]
):
block_type = block_type.lower()
if block_type == "preamble":
block = Preamble(
start_line=5, raw="@Preamble{a_x + b_x^2}", value="a_x + b_x^2"
)
elif block_type == "imp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_block(self, block):\n pass",
"def test_block_bad_signature(self):\n pass",
"def block_type(self):\r\n raise NotImplementedError()",
"def _getBlockTypesToModify(self):\n raise NotImplementedError",
"def _getBlockTypesToModify(self):\n return flags.Flags.FUEL",
... | [
"0.6337795",
"0.6182725",
"0.6101678",
"0.6096466",
"0.6014013",
"0.5886278",
"0.5881327",
"0.58701074",
"0.5809969",
"0.5779813",
"0.5751385",
"0.5703393",
"0.56590945",
"0.56563073",
"0.5580384",
"0.5553192",
"0.5553192",
"0.551886",
"0.54754853",
"0.54682887",
"0.54646623"... | 0.7184661 | 0 |
Verify all attributes of entry (except `fields`) are identical. | def assert_nonfield_entry_attributes_unchanged(original_copy, transformed_entry):
assert transformed_entry.start_line == original_copy.start_line
assert transformed_entry.raw == original_copy.raw
assert transformed_entry.entry_type == original_copy.entry_type
assert transformed_entry.key == original_cop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attributes_equal(self):\n test1 = self.Test({ 'id': 2, 'name': 'Poop Head' })\n test2 = self.Test({ 'id': 2, 'name': 'Poop Head' })\n self.assertEqual(test1, test2)",
"def test_SameNumberOfFields(self):\n pass",
"def _assert_fields_set(forum_tag_update):\n vampytest.asse... | [
"0.65894204",
"0.6497942",
"0.6293213",
"0.6205734",
"0.6142325",
"0.6035967",
"0.59711903",
"0.59414756",
"0.59143895",
"0.58963096",
"0.5874734",
"0.58587384",
"0.5855202",
"0.58478683",
"0.5813428",
"0.57964057",
"0.57876307",
"0.57832503",
"0.57795215",
"0.5778588",
"0.57... | 0.6908734 | 0 |
Here we expect a line in the format sizespec = "N=" intnumber "L=" intnumber | def parse_sizespec(self):
line_splitted = self.line.split()
for argument_unit in line_splitted:
# words[0] is the identifier of the argument
# and words[1] is the argument value.
words = self.split_argument_unit(argument_unit)
if words[0] == 'N':
self.node_number = int(words[1])
elif word... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_size_pretty_intonly(self):\n assert smdba.basegate.BaseGate.size_pretty(size=str(0x19000000000), int_only=True) == \"2 TB\"\n assert smdba.basegate.BaseGate.size_pretty(size=str(0x19000000000), int_only=False) == \"1.56 TB\"",
"def size(self, size_input: Tuple[str, str]):\n self.isi... | [
"0.57872283",
"0.5706722",
"0.56756955",
"0.5569172",
"0.5495234",
"0.5490167",
"0.5487867",
"0.5450883",
"0.5442286",
"0.53841186",
"0.53411824",
"0.5334287",
"0.5288812",
"0.5267331",
"0.52422196",
"0.5231751",
"0.52293426",
"0.5173249",
"0.51725954",
"0.51700723",
"0.51680... | 0.72830147 | 0 |
Here we expect a line int he format node = "I=" intnumber { "t=" floatnumber | "W=" string | "s=" string | "L=" string | "v=" intnumber } | def parse_node(self):
line_splitted = self.line.split()
i=t=w=s=l=v=None
for argument_unit in line_splitted:
words = self.split_argument_unit(argument_unit)
if words[0] == 'I':
i = words[1]
elif words[0] == 't':
t = float(words[1])
elif words[0] == 'W':
w = words[1]
elif words[0] == '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typed_line(line, parser):\n user, item, rating = parser(line)\n return int(user), int(item), float(rating)",
"def parse_nbest_line(line):\n fields=[ x.strip() for x in line.strip().split('|||') ]\n fields[0]=int(fields[0])\n fields[3]=float(fields[3])\n return fields",
"def parse_riatahg... | [
"0.6109663",
"0.58706415",
"0.5780289",
"0.5749846",
"0.5729524",
"0.57160765",
"0.5703965",
"0.5666008",
"0.5617194",
"0.56143785",
"0.5559619",
"0.554664",
"0.54934543",
"0.5439141",
"0.54043555",
"0.53888535",
"0.53875023",
"0.5380105",
"0.5378863",
"0.5359797",
"0.5335198... | 0.6027205 | 1 |
We expect a lattice file with at least the nodes and links specifications | def parse(self, lat_file):
self.line_number = 0
for self.line in open(lat_file):
self.line_number = self.line_number + 1
if self.line.startswith(self.COMMENT_CHAR) or self.line.strip() == '':
continue
self.current_arg_name = self.line.split()[0].split('=')[0]
if self.current_arg_name == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_lattice(lattice_params):\n meshfn = find_meshfn(lattice_params)\n xyload = np.loadtxt(meshfn + '_xy.txt', delimiter=',', skiprows=1, usecols=(0, 1)) # , unpack=True)\n NLload = np.loadtxt(meshfn + '_NL.txt', delimiter=',', skiprows=1)\n KLload = np.loadtxt(meshfn + '_KL.txt', delimiter=',', s... | [
"0.6408197",
"0.6402167",
"0.61103106",
"0.5723678",
"0.5705532",
"0.55874264",
"0.5507766",
"0.54999375",
"0.5460624",
"0.54605263",
"0.5451043",
"0.54273945",
"0.54033875",
"0.53984725",
"0.5385291",
"0.5383027",
"0.53586286",
"0.5342684",
"0.533525",
"0.5321909",
"0.530006... | 0.64465874 | 0 |
Basic dynamics of xdot = u + w X = [x, y, theta, v] U = [a, thetadot] | def xdot(self, t, x, u, w):
a= u[0]
thetadot = u[1]
theta = x[2]
v = x[3]
w = w * self.w_scale
return np.array([v*np.cos(theta), v*np.sin(theta), thetadot, a]) + np.array([np.cos(theta) * w[0] - np.sin(theta) * w[1], np.sin(theta) * w[0] + np.cos(theta) * w[1], v * w[2], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _x_dot(self, x, t, u):\r\n # freeze system if state is irrecoverable\r\n if self.is_irrecoverable(ignore_force_check=True):\r\n return np.concatenate([x[3:], -100 * x[3:]])\r\n\r\n omega_dot = self._compute_omega_dot(x, u)\r\n return np.concatenate([x[3:], omega_dot])",
... | [
"0.7095485",
"0.67280114",
"0.6631565",
"0.6583655",
"0.6473879",
"0.64622515",
"0.6437646",
"0.6346359",
"0.6318589",
"0.6317359",
"0.6280072",
"0.62792444",
"0.6275815",
"0.62749016",
"0.6229366",
"0.6229271",
"0.6220608",
"0.6207483",
"0.6186498",
"0.616053",
"0.61565715",... | 0.8511646 | 0 |
Find jacobian of xdot wrt x, u, w | def jacobian(self, t, x, u, w):
a= u[0]
theta = x[2]
v = x[3]
fx = np.array([[0, 0, 0, 0],
[0, 0, 0, 0],
[-v*np.sin(theta), v*np.cos(theta), 0, 0],
[np.cos(theta), np.sin(theta), 0, 0]])
fu = np.array([[0, 0, 0,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jacobian(self, x):\n pass",
"def jacobian_i(self, x):\n return np.matrix([-x**3, -x**2, -x, -1])",
"def jacobian(x, u):\n yaw = x[2, 0]\n v = u[0, 0]\n jac = np.array([\n [1.0, 0.0, -dt * v * math.sin(yaw), dt * math.cos(yaw)],\n [0.0, 1.0, dt * v * math.cos(yaw), dt * ... | [
"0.7635287",
"0.7433471",
"0.7396353",
"0.7174867",
"0.7082837",
"0.70720506",
"0.70720506",
"0.70561296",
"0.7034001",
"0.6884063",
"0.6869111",
"0.6838496",
"0.6799053",
"0.67983246",
"0.6773296",
"0.67557317",
"0.67102885",
"0.6704614",
"0.6600641",
"0.6588736",
"0.6552797... | 0.7442697 | 1 |
Set cached/overridden repo name | def repo_name(self, value):
self._repo_name = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo(name: str) -> str:\n if \"REPOS\" in environ:\n return path.join(environ[\"REPOS\"], name)\n else:\n high(\n r\"Hey I use the $REPOS environment variable to determine where repositories are on my computer. If you have some directory you put those -- set something like 'expor... | [
"0.666232",
"0.6347797",
"0.6319982",
"0.6319982",
"0.6319982",
"0.62070084",
"0.6077217",
"0.60260475",
"0.5873363",
"0.5843754",
"0.5842505",
"0.58378583",
"0.5799823",
"0.5794301",
"0.57833487",
"0.57705575",
"0.5744735",
"0.57145834",
"0.56794924",
"0.56694865",
"0.565500... | 0.78428745 | 0 |
Load the data in the file as YAML, then deserialize into the model with the schema | def load_yaml_file(self, path):
with path.open('r') as handle:
data = load_yaml(handle)
self.set_all(**self.SCHEMA.load(data).data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(fname, schema=None):\n with open(fname) as fh:\n data = yaml.safe_load(fh.read())\n if schema:\n import jsonschema\n jsonschema.validate(data, schema=schema)\n return data",
"def load_yaml():\n yamlfullpath = os.path.join(THISDIR, 'ff_data.yaml')\n\n with open(ya... | [
"0.7052859",
"0.6938935",
"0.6663248",
"0.66504115",
"0.6547714",
"0.65372574",
"0.6492213",
"0.6489156",
"0.6478954",
"0.6426492",
"0.642378",
"0.6408891",
"0.63940364",
"0.63902265",
"0.63423324",
"0.6328812",
"0.6247367",
"0.6204342",
"0.61898434",
"0.6164526",
"0.6142374"... | 0.70614487 | 0 |
Transform the dataframes train_data and test_data using the simple_pre_process_text_df fuction | def pre_process_df(train_data, test_data):
train_data["text"] = train_data["sentence1"] + ", " + train_data["sentence2"] # noqa
test_data["text"] = test_data["sentence1"] + ", " + test_data["sentence2"]
train_data.drop(["sentence1", "sentence2"], axis=1, inplace=True)
test_data.drop(["sentence1", "sent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_process_df_and(train_data, test_data):\n train_data[\"text\"] = train_data[\"sentence1\"] + \", \" + train_data[\"sentence2\"] # noqa\n test_data[\"text\"] = test_data[\"sentence1\"] + \", \" + test_data[\"sentence2\"]\n train_data.drop([\"sentence1\", \"sentence2\"], axis=1, inplace=True)\n t... | [
"0.8317033",
"0.71798605",
"0.7019761",
"0.7012555",
"0.68675",
"0.68186945",
"0.6800046",
"0.67037183",
"0.6595085",
"0.6558292",
"0.64326715",
"0.6403922",
"0.63942146",
"0.63649434",
"0.63630503",
"0.6360753",
"0.6347602",
"0.63435566",
"0.6339177",
"0.6337749",
"0.6318478... | 0.8711986 | 0 |
Transform the dataframes train_data and test_data using the simple_pre_process_text_df fuction | def pre_process_df_and(train_data, test_data):
train_data["text"] = train_data["sentence1"] + ", " + train_data["sentence2"] # noqa
test_data["text"] = test_data["sentence1"] + ", " + test_data["sentence2"]
train_data.drop(["sentence1", "sentence2"], axis=1, inplace=True)
test_data.drop(["sentence1", "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_process_df(train_data, test_data):\n train_data[\"text\"] = train_data[\"sentence1\"] + \", \" + train_data[\"sentence2\"] # noqa\n test_data[\"text\"] = test_data[\"sentence1\"] + \", \" + test_data[\"sentence2\"]\n train_data.drop([\"sentence1\", \"sentence2\"], axis=1, inplace=True)\n test_... | [
"0.8712246",
"0.7179881",
"0.70199734",
"0.7013015",
"0.6867418",
"0.68180364",
"0.6800781",
"0.6704047",
"0.65928185",
"0.6557004",
"0.6432491",
"0.6403363",
"0.6392462",
"0.6363344",
"0.6362623",
"0.6358992",
"0.63511384",
"0.6342292",
"0.6338978",
"0.6337713",
"0.63191843"... | 0.8317381 | 1 |
(Python 3) Funcion que devuelve una lista con strings de todos las interfaces de red que tenga tu computadora | def get_interfaces():
with open('/proc/net/dev','r') as f: #Abrimos el archivo con la informacion de red
interfaces = []
for linea in f:
if ':' in linea:
interfaces.append(linea[:linea.find(':')]) #Extraemos los primeros caracteres de las lineas con informacion d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface_list() -> List[str]:\n cmd_ip = system_command('ip')\n command = f\"{cmd_ip} -o addr show up primary scope global\".split()\n result = SUDO.execute_unit(command)\n result.assert_return()\n line_list = result.stdout.splitlines()\n pattern = re.compile(r\"^\\d+[:]\\s+(\\S+)\\s+(.+)$\"... | [
"0.7471883",
"0.68196785",
"0.68036413",
"0.67726964",
"0.64654857",
"0.6249705",
"0.6198327",
"0.6175823",
"0.6146426",
"0.61315215",
"0.60893565",
"0.60683876",
"0.60423905",
"0.5926157",
"0.5891671",
"0.5889576",
"0.58737075",
"0.58512723",
"0.5843293",
"0.5829948",
"0.581... | 0.7384779 | 1 |
Create a new bundle and add it at the end of the document. | def create_bundle(self):
self._highest_bundle_id += 1
bundle = Bundle(document=self, bundle_id=str(self._highest_bundle_id))
self.bundles.append(bundle)
bundle.number = len(self.bundles)
return bundle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundle(self, app):\r\n assert(isinstance(app, BundleCreate.App))\r\n\r\n bundledir = os.path.join(self.outdir, '%s-bundle' % app.basename)\r\n self.context.log.info('creating %s' % os.path.relpath(bundledir, get_buildroot()))\r\n\r\n safe_mkdir(bundledir, clean=True)\r\n\r\n classpath = OrderedS... | [
"0.613188",
"0.6057387",
"0.60490054",
"0.6018387",
"0.5994574",
"0.59157234",
"0.5887433",
"0.5883327",
"0.5745319",
"0.5706084",
"0.5564178",
"0.55551183",
"0.54527986",
"0.5399539",
"0.5382822",
"0.53428787",
"0.529444",
"0.5280484",
"0.5274187",
"0.5241557",
"0.5231771",
... | 0.7890401 | 0 |
Load a document from a conlluformatted file. | def load_conllu(self, filename):
reader = ConlluReader(files=filename)
reader.process_document(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_doc(filename):\n\tfile = open(filename, 'r')\n\ttext = file.read()\n\tfile.close()\n\treturn text",
"def load_doc(filename):\n file = open(filename, 'r')\n text = file.read()\n file.close()\n return text",
"def load_doc(filename):\n file = open(filename, 'r')\n text = file.read()\n ... | [
"0.62912846",
"0.6211304",
"0.6211304",
"0.6177588",
"0.6171319",
"0.58116096",
"0.5705853",
"0.5667673",
"0.5545391",
"0.55173826",
"0.5491514",
"0.5421002",
"0.5411794",
"0.53875315",
"0.52885556",
"0.5275798",
"0.52268267",
"0.5219097",
"0.52161604",
"0.5202413",
"0.515286... | 0.8030381 | 0 |
Store a document into a conlluformatted file. | def store_conllu(self, filename):
writer = ConlluWriter(files=filename)
writer.process_document(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(corpus,dataFormat,path):\n\t\n\tassert dataFormat in ['standoff','biocxml','pubannotation']\n\n\tassert isinstance(corpus,kindred.Corpus)\n\n\tif dataFormat == 'standoff':\n\t\tassert os.path.isdir(path), \"Path must be an existing directory\"\n\n\t\tfor i,d in enumerate(corpus.documents):\n\t\t\tif d.sou... | [
"0.60064656",
"0.59198076",
"0.5866057",
"0.5864834",
"0.5774028",
"0.5687176",
"0.5670429",
"0.56385",
"0.5624686",
"0.5620071",
"0.56106544",
"0.5610107",
"0.5609225",
"0.56054246",
"0.5591675",
"0.5588718",
"0.5572393",
"0.5547389",
"0.55432725",
"0.5540909",
"0.5540909",
... | 0.75027597 | 0 |
Main handling function. Wraps deckoverview. | def main():
logging.basicConfig(format="%(asctime)s %(levelname)-5.5s %(message)s",
stream=sys.stdout,
level=logging.DEBUG)
# Parse options
parser = argparse.ArgumentParser(description='Generate a Commander decklist')
parser.add_argument("--layout", help=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deckoverview(args):\n\n # Load deck from the XML file.\n deck = mtgoverlay.Deck.from_dek_file(args.dekfile)\n log.info(\"Loaded deck %s\", deck)\n\n # Save the deck list\n layout = LAYOUTS[args.layout]\n renderer = mtgoverlay.GenericRenderer(args.width, args.height, layout)\n decklist = re... | [
"0.7493635",
"0.61137074",
"0.6106042",
"0.5965356",
"0.595034",
"0.58284366",
"0.5825609",
"0.57860893",
"0.5721606",
"0.5704529",
"0.5697303",
"0.56812227",
"0.56631297",
"0.564853",
"0.56423414",
"0.56403255",
"0.56251526",
"0.5548399",
"0.5540151",
"0.55094177",
"0.550925... | 0.76453274 | 0 |
REACH INTO THE MODULES AND OBJECTS TO SET CONSTANTS. THINK OF THIS AS PRIMITIVE DEPENDENCY INJECTION FOR MODULES. USEFUL FOR SETTING DEBUG FLAGS. | def set(constants):
if not constants:
return
constants = wrap(constants)
for k, new_value in constants.leaves():
errors = []
try:
old_value = pyDots.set_attr(sys.modules, k, new_value)
continue
except Exception, e:
errors.append(e)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n declared = []\n spec = get_specs_for_module(self.module_name)\n\n # Inputs\n for entry in spec.cpacs_inout.inputs:\n if entry.var_name in declared:\n log.info(\"Already declared\")\n elif entry.var_name in Rt.optim_var_dict:\n ... | [
"0.5976224",
"0.57806414",
"0.5628132",
"0.55672365",
"0.5515956",
"0.5514253",
"0.5505236",
"0.54215556",
"0.5420737",
"0.5402465",
"0.539041",
"0.53710854",
"0.5367282",
"0.53038657",
"0.5302808",
"0.5281871",
"0.5279745",
"0.52625",
"0.52606916",
"0.5250562",
"0.5240351",
... | 0.67637515 | 0 |
This function will import the subscription details from a designated csv file. The output is a list of sub/pw tuples. | def importDetails(details):
sublist = []
sub_no =''
for row in details:
sub_no = row[0].rsplit('@')[0]
pw = row[1]
entry = (sub_no, pw)
sublist.append(entry)
return sublist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importAll():\n csvFile = openCsv()\n items = [] # chooseKey, count, grade, keyType, mainCategory, mainKey,\n # name, pricePerOne, subCategory, subKey, totalTradeCount,\n # mainLabel, subLabel, description\n\n with open(csvFile) as i:\n readItem = csv.reader(i)... | [
"0.5877453",
"0.58602124",
"0.5681427",
"0.5672557",
"0.56724876",
"0.556173",
"0.55147445",
"0.5509887",
"0.5499087",
"0.54834837",
"0.54577386",
"0.5454571",
"0.5450725",
"0.5435765",
"0.54297924",
"0.5412751",
"0.54054964",
"0.54016376",
"0.5400664",
"0.53852564",
"0.53832... | 0.62211496 | 0 |
This function takes sub/pw tuple, checks to see if already ported. If already ported, remove from provisioning list and place in own list. Return both lists. | def check_list_for_existing_ports (subdata):
list_of_existing_ports =[]
not_ported_subs = []
count = 0 # count needed for subdata list pop if required.
for row in subdata:
print (" Checking {0} in NGIN GNP Database.".format(row[0]))
prov_logger.info(" Checking {0} in NGIN GNP Data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def taken_ports():\n odoo = 'odoo' if env.api.system != 'wheezy' else 'openerp'\n ports = sudo('grep _port /srv/{odoo}/*/*cfg /srv/{odoo}/*/*/*cfg'\n '|cut -d= -f2|sort|uniq'\n .format(odoo=odoo)).splitlines()\n ports += sudo('grep \\.bind /srv/{odoo}/*/*cfg /srv/{odoo}/*/... | [
"0.52948636",
"0.52251506",
"0.51752406",
"0.5122571",
"0.50250626",
"0.5002854",
"0.49880207",
"0.4910818",
"0.48990184",
"0.48881048",
"0.4888041",
"0.47936684",
"0.47565603",
"0.47528648",
"0.47504106",
"0.47445604",
"0.47287738",
"0.47131658",
"0.4692721",
"0.46912444",
"... | 0.5812311 | 0 |
Create the hosted office subscription. | def create_hosted_office(sub, pw):
s1 = ims.hostedOfficeSubscriber(sub)
session = {}
session['emaSession'] = ema.emaLogin()
session['sub_pw'] = pw # Get password from xls sheet and put here
result = s1.subscriberCreate(session)
ema.ema_logout(session['emaSession'])
return res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_subscription(self,\n body):\n\n return super().new_api_call_builder.request(\n RequestBuilder().server('default')\n .path('/v2/subscriptions')\n .http_method(HttpMethodEnum.POST)\n .header_param(Parameter()\n ... | [
"0.6670702",
"0.64235014",
"0.6394689",
"0.6356803",
"0.63560337",
"0.62949973",
"0.6232281",
"0.6223814",
"0.62120175",
"0.61827266",
"0.6049368",
"0.6036577",
"0.60067517",
"0.59117335",
"0.5866046",
"0.5861581",
"0.58576417",
"0.58350927",
"0.582679",
"0.574904",
"0.568849... | 0.75290436 | 0 |
Download the plugin, name, Drupdates oragnization on Github. | def download_plugin(name):
uri = 'https://github.com/drupdates/' + name + '.git'
plugins_dir = Utils.check_dir(os.path.join('~', '.drupdates', 'plugins'))
if not bool(urlparse(uri).netloc):
msg = ("Error: {0} url, {1}, is not a valid url").format(name, uri)
raise Drupdate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(ui, repo, clname, **opts):\n\tcl, patch, err = DownloadCL(ui, repo, clname)\n\tif err != \"\":\n\t\treturn err\n\tui.write(cl.EditorText() + \"\\n\")\n\tui.write(patch + \"\\n\")\n\treturn",
"def _Download( self ):\n self._DownloadPipe += PackageUtil.ExecuteSimpleCommand( \"git\", [\"clone\",... | [
"0.62739855",
"0.6217709",
"0.6036224",
"0.5973068",
"0.5895806",
"0.58349043",
"0.578747",
"0.57808423",
"0.571205",
"0.5651446",
"0.56146574",
"0.56046724",
"0.5577172",
"0.55708",
"0.55604523",
"0.55491525",
"0.553414",
"0.5504959",
"0.54944205",
"0.5483361",
"0.54662037",... | 0.71561515 | 0 |
Recursively gets all substructures up to a maximum size starting from an atom in a substructure. | def get_substructures_from_atom(atom: Chem.Atom,
max_size: int,
substructure: Set[int] = None) -> Set[FrozenSet[int]]:
assert max_size >= 1
if substructure is None:
substructure = {atom.GetIdx()}
substructures = {frozenset(substructur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_substructures(atoms: List[Chem.Atom],\n sizes: List[int],\n max_count: int = None) -> Set[FrozenSet[int]]:\n max_count = max_count or float('inf')\n\n random.shuffle(atoms)\n\n substructures = set()\n for atom in atoms:\n # Get all substructures ... | [
"0.69485503",
"0.5376733",
"0.53041303",
"0.5191946",
"0.50944483",
"0.50019085",
"0.49215192",
"0.4910981",
"0.4894355",
"0.4871626",
"0.4824641",
"0.48239958",
"0.4822886",
"0.47936785",
"0.47487363",
"0.4729319",
"0.4718886",
"0.47037464",
"0.46582624",
"0.465577",
"0.4643... | 0.78206426 | 0 |
Gets up to max_count substructures (frozenset of atom indices) from a molecule. | def get_substructures(atoms: List[Chem.Atom],
sizes: List[int],
max_count: int = None) -> Set[FrozenSet[int]]:
max_count = max_count or float('inf')
random.shuffle(atoms)
substructures = set()
for atom in atoms:
# Get all substructures up to max size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_substructures_from_atom(atom: Chem.Atom,\n max_size: int,\n substructure: Set[int] = None) -> Set[FrozenSet[int]]:\n assert max_size >= 1\n\n if substructure is None:\n substructure = {atom.GetIdx()}\n\n substructures = {frozense... | [
"0.7373396",
"0.54113394",
"0.52654713",
"0.5255495",
"0.5120086",
"0.5108632",
"0.5069359",
"0.50302774",
"0.5025455",
"0.50042593",
"0.49732763",
"0.49566078",
"0.49356902",
"0.49296722",
"0.4917896",
"0.49157408",
"0.4882996",
"0.4879317",
"0.48698932",
"0.48333228",
"0.48... | 0.72961175 | 1 |
Converts a substructure (set of atom indices) to a feature string by sorting and concatenating atom and bond feature vectors. | def substructure_to_feature(mol: Chem.Mol,
substructure: FrozenSet[int],
fg_features: List[List[int]] = None) -> str:
if fg_features is None:
fg_features = [None] * mol.GetNumAtoms()
substructure = list(substructure)
atoms = [Chem.Mol.GetAtomW... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feat_info_to_str(feat_list, add_id=False):\n #add part handling texts with a all_sent_f_list as + arg\n #feat_list = [(fn, fs[fn]) for fn in features.keys()]\n feat_list.sort()\n feature_n = [el[0] for el in feat_list]\n float_fs = [] #needed?\n float_fs = map(lambda x: str(float(x[1])), feat... | [
"0.585894",
"0.58417565",
"0.5654706",
"0.5368779",
"0.534436",
"0.5313031",
"0.5312675",
"0.5259963",
"0.525415",
"0.5223844",
"0.52128166",
"0.5154738",
"0.5138791",
"0.5084473",
"0.50756",
"0.50707704",
"0.503333",
"0.5013536",
"0.50082433",
"0.4946126",
"0.49266553",
"0... | 0.7760963 | 0 |
Loads the Vocab a model was trained with. | def load_vocab(path: str) -> Vocab:
return torch.load(path, map_location=lambda storage, loc: storage)['args'].vocab | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_vocab():\n # vocab loaded internally at google\n unused = r.sp_model\n del unused\n return r",
"def load(cls, path: str) -> 'Vocab':\n with open(path, 'r', encoding='utf-8') as f:\n return cls.from_json(f.read())",
"def load_vocab(self, fn):\n vocab = load_vocab(fn)\n ... | [
"0.76706827",
"0.709628",
"0.703546",
"0.6947733",
"0.6805562",
"0.6804808",
"0.67778677",
"0.6746486",
"0.67311305",
"0.6641784",
"0.6636589",
"0.65878385",
"0.65801126",
"0.6552187",
"0.6547009",
"0.65337616",
"0.65273845",
"0.6513308",
"0.6441233",
"0.6418493",
"0.63563246... | 0.7340449 | 1 |
Do a call on tequila'server | def do_query(call, data=None):
if data:
# Tequila's encoding
data = '\n'.join(['{}={}'.format(k, v) for k, v in data.items()])
r = requests.post('{}/cgi-bin/tequila/{}'.format(settings.TEQUILA_SERVER, call), data=data)
else:
r = requests.get('{}/cgi-bin/tequila/{}'.format(sett... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self) -> global___Snippet.ClientCall:",
"def call(self) -> global___Snippet.ClientCall:",
"def main():\n return execute_api(Freta(), [Endpoint], __version__)",
"def ftp():\n pass",
"def execute():",
"def main():\n frontend_query(PATH, USER)",
"def run(ctx, user_cmd):\n connecter = ... | [
"0.59860486",
"0.59860486",
"0.59111726",
"0.57128847",
"0.571164",
"0.56951916",
"0.5694634",
"0.56521326",
"0.5643486",
"0.56143826",
"0.5613402",
"0.5597519",
"0.55822843",
"0.55799145",
"0.55533016",
"0.55174285",
"0.551261",
"0.55023444",
"0.5438743",
"0.5435733",
"0.543... | 0.6828846 | 0 |
Build an HttpResponseRedirect for a faillure | def build_faillure(request, string):
return HttpResponseRedirect("{}?why={}".format(settings.TEQUILA_FAILURE, string)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_page_401_response(self, request):\n _login_url = request.build_absolute_uri(reverse('account:login_page'))\n\n _next = request.build_absolute_uri()\n _redirect = build_redirect_url(_next, _login_url, 'refer_url')\n return HttpResponseRedirect(_redirect)",
"def redirect(url)... | [
"0.6588757",
"0.65288454",
"0.6418313",
"0.63300526",
"0.6229946",
"0.6219899",
"0.6161653",
"0.6142825",
"0.6098923",
"0.6053982",
"0.6050653",
"0.6048103",
"0.60446143",
"0.6005473",
"0.5987757",
"0.5964451",
"0.59631574",
"0.59631574",
"0.59344584",
"0.5922956",
"0.5922257... | 0.8032009 | 0 |
Collects user's checkout details | def collect_details():
user_details = []
user_details.append(
input("\tEnter your first name for checkout purposes\n\t(press Enter to continue)\n\n\t"))
user_details.append(
input("\n\tEnter your last name for checkout purposes\n\t(press Enter to continue)\n\n\t"))
user_details.append(input(
"\n\tEnter your... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkout(user_data):\n checkout_res = requests.post(url=\"http://127.0.0.1:5000/checkout\", json=user_data)\n return checkout_res.text",
"def add_billing_details_user(self) -> \"CheckoutPage\":\n logging.info('User add bulling details')\n self.accordion = BillingDetailsUser(self.driver)\n... | [
"0.60785633",
"0.6068851",
"0.5824859",
"0.5762445",
"0.5541739",
"0.5503266",
"0.54720485",
"0.53985155",
"0.53443545",
"0.53279644",
"0.5320095",
"0.5311186",
"0.5296312",
"0.52940387",
"0.526848",
"0.5237379",
"0.5215513",
"0.5205314",
"0.51679015",
"0.5159598",
"0.5151418... | 0.61940217 | 0 |
checks twitter for restock notifications | def restock_checker(last_check_time = "2020-12-23 14:20:00") -> tuple:
# config settings for twitter scraping (via twint)
cfg = tw.Config()
cfg.Username = "tendmoney"
cfg.Since = last_check_time # tweets since last check
# cfg.Limit = 1 # max num tweets
cfg.Search = "DiscountMoneyStore.com" # search term
# r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_retweet(tweet):\n\n return 'retweeted_status' in tweet",
"def _send_notification(update, tweet):\n return tweet_update(update, not tweet)",
"def get_user_notifications(self, login):",
"def twitter_status_update(self, msg):\n print('updating twitter status with message: %s' % msg)\n\n ... | [
"0.610516",
"0.6098919",
"0.59553474",
"0.5881055",
"0.5793205",
"0.57025826",
"0.56222266",
"0.56125313",
"0.5611607",
"0.55688375",
"0.5562334",
"0.55389106",
"0.55378354",
"0.5515991",
"0.5479419",
"0.54766476",
"0.54651195",
"0.54486114",
"0.5448336",
"0.5440917",
"0.5423... | 0.6198854 | 0 |
Cleanup orphan tracks and empty playlists. | def clean():
tracks = []
removed_playlists = 0
for playlist in PlaylistManager.find():
if len(playlist.tracks) == 0:
PlaylistManager.remove(playlist.id)
removed_playlists += 1
else:
tracks += playlist.tracks
tracks = list(set(tracks))
removed_tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n self.all_wav_to_mp3()\n self.past_songs_db.close()\n self.move_tracks_to_music_folder( )\n self.delete_leftovers()\n print \"Cleanup finished\"",
"def clean_up(self, graph):\n # Delete albums associated with place\n if len(self.albums) != 0:\n... | [
"0.7014401",
"0.65916455",
"0.6552946",
"0.6492669",
"0.61238474",
"0.5978729",
"0.59191513",
"0.587934",
"0.5877266",
"0.5864095",
"0.5843369",
"0.58059746",
"0.57673216",
"0.57207036",
"0.5718766",
"0.569898",
"0.5676357",
"0.5655346",
"0.56299233",
"0.5629842",
"0.5619104"... | 0.7944109 | 0 |
Returns average of all stored heart rates for user since some time if given | def average_hr(self, since_time=None):
try:
import numpy as np
except ImportError as e:
print("Necessary import failed: {}".format(e))
return None
hr = np.array(self.heart_rate)
if since_time is not None:
hr_adjusted = np.array([])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval_average():\r\n import statistics as st\r\n from tach_detect import tach_detect\r\n r = request.get_json()\r\n try:\r\n email = r[\"user_email\"]\r\n except KeyError:\r\n return jsonify(\"no email input\"), 400\r\n raise LookupError(\"no email input\")\r\n check_e... | [
"0.7452025",
"0.72157973",
"0.71164423",
"0.68806595",
"0.6503524",
"0.648473",
"0.63955784",
"0.6392288",
"0.63793623",
"0.63394165",
"0.622651",
"0.62148166",
"0.6195902",
"0.614133",
"0.61285305",
"0.60863906",
"0.60718745",
"0.60439956",
"0.59818286",
"0.59671843",
"0.594... | 0.75091505 | 0 |
Adjust age and age units to fit analysis ranges | def adjust_age(self):
try:
from tools import valid_units
except ImportError as e:
print("Necessary import failed: {}".format(e))
if not valid_units(self.age_units):
print("Given unit is not supported: {}".format(self.age_units))
raise ValueError()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tachycardic_range(self):\n self.adjust_age()\n if self.age_units == \"day\":\n if self.age <= 2:\n return 159\n elif self.age <= 6:\n return 166\n elif self.age_units == \"week\":\n return 182\n elif self.age_units == \"... | [
"0.63468486",
"0.6262983",
"0.61958957",
"0.61551124",
"0.60395265",
"0.6028269",
"0.5972397",
"0.5968888",
"0.5960384",
"0.59436285",
"0.5922985",
"0.5921949",
"0.5894594",
"0.58642703",
"0.5856044",
"0.5854224",
"0.58107024",
"0.58046377",
"0.58046377",
"0.57755107",
"0.577... | 0.7820122 | 0 |
Determines lower bound for tachycardia given age of User | def tachycardic_range(self):
self.adjust_age()
if self.age_units == "day":
if self.age <= 2:
return 159
elif self.age <= 6:
return 166
elif self.age_units == "week":
return 182
elif self.age_units == "month":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_age_range(self):\n\n # Checks if user is in the age range of 1 to 3\n if self.age < 0 & self.age >= 3:\n self.age_range = \"1-3\"\n \n # Checks if user is in the age range of 4 to 8\n if self.age >= 4 & self.age <= 8:\n self.age_range = \"4-8\"\n... | [
"0.662293",
"0.63977665",
"0.637395",
"0.61643904",
"0.61416554",
"0.61267847",
"0.61246365",
"0.607577",
"0.60466456",
"0.60255307",
"0.59957397",
"0.59957397",
"0.59515685",
"0.595111",
"0.59409004",
"0.5940497",
"0.59309125",
"0.5921905",
"0.5916597",
"0.59147346",
"0.5910... | 0.6890343 | 0 |
Connect to an LDAP server | def _ldap_server_connect():
ldap_server = current_app.config['LDAP_SERVER']
ldap_port = int(current_app.config['LDAP_PORT'])
ldap_use_tls = current_app.config['LDAP_USE_TLS']
ldap_key_path = current_app.config['LDAP_KEY_PATH']
ldap_sa_bind_dn = current_app.config['LDAP_SA_BIND_DN']
ldap_sa_passw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self, conf):\n\n uri = '%s://%s:%d' % (conf['ldap_protocol'],conf['ldap_server'],\n conf['ldap_server_port'])\n\n connection = ldap.initialize(uri)\n if conf['ldap_tls']:\n connection.start_tls_s()\n return connection",
"def connec... | [
"0.8000891",
"0.7738051",
"0.76032484",
"0.75907457",
"0.72489977",
"0.7220551",
"0.7058913",
"0.6793673",
"0.6768772",
"0.6553842",
"0.6476209",
"0.63993543",
"0.6324652",
"0.6245748",
"0.6043256",
"0.60395026",
"0.6022642",
"0.6000588",
"0.5997529",
"0.59047997",
"0.5840307... | 0.8104701 | 0 |
Load Edward Snelson's 1d regression data set []. It contains 200 examples of a few oscillations of an example function. It has seen extensive use as a toy dataset for illustrating qualitative behaviour of Gaussian process approximations. | def snelson1d(path):
path = os.path.expanduser(path)
inputs_path = os.path.join(path, 'snelson_train_inputs')
outputs_path = os.path.join(path, 'snelson_train_outputs')
# Contains all source as well. We just need the data.
url = 'http://www.gatsby.ucl.ac.uk/~snelson/SPGP_dist.zip'
if not (os.path.exists(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nnRegression(data):",
"def run_regression(train_embeds, train_labels, test_embeds, test_labels):\n np.random.seed(1)\n from sklearn.linear_model import SGDClassifier\n from sklearn.dummy import DummyClassifier\n from sklearn.metrics import f1_score\n dummy = DummyClassifier()\n dummy.fit(tr... | [
"0.66172385",
"0.60256225",
"0.57156783",
"0.56414866",
"0.5569864",
"0.5549822",
"0.5543194",
"0.55136585",
"0.5509278",
"0.5494851",
"0.54813856",
"0.54782563",
"0.5467174",
"0.5454889",
"0.5435417",
"0.54338676",
"0.54290825",
"0.53819937",
"0.53567564",
"0.53558016",
"0.5... | 0.660342 | 1 |
expand fit results from the good cells to cells with not so good fitting results. | def expand_fit_results(self, fitResultsDF):
# Now we have the good fits!
# We'll have to find fits for cells
# where we didn't find good fits.
expFitDataTupleArr = []
minLat = round( self.sapsVelsDF["MLAT"].min() )
maxLat = round( self.sapsVelsDF["MLAT"].max() )
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_fit(self):\n pass",
"def inner_fit(self):\n pass",
"def fit():\n pass",
"def reset_fit(self):\n raise NotImplementedError()",
"def fit(self):\n raise NotImplementedError # pragma: no cover",
"def fill_fit(m, dicts, squares_coords, candidates=[], single_candid... | [
"0.61007386",
"0.61007386",
"0.583306",
"0.56662136",
"0.55930704",
"0.54459065",
"0.5433905",
"0.5419561",
"0.5364847",
"0.5364847",
"0.53641796",
"0.53489566",
"0.5332872",
"0.5324471",
"0.5238464",
"0.52373004",
"0.52113676",
"0.5197855",
"0.51785505",
"0.51751053",
"0.514... | 0.69621944 | 0 |
Plot the fitted velocities on a map. Mostly for verification purposes! | def plot_lshell_map(self, fitResultsDF,\
baseDir="/home/bharat/Documents/code/new-vel-data/fit-figs/"):
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib.colors import Normalize
# Seaborn styling
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_velocity(self):\n \n plt.figure(figsize=[2,6])\n plt.plot(self.velocity_model['vp'],self.velocity_model['depth'],'r',label='vp')\n plt.plot(self.velocity_model['vs'],self.velocity_model['depth'],'b',label='vs')\n\n plt.ylim(np.max(self.velocity_model['depth']),np.min(sel... | [
"0.7022523",
"0.65021163",
"0.62665",
"0.62476707",
"0.62451595",
"0.6242786",
"0.60798997",
"0.6036668",
"0.5974265",
"0.59261113",
"0.5872509",
"0.5868377",
"0.5867707",
"0.5789536",
"0.576815",
"0.57312685",
"0.5700038",
"0.5693819",
"0.5684121",
"0.5683079",
"0.5679153",
... | 0.70586014 | 0 |
Reads the contacts from the excel sheet, and then calls the add_contact function to add the contact to the DB. | def read_contacts(filename: str, database) -> None:
wb = xlrd.open_workbook(filename) # opens the excel workbook
sheet = wb.sheet_by_index(0) # gets the sheet
number_of_rows = sheet.nrows # total number of rows in the sheet
blank_counter = 0 # Will count the number of blank phone numbers
# Lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_contact(self):\n contact = Contact.create_contact()\n self.contact_list.append(contact)\n\n df = pd.read_csv('address_book.csv')\n #print(df)\n adf = pd.DataFrame({'FIRST NAME': [contact.first_name],\n 'LAST NAME': [contact.last_name],\n ... | [
"0.7066294",
"0.61696666",
"0.60703355",
"0.58912235",
"0.5781034",
"0.571478",
"0.56779385",
"0.55662787",
"0.552898",
"0.55124164",
"0.5507964",
"0.5500325",
"0.54823494",
"0.5451285",
"0.5436135",
"0.5436135",
"0.54300547",
"0.54207885",
"0.5404034",
"0.53989685",
"0.53493... | 0.75509906 | 0 |
Checks if the current contact already exists in the database, and adds it if it does not exist. Otherwise, the contact is added to the "duplicates" table. | def add_contact(database, name: str, email: str, phone: int) -> None:
# Searches the database for the the current contact (excel row)
cursor = database.execute("SELECT DISTINCT name, email, phone FROM contacts "
"WHERE name = ? AND email =? OR phone = ?", (name, email, phone))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_contact(contact):\n db = get_db()\n \n if contact.get_hash_name() not in db:\n db[contact.get_hash_name()] = json.loads(contact.json())\n write_db(db)\n else:\n sys.exit(logger.fail('fatal: contact already exists'))",
"def add_contact_to_db(self):\n self.init_db(se... | [
"0.6960862",
"0.6319943",
"0.6296879",
"0.6217902",
"0.6072962",
"0.59271467",
"0.5851053",
"0.58489406",
"0.5839983",
"0.5777871",
"0.57161134",
"0.57002693",
"0.56857413",
"0.5684179",
"0.56535876",
"0.56197083",
"0.56172556",
"0.55993176",
"0.5504139",
"0.5473075",
"0.5464... | 0.69774455 | 0 |
Increate post's upvote counter | def upvote(self, request, pk=None):
post = self.get_object()
post.upvotes += 1
post.save()
serializer = self.get_serializer(post)
return Response(serializer.data, status.HTTP_200_OK) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_vote(cls, user, message):\r\n pass",
"def up_vote(cls, user, message):\n pass",
"def test_vote_view_increment_up_vote_counter(self):\n self.client.login(username=\"John\", password=\"newpass1234\")\n up_votes = Post.objects.get(id=2).up_votes\n response = self.client.p... | [
"0.7197068",
"0.7096245",
"0.70701677",
"0.6957067",
"0.68950737",
"0.680566",
"0.6787692",
"0.6770548",
"0.6725029",
"0.67147857",
"0.65770143",
"0.65635556",
"0.65096575",
"0.6499263",
"0.6498596",
"0.64750415",
"0.64684665",
"0.6438345",
"0.6409633",
"0.6303753",
"0.629002... | 0.77914023 | 0 |
Create a timer set to expire after `duration` sec. | def __init__(self, duration=0.0):
super(Timer, self).__init__()
self.duration = duration
# For storing aritrary data with timers
self.data = Bunch.Bunch()
self.timer = QtCore.QTimer()
self.timer.setSingleShot(True)
self.timer.setTimerType(QtCore.Qt.PreciseTimer)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_duration(self, duration, movable_attr=\"DTSTART\"):\n i = self.icalendar_component\n return self._set_duration(i, duration, movable_attr)",
"def set_duration(self, duration_secs):\n raise UnsupportedOperation('Duration not implemented')",
"async def afterHoursAutoPurgeInactiveDurat... | [
"0.6003537",
"0.5881478",
"0.58573",
"0.5835526",
"0.5711331",
"0.5669319",
"0.5549151",
"0.5535602",
"0.552528",
"0.54921335",
"0.54921335",
"0.5448305",
"0.54140663",
"0.5406332",
"0.538407",
"0.537495",
"0.53745776",
"0.53672856",
"0.53672856",
"0.53672856",
"0.53672856",
... | 0.6417997 | 0 |
Start the timer. If `duration` is not None, it should specify the time to expiration in seconds. | def start(self, duration=None):
if duration is None:
duration = self.duration
self.set(duration) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n duration: Optional[pulumi.Input[str]] = None):\n if duration is not None:\n pulumi.set(__self__, \"duration\", duration)",
"async def async_set_duration(self, duration):\n self._duration = duration",
"def __init__(self, duration=0.0):\n ... | [
"0.62379247",
"0.61429274",
"0.6106151",
"0.6051431",
"0.6010706",
"0.5824973",
"0.5784653",
"0.5784653",
"0.5754865",
"0.5754865",
"0.5754865",
"0.5754865",
"0.5754865",
"0.5754865",
"0.5754865",
"0.5754865",
"0.56931996",
"0.5645179",
"0.5567631",
"0.5456803",
"0.5441991",
... | 0.73103094 | 0 |
Convert a Ginga colormap into a QPixmap | def cmap2pixmap(cmap, steps=50):
import numpy as np
inds = np.linspace(0, 1, steps)
n = len(cmap.clst) - 1
tups = [cmap.clst[int(x * n)] for x in inds]
rgbas = [QColor(int(r * 255), int(g * 255),
int(b * 255), 255).rgba() for r, g, b in tups]
im = QImage(steps, 1, QImage.For... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertToQPixelmap(self, imgToConvert):\n \n # Conversion en image QImage\n if ( len(imgToConvert.shape) == 3 ):\n img_qimg = QtGui.QImage(imgToConvert.data, \n imgToConvert.shape[1], \n imgToConvert.shape[0],... | [
"0.6293965",
"0.6190868",
"0.5958037",
"0.59003407",
"0.57389235",
"0.5729437",
"0.56959486",
"0.56415576",
"0.56249183",
"0.5609247",
"0.56004065",
"0.55644566",
"0.5487326",
"0.5457773",
"0.533423",
"0.53078157",
"0.5302475",
"0.5301996",
"0.5301996",
"0.5301996",
"0.527979... | 0.7234557 | 0 |
Returns the (degrees, direction) of a scroll motion Qt event. | def get_scroll_info(event):
# 15 deg is standard 1-click turn for a wheel mouse
# TODO: use pixelDelta() for better handling on hi-res devices?
point = event.angleDelta()
dx, dy = point.x(), point.y()
delta = math.sqrt(dx ** 2 + dy ** 2)
if dy < 0:
delta = -delta
ang_rad = math.ata... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_scroll(self, event):\n scroll_y = Quartz.CGEventGetIntegerValueField(\n event, Quartz.kCGScrollWheelEventDeltaAxis1)\n scroll_x = Quartz.CGEventGetIntegerValueField(\n event, Quartz.kCGScrollWheelEventDeltaAxis2)\n return scroll_x, scroll_y",
... | [
"0.69850403",
"0.6932246",
"0.6611825",
"0.6334298",
"0.6149039",
"0.59107375",
"0.58700895",
"0.5862747",
"0.58468974",
"0.58053017",
"0.5765898",
"0.5735515",
"0.56846386",
"0.5560631",
"0.552354",
"0.5468894",
"0.54422885",
"0.5430647",
"0.5419952",
"0.54178554",
"0.539822... | 0.7687567 | 0 |
Sums passed in numbers returning the total, also update the global variable num_hundreds with the amount of times 100 fits in total | def sum_numbers(numbers: list) -> int:
global num_hundreds
total = sum(numbers)
num_hundreds += total // 100
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_numbers(numbers):\r\n return sum(numbers)",
"def total(num_list):\n num_sum = 0.0\n for item in num_list:\n num_sum += item\n return num_sum",
"def twenty():\r\n \r\n n = 100\r\n factorial = 1\r\n sum = 0\r\n \r\n while n > 0:\r\n factorial... | [
"0.69545",
"0.69212234",
"0.6792669",
"0.65813065",
"0.6560508",
"0.6560508",
"0.6557246",
"0.6541414",
"0.6519697",
"0.6496392",
"0.6472625",
"0.6392478",
"0.6331032",
"0.6302679",
"0.6302457",
"0.6279869",
"0.6248729",
"0.62144315",
"0.6175766",
"0.61494505",
"0.6112115",
... | 0.8789076 | 0 |
returns a boolean indicating if the dicts are different and a DeepDiff dictlike object that describes the differences. | def diff_dicts(dict_1, dict_2):
differ = deepdiff.DeepDiff(dict_1, dict_2)
return len(differ) > 0, differ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_dicts(dict1, dict2):\n\n if dict1 is None and dict2 is None:\n return True\n if dict1 is None or dict2 is None:\n return False\n\n both_equal = True\n for dict1_item, dict2_item in zip(dict1.items(), dict2.items()):\n if dict1_item != dict2_i... | [
"0.72355306",
"0.7119364",
"0.7114645",
"0.7026509",
"0.6965695",
"0.695171",
"0.6922021",
"0.68142796",
"0.6785463",
"0.6720722",
"0.668509",
"0.64790505",
"0.64742225",
"0.64544547",
"0.64464885",
"0.6422051",
"0.6301182",
"0.6220949",
"0.62192076",
"0.61874956",
"0.6184906... | 0.8325299 | 0 |
Add links, data = (plugin, url) tuple. Internal method should use API. | def addLinks(self, data, package):
self.db.addLinks(data, package, OWNER)
self.evm.dispatchEvent("packageUpdated", package) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_links(self, *args):\n for link in args:\n self.add_link(link)",
"def add_link(self, **kwgs):\n self.links.append(kwgs)",
"def add_link(self, link):\n raise NotImplementedError",
"def add_links(update: Update, context: CallbackContext):\n urls = update.message.parse_... | [
"0.6552505",
"0.6227947",
"0.6004044",
"0.5942437",
"0.58557445",
"0.5821289",
"0.58067364",
"0.5781467",
"0.5742814",
"0.55907834",
"0.5577512",
"0.555951",
"0.5526747",
"0.5506315",
"0.5470137",
"0.54616594",
"0.5458213",
"0.54565334",
"0.5452873",
"0.5421986",
"0.53969854"... | 0.638559 | 1 |
return a TreeCollection and fill the info data of containing packages. optional filter only unfnished files | def getTree(self, pid, full, state):
view = TreeCollection(pid)
# for depth=1, we don't need to retrieve all files/packages
root = pid if not full else None
packs = self.db.getAllPackages(root)
files = self.db.getAllFiles(package=root, state=state)
# updating from cach... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def packages(self):\n return []",
"def get_packages():\n\tapps=[]\n\tlspackages = glob.glob(u'/home/wpkg/packages/*.xml')\n\tfor fic in lspackages:\n #print fic\n\t\tif os.path.isfile(fic):\n\t\t\ttry:\n\t\t\t\txml = etree.parse(fic)\n\t\t\texcept:\n\t\t\t\t#si erreur on tente de corriger le fichie... | [
"0.58902115",
"0.5826688",
"0.57479423",
"0.5567829",
"0.55358243",
"0.5525156",
"0.5499356",
"0.54982823",
"0.545261",
"0.5416979",
"0.54130805",
"0.5380769",
"0.5362742",
"0.5331826",
"0.5313652",
"0.52960855",
"0.52937514",
"0.5289747",
"0.527761",
"0.5265145",
"0.5261934"... | 0.58814615 | 1 |
return number of downloads | def getDownloadCount(self):
if self.downloadcount == -1:
self.downloadcount = self.db.downloadcount()
return self.downloadcount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_download_count(self):\n downloads = self.driver.find_elements(*DownloadFileLocators.DOWNLOADS)\n return len(downloads)",
"def downloads(self):\n return self.proto.details.appDetails.numDownloads",
"def downloadsize(self):\n self.log.info(\"downloadsize\")\n keys = lis... | [
"0.8234746",
"0.7804121",
"0.75879425",
"0.75858355",
"0.7286933",
"0.72732425",
"0.7099034",
"0.7066958",
"0.6933806",
"0.6894024",
"0.68867105",
"0.6738019",
"0.66032743",
"0.65658665",
"0.6554842",
"0.654671",
"0.6507159",
"0.6505237",
"0.6485271",
"0.64587516",
"0.6414788... | 0.81090957 | 1 |
checks if package is finished and calls addonmanager | def checkPackageFinished(self, pyfile):
ids = self.db.getUnfinished(pyfile.packageid)
if not ids or (pyfile.id in ids and len(ids) == 1):
if not pyfile.package().setFinished:
self.core.log.info(_("Package finished: %s") % pyfile.package().name)
self.core.addo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_install_pkg(self, installable_pkg):\n pass",
"def on_finish(self):\n pass",
"def waitUntilFinished():",
"def waitUntilFinished():",
"def waitUntilFinished():",
"def waitUntilFinished():",
"def isFinished():",
"def isFinished():",
"def isFinished():",
"def finish():\n ... | [
"0.603424",
"0.60292125",
"0.6021975",
"0.6021975",
"0.6021975",
"0.6021975",
"0.5997729",
"0.5997729",
"0.5997729",
"0.58781594",
"0.5833941",
"0.5774004",
"0.5774004",
"0.5774004",
"0.5774004",
"0.5769067",
"0.57552546",
"0.5742528",
"0.57176185",
"0.57176185",
"0.57137483"... | 0.6977388 | 0 |
move all fids to pid | def moveFiles(self, fids, pid):
f = self.getFileInfo(fids[0])
if not f or f.package == pid:
return False
if not self.getPackageInfo(pid):
raise PackageDoesNotExists(pid)
# TODO move real files
self.db.moveFiles(f.package, fids, pid)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_pid(self,pid):\n self.pid=int(pid)",
"def set_pid(self, pid): # type: (int) -> None\n for i in range(len(self.__target_pids)):\n if self.__target_pids[i] == \"$$TBD\":\n self.__target_pids[i] = pid\n break",
"def _assignUIDs(self):\n for me... | [
"0.5629004",
"0.5444117",
"0.53581256",
"0.53278893",
"0.52729803",
"0.5204982",
"0.520262",
"0.51959324",
"0.502873",
"0.4988935",
"0.49727038",
"0.496559",
"0.49641278",
"0.49559668",
"0.4936873",
"0.4936873",
"0.4917239",
"0.48942253",
"0.48876598",
"0.4877353",
"0.4865668... | 0.5697748 | 0 |
restart all failed links | def restartFailed(self):
# failed should not be in cache anymore, so working on db is sufficient
self.db.restartFailed() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restart(self):\n pass",
"def restart(self):",
"def restart_all():\n\n restart_nginx()\n restart_supervisor()",
"def restart(self) -> None:",
"def restart(self):\n pass",
"def restart(self):\n\n #Kill processes\n print('Restarting scan...... \\n')\n self.kill(... | [
"0.6351152",
"0.62517476",
"0.62503207",
"0.6174372",
"0.6117254",
"0.610471",
"0.60902524",
"0.6044572",
"0.6029564",
"0.60230553",
"0.5998113",
"0.5895485",
"0.5887861",
"0.58733034",
"0.58672494",
"0.5839675",
"0.5809843",
"0.58095443",
"0.5773583",
"0.57719153",
"0.576199... | 0.65264475 | 0 |
reads the data from file and creates the Payment objects | def read_data():
data = open("database.txt", "r", encoding="UTF-8") # opening the file
for line in data: # iterating through the database.txt file
if line[0] == "#": # this is comment, so skip it
continue
else:
values = line.split(",") # split line into values
for i in range(len(values)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_payments_file(self, fname):\n f = open(fname, 'r')\n fields = \" \".join(f.readline().split())\n content = f.read()\n f.close()\n\n payment = namedtuple('payment', fields)\n payments = []\n split_content = re.split(r'\\s+(?=\\d{4}-\\d{2}-\\d{2}\\s+\\d{2}:\... | [
"0.65995437",
"0.61367077",
"0.6070969",
"0.60568655",
"0.60090584",
"0.60088986",
"0.5945839",
"0.59123427",
"0.59108436",
"0.58624715",
"0.58081853",
"0.58031344",
"0.5793678",
"0.5782173",
"0.57454497",
"0.5720871",
"0.5714996",
"0.5706418",
"0.57028025",
"0.56996584",
"0.... | 0.7037002 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.