query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return `true` when self and other are not equal, false otherwise. | def __ne__(self, other: 'NextHref') -> bool:
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return not self.__ne__(other)",
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)"... | [
"0.8608476",
"0.85141045",
"0.8458375",
"0.84514666",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
... | 0.0 | -1 |
Initialize a Origin object from a json dictionary. | def from_dict(cls, _dict: Dict) -> 'Origin':
args = {}
if 'name' in _dict:
args['name'] = _dict.get('name')
if 'description' in _dict:
args['description'] = _dict.get('description')
if 'address' in _dict:
args['address'] = _dict.get('address')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'OriginInput':\n args = {}\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'description' in _dict:\n args['description'] = _dict.get('description')\n if 'address' in _dict:\n args['address'] = _dict.get('a... | [
"0.78729266",
"0.64846957",
"0.6447405",
"0.6445011",
"0.6435004",
"0.6419723",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
"0.64027035",
... | 0.82001513 | 0 |
Initialize a Origin object from a json dictionary. | def _from_dict(cls, _dict):
return cls.from_dict(_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'Origin':\n args = {}\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'description' in _dict:\n args['description'] = _dict.get('description')\n if 'address' in _dict:\n args['address'] = _dict.get('addres... | [
"0.8201788",
"0.787433",
"0.6484733",
"0.64467126",
"0.6444324",
"0.6433164",
"0.64186275",
"0.63851696",
"0.6366264",
"0.6278728",
"0.62753093",
"0.62668496",
"0.6221284",
"0.6216425",
"0.6188599",
"0.6147552",
"0.61076057",
"0.6107118",
"0.60963356",
"0.60963356",
"0.609633... | 0.6402958 | 35 |
Return `true` when self and other are equal, false otherwise. | def __eq__(self, other: 'Origin') -> bool:
if not isinstance(other, self.__class__):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"de... | [
"0.8637504",
"0.8509938",
"0.8509938",
"0.8452069",
"0.8452069",
"0.833335",
"0.8319583",
"0.8300503",
"0.8300503",
"0.82743293",
"0.8272289",
"0.8259091",
"0.8255991",
"0.8246755",
"0.82411456",
"0.82053465",
"0.82053465",
"0.8190857",
"0.8183335",
"0.8158784",
"0.8140229",
... | 0.0 | -1 |
Return `true` when self and other are not equal, false otherwise. | def __ne__(self, other: 'Origin') -> bool:
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return not self.__ne__(other)",
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)"... | [
"0.8608476",
"0.85141045",
"0.8458375",
"0.84514666",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
... | 0.0 | -1 |
Initialize a OriginInput object from a json dictionary. | def from_dict(cls, _dict: Dict) -> 'OriginInput':
args = {}
if 'name' in _dict:
args['name'] = _dict.get('name')
if 'description' in _dict:
args['description'] = _dict.get('description')
if 'address' in _dict:
args['address'] = _dict.get('address')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'Origin':\n args = {}\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'description' in _dict:\n args['description'] = _dict.get('description')\n if 'address' in _dict:\n args['address'] = _dict.get('addres... | [
"0.7492837",
"0.62344563",
"0.61030567",
"0.6082084",
"0.59820443",
"0.5948343",
"0.59431297",
"0.5934368",
"0.5917385",
"0.5903763",
"0.5840349",
"0.58308357",
"0.58308357",
"0.58308357",
"0.58026826",
"0.5801092",
"0.5801092",
"0.5801092",
"0.5801092",
"0.5801092",
"0.58010... | 0.84532976 | 0 |
Initialize a OriginInput object from a json dictionary. | def _from_dict(cls, _dict):
return cls.from_dict(_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'OriginInput':\n args = {}\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'description' in _dict:\n args['description'] = _dict.get('description')\n if 'address' in _dict:\n args['address'] = _dict.get('a... | [
"0.84526724",
"0.7491267",
"0.62372255",
"0.61043245",
"0.6083069",
"0.5981827",
"0.5950301",
"0.5944827",
"0.5934777",
"0.59174633",
"0.59049195",
"0.5838582",
"0.583056",
"0.583056",
"0.583056",
"0.58007276",
"0.5779823",
"0.57599795",
"0.5756079",
"0.57220536",
"0.57218933... | 0.5800927 | 45 |
Return `true` when self and other are equal, false otherwise. | def __eq__(self, other: 'OriginInput') -> bool:
if not isinstance(other, self.__class__):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"de... | [
"0.8637504",
"0.8509938",
"0.8509938",
"0.8452069",
"0.8452069",
"0.833335",
"0.8319583",
"0.8300503",
"0.8300503",
"0.82743293",
"0.8272289",
"0.8259091",
"0.8255991",
"0.8246755",
"0.82411456",
"0.82053465",
"0.82053465",
"0.8190857",
"0.8183335",
"0.8158784",
"0.8140229",
... | 0.0 | -1 |
Return `true` when self and other are not equal, false otherwise. | def __ne__(self, other: 'OriginInput') -> bool:
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return not self.__ne__(other)",
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)"... | [
"0.8608476",
"0.85141045",
"0.8458375",
"0.84514666",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
... | 0.0 | -1 |
Initialize a Pool object. | def __init__(self,
*,
id: str = None,
name: str = None,
description: str = None,
enabled: bool = None,
healthy_origins_threshold: int = None,
origins: List['Origin'] = None,
monitor: s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pool_size: float = 10):\n self.pool_size = pool_size",
"async def init(self):\n self.init_connection_params()\n self._pool = await self._create_pool()\n\n return self",
"def _init_pool(self, cfg: dict):\n pool = PyMysqlPoolBase(**cfg)\n return pool",... | [
"0.7341924",
"0.7331522",
"0.72819024",
"0.7221522",
"0.7131578",
"0.70257014",
"0.70157033",
"0.69520664",
"0.6928283",
"0.6908183",
"0.69051003",
"0.6851333",
"0.6822573",
"0.6685633",
"0.6628527",
"0.65894544",
"0.657133",
"0.6482922",
"0.6476239",
"0.64746463",
"0.6435102... | 0.0 | -1 |
Initialize a Pool object from a json dictionary. | def from_dict(cls, _dict: Dict) -> 'Pool':
args = {}
if 'id' in _dict:
args['id'] = _dict.get('id')
if 'name' in _dict:
args['name'] = _dict.get('name')
if 'description' in _dict:
args['description'] = _dict.get('description')
if 'enabled' in _... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'LoadBalancerAzPoolsItem':\n args = {}\n if 'availability_zone' in _dict:\n args['availability_zone'] = _dict.get('availability_zone')\n if 'pools' in _dict:\n args['pools'] = _dict.get('pools')\n return cls(**args)",
"def from_... | [
"0.7036225",
"0.68654054",
"0.6622647",
"0.6581786",
"0.6494032",
"0.6483696",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
"0.6474449",
... | 0.7530066 | 0 |
Initialize a Pool object from a json dictionary. | def _from_dict(cls, _dict):
return cls.from_dict(_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, _dict: Dict) -> 'Pool':\n args = {}\n if 'id' in _dict:\n args['id'] = _dict.get('id')\n if 'name' in _dict:\n args['name'] = _dict.get('name')\n if 'description' in _dict:\n args['description'] = _dict.get('description')\n if '... | [
"0.75261796",
"0.70356274",
"0.68646854",
"0.662146",
"0.6582162",
"0.65002126",
"0.64875364",
"0.63630944",
"0.63162684",
"0.6300067",
"0.62613183",
"0.6233348",
"0.6231634",
"0.62246066",
"0.6182214",
"0.6133808",
"0.6112956",
"0.6111321",
"0.6094863",
"0.6092521",
"0.60917... | 0.64761645 | 41 |
Return a `str` version of this Pool object. | def __str__(self) -> str:
return json.dumps(self.to_dict(), indent=2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n\n return 'NodePool({}, {})'.format(self.name, self.genesis_txn_path)",
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n self.semaphore_lock.acquire()\n string_representation = \"\"\n for key, value in self.__dict.items():\n ... | [
"0.7687141",
"0.7426842",
"0.7334483",
"0.72329205",
"0.7217249",
"0.71821517",
"0.71821517",
"0.71821517",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
"0.71637183",
... | 0.0 | -1 |
Return `true` when self and other are equal, false otherwise. | def __eq__(self, other: 'Pool') -> bool:
if not isinstance(other, self.__class__):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"de... | [
"0.8637504",
"0.8509938",
"0.8509938",
"0.8452069",
"0.8452069",
"0.833335",
"0.8319583",
"0.8300503",
"0.8300503",
"0.82743293",
"0.8272289",
"0.8259091",
"0.8255991",
"0.8246755",
"0.82411456",
"0.82053465",
"0.82053465",
"0.8190857",
"0.8183335",
"0.8158784",
"0.8140229",
... | 0.0 | -1 |
Return `true` when self and other are not equal, false otherwise. | def __ne__(self, other: 'Pool') -> bool:
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return not self.__ne__(other)",
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)"... | [
"0.8608476",
"0.85141045",
"0.8458375",
"0.84514666",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
"0.8406577",
... | 0.0 | -1 |
Show details of the specified opinion TYPE. | def show_opinion_type(opinion_type):
click.echo(format_type(opinion_type)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opinion_type():\n pass",
"def show_type(type_):\n click.echo(format_type(type_))",
"def detail_type(self) -> str:\n return pulumi.get(self, \"detail_type\")",
"def opinion_show(opinion, time):\n\n click.echo(format_opinion(opinion, time))",
"def opinion_type_list():\n for type_ in or... | [
"0.6960005",
"0.6712954",
"0.62206167",
"0.6145516",
"0.6093734",
"0.57508165",
"0.5719246",
"0.57021236",
"0.5589874",
"0.5585225",
"0.55657893",
"0.55657893",
"0.55259836",
"0.54489404",
"0.54325956",
"0.54321915",
"0.5427692",
"0.5413673",
"0.5365936",
"0.5363672",
"0.5360... | 0.8204503 | 0 |
Algorithm specific sign() method | def sign(self) -> str:
raise NotImplementedError("Please implement algorithm specific sign() method") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(data):\n return _make.sign(data)",
"def sign(self, inputs):\n pass",
"def sign(self, inputs):\n pass",
"def sign(x):\n return(copysign(1, x))",
"def sign(self, msg):\n z = int.from_bytes(helper.hash256(msg), \"big\")\n k = self.deterministic_k(z)\n k_inv = ... | [
"0.7641326",
"0.745211",
"0.745211",
"0.7318082",
"0.7239542",
"0.72041506",
"0.680531",
"0.6783401",
"0.66706795",
"0.65849656",
"0.65552855",
"0.65509707",
"0.6512269",
"0.64879763",
"0.6461312",
"0.64372456",
"0.6431463",
"0.64183265",
"0.6413334",
"0.6360147",
"0.62929475... | 0.7642233 | 0 |
Yields all the hashes in the file store. | def ListHashes(token=None, age=aff4.NEWEST_TIME):
if age == aff4.ALL_TIMES:
raise ValueError("age==aff4.ALL_TIMES is not allowed.")
urns = []
for fingerprint_type, hash_types in HashFileStore.HASH_TYPES.iteritems():
for hash_type in hash_types:
urns.append(HashFileStore.PATH.Add(fingerp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_multiple_files(self, inputs):\n\n yield self.header\n for filename_or_bytestream in inputs: # Calculate digest(s) for each file\n digests = self.hash_file(filename_or_bytestream)\n if digests is not None:\n yield (filename_or_bytestream, *digests)",
"d... | [
"0.6963307",
"0.6877442",
"0.6682614",
"0.6479816",
"0.6296903",
"0.62667835",
"0.624731",
"0.61292756",
"0.60978186",
"0.60866535",
"0.59642863",
"0.59503365",
"0.5930769",
"0.5906599",
"0.58857065",
"0.5827093",
"0.5816434",
"0.58147204",
"0.57726675",
"0.57701206",
"0.5720... | 0.7087534 | 0 |
Converts a string to an array of strings of bytes | def string2bits(s=''):
return [bin(ord(x))[2:].zfill(8) for x in s] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_encoder(string: str) -> List[bytes]:\n return [w.encode(\"utf-8\") for w in string.split()]",
"def octet_string_to_bytearray(octet_string):\n ret = []\n for ch in octet_string:\n ret.append(ch)\n return bytearray(ret)",
"def hex_str_to_bytes_arr(bytes_str: str) -> List[int]:\n ... | [
"0.7502057",
"0.7347422",
"0.73058563",
"0.69757265",
"0.69757265",
"0.6955079",
"0.69345474",
"0.682459",
"0.67726964",
"0.6705258",
"0.66886014",
"0.667717",
"0.6662506",
"0.66199636",
"0.65155995",
"0.6465751",
"0.6459363",
"0.6459184",
"0.64569783",
"0.64385486",
"0.64330... | 0.60442495 | 46 |
Convert an array of strings of bytes to a single string | def bits2string(b=None):
return ''.join([chr(int(x, 2)) for x in b]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bytes_bytearray_to_str(s):\n if isinstance(s, (bytes, bytearray)):\n return s.decode()\n return s",
"def bit_array_to_string(array: Iterable) -> str:\n\n res = ''.join(\n [chr(int(y, 2)) for y in [''.join([str(x) for x in _bytes])\n for _by... | [
"0.7812002",
"0.7738147",
"0.7457398",
"0.72694564",
"0.6937712",
"0.69279003",
"0.6800924",
"0.6745115",
"0.6718312",
"0.6644689",
"0.66347396",
"0.6543537",
"0.6531852",
"0.6531611",
"0.6530692",
"0.6530692",
"0.6530692",
"0.64559",
"0.64220756",
"0.6394825",
"0.63497823",
... | 0.600905 | 31 |
Constructs a datetime from a tweet, or its tweet.created_at field. Twitter tweets have a created_at field. | def twitterTimestampToDatetime(str_or_tweet):
if isinstance(str_or_tweet, twitter.Status):
s = str_or_tweet.created_at
elif isinstance(str_or_tweet, str) or isinstance(str_or_tweet, unicode):
s = str_or_tweet
else:
raise ValueError("twitterTimestampToDatetime requires a str/unicode o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_timestamp(tweet):\n\n if 'timestamp_ms' in tweet:\n timestamp_ms = int(tweet[\"timestamp_ms\"])\n timestamp_ms = timestamp_ms - timestamp_ms % 1000\n return timestamp_ms / 1000.\n elif 'created_at' in tweet:\n return parse(tweet['created_at']).timestamp()\n\n raise ... | [
"0.6893835",
"0.67704004",
"0.6758503",
"0.6681112",
"0.6438697",
"0.6270988",
"0.6251579",
"0.62422824",
"0.61945045",
"0.61710525",
"0.57497275",
"0.5743262",
"0.57376873",
"0.56649554",
"0.56487507",
"0.56226325",
"0.5592055",
"0.55380636",
"0.55308735",
"0.55034256",
"0.5... | 0.71839064 | 0 |
Get the current configuration. | def get(self) -> dict:
return Config.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def config(self):\n return self[CONFIG_KEY]",
"def getConfig(self):\n \n return self.config",
"def config(self):\r\n return self._config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return s... | [
"0.87317115",
"0.85202163",
"0.8438287",
"0.8390375",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
"0.8383969",
... | 0.8072712 | 90 |
Get a dashboard configuration by name. | def get_dashboard(self, name: str) -> str:
return Config.get_dashboard(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, name):\n return self.configs[name][0]",
"def get_config(name: str):\n conf_file = Path(__file__).parent.joinpath(\"configs\").joinpath(name)\n return console.read_config(conf_file)",
"def get_config_by_name(name):\r\n attrs = get_config_attributes(name)\r\n if attrs['onl... | [
"0.7299341",
"0.7014622",
"0.6980252",
"0.68524355",
"0.6705417",
"0.66919965",
"0.66209507",
"0.65608454",
"0.6537401",
"0.6518166",
"0.64041704",
"0.63599247",
"0.62949127",
"0.62789005",
"0.62665945",
"0.62115633",
"0.6156589",
"0.6156396",
"0.61290574",
"0.6039831",
"0.60... | 0.8013054 | 0 |
Homepage deve usar o template inicio.html. | def test_template(self):
self.assertTemplateUsed(self.resp, 'inicio.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home():\n\n\treturn render_template('solai.html')",
"def inicio(request):\r\n assert isinstance(request, HttpRequest)\r\n return render(\r\n request,\r\n 'app/index.html',\r\n context_instance=RequestContext(re... | [
"0.80901086",
"0.7988803",
"0.7703682",
"0.7682105",
"0.7642562",
"0.7619628",
"0.75865245",
"0.7578859",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
"0.7576797",
... | 0.0 | -1 |
Homepage deve usar o template cadastro.html. | def test_template(self):
self.assertTemplateUsed(self.resp, 'cadastro.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s_contato(request):\r\n assert isinstance(request, HttpRequest)\r\n return render(\r\n request,\r\n 'app/site/s_contato.html',\r\n context_instance=RequestContext(request,\r\n {\r\n 'title': 'Colmeia | ... | [
"0.71641845",
"0.68594533",
"0.6836325",
"0.6747013",
"0.67384344",
"0.67374516",
"0.6668674",
"0.66612756",
"0.6634707",
"0.6590275",
"0.65457207",
"0.65457207",
"0.6415779",
"0.6382483",
"0.635466",
"0.6354201",
"0.6337145",
"0.63217753",
"0.6311396",
"0.62854916",
"0.62783... | 0.6103962 | 37 |
Return the node UCB value of the MAX player. Concrete classes must implement this method. | def calculate_ucb_max(self, node):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u_max(self):\n if self._u_max is None:\n return self.uv_max\n else:\n return self._u_max",
"def get_max(self):\n\t\tif self.right:\n\t\t\treturn self.right.get_max()\n\t\treturn self.value",
"def native_max_value(self) -> float:\n return TEMP_MAXIMUM",
"def _max... | [
"0.7108059",
"0.65479255",
"0.6511392",
"0.64143884",
"0.63735986",
"0.63190943",
"0.6291851",
"0.62656707",
"0.6247715",
"0.6236738",
"0.62190586",
"0.6208553",
"0.6201444",
"0.6192134",
"0.6190994",
"0.61814797",
"0.6181042",
"0.61786634",
"0.617753",
"0.61745816",
"0.61745... | 0.77771825 | 0 |
Return the node UCB value of the MIN player. Concrete classes must implement this method. | def calculate_ucb_min(self, node):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def native_min_value(self) -> float:\n return TEMP_MINIMUM",
"def _get_minimum_value(self):\n if hasattr(self, '_minimum_value'):\n return self._minimum_value\n return None",
"def _minimum(self) -> float:\n if self._type == \"power\":\n return 1.0\n elif... | [
"0.6676323",
"0.65341765",
"0.65289056",
"0.65114486",
"0.6476541",
"0.6454943",
"0.64415383",
"0.64228827",
"0.63799095",
"0.6378416",
"0.63754123",
"0.63714045",
"0.6364213",
"0.6344471",
"0.6330319",
"0.6330319",
"0.62932175",
"0.62857443",
"0.6285217",
"0.62167245",
"0.61... | 0.74823827 | 0 |
Return the number of nodes in the tree starting from self.root. Currently works only when node == self.root. | def get_tree_size(self, node):
# If the tree has not been created yet.
if node == None:
return 0
n_nodes = 1
for child in node.children:
n_nodes += self.get_tree_size(node.children[child])
return n_nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_count(self):\n return self._root.count()",
"def count_nodes(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n if self.get_left():\n if self.get_right():\n return 1 + self.get_... | [
"0.8329587",
"0.82403165",
"0.81393576",
"0.8138181",
"0.7993864",
"0.7944361",
"0.782431",
"0.7765088",
"0.77538776",
"0.7714754",
"0.7678273",
"0.7649894",
"0.7593012",
"0.75899917",
"0.7589955",
"0.75735676",
"0.75304973",
"0.7470044",
"0.7415282",
"0.7413205",
"0.74076104... | 0.8177388 | 2 |
Propagate the game value all the way up the tree to the root. | def backpropagate(self, search_path, value):
for node in search_path:
node.n_visits += 1
node.n_a[node.action_taken] += 1
# Incremental mean calculation
node.q_a[node.action_taken] = (node.q_a[node.action_taken] *
(no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backpropagate(self, child, score):\n current = child\n while current:\n # 1) update current nodes win counter and sim counter\n # print(\"Node before:\")\n # print(current)\n # print(current.n_won)\n # print(current.ucb)\n current.... | [
"0.62031883",
"0.61532485",
"0.6085839",
"0.60832024",
"0.602925",
"0.60221714",
"0.59616584",
"0.5889199",
"0.5889199",
"0.5889199",
"0.58578515",
"0.5753529",
"0.5727591",
"0.5720577",
"0.57120204",
"0.567184",
"0.56643385",
"0.5649767",
"0.56343937",
"0.5633206",
"0.562238... | 0.5245401 | 85 |
Return the child Node with the highest UCB score. | def select_child(self, node):
ucb_values = []
for action, child in node.children.items():
if node.state.player_turn == 1:
if child.n_visits == 0:
ucb_max = float('inf')
else:
ucb_max = self.calculate_ucb_max(node, actio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_child(self, parent):\n child_games = [parent.forecast_move(m) for m in parent.get_legal_moves()]\n scores = [(self.ucb1(child, parent), child) for child in child_games]\n _, best = max(scores, key=lambda x: x[0])\n return best",
"def most_visited_child(self):\n return max(... | [
"0.71733606",
"0.71547556",
"0.7049318",
"0.7035555",
"0.69925034",
"0.69012904",
"0.6842827",
"0.68410754",
"0.6818569",
"0.6766905",
"0.6743907",
"0.6701981",
"0.66341907",
"0.6610672",
"0.6594898",
"0.65827155",
"0.65827155",
"0.65827155",
"0.65827155",
"0.6576569",
"0.649... | 0.6973639 | 5 |
Get the value of the indexth node in the linked list. If the index is invalid, return 1. | def item_at_index(self, index):
if index < 0 or index >= self.size:
return -1
if self.head is None:
return -1
curr = self.head
for i in range(index):
curr = curr.next
return curr.val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n r... | [
"0.8309643",
"0.82229614",
"0.8100885",
"0.7982059",
"0.7971532",
"0.7967203",
"0.7952165",
"0.79494095",
"0.7927902",
"0.790503",
"0.7735397",
"0.7732235",
"0.7651315",
"0.7584351",
"0.7507072",
"0.7473953",
"0.7454898",
"0.7388481",
"0.7388481",
"0.73843974",
"0.7336283",
... | 0.77995473 | 10 |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. | def addAtHead(self, val):
node = Node(val)
node.next = self.head
self.head = node
self.size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node",
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ... | [
"0.78888327",
"0.78128237",
"0.77156687",
"0.76672965",
"0.7632993",
"0.75963074",
"0.7586912",
"0.75706255",
"0.7502218",
"0.74938524",
"0.7477616",
"0.74631184",
"0.7429465",
"0.7405691",
"0.73827714",
"0.728465",
"0.72477174",
"0.72355413",
"0.71701944",
"0.71425265",
"0.7... | 0.73492926 | 15 |
Append a node of value val to the last element of the linked list. | def addAtTail(self, val):
curr = self.head
if curr is None:
self.head = Node(val)
else:
while curr.next is not None:
curr = curr.next
curr.next = Node(val)
self.size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node",
"def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ... | [
"0.80121386",
"0.79795235",
"0.7893152",
"0.78559566",
"0.7783268",
"0.77445775",
"0.7737258",
"0.7721552",
"0.769086",
"0.7632184",
"0.76267946",
"0.7549883",
"0.7530906",
"0.7523129",
"0.7448593",
"0.7416308",
"0.73188025",
"0.7240051",
"0.72215813",
"0.7216466",
"0.7214423... | 0.7879479 | 3 |
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. | def addAtIndex(self, index, val):
if index < 0 or index > self.size:
return
if index == 0:
self.addAtHead(val)
else:
curr = self.head
for i in range(index - 1):
curr = curr.next
node = Node(val)
node.next = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ... | [
"0.80058235",
"0.7905295",
"0.7842",
"0.78016585",
"0.77571636",
"0.7742864",
"0.7742677",
"0.77302635",
"0.7709267",
"0.7618808",
"0.7596944",
"0.7502421",
"0.72808725",
"0.72095805",
"0.7154297",
"0.7089389",
"0.7024109",
"0.70222694",
"0.70174867",
"0.6929566",
"0.6921748"... | 0.7613046 | 11 |
Get item at index | def get_item(self,index):
current = self.head
count = 0
while current != None and count <= index:
count+=1
current =current.get_next()
if count!=index:
print('Index out of bound') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(self, index: int) -> _T:\n return self.index_to_item[index]",
"def __getitem__(self, index):\r\n return self._items[index]",
"def __getitem__(self, index):\n item = self.data[index]\n return item",
"def get_by_index(self, index):\n if index > self.length - 1:\n... | [
"0.88176966",
"0.8632663",
"0.85930496",
"0.8575071",
"0.8395208",
"0.82754534",
"0.8251214",
"0.82357895",
"0.8188821",
"0.81231475",
"0.8075846",
"0.8075846",
"0.8046541",
"0.80415237",
"0.80403894",
"0.80403894",
"0.80382705",
"0.8030636",
"0.80136895",
"0.800425",
"0.7994... | 0.0 | -1 |
Pad 'text' to a field of 'width' characters. 'width' The desired size of the padded field. If negative, the text is leftjustified in the field; if positive, the text is rightjustified. 'pad_character' The character to use for padding. returns The padded text. If the lenght of 'text' is greater than 'width', returns 'te... | def pad(text, width, pad_character=" "):
length = len(text)
if width < 0 and length < -width:
return text + (-width - length) * pad_character
elif width > 0 and length < width:
return (width - length) * pad_character + text
else:
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(text, indentation, width=None, pad_character=\" \"):\n\n text = pad_character * indentation + text\n length = len(text)\n if width is None or length >= width:\n return text\n else:\n return text + pad_character * (width - length)",
"def filter_pad(val: Union[int, str], width:... | [
"0.73672",
"0.69758177",
"0.6773482",
"0.66746384",
"0.6658907",
"0.6645794",
"0.65436596",
"0.64727163",
"0.640489",
"0.6388406",
"0.63417226",
"0.63271517",
"0.61964184",
"0.6097558",
"0.60860455",
"0.6067889",
"0.60080135",
"0.5966845",
"0.59627557",
"0.59535027",
"0.59106... | 0.84780675 | 0 |
Indent 'text', and optionally rightpad it to 'width'. | def indent(text, indentation, width=None, pad_character=" "):
text = pad_character * indentation + text
length = len(text)
if width is None or length >= width:
return text
else:
return text + pad_character * (width - length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap(self, text, width=None, indent=None):\n width = width if width is not None else self.options.wrap_length\n indent = indent if indent is not None else self.indentation\n initial_indent = self.initial_indentation\n return textwrap.fill(text, width=width,\n ... | [
"0.70861727",
"0.695022",
"0.6562256",
"0.65464526",
"0.65004104",
"0.6451238",
"0.64111316",
"0.63845176",
"0.6379408",
"0.6309006",
"0.62880933",
"0.6272893",
"0.6271202",
"0.6270615",
"0.6254904",
"0.6184065",
"0.6181825",
"0.61693573",
"0.6153997",
"0.61067307",
"0.608407... | 0.78836167 | 0 |
Function for filtering on the keys of the json entry | def filter_keys(self):
filters = self.args.keyfilter.split('.')
self.logger.info(u'Filtering with:{f}'.format(f=filters))
data = self.inputdata
newdata = {}
for key, value in data.items():
self.logger.info(u'\nProcessing Key:{k}'.format(k=key))
returned_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_keys(data, keys=[]):\n # filter key\n for filter_key in keys:\n if filter_key in data:\n del data[filter_key]\n\n # filter sub dictionaries\n for _, value in data.items():\n if type(value) == dict:\n filter_keys(value, keys)",
"def filter(self, filter_di... | [
"0.6647548",
"0.6424631",
"0.6351514",
"0.6291446",
"0.6289006",
"0.6213832",
"0.6208831",
"0.6192454",
"0.6155603",
"0.61439663",
"0.6101747",
"0.60838264",
"0.6080104",
"0.6055826",
"0.60447377",
"0.59892017",
"0.5954835",
"0.5948756",
"0.59357005",
"0.59107804",
"0.5893024... | 0.6508449 | 1 |
Returns a function that maps each index in 0, 1, ..., n1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name. | def get_cmap(n):
cmap_fn = plt.cm.get_cmap('hsv', n+1)
colors = [cmap_fn(i + 1)[:3] for i in range(n)]
random.shuffle(colors)
cmap = (np.array(colors) * 255.0).astype(np.uint8)
return cmap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name=\"hsv\"... | [
"0.7027014",
"0.69774944",
"0.69774944",
"0.6945795",
"0.69294786",
"0.69294786",
"0.69294786",
"0.6721123",
"0.65807897",
"0.6511925",
"0.6428395",
"0.63602495",
"0.6328437",
"0.6288466",
"0.6182749",
"0.6114085",
"0.6093694",
"0.60440433",
"0.60209644",
"0.5991577",
"0.5960... | 0.6140903 | 15 |
Returns the genes that are shared. Matching genes are genes that each of P1 and P2 have. Note that, like get_disjoint and get_excess, this returns P1's version of these genes. P1 G1 G2 D3 G5 E7 P2 G1 G2 D4 G5 E6 returns [G1, G2, G4] | def get_matching_genes(self, other):
innovs = {g.innov_num for g in other.link_genes}
if not innovs:
return []
max_innov = max(innovs)
return [g for g in self.link_genes
if g.innov_num in innovs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genes_GT():\n df1=pd.read_csv(config['geneInfo'], sep=\" \")\n df1=df1[df1.chr == '22']\n df2=pd.read_csv(config['counts'], sep=\" \")\n genes=df1.merge(df2.gene_id, on=\"gene_id\")\n return list(set(genes['gene_id']))",
"def genes_with_multiple_mutants(self):\n # the empty-set argument... | [
"0.6014585",
"0.59329313",
"0.5806732",
"0.56952405",
"0.5608269",
"0.55895203",
"0.55309016",
"0.55045974",
"0.5468424",
"0.54433864",
"0.5442318",
"0.5431144",
"0.541564",
"0.540211",
"0.53534603",
"0.5327246",
"0.53259",
"0.5314385",
"0.5265831",
"0.52641255",
"0.5228788",... | 0.6078165 | 0 |
Returns the acvtivation values of the output nodes. These are computed by passing a signal through the network until all output nodes are active. If after max_iter iterations, the output nodes remain off, an array of nans is returned instead. Additionally, we reactivate the input nodes at each time step. | def activate(self, inputs, max_iters=10, verbose=False):
# Node activation values
self.node_vals = np.zeros(self.A.shape[0])
# Bool to check if node was activated in the current time step
self.active_nodes = np.zeros((self.A.shape[0]), dtype=bool)
# Label inputs and bias as act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self):\n # print \"Neuron output\"\n\n if self.output_cache is not None:\n # print self, \"returning from cache\"\n return self.output_cache\n\n self.inputs_cache = []\n\n sum = 0\n for input_edge in self.inputs:\n input = input_edge.fr... | [
"0.64673394",
"0.6213756",
"0.599832",
"0.5973064",
"0.5943639",
"0.5941397",
"0.58750725",
"0.5854153",
"0.58127725",
"0.5769044",
"0.5729497",
"0.5711202",
"0.5709687",
"0.5709687",
"0.56758046",
"0.557619",
"0.5567527",
"0.5563911",
"0.5563876",
"0.55567914",
"0.5550456",
... | 0.69452536 | 0 |
Tests that numUnreadMessagesForConversationAndUser returns the correct number of unread messages for each user | def testNumUnreadMessagesForConversationAndUser(self):
# The initial conversation should have one unread message
expected = 1
actual = gciconversation_logic.numUnreadMessagesForConversationAndUser(
conversation=self.conv_a.key, user=self.user_keys[0])
self.assertEqual(expected, actual)
# A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNumUnreadMessagesForProgramAndUser(self):\n\n # Add three new messages to the first conversation, each one minute apart,\n # starting one minute after the last message.\n for x in range(3):\n self.conv_utils.addMessage(\n conversation=self.conv_a.key,\n time=(self.conv_a.las... | [
"0.8165451",
"0.7723656",
"0.73923934",
"0.7176974",
"0.7117529",
"0.70110494",
"0.69406146",
"0.6834623",
"0.6672684",
"0.66243696",
"0.6565314",
"0.64731973",
"0.6400917",
"0.6350246",
"0.6289794",
"0.6281149",
"0.6265751",
"0.6227628",
"0.6199173",
"0.61848575",
"0.6133091... | 0.81958765 | 0 |
Tests that markAllReadForConversationAndUser correctly marks the conversation as read. | def testMarkAllReadForConversationAndUser(self):
# Add three new messages to the first conversation, each one minute apart,
# starting one minute after the last message.
for x in range(3):
self.conv_utils.addMessage(
conversation=self.conv_a.key,
time=(self.conv_a.last_message_on ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_all(self):\n self.assertEqual(self.category.categoryread_set.count(), 0)\n\n response = self.client.post(self.category.get_read_api_url())\n self.assertEqual(response.status_code, 200)\n\n self.category.categoryread_set.get(user=self.user)\n\n # user was resynced\n ... | [
"0.7234034",
"0.6936133",
"0.6863",
"0.67241687",
"0.6685591",
"0.66184235",
"0.6566422",
"0.6531079",
"0.647217",
"0.6457645",
"0.63731444",
"0.6369989",
"0.6332776",
"0.63083297",
"0.62935096",
"0.6235122",
"0.62330025",
"0.62008125",
"0.6196548",
"0.615557",
"0.61366624",
... | 0.8474052 | 0 |
Tests that refreshConversationsForUser correctly adds a user to all conversations they should be in but aren't, and removes them from conversations they shouldn't be in. | def testRefreshConversationsForUser(self):
self.conv_a.key.delete()
self.conv_b.key.delete()
# Create a couple dummy organizations
org_keys = map(
lambda org: ndb.Key.from_old_key(org.key()),
(program_utils.seedOldOrganization(self.conv_utils.program_key)
for _ in range(2))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testRefreshConversationParticipants(self):\n\n # Create a couple dummy organizations\n org_keys = map(\n lambda org: ndb.Key.from_old_key(org.key()),\n (program_utils.seedOldOrganization(self.conv_utils.program_key)\n for _ in range(2)))\n\n # Create dummy admins, mentors, and... | [
"0.6899015",
"0.66310316",
"0.6208834",
"0.6136542",
"0.6019508",
"0.5892705",
"0.57989347",
"0.576658",
"0.57004595",
"0.5644548",
"0.5463138",
"0.542041",
"0.54017144",
"0.5269997",
"0.52644944",
"0.52514863",
"0.52440995",
"0.5222994",
"0.52131635",
"0.51684254",
"0.515911... | 0.7459773 | 0 |
Show an image of suggested initial responsibility. | def show(self, **kwargs):
n = self.guess.shape[0]
cmap_name = 'tab20' if n > 10 else 'tab10'
clrs = ((1., 1., 1.),) + get_cmap(cmap_name).colors
cmap = ListedColormap(np.delete(clrs, slice(n+1, None), axis=0))
self.image = self.__make_image()
plt.imshow(self.image, cmap =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_image(self, image_set='train', index=None, interactive_mode=True):\n if interactive_mode:\n plt.ion()\n else:\n plt.ioff()\n\n if image_set == 'train':\n target = self.train_dataset\n else:\n target = self.test_dataset\n\n if i... | [
"0.6228945",
"0.5994611",
"0.5884426",
"0.57815284",
"0.5772592",
"0.5718857",
"0.57081413",
"0.56981945",
"0.56708395",
"0.56674",
"0.5660341",
"0.56518644",
"0.5608896",
"0.5604644",
"0.5601204",
"0.5594708",
"0.55775076",
"0.55757964",
"0.5568624",
"0.5565692",
"0.55630094... | 0.0 | -1 |
Validate that the dockercompose commands are executed with the valid paramters. Since the dockercompose file was dynamically generated, we must pass the full path of that file to dockercompose command. Also, set the context of the execution to the current path. | def test_build_artifacts_invokes_docker_commands(mocker):
tmp_filename = '/var/folders/xw/yk2rrhks1w72y0zr_7t7b851qlt8b3/T/tmp52bd77s3'
mock_builder = mocker.patch('juniper.actions.build_compose', return_value=tmp_filename)
# Mocking the dependencies of this action. These three high level packages are
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check(self) -> bool:\n path, base_path = self.list_path[-1]\n if \"override\" in path:\n return True\n command = \"cd {} && docker-compose config\".format(\n os.path.dirname(get_path(path, base_path))\n )\n ret = console.run(command, get_stdout=False, s... | [
"0.62067336",
"0.61402744",
"0.6136988",
"0.6079695",
"0.59925497",
"0.56440425",
"0.5363111",
"0.5340375",
"0.53103185",
"0.5131731",
"0.51276255",
"0.512033",
"0.5098452",
"0.5078052",
"0.50442064",
"0.5041865",
"0.5025615",
"0.5016463",
"0.4982905",
"0.49598867",
"0.493825... | 0.47779563 | 34 |
Get the odometr miles of the car. | def read_odometer(self):
msg = f"Car has {self.odometer_reading} miles on it."
return msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_miles(self):\n return self._distance_miles",
"def test_get_miles(self):\n miles = location_util.vincenty(COORDINATES_PARIS,\n COORDINATES_NEW_YORK,\n miles=True)\n self.assertEqual(round(miles, 2), DISTA... | [
"0.71298575",
"0.6994882",
"0.6810046",
"0.6549336",
"0.65260476",
"0.63570243",
"0.63246614",
"0.6167621",
"0.61546373",
"0.61390555",
"0.6066335",
"0.6037725",
"0.5987233",
"0.585233",
"0.58272105",
"0.58259255",
"0.5787262",
"0.57649815",
"0.5763807",
"0.575002",
"0.570236... | 0.5414917 | 51 |
Converts a key and an array of values into AWS query param format. | def _pathlist(self, key, arr):
params = {}
i = 0
for value in arr:
i += 1
params["%s.%s" % (key, i)] = value
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch_params(sql_params, key, value):\n if not isinstance(value, list):\n sql_params[key] = value\n else:\n for i, elem in enumerate(value):\n sql_params[key + str(i)] = elem\n return sql_params",
"def _set_query_params(query, key, value):\n ... | [
"0.670511",
"0.66083956",
"0.6556347",
"0.6202431",
"0.6040294",
"0.6026184",
"0.5998777",
"0.59762955",
"0.5973938",
"0.5971705",
"0.5962218",
"0.5901684",
"0.5882507",
"0.58702874",
"0.5854979",
"0.58398294",
"0.576171",
"0.57579744",
"0.57372785",
"0.5722913",
"0.5703433",... | 0.5579041 | 32 |
Return a dictionary of tags for this instance. | def ex_describe_tags(self, node):
params = { 'Action': 'DescribeTags',
'Filter.0.Name': 'resource-id',
'Filter.0.Value.0': node.id,
'Filter.1.Name': 'resource-type',
'Filter.1.Value.0': 'instance',
}
result =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> dict:\n return self._tags",
"def get_tags(self) -> Dict:\n return self.orthanc.get_instance_tags(self.identifier)",
"def tags(self) -> dict:\n\n return self._tags or None # store trivial tags as empty (for iteration), return as None",
"def tags(self) -> Dict:\n ... | [
"0.89697033",
"0.8921453",
"0.8590969",
"0.85803294",
"0.83769065",
"0.835328",
"0.835328",
"0.8262658",
"0.8221088",
"0.8221088",
"0.8221088",
"0.8221088",
"0.8122034",
"0.80323696",
"0.80323696",
"0.80323696",
"0.80323696",
"0.80323696",
"0.80323696",
"0.80323696",
"0.80323... | 0.0 | -1 |
Compute the Root Sum of Squares (RSS) transform along a given dimension of a tensor. | def root_sum_of_squares(data, dim=0):
return torch.sqrt((data ** 2).sum(dim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scipy_ss(a, axis=0):\n a, axis = _chk_asarray(a, axis)\n\n if 'int' in str(a.dtype):\n a = a.astype('int64')\n return np.sum(a*a, axis)",
"def sqrt(tensor):\n raise NotImplementedError",
"def sum(tensor, axis=None):\n raise NotImplementedError",
"def reduce_std(tensor, axis=... | [
"0.581068",
"0.57225794",
"0.5708477",
"0.5628056",
"0.5626165",
"0.5597852",
"0.5593604",
"0.5366592",
"0.5363842",
"0.5352245",
"0.5309728",
"0.5233604",
"0.5217101",
"0.52025735",
"0.5130254",
"0.5116965",
"0.5084437",
"0.5046575",
"0.5029602",
"0.5019464",
"0.5011764",
... | 0.5851656 | 1 |
Apply a center crop to the input real image or batch of real images. | def center_crop(data, shape):
assert 0 < shape[0] <= data.shape[-2]
assert 0 < shape[1] <= data.shape[-1]
w_from = (data.shape[-2] - shape[0]) // 2
h_from = (data.shape[-1] - shape[1]) // 2
w_to = w_from + shape[0]
h_to = h_from + shape[1]
return data[..., w_from:w_to, h_from:h_to] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop_center_img(self):\n # TODO Task 1.1\n img = self.data\n img_with_missing_crop = np.copy(img)\n dim =128\n crop = dim // 2\n start = crop - (crop // 2)\n #ground truth overlaps img_with_missing_crop by 7 pixels in all directions\n img_with_missing_cro... | [
"0.7632245",
"0.7590638",
"0.7166542",
"0.7009025",
"0.7006848",
"0.69468933",
"0.69301003",
"0.68622965",
"0.6797125",
"0.6779455",
"0.67451215",
"0.673643",
"0.6732417",
"0.6731435",
"0.66996336",
"0.66549",
"0.664806",
"0.6590628",
"0.65809447",
"0.6564683",
"0.6561922",
... | 0.6490208 | 23 |
Apply a center crop to the input image or batch of complex images. | def complex_center_crop(data, shape):
assert 0 < shape[0] <= data.shape[-3]
assert 0 < shape[1] <= data.shape[-2]
w_from = (data.shape[-3] - shape[0]) // 2
h_from = (data.shape[-2] - shape[1]) // 2
w_to = w_from + shape[0]
h_to = h_from + shape[1]
return data[..., w_from:w_to, h_from:h_to, :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cropping_center(x, crop_shape, batch=False):\n orig_shape = x.shape\n if not batch:\n h0 = int((orig_shape[0] - crop_shape[0]) * 0.5)\n w0 = int((orig_shape[1] - crop_shape[1]) * 0.5)\n x = x[h0 : h0 + crop_shape[0], w0 : w0 + crop_shape[1]]\n else:\n h0 = int((orig_shape[1... | [
"0.756308",
"0.7461502",
"0.71137637",
"0.7078431",
"0.70657444",
"0.7048104",
"0.6980998",
"0.6964684",
"0.6934136",
"0.6930183",
"0.68883646",
"0.6869697",
"0.68564737",
"0.68216395",
"0.68198633",
"0.67062503",
"0.6632218",
"0.6604609",
"0.65723586",
"0.65723586",
"0.65606... | 0.6727223 | 16 |
Returns the reward for the given action and observation. | def get_reward_dict(self,
action: np.ndarray,
obs_dict: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:
# TODO: Check if the goal index is satisfied.
if not self._idx_completion:
if self.goal_idx == 0:
if self.current_idx == 2 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_reward(self, action):\n HIRE_COST = 1 # TODO 7/29/20 - Determine significance of this value\n\n # Lookup the state representation using the cur_state index. Then we\n # can get the candidate productivity score.\n obs = self.observation_function[self.cur_state]\n prod_sc... | [
"0.7533448",
"0.74208605",
"0.73254144",
"0.73105955",
"0.72739947",
"0.72213364",
"0.71720135",
"0.71208405",
"0.70812225",
"0.70812225",
"0.70812225",
"0.69488806",
"0.6940732",
"0.6933153",
"0.68504405",
"0.68037796",
"0.67748386",
"0.67460334",
"0.6745014",
"0.6728301",
"... | 0.69682133 | 11 |
Transform coord into a compatible tuple of floats. | def _coord_to_tuple(self, coord):
if isinstance(coord, str):
return tuple(float(k) for k in coord[1:-1].split(', '))
else:
assert len(coord) == 2
return coord | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tuple(self) -> Tuple[float, float]:\n return (self.latitude, self.longitude)",
"def _fs (v):\r\n try : \r\n v = float(v)\r\n except : \r\n v = tuple([float (ss) for ss in \r\n v.replace('(', '').replace(')', '').split(',')])\r... | [
"0.6943822",
"0.6644619",
"0.6455465",
"0.63934773",
"0.63312197",
"0.62181616",
"0.6132358",
"0.61013025",
"0.6063929",
"0.60162735",
"0.59868723",
"0.5985579",
"0.5969712",
"0.5956383",
"0.59424263",
"0.59060574",
"0.58640856",
"0.58572465",
"0.58092916",
"0.5806862",
"0.57... | 0.7993372 | 0 |
Get the plural of the given word. Contains a dictionary for nonstandard plural forms. If the word ends in one of 5 known endings, appends an 'es' to the end. By default, just appends an 's' to the given word. | def pluralized(word):
defined_plurals = {
"person": "people"
}
if word in defined_plurals:
return defined_plurals[word]
es_endings = ["s", "sh", "ch", "x", "z"]
if any([word.endswith(ending) for ending in es_endings]):
return f"{word}es"
else:
return f"{word}s" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralize(word):\n\n assert word\n assert isinstance(word, basestring)\n assert len(word) > 0\n\n second_last = word[-2]\n last = word[-1]\n if last in ['s', 'z','x']:\n return word + \"es\"\n elif last == 'h':\n if second_last in ['s', 'c']:\n return word + \"es\"... | [
"0.81050915",
"0.75866413",
"0.72766984",
"0.6663193",
"0.62721395",
"0.6256475",
"0.6248089",
"0.61378443",
"0.5993855",
"0.5933461",
"0.58854115",
"0.58740777",
"0.58355075",
"0.57656765",
"0.57498425",
"0.56952584",
"0.5630151",
"0.5582441",
"0.55640423",
"0.55414724",
"0.... | 0.79146755 | 1 |
MagnetPolarity in ('mu', 'md') | def __init__(self, input_file=None,**argd):
VariousOptions.__init__(self, input_file=input_file, isMC=True, isPrescaled=False, **argd)
self.decNumber = decNumbers.get(self.name[:-3], 0)
if not self.input_file:
self.input_file = 'inputFiles/MC/MC_{dataType}_{decNumber}_Beam4000GeV{dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mortality(self):\n pass",
"def tonality(self, mdct_norm):\n return self.psychoacoustic.tonality(mdct_norm)",
"def predictType(self):\n return 'Music' if self.name.startswith('mu') else 'Speech'",
"def _polarity(waveform):\n return waveform * -1",
"def default_is_radian(self):\r\n ... | [
"0.5668454",
"0.5614066",
"0.53911555",
"0.5324809",
"0.5300105",
"0.51552814",
"0.5060264",
"0.50536126",
"0.50381106",
"0.5029966",
"0.50083137",
"0.49865025",
"0.49823445",
"0.49189234",
"0.48718905",
"0.48533565",
"0.4827354",
"0.48214293",
"0.4818645",
"0.48055732",
"0.4... | 0.0 | -1 |
Create and return a dataframe from the run dictionary | def create_state_df(runs, iters=100000):
df_st = pd.DataFrame()
for l in runs.keys():
for i in range(runs[l].shape[0]):
df = pd.DataFrame()
df["Step"] = np.arange(iters)
df["Maximum"] = np.maximum.accumulate(runs[l][i].flatten())
df["run-type"] = "Short Bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_records_dataframe(self, run_idx, run_record_key):\n records = self.run_records(run_idx, run_record_key)\n return pd.DataFrame(records)",
"def dataframe(sorter, run_function):\n\n df = None\n for run in sorter:\n data = {\n 'mouse': [run.mouse],\n 'date': [... | [
"0.66812027",
"0.6672747",
"0.62714213",
"0.6262376",
"0.6247702",
"0.6247537",
"0.61908674",
"0.6160192",
"0.61521393",
"0.61386144",
"0.61269176",
"0.61016387",
"0.6092371",
"0.6085648",
"0.60756457",
"0.6052941",
"0.59867585",
"0.59752357",
"0.59704036",
"0.5964145",
"0.59... | 0.6624735 | 2 |
Score is precision @ k Relevance is binary (nonzero is relevant). >>> r = [0, 0, 1] >>> precision_at_k(r, 1) 0.0 >>> precision_at_k(r, 2) 0.0 >>> precision_at_k(r, 3) 0.33333333333333331 >>> precision_at_k(r, 4) | def precision_at_k(r, k):
assert k >= 1
r = np.asarray(r)[:k] != 0
if r.size != k:
raise ValueError('Relevance score length < k')
return np.mean(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)",
"def precision_at_k(r, k = None):\n assert k is None or k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k and k is not None:\n ... | [
"0.810669",
"0.80320096",
"0.7794077",
"0.75588703",
"0.745073",
"0.7408172",
"0.74021316",
"0.7149164",
"0.71229374",
"0.70036435",
"0.6793716",
"0.67831004",
"0.6689464",
"0.66819024",
"0.6608123",
"0.6559482",
"0.65499735",
"0.65133405",
"0.6497865",
"0.64929855",
"0.64783... | 0.8120763 | 0 |
Score is average precision (area under PR curve) Relevance is binary (nonzero is relevant). >>> r = [1, 1, 0, 1, 0, 1, 0, 0, 0, 1] >>> delta_r = 1. / sum(r) | def average_precision(r):
r = np.asarray(r) != 0
out = [precision_at_k(r, k + 1) for k in range(r.size) if r[k]]
if not out:
return 0.
return np.mean(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r_precision(r):\n r = np.asarray(r) != 0\n z = r.nonzero()[0]\n if not z.size:\n return 0.\n return np.mean(r[:z[-1] + 1])",
"def discount_rewards(self, r):\n discounted_r = np.zeros_like(r)\n running_add = 0\n for t in reversed(range(0, r.size)):\n if r[t] ... | [
"0.64191943",
"0.63737893",
"0.61734176",
"0.61721736",
"0.6158163",
"0.6158163",
"0.6049752",
"0.6027911",
"0.6019267",
"0.5994136",
"0.5973479",
"0.5938678",
"0.59161",
"0.590742",
"0.58925384",
"0.58870906",
"0.58665663",
"0.58541036",
"0.5830422",
"0.5829389",
"0.58254826... | 0.5656756 | 33 |
Score is mean average precision Relevance is binary (nonzero is relevant). >>> rs = [[1, 1, 0, 1, 0, 1, 0, 0, 0, 1]] >>> mean_average_precision(rs) 0.78333333333333333 >>> rs = [[1, 1, 0, 1, 0, 1, 0, 0, 0, 1], [0]] >>> mean_average_precision(rs) 0.39166666666666666 | def mean_average_precision(rs):
return np.mean([average_precision(r) for r in rs]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_average_precision(rs):\n return np.mean([average_precision(r) for r in rs])",
"def mean_avg_precision(top_k_results, relevance):\n map_score = 0.0\n for j, scores in relevance.items():\n precision, _ = calculate_precision_recall(top_k_results[j - 1], scores)\n relevant = set()\n ... | [
"0.8260779",
"0.7615301",
"0.7520832",
"0.7454814",
"0.7454814",
"0.7360572",
"0.7314742",
"0.73007286",
"0.7256968",
"0.7090746",
"0.708437",
"0.7077428",
"0.7048561",
"0.6940685",
"0.69115007",
"0.68994355",
"0.67348355",
"0.6650228",
"0.663301",
"0.6631078",
"0.6626502",
... | 0.82447165 | 1 |
shrink learning rate for pytorch | def adjust_learning_rate(optimizer, lr):
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, epoch, args):\n \"\"\"Comes from pytorch demo\"\"\"\n lr = args.lr * (0.1 ** (epoch // 30))\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_learning_rate(optimizer: torch.optim.SGD, epoch: int, args: Namespace):\n lr = arg... | [
"0.7026999",
"0.6677786",
"0.65512234",
"0.65512234",
"0.64308405",
"0.63593376",
"0.63058156",
"0.6291167",
"0.62689626",
"0.6246403",
"0.6218081",
"0.62059516",
"0.6199704",
"0.61931276",
"0.61894494",
"0.61846554",
"0.61840975",
"0.61840975",
"0.61840975",
"0.61831063",
"0... | 0.0 | -1 |
Retrieve a node's attribute from the attrib hash. | def __getitem__(self, key):
return self.attrib[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node_attr(self, node, attr):\n return self.metrics[attr].ix[node]",
"def _get_attr(self, attr, root=None):\n with self._h5file('r') as h5file:\n if root is None:\n obj = h5file\n else:\n obj = h5file[root]\n return get_decoded(... | [
"0.79159194",
"0.7671952",
"0.74305105",
"0.71056813",
"0.70064753",
"0.6943956",
"0.6936245",
"0.6930656",
"0.6913148",
"0.68379766",
"0.6834571",
"0.68190086",
"0.6767745",
"0.6711323",
"0.6706494",
"0.6700773",
"0.66855186",
"0.66285855",
"0.6615837",
"0.65721554",
"0.6536... | 0.684031 | 10 |
Return the CORBA attr type | def get_attr(self):
attr = self._bld.FindOrCreateAttribute(self._sobj, self.sname)
return attr._narrow(self.stype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributeType(self) -> unicode:\n ...",
"def get_type(self, ):\n return self.attrs.get(self.AttributeNames.TYPE, None)",
"def Type(self):\r\n\t\treturn self._get_attribute('type')",
"def type(self) -> str:\n return self._search_in_description(REGEXP_ATTR_TYPE)",
"def get_attr(self,... | [
"0.7915341",
"0.7332839",
"0.7013556",
"0.6755702",
"0.66767913",
"0.65429515",
"0.64748126",
"0.64403087",
"0.6432759",
"0.6427032",
"0.64100105",
"0.6399085",
"0.6363115",
"0.63588315",
"0.6340176",
"0.63155615",
"0.6286933",
"0.62547135",
"0.6254331",
"0.6201025",
"0.61845... | 0.7006661 | 3 |
Test the equality of two nodes by testing their entry | def __eq__(self, node):
return (self.entry == node.entry) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return type(self) == type(other) and self.node is other.node",
"def equals(self, *args):\n return _libsbml.XMLNode_equals(self, *args)",
"def __eq__(self, other):\n return type(other) is type(self) and other._node is self._node",
"def __eq__(self, other... | [
"0.73314077",
"0.71941257",
"0.7186584",
"0.7186584",
"0.7186584",
"0.7186584",
"0.7186584",
"0.7120458",
"0.7116338",
"0.70906115",
"0.7052149",
"0.7031184",
"0.7018979",
"0.6979003",
"0.69620746",
"0.6955308",
"0.6953072",
"0.69524634",
"0.6913408",
"0.6863372",
"0.6860486"... | 0.76529616 | 0 |
Return the group key of the given group name | def give_group_key(self, mesh, grp_name):
grps = self._grps
for key in grps:
if grp_name in grps[key].find_groups(mesh):
return key
else:
mess = "Group '%s' not found on the mesh '%s'"
raise ValueError(mess % (grp_name, mesh.read_name())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self, group_name):\n\n return self._group[group_name]",
"def getGroupId(groupName):\r\n return Group.getGroupId(str(groupName))",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def get_group_name(self):\n return self.groupname",
"def group_i... | [
"0.75254095",
"0.71523273",
"0.711112",
"0.70656484",
"0.69396883",
"0.69396883",
"0.6898602",
"0.6898602",
"0.68888956",
"0.6883425",
"0.6876027",
"0.6865113",
"0.68425804",
"0.6788967",
"0.6736359",
"0.6671234",
"0.66703206",
"0.6651289",
"0.6650129",
"0.6650129",
"0.665012... | 0.78493285 | 0 |
Build a Mesh from the SMESH object | def attach_mesh_from(self, smesh_obj):
sstd = self.sstd
sobj = sstd.FindObjectIOR(sstd.ConvertObjectToIOR(smesh_obj))
node = self.build_node_from_entry(sobj.GetID())
return Mesh(node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_mesh_from_data(mesh_name, bsp_verts, bsp_faces, materials, scale_factor):\n\n\n def vertex_stream(vertices, stream_id):\n for vertex in vertices:\n yield vertex[stream_id]\n\n # Create mesh and object\n me = bpy.data.meshes.new(mesh_name+'Mesh')\n ob = bpy.data.objects.new(... | [
"0.6826945",
"0.67043877",
"0.65863603",
"0.6534374",
"0.6479676",
"0.6398354",
"0.6361455",
"0.63601655",
"0.63150835",
"0.6278875",
"0.6241482",
"0.61849743",
"0.6169891",
"0.6150137",
"0.6143824",
"0.6116077",
"0.61127496",
"0.60171777",
"0.59961706",
"0.598774",
"0.598058... | 0.68177444 | 1 |
Parse the manifest XML and create a dictionary with the data | def get_manifest_info(manifest_xml):
manifest_info = mf_parse.Manifest(manifest_xml, is_bytes=True)
manifest_data = manifest_info.parse_data()
return mf_info.ManifestInfo(manifest_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_data(self):\n\n try:\n if self.is_bytes:\n self.data = etree.XML(self.manifest)\n else:\n with open(self.manifest) as fh:\n self.data = etree.XML(fh.read().encode())\n except etree.XMLSyntaxError:\n raise Inva... | [
"0.76703036",
"0.7376518",
"0.7376518",
"0.69863945",
"0.69007695",
"0.67912966",
"0.65566486",
"0.65264666",
"0.6464162",
"0.64371055",
"0.6433693",
"0.63525885",
"0.62444323",
"0.616695",
"0.6096529",
"0.60549223",
"0.6035429",
"0.5997228",
"0.5984452",
"0.59664387",
"0.589... | 0.7034084 | 3 |
Returns all moves which are legal in current state of the puzzle. The method should be used to check valid moves prior to calling move(). | def legal_moves(self):
moves = ""
swappable = self.swappable_positions
empty_position = self.get_position(0)
for s in swappable:
pos_diff = empty_position[0] - s[0], empty_position[1] - s[1]
if pos_diff[0] > 0:
moves += "U"
elif pos_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n if self.turn == DEFENDER:\n allowed.extend((KING, CASTLE_OCCUPIED))\n it = np.nditer(self.board_state, flags=['multi_index'])\n... | [
"0.8413419",
"0.8002399",
"0.79904896",
"0.794659",
"0.79002875",
"0.77289605",
"0.76891285",
"0.7670011",
"0.76604795",
"0.7631297",
"0.76069057",
"0.7602054",
"0.759633",
"0.7581169",
"0.7550169",
"0.7549101",
"0.75312483",
"0.75299746",
"0.75209063",
"0.7519016",
"0.751873... | 0.0 | -1 |
Returns True if the state of the puzzle is in sequence. | def is_sequential(self):
counter = 1
for r in range(0, 4):
for c in range(0, 4):
if counter == 16:
return True
elif self.get((r, c)) != counter:
return False
counter += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isstate(self, state):\r\n if len(self):\r\n return self[-1] == state\r\n else:\r\n return False",
"def is_solvable(self) -> bool:\r\n inv_count = 0\r\n arr = self.current_state.flatten()\r\n for i in range(0, 9):\r\n for j in range(i + 1, 9)... | [
"0.68219125",
"0.668109",
"0.6645452",
"0.65974367",
"0.65891296",
"0.6569594",
"0.65263724",
"0.64955163",
"0.6417268",
"0.6411101",
"0.6408533",
"0.63894653",
"0.6376151",
"0.6358591",
"0.63026905",
"0.6272235",
"0.62715685",
"0.6270337",
"0.62639284",
"0.6253824",
"0.62538... | 0.63836396 | 12 |
Returns True if the given text is a string in the proper format to be an 'absolute' URI, by which we mean the URI has a scheme (http or https) and a host specification. | def is_valid_absolute_uri(text):
# Technically something like 'foo/bar.html' is also a URI, but it is a relative one, and
# the intended use of this function is to verify the URI specification of a resource on the web,
# independent of browser context, so a relative specification would be meaningless. We ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_absolute_url(path):\n return path.startswith(\"http\")",
"def _is_url(string):\n return \"http\" in string",
"def _isurl(self, path):\n\n # We do this here to reduce the 'import numpy' initial import time.\n from urllib.parse import urlparse\n\n # BUG : URLs require a scheme s... | [
"0.74578285",
"0.70959044",
"0.7037983",
"0.7018224",
"0.6944739",
"0.6912348",
"0.69096535",
"0.68905294",
"0.6846146",
"0.6719269",
"0.66210693",
"0.6559485",
"0.65140826",
"0.645232",
"0.6426859",
"0.64165664",
"0.6413625",
"0.6412861",
"0.63936067",
"0.63936067",
"0.63750... | 0.8171139 | 0 |
Wrapper for TestApp.patch_json that logs the outgoing PATCH | def patch_json(self, url, fields, **kwargs):
logging.info('OUTGOING HTTP PATCH on url: %s with changes: %s' % (url, fields))
try:
return self.wrapped_app.patch_json(url, fields, **kwargs)
except webtest.AppError as e:
raise VirtualAppError(msg='HTTP PATCH failed.', url=ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simulate_patch(app, path, **kwargs) -> _ResultBase:\n return simulate_request(app, 'PATCH', path, **kwargs)",
"def patch_json(self, data):\n def hook(response):\n response.patch_json(data)\n return self.dynamic_hook(hook)",
"def view_patch():\n\n return jsonify(\n get_... | [
"0.7250297",
"0.709649",
"0.7006973",
"0.68903226",
"0.68896157",
"0.68869454",
"0.6858595",
"0.68477017",
"0.6838667",
"0.683194",
"0.6779105",
"0.6704583",
"0.66788626",
"0.6631675",
"0.65878195",
"0.656198",
"0.65478",
"0.6527526",
"0.647694",
"0.6459613",
"0.644929",
"0... | 0.7089538 | 2 |
This gets a value from either an environment variable or a config file. The environment variable overrides, since it is more dynamic in nature than a config file, which might be checked into source control. If the value of env_var is None, it will default to a name similar to ini_var, but in uppercase and with '.' repl... | def get_setting_from_context(settings, ini_var, env_var=None, default=None):
if env_var is not False: # False specially means don't allow an environ variable, in case that's ever needed.
if env_var is None:
# foo.bar.baz in config file corresponds to FOO_BAR_BAZ as an environment variable setti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key, default=None):\n value = os.environ.get(key)\n\n if value:\n self.logging.info(\"Got %s from environment.\" % key)\n self.logging.debug(value)\n return_val = value\n elif key in self._config.keys():\n self.logging.info(\"Got %s fro... | [
"0.74075204",
"0.73048484",
"0.7191001",
"0.7081116",
"0.692892",
"0.6921951",
"0.686308",
"0.68173695",
"0.68050176",
"0.68037546",
"0.6781183",
"0.6772373",
"0.6769702",
"0.6762535",
"0.6762535",
"0.6754744",
"0.6751606",
"0.6733775",
"0.6711389",
"0.67040783",
"0.66551393"... | 0.76983434 | 0 |
Returns a YYYYmmdd date string, relative to the UTC timezone. | def utc_today_str():
return datetime.datetime.strftime(datetime.datetime.utcnow(), "%Y-%m-%d") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datecode():\n now = datetime.utcnow()\n return now.strftime(\"%Y%m%d\")",
"def get_date():\n dt = datetime.now()\n return dt.strftime(\"%Y-%m-%d\")",
"def get_date():\n now = datetime.now()\n date = now.strftime(\"%Y%m%d\")\n return date",
"def GetCompactDateString():\r\n utc_ti... | [
"0.67584413",
"0.6493648",
"0.64422905",
"0.6417613",
"0.64097583",
"0.63959455",
"0.63619107",
"0.6350435",
"0.6308878",
"0.63037544",
"0.6272514",
"0.6245173",
"0.6245173",
"0.6241847",
"0.62285775",
"0.6216954",
"0.6212947",
"0.6203104",
"0.61835146",
"0.61816007",
"0.6124... | 0.6675011 | 1 |
Coerces a relative amount of time (keyword arguments seconds, minutes, etc. like timedelta) into seconds. If the number of seconds is an integer, it will be coerced to an integer. Otherwise, it will be a float. If as_float is given and not None, it will be applied as a function to the result, allowing it to be coerced ... | def as_seconds(*, seconds=0, minutes=0, hours=0, days=0, weeks=0, milliseconds=0, as_type=None):
delta = datetime.timedelta(seconds=seconds, minutes=minutes, hours=hours,
days=days, weeks=weeks, milliseconds=milliseconds)
seconds = delta.total_seconds()
frac, intpart = math.mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_seconds(hours, minutes, seconds):\n return hours*3600+minutes*60+seconds",
"def to_seconds(hours, minutes, seconds):\n return hours*60**2 + minutes*60 + seconds",
"def to_seconds(hours,minutes,seconds):\n return hours*3600+minutes*60+seconds",
"def to_seconds(time):\n return 3600 * time",
... | [
"0.6721457",
"0.66667306",
"0.6474821",
"0.637833",
"0.63701886",
"0.6326922",
"0.62424445",
"0.6169347",
"0.6169118",
"0.61662817",
"0.6095887",
"0.60765487",
"0.60373884",
"0.6034355",
"0.59373933",
"0.58513355",
"0.58345896",
"0.5811804",
"0.5771685",
"0.5768268",
"0.57311... | 0.8374514 | 0 |
Returns the current time in the portal's reference timezone, as determined by REF_TZ. Because this software originates at Harvard Medical School, the reference timezone defaults to US/Eastern. It can be set to another value by binding the REF_TZ environment variable. | def ref_now():
return as_datetime(datetime.datetime.now(), REF_TZ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now(self):\n os.environ['TZ'] = conf.timezone\n time.tzset()\n return time.strftime(\"%B %d %Y %H:%M:%S IST\", time.localtime())",
"def get_time():\n\teastern = timezone('US/Eastern')\n\tnow = datetime.datetime.now(eastern).time()\n\treturn(now)",
"def _get_tz():\n return 'UTC'",
"def get_tim... | [
"0.67378354",
"0.6493478",
"0.64780456",
"0.64599454",
"0.64363337",
"0.6419165",
"0.63951504",
"0.6372013",
"0.63617206",
"0.63487536",
"0.6315507",
"0.6311734",
"0.63052416",
"0.62760705",
"0.6229972",
"0.62052464",
"0.6192469",
"0.6174816",
"0.6147239",
"0.6116211",
"0.609... | 0.7168168 | 0 |
The timestamp is readonly. Use update_timestamp() to set it. | def timestamp(self):
return self._timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_timestamp(self):\n self._timestamp = datetime.datetime.now()",
"def timestamp(self, timestamp: datetime):\r\n self._timestamp = timestamp",
"def timestamp(self, timestamp):\n \n self._timestamp = timestamp",
"def timestamp(self, timestamp):\n\n self._timestamp = ... | [
"0.8440497",
"0.83719087",
"0.829373",
"0.8206793",
"0.8206793",
"0.8206793",
"0.8206793",
"0.8206793",
"0.8206793",
"0.8206793",
"0.7801769",
"0.77159274",
"0.770279",
"0.7540888",
"0.74751693",
"0.74341375",
"0.7406122",
"0.7405983",
"0.7358929",
"0.7298014",
"0.72804725",
... | 0.72991806 | 25 |
Converts snake_case to CamelCase. (Note that "our" CamelCase always capitalizes the first character.) With a separator argument (default '_'), expect that character instead for snake_case. e.g., with separator='', you'll expect snakecase. | def snake_case_to_camel_case(s, separator='_'):
return s.title().replace(separator, '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel_case_to_snake_case(s, separator='_'):\n return ''.join(separator + c.lower() if c.isupper() else c for c in s).lstrip(separator)",
"def CamelCase(text, separator='_'):\n return ''.join(map(str.capitalize, text.split(separator)))",
"def snakecase(label, separator='_'):\n subbed = RegexCamelSnak... | [
"0.7535152",
"0.73726827",
"0.7267097",
"0.7247274",
"0.664745",
"0.6567437",
"0.6567437",
"0.6471937",
"0.645908",
"0.63833684",
"0.6355874",
"0.6303461",
"0.6240061",
"0.621972",
"0.61829245",
"0.61752003",
"0.6160202",
"0.61547375",
"0.6127226",
"0.6099129",
"0.60933954",
... | 0.81705385 | 0 |
Converts a string that might be in snake_case or CamelCase into CamelCase. | def to_camel_case(s):
if s[:1].isupper() and '_' not in s:
return s
else:
return snake_case_to_camel_case(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_to_camel_case(string: str):\n return ''.join(string_component.title() for string_component in string.split('_'... | [
"0.8294101",
"0.8192725",
"0.80273736",
"0.7946606",
"0.7930704",
"0.7913226",
"0.779464",
"0.77179605",
"0.7660657",
"0.76452565",
"0.7617424",
"0.7585224",
"0.75659055",
"0.75426704",
"0.7538262",
"0.7538262",
"0.7532905",
"0.7510901",
"0.74949217",
"0.7482082",
"0.7416958"... | 0.8151977 | 2 |
Turns a commaseparated list into an actual list, trimming whitespace and ignoring nulls. >>> string_list('foo, bar,,baz ') ['foo', 'bar', 'baz'] | def string_list(s):
if not isinstance(s, str):
raise ValueError(f"Not a string: {s!r}")
return [p for p in [part.strip() for part in s.split(",")] if p] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_empty_string(str_list):\n return list(filter(None, str_list))",
"def stringInputToList(x):\n return list(filter(None, [y.strip() for y in x.split(',')]))",
"def _clean_string(self, string):\n if string is None:\n return []\n str_list = string.strip().split(\",\")\n... | [
"0.71860105",
"0.7179068",
"0.71771365",
"0.7119025",
"0.7029148",
"0.6924759",
"0.68669677",
"0.686035",
"0.6826808",
"0.68141913",
"0.6807301",
"0.6804308",
"0.6689648",
"0.6572147",
"0.65572476",
"0.6554369",
"0.65220654",
"0.65204465",
"0.6473458",
"0.64206934",
"0.640484... | 0.7390121 | 0 |
This function is taken and renamed from ENCODE's snovault quick_deepcopy Deep copy an object consisting of dicts, lists, and primitives. This is faster than Python's `copy.deepcopy` because it doesn't do bookkeeping to avoid duplicating objects in a cyclic graph. This is intended to work fine for data deserialized from... | def copy_json(obj):
if isinstance(obj, dict):
obj = {k: copy_json(v) for k, v in obj.items()}
elif isinstance(obj, list):
obj = [copy_json(v) for v in obj]
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deepcopy(obj):\n if isinstance(obj, dict):\n return {deepcopy(key): deepcopy(value) for key, value in obj.items()}\n if hasattr(obj, '__iter__'):\n return type(obj)(deepcopy(item) for item in obj)\n return obj",
"def _app_cache_deepcopy(obj):\n if isinstance(obj, dict):\n ret... | [
"0.802849",
"0.7507352",
"0.7229571",
"0.6823999",
"0.6734716",
"0.6723845",
"0.66690904",
"0.66468894",
"0.6607739",
"0.6475197",
"0.64068544",
"0.63464046",
"0.62804663",
"0.6239363",
"0.6226398",
"0.6225235",
"0.62047064",
"0.6194158",
"0.6152555",
"0.61479306",
"0.6131895... | 0.64496285 | 10 |
Given an expression and some substitutions, substitutes all occurrences of the given substitutions. | def json_leaf_subst(exp, substitutions):
def do_subst(e):
return json_leaf_subst(e, substitutions)
if isinstance(exp, dict):
return {do_subst(k): do_subst(v) for k, v in exp.items()}
elif isinstance(exp, list):
return [do_subst(e) for e in exp]
elif exp in substitutions: # Somet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multi_replace(string, substitutions):\n substrings = sorted(substitutions, key=len, reverse=True)\n regex = re.compile('|'.join(map(re.escape, substrings)))\n return regex.sub(lambda match: substitutions[match.group(0)], string)",
"def do_subs(self, e):\n for expr, var in self.items():\n ... | [
"0.6825438",
"0.6693225",
"0.65881205",
"0.64701337",
"0.63628",
"0.6334616",
"0.6219374",
"0.60951954",
"0.6084909",
"0.60496396",
"0.60232234",
"0.5995198",
"0.596835",
"0.59245735",
"0.59105015",
"0.5875852",
"0.58414316",
"0.58411294",
"0.5827861",
"0.5827861",
"0.581747"... | 0.5926141 | 13 |
Mark the graph as finished and check for cycles in the graph. If any cycle is detected, "CycleError" will be raised, but "get_ready" can still be used to obtain as many nodes as possible until cycles block more progress. After a call to this function, the graph cannot be modified and therefore no more nodes can be adde... | def prepare(self):
if self._ready_nodes is not None:
raise ValueError("cannot prepare() more than once")
self._ready_nodes = [
i.node for i in self._node2info.values() if i.npredecessors == 0
]
# ready_nodes is set before we look for cycles on purpose:
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done(self):\n while True:\n self.update_graph()",
"def _check_cycles(self, graph):\n if list(nx.simple_cycles(graph)):\n raise AbstractGraphError('Cycles in graph')",
"def done(self, *nodes):\n\n if self._ready_nodes is None:\n raise ValueError(\"prepar... | [
"0.6335829",
"0.6151132",
"0.61059743",
"0.5939238",
"0.57371545",
"0.5523497",
"0.5502412",
"0.54938686",
"0.549257",
"0.5429481",
"0.5408461",
"0.54022396",
"0.53823006",
"0.5309058",
"0.5308183",
"0.5291472",
"0.5290547",
"0.5260492",
"0.52534306",
"0.5249743",
"0.5232952"... | 0.5979497 | 3 |
get the filename only | def get_fname(a_file):
fname, fext = os.path.splitext(a_file)
return os.path.basename(fname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(self):\n filename, ext = os.path.splitext(self.file.name)\n return filename.split('/')[-1]",
"def get_filename(self):\n \n for f in os.listdir(self.get_directory()):\n if os.path.isfile(os.path.join(self.get_directory(), f)):\n return... | [
"0.8149858",
"0.81272596",
"0.81119883",
"0.8046814",
"0.8037212",
"0.79741955",
"0.79505414",
"0.7938233",
"0.7925669",
"0.78973913",
"0.7842346",
"0.77857304",
"0.7784356",
"0.7768325",
"0.77559966",
"0.7729143",
"0.77165014",
"0.7703956",
"0.7684395",
"0.7659758",
"0.76538... | 0.77571553 | 15 |
chdir to working_path, return the file's relative path | def get_relative_path(file_string, root_path, working_path=""):
if not working_path:
working_path = os.getcwd()
new_file = to_abs_list(file_string, root_path)[0]
working_path = win2unix(working_path)
f, d = re.split("/", new_file), re.split("/", working_path)
ff, dd = f[:], d[:]
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_cwd():\n return os.path.relpath(os.getcwd(), git_toplevel())",
"def get_working_dir():\n working_dir = os.path.dirname(os.path.abspath(__file__))\n return working_dir",
"def get_relative_path(self, source: str) -> str:\n abs_top_level_dir = os.path.normcase(\n os.path.normpath(... | [
"0.703163",
"0.70315284",
"0.6852108",
"0.6816119",
"0.67907476",
"0.67575425",
"0.6693841",
"0.66373277",
"0.6627564",
"0.6587422",
"0.6570605",
"0.65527236",
"0.6551317",
"0.6537264",
"0.65283567",
"0.6520564",
"0.64554065",
"0.64416105",
"0.6420045",
"0.6407554",
"0.640215... | 0.6080702 | 53 |
svn_fs_berkeley_logfiles(char path, svn_boolean_t only_unused, apr_pool_t pool) > svn_error_t | def svn_fs_berkeley_logfiles(*args):
return _fs.svn_fs_berkeley_logfiles(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svn_fs_berkeley_recover(*args):\r\n return _fs.svn_fs_berkeley_recover(*args)",
"def svn_fs_open_berkeley(*args):\r\n return _fs.svn_fs_open_berkeley(*args)",
"def svn_fs_berkeley_path(*args):\r\n return _fs.svn_fs_berkeley_path(*args)",
"def svn_client_ls(apr_hash_t_dirents, char_path_or_url, svn_opt... | [
"0.58423275",
"0.5749368",
"0.5700871",
"0.5638795",
"0.54768753",
"0.5447107",
"0.5438403",
"0.5359299",
"0.5348531",
"0.52991116",
"0.52957594",
"0.5178075",
"0.51775885",
"0.514714",
"0.5077724",
"0.5046152",
"0.50074",
"0.5002512",
"0.49954513",
"0.49852777",
"0.49830583"... | 0.8167841 | 0 |
Create a new proxy object for svn_fs_path_change2_t | def set_parent_pool(self, parent_pool=None):
import libsvn.core, weakref
self.__dict__["_parent_pool"] = \
parent_pool or libsvn.core.application_pool;
if self.__dict__["_parent_pool"]:
self.__dict__["_is_valid"] = weakref.ref(
self.__dict__["_parent_pool"]._is_valid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svn_fs_path_change2_create(*args):\r\n return _fs.svn_fs_path_change2_create(*args)",
"def svn_fs_paths_changed2(*args):\r\n return _fs.svn_fs_paths_changed2(*args)",
"def svn_fs_new(*args):\r\n return _fs.svn_fs_new(*args)",
"def svn_client_commit_item2_t_path_set(svn_client_commit_item2_t_self, char... | [
"0.7391281",
"0.65590066",
"0.6014609",
"0.58635634",
"0.5844773",
"0.58274937",
"0.57888186",
"0.57540196",
"0.5736157",
"0.570081",
"0.56680036",
"0.56589645",
"0.56380546",
"0.56359345",
"0.55812067",
"0.5575705",
"0.5565786",
"0.556414",
"0.5541069",
"0.5514498",
"0.55016... | 0.0 | -1 |
svn_fs_set_uuid(svn_fs_t fs, char uuid, apr_pool_t pool) > svn_error_t | def svn_fs_set_uuid(*args):
return _fs.svn_fs_set_uuid(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svn_client_uuid_from_path(char_uuid, char_path, svn_wc_adm_access_t_adm_access, svn_client_ctx_t_ctx, apr_pool_t_pool): # real signature unknown; restored from __doc__\n pass",
"def svn_info_t_repos_UUID_set(svn_info_t_self, char_repos_UUID): # real signature unknown; restored from __doc__\n pass",
"... | [
"0.66487885",
"0.6568112",
"0.61703414",
"0.5951304",
"0.5870097",
"0.58192843",
"0.58192843",
"0.58192843",
"0.58192843",
"0.579298",
"0.5552122",
"0.55414814",
"0.55414814",
"0.5404135",
"0.5298561",
"0.51953304",
"0.51585484",
"0.5147286",
"0.51141584",
"0.51017857",
"0.50... | 0.8158777 | 0 |
Get a setting; return ``default`` if one is passed. If ``key`` isn't in settings, try prepending ``'tangled.app.'``. If the ``key`` isn't present, return the ``default`` if one was passed; if a ``default`` wasn't passed, a KeyError will be raised. | def get_setting(self, key, default=NOT_SET):
if key in self.settings:
return self.settings[key]
app_key = 'tangled.app.' + key
if app_key in self.settings:
return self.settings[app_key]
if default is NOT_SET:
raise KeyError("'{}' not present in setting... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_setting_value(self, key, default = None):\n \n if not \"settings\" in self.configuration or not key in self.configuration['settings']:\n return default\n \n return self.configuration['settings'][key]",
"def get(self, key, default=None):\n return self.settings.get... | [
"0.7081361",
"0.7046409",
"0.65891564",
"0.6575801",
"0.6523407",
"0.65171874",
"0.63596314",
"0.6223339",
"0.6159278",
"0.61486906",
"0.6116944",
"0.6073985",
"0.6058005",
"0.6044894",
"0.60345304",
"0.60251445",
"0.6022708",
"0.60225314",
"0.59948874",
"0.5989284",
"0.59595... | 0.7918793 | 0 |
Add dynamic attribute to requests. This is mainly intended so that extensions can easily add request methods and properties. Functions can already be decorated, or a ``decorator`` can be specified. If ``reify`` is ``True``, the function will be | def add_request_attribute(self, attr, name=None, decorator=None,
reify=False):
if not name:
if hasattr(attr, '__name__'):
name = attr.__name__
elif isinstance(attr, property):
name = attr.fget.__name__
if not name:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attrs(**kwds):\n\n def decorate(f):\n for k in kwds:\n setattr(f, k, kwds[k])\n return f\n\n return decorate",
"def register_request_hydrator(self):\n\n # pylint: disable=missing-return-doc, missing-return-type-doc\n def decorator(func):\n self.request_... | [
"0.5711958",
"0.55721563",
"0.55249083",
"0.5453537",
"0.53941965",
"0.5303469",
"0.5295133",
"0.5287129",
"0.5242412",
"0.5225089",
"0.52213085",
"0.52040964",
"0.52021265",
"0.51831645",
"0.51647234",
"0.51616746",
"0.5139631",
"0.51290804",
"0.5127077",
"0.51225835",
"0.51... | 0.81411606 | 0 |
Returns a dictionary with sensitive settings blurred out. | def get_safe_dict(target: dict) -> dict:
return_value = {}
for k in target:
return_value[k] = cleanse_value(k, target.get(k))
return return_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_safe_settings() -> dict:\n return get_safe_dict(\n {k: getattr(settings, k) for k in dir(settings) if k.isupper()}\n )",
"def get_sensitive_attributes(self):\n return self.sensitive_attrs",
"def mask_sensitive_data(data):\n\n if type(data) != dict:\n return data\n\n for k... | [
"0.6171837",
"0.5878699",
"0.5769817",
"0.5759694",
"0.572144",
"0.56862825",
"0.55533475",
"0.54878175",
"0.5444056",
"0.5434853",
"0.542677",
"0.53956705",
"0.538909",
"0.5386029",
"0.53693706",
"0.5322128",
"0.5311988",
"0.5266664",
"0.52601075",
"0.5251843",
"0.52193934",... | 0.0 | -1 |
whether rect1 contains rect2 | def rectContains(rect1, rect2):
x1, y1, w1, h1 = rect1
x2, y2, w2, h2 = rect2
if x2 >= x1 and y2 >= y1 and x2 <= x1 + w1 and y2 <= y1 + h1 and x2 + w2 <= x1 + w1 and y2 + h2 <= y1 + h1:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rect_intersects(self, rect):\n\tb = (self.left() > rect.right() or \n\t\tself.right() < rect.left() or \n\t\tself.top() < rect.bottom() or \n\t\tself.bottom() > rect.top())\n\treturn not b",
"def intersects(self, rect):\n\t\treturn ( rect.right >= self.left and rect.left < self.right\n\t\t\tand rect.bottom ... | [
"0.79091203",
"0.7749103",
"0.74176633",
"0.7409241",
"0.7385194",
"0.73476404",
"0.7284548",
"0.7275689",
"0.72349346",
"0.7194343",
"0.7142221",
"0.71165174",
"0.70880497",
"0.70045274",
"0.69933957",
"0.6984318",
"0.6978628",
"0.69517994",
"0.6951129",
"0.69306093",
"0.689... | 0.835428 | 0 |
Return a set of root nodes of the graph | def roots(self):
return {
nodeObj for nodeId, nodeObj
in self.nodes.items()
if nodeId not in self.childNodes} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roots(self) -> List[str]:\n return [node for node, degree in self.graph.in_degree() if degree == 0]",
"def nodes(self):\n\n return list(set(self._graph.keys() + [x for x in itertools.chain.from_iterable(self._graph.values())]))",
"def roots(self):\n if not self.__roots:\n se... | [
"0.7668125",
"0.7630493",
"0.7510259",
"0.74285316",
"0.7397876",
"0.73438436",
"0.721784",
"0.71782094",
"0.71597415",
"0.71485865",
"0.7145246",
"0.70911753",
"0.70871013",
"0.7084507",
"0.70046085",
"0.6999962",
"0.69617575",
"0.69529396",
"0.69460726",
"0.6898439",
"0.688... | 0.70841205 | 14 |
Helper function for merges. Given a root, and a list of collapsable subtrees, for each neighbor if any child of the root is in the list, collapse it. Else recursively search all uncollapsed children | def mergeHelper(self, root, collapsable):
# print("Checking all children of {}".format(root.id))
for neighbor in list(root.neighbors):
if neighbor in collapsable:
# do the marking FIRST, very important so as to deal with
# potential of introducing cycles.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markMerged(self, root):\n root.safe = False\n for neighbor in root.neighbors:\n self.markMerged(neighbor)\n return # Base case will skip loop and jump here (leaf node)",
"def postOrderMergeHelper(self, root, seen):\n\n # Check if each neighbor is collapsible\n f... | [
"0.59052896",
"0.58475035",
"0.5783385",
"0.5555027",
"0.53372204",
"0.5257545",
"0.5211509",
"0.51371455",
"0.5128983",
"0.50935364",
"0.50866145",
"0.50789976",
"0.506999",
"0.5060621",
"0.50509495",
"0.5044688",
"0.5032194",
"0.50150913",
"0.5008484",
"0.49940312",
"0.4992... | 0.717926 | 0 |
Given a root, recrusively mark that subtree as merged for deletion | def markMerged(self, root):
root.safe = False
for neighbor in root.neighbors:
self.markMerged(neighbor)
return # Base case will skip loop and jump here (leaf node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeHelper(self, root, collapsable):\n # print(\"Checking all children of {}\".format(root.id))\n for neighbor in list(root.neighbors):\n if neighbor in collapsable:\n # do the marking FIRST, very important so as to deal with\n # potential of introducing ... | [
"0.7316842",
"0.63581",
"0.62741977",
"0.6263691",
"0.62240344",
"0.61994463",
"0.6195775",
"0.61913395",
"0.61588633",
"0.6110875",
"0.6072193",
"0.6071457",
"0.6010223",
"0.6003658",
"0.5999196",
"0.5954584",
"0.59041923",
"0.58887714",
"0.5879872",
"0.58777976",
"0.5834908... | 0.7598648 | 0 |
Get predictions from sagemaker endpoint. | def get_predictions(payload):
return sm_client.invoke_endpoint(EndpointName=EMBEDDING_MODEL_ENDPOINT_NAME,
Body=payload,
ContentType='application/json') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict():\n\n\n json_payload = request.json\n #LOG.info(f\"JSON payload: %s\" %json_payload)\n inference_payload = pd.DataFrame(json_payload)\n #LOG.info(\"inference payload DataFrame: %s\" %inference_payload)\n scaled_payload = scale(inference_payload)\n prediction = list(clf.predict(scaled... | [
"0.68535626",
"0.68307686",
"0.67041147",
"0.6549635",
"0.6505668",
"0.6482876",
"0.64604634",
"0.63724005",
"0.6244161",
"0.6210581",
"0.6209168",
"0.61920106",
"0.6170524",
"0.6123495",
"0.6120624",
"0.61078066",
"0.6104131",
"0.60925484",
"0.608216",
"0.6061785",
"0.603148... | 0.7122553 | 0 |
Initialize this dataset class. | def __init__(self, opt):
BaseDataset.__init__(self, opt)
self.dir_AB = os.path.join(opt.dataroot, opt.phase) # get the image directory
self.AB_paths = sorted(make_dataset(self.dir_AB, opt.max_dataset_size)) # get image paths
assert(self.opt.load_size >= self.opt.crop_size) # crop_siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.__dataset = None",
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s... | [
"0.816631",
"0.81641185",
"0.8013762",
"0.76137954",
"0.7422038",
"0.7393049",
"0.7352237",
"0.73437655",
"0.7111143",
"0.71019876",
"0.7099074",
"0.7096382",
"0.70223516",
"0.696418",
"0.6961817",
"0.6889772",
"0.6879775",
"0.68740934",
"0.68599087",
"0.68520594",
"0.6842619... | 0.0 | -1 |
Return a data point and its metadata information. | def __getitem__(self, index):
# # read a image given a random integer index
# AB_path = self.AB_paths[index]
# AB = Image.open(AB_path).convert('RGB')
# # split AB image into A and B
# w, h = AB.size
# w2 = int(w / 2)
# A = AB.crop((0, 0, w2, h))
# B = AB.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point(self):\n return self.x, self.y, self.z",
"def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_height,\n\n 'mesh_normal': self.mesh_normal.to_data(),\n 'up_vector': self.up_vector.to_data()... | [
"0.6607296",
"0.6599758",
"0.65745145",
"0.6535129",
"0.65202826",
"0.63402396",
"0.6291092",
"0.6291092",
"0.61568433",
"0.61515397",
"0.6138252",
"0.6133588",
"0.6116883",
"0.60677505",
"0.6049698",
"0.60260797",
"0.5992455",
"0.59917825",
"0.59876746",
"0.59777427",
"0.596... | 0.0 | -1 |
Return the player ID for the name specified. | def getPlayerIDFromName(name):
# Connect to the database.
conn, c = main.connect()
# Select the player that matches the name.
SQL = "SELECT playerID FROM player WHERE playerName=%s"
data = (name, )
c.execute(SQL, data)
toReturn = c.fetchone()
conn.commit()
conn.close()
# Onl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player(self, name):\n\n self.name = name\n q = Query()\n data = TinyDB('app/data/db_player.json').table('players')\n\n self.search_result = data.search(\n (q.name == self.name) |\n (q.surname == self.name)\n )\n\n if len(self.search_re... | [
"0.7494445",
"0.70838946",
"0.696872",
"0.68431336",
"0.6784962",
"0.6780483",
"0.6748288",
"0.6727132",
"0.6675611",
"0.6671527",
"0.66703033",
"0.65796",
"0.6574955",
"0.6572702",
"0.65555495",
"0.6512537",
"0.6492538",
"0.64709324",
"0.64366364",
"0.6415761",
"0.6397056",
... | 0.8133356 | 0 |
Draw the line on a color mask image. | def draw(self, mask, color=(255, 0, 0), line_width=50, average=False):
h, w = mask.shape[:2]
plot_y = np.linspace(0, h - 1, h)
coeffs = self.average_fit if average else self.last_fit_pixel
line_center = coeffs[0] * plot_y ** 2 + coeffs[1] * plot_y + coeffs[2]
line_left_side = l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawLine(img, start, end, color = (0,0,255), thickness = 3):\n\tcv2.line(img, start, end, color, thickness)",
"def _plot_line(self, image, x1, y1, x2, y2, width, color):\n\n draw = ImageDraw.Draw(image, \"RGBA\")\n draw.line([x1, y1, x2, y2], fill=color, width=width)\n del draw\n\n ... | [
"0.7061069",
"0.70104575",
"0.67406094",
"0.66183156",
"0.6609182",
"0.64976215",
"0.6469598",
"0.6468056",
"0.6332734",
"0.6330735",
"0.6275122",
"0.6251031",
"0.6234196",
"0.6226588",
"0.61729026",
"0.6146423",
"0.6083512",
"0.60751015",
"0.60577977",
"0.60559136",
"0.60360... | 0.6737607 | 3 |
Concatenates the tensors in multiple lists of tensors along the given dimension. It returns another list of tensors. | def list_cat(args, dim=-1):
return [torch.cat(x, dim=dim) for x in zip(*args)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate(tensors, axis=0):\n raise NotImplementedError",
"def concat(self, tensors):\n # check the arguments and try the fast path: only one tensor\n tensors = list(tensors)\n if not tensors:\n return []\n length = len(tensors[0])\n if length == 0:\n ... | [
"0.74517065",
"0.74384826",
"0.72329384",
"0.72326255",
"0.71328557",
"0.6942348",
"0.6942348",
"0.66862094",
"0.6663415",
"0.6600548",
"0.6583602",
"0.641451",
"0.639837",
"0.6396787",
"0.6395047",
"0.638488",
"0.6321483",
"0.6250911",
"0.6175356",
"0.6139963",
"0.61061686",... | 0.6708255 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.