query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Get a single database | def get_database(self, database, instance=None):
return self._get(_database.Database, database) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database() -> Database:\n db_config = DatabaseConfig(DB_NAME)\n return connect_to_db(db_config)",
"def get_database(self, instance, name):\n return instance.get_database(name)",
"def get_db(self, dbname, **params):\n return Database(self._db_uri(dbname), server=self, **params)",
"... | [
"0.8189091",
"0.7899076",
"0.7844062",
"0.7762001",
"0.7726166",
"0.772395",
"0.7723282",
"0.7685286",
"0.765148",
"0.762424",
"0.7616151",
"0.76047456",
"0.7597356",
"0.7583495",
"0.7570153",
"0.75534976",
"0.74211323",
"0.74180853",
"0.7410544",
"0.7392949",
"0.7318623",
... | 0.7978113 | 1 |
Get a single flavor | def get_flavor(self, flavor):
return self._get(_flavor.Flavor, flavor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_flavor(name):\r\n return nova.flavors.find(name=name)",
"def flavor(self, name=None):\n return self.find(self.flavors(), name=name)",
"def get_flavor(self, flavor_id):\n return self._flavor_manager.get(flavor_id)",
"def get_flavor(self, flavor_id):\n url = '%s/flavors/%s' % (s... | [
"0.82900196",
"0.8277593",
"0.8069578",
"0.789696",
"0.7692458",
"0.7663924",
"0.75685847",
"0.7417431",
"0.7335429",
"0.72927356",
"0.71877533",
"0.71117985",
"0.69786406",
"0.6909632",
"0.6736771",
"0.67233574",
"0.67233574",
"0.66672426",
"0.66635484",
"0.6631124",
"0.6613... | 0.86241716 | 1 |
Return a generator of flavors | def flavors(self, **query):
return self._list(_flavor.Flavor, **query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flavors(self, **kwargs):\n raise NotImplementedError",
"def flavors(self, details=True):\n flv = _flavor.FlavorDetail if details else _flavor.Flavor\n return list(self._list(flv, paginated=True))",
"def flavors(self, **kwargs):\n if kwargs is None:\n result = self.get... | [
"0.74028367",
"0.6779597",
"0.6729681",
"0.64055777",
"0.6195069",
"0.59106874",
"0.59053063",
"0.58540213",
"0.5842893",
"0.5784032",
"0.57393897",
"0.5738477",
"0.5722725",
"0.5588289",
"0.5528176",
"0.54953",
"0.5488104",
"0.54655933",
"0.54139316",
"0.5388655",
"0.5348195... | 0.679078 | 1 |
Find a single instance | def find_instance(self, name_or_id, ignore_missing=True):
return self._find(
_instance.Instance, name_or_id, ignore_missing=ignore_missing
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_instance(cls, identifier):\r\n for instance in cls.all:\r\n if instance.identifier == identifier:\r\n return instance\r\n return None",
"def find(cls, **kwargs):\n return cls.query.filter_by(**kwargs).first()",
"def find(self, **kwargs):\n rl = sel... | [
"0.7728593",
"0.71363354",
"0.7030264",
"0.6881119",
"0.68568933",
"0.68549156",
"0.6848733",
"0.6823757",
"0.6800267",
"0.6779677",
"0.67150754",
"0.6676291",
"0.6646991",
"0.6642961",
"0.65998936",
"0.6545709",
"0.6520098",
"0.6490596",
"0.64855844",
"0.6475394",
"0.6446852... | 0.7567719 | 1 |
Get a single instance | def get_instance(self, instance):
return self._get(_instance.Instance, instance) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetInstance():\n pass",
"def get_instance(self, instance_id):\n return self.instances.get(instance_id)",
"def get_instance(cls, *args, **kwargs):\n if cls._instance is not None:\n return cls._instance\n return cls(*args, **kwargs)",
"def _get_instance(self):\n ... | [
"0.7694641",
"0.75701267",
"0.75683355",
"0.7447133",
"0.7252449",
"0.7242679",
"0.7239021",
"0.7208093",
"0.71733356",
"0.71482056",
"0.71482056",
"0.7138967",
"0.70699036",
"0.7006299",
"0.69852996",
"0.69710827",
"0.69649774",
"0.69454527",
"0.69406265",
"0.6925822",
"0.68... | 0.7944661 | 0 |
Add a user to 'prospects' unless the user is the campaign owner or is already linked to 'workers', 'prospects', or 'blacklist'. Also decline to add prospects when the campaign is not active. user A TcsUser instance to link to 'prospects' | def addProspect(self, user):
if self.is_active and (user != self.owner) and not self.prospects.filter(pk=user.id).exists() \
and not self.workers.filter(pk=user.id) and not self.blacklist.filter(pk=user.id).exists():
self.prospects.add(user)
return self
return Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addWorker(self, user):\n if (user != self.owner) and not self.workers.filter(pk=user.id).exists():\n self.workers.add(user)\n if self.prospects.filter(pk=user.id).exists():\n self.prospects.remove(user)\n if self.blacklist.filter(pk=user.id).exists():\n ... | [
"0.57529235",
"0.57101214",
"0.56048286",
"0.549154",
"0.52644926",
"0.516734",
"0.51544005",
"0.50623524",
"0.49674854",
"0.49344334",
"0.48778322",
"0.48658597",
"0.48227632",
"0.481681",
"0.4816524",
"0.48090467",
"0.48052084",
"0.47986007",
"0.4791924",
"0.47789344",
"0.4... | 0.8156176 | 0 |
Remove the user from the lists of workers and prospects, if applicable, and add the user to the blacklist. Note that adding somebody as a worker removes the person from the blacklist. user A TcsUser instance to link to the blacklist | def addToBlacklist(self, user):
if (user != self.owner) and not self.blacklist.filter(pk=user.id).exists():
self.blacklist.add(user)
if self.prospects.filter(pk=user.id).exists():
self.prospects.remove(user)
if self.workers.filter(pk=user.id).exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def add_blacklist(self, ctx, user: discord.Member):\r\n if user.id not in self.settings['blacklist']:\r\n try:\r\n self.settings['blacklist'].append(user.id)\r\n await ctx.send(\"User blacklisted.\")\r\n except:\r\n await ctx.send(\"An... | [
"0.74218553",
"0.7352311",
"0.7122453",
"0.67325133",
"0.6435446",
"0.6364521",
"0.6361342",
"0.6294082",
"0.6188603",
"0.58658487",
"0.5860538",
"0.58456814",
"0.58305186",
"0.58287203",
"0.57763344",
"0.57541144",
"0.56883603",
"0.5684058",
"0.55988926",
"0.55928737",
"0.55... | 0.81987846 | 0 |
Remove the user from 'prospects' and 'blacklist', if applicable, and add the user to 'workers'. Note that adding somebody as a worker removes the person from the blacklist. user A TcsUser instance to link to workers | def addWorker(self, user):
if (user != self.owner) and not self.workers.filter(pk=user.id).exists():
self.workers.add(user)
if self.prospects.filter(pk=user.id).exists():
self.prospects.remove(user)
if self.blacklist.filter(pk=user.id).exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addToBlacklist(self, user):\n if (user != self.owner) and not self.blacklist.filter(pk=user.id).exists():\n self.blacklist.add(user)\n if self.prospects.filter(pk=user.id).exists():\n self.prospects.remove(user)\n if self.workers.filter(pk=user.id).exists(... | [
"0.7682945",
"0.6766191",
"0.6598563",
"0.62174505",
"0.60659224",
"0.5727882",
"0.56629395",
"0.5472015",
"0.54637945",
"0.54543555",
"0.53860176",
"0.53835195",
"0.53404295",
"0.5299187",
"0.5298164",
"0.5247873",
"0.5234306",
"0.5230454",
"0.52074",
"0.51751196",
"0.516473... | 0.7764532 | 0 |
Return active constituent voters who have not been contacted since the last election and have not been served to a supporter in the last two days. Don't limit the size of the result set here; let APIs do that. | def getVotersToContact(self):
two_days_ago = date.today() - timedelta(2)
year_ago = date.today() - timedelta(365)
return self.voters.filter(
Q(campaignstovoters__last_served=None) | Q(campaignstovoters__last_served__lt=two_days_ago),
Q(campaignstovoters__last_contacted=No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _inactiveplayers():\n\n rosters = _activerosters()\n dbrosters = _eidset() # players not in rosters scrape but in db.\n notactive = dbrosters.difference(rosters)\n return notactive",
"def getVotersToDial(self):\n return self.getVotersToContact().exclude(\n (Q(phone_number1='') ... | [
"0.6028861",
"0.5758767",
"0.5515115",
"0.54826623",
"0.5425473",
"0.5403842",
"0.53461355",
"0.5314975",
"0.5251976",
"0.5220554",
"0.5220554",
"0.5193499",
"0.51809436",
"0.51725066",
"0.517217",
"0.5158285",
"0.51561767",
"0.5152371",
"0.51470834",
"0.51421833",
"0.5122205... | 0.65486276 | 0 |
Return active constituent voters with valid phone contact information who have not been contacted since the last election. Don't limit the size of the result set here; let APIs do that. | def getVotersToDial(self):
return self.getVotersToContact().exclude(
(Q(phone_number1='') | Q(wrong_phone_number1__gt=1)),
(Q(phone_number2='') | Q(wrong_phone_number2__gt=1))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVotersToContact(self):\n two_days_ago = date.today() - timedelta(2)\n year_ago = date.today() - timedelta(365)\n return self.voters.filter(\n Q(campaignstovoters__last_served=None) | Q(campaignstovoters__last_served__lt=two_days_ago),\n Q(campaignstovoters__last_co... | [
"0.6920536",
"0.57854915",
"0.5222731",
"0.50926673",
"0.5040607",
"0.502312",
"0.50023216",
"0.48708686",
"0.48509404",
"0.48265207",
"0.48217788",
"0.48114735",
"0.47936308",
"0.47893497",
"0.47839564",
"0.47823417",
"0.47818604",
"0.4778862",
"0.47737798",
"0.47727492",
"0... | 0.671149 | 1 |
Remove the user from 'workers' or 'prospects', if applicable. user A TcsUser instance to remove from workers | def removeWorker(self, user):
if user == self.owner:
return None
# Without these queries, there's no way to tell if anything actually gets removed.
# Calling remove() on a user that is not in the set does not raise an error.
if self.workers.filter(pk=user.id).exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_candidate(self, user):\n self.assignment_related_users.filter(user=user).delete()\n inform_changed_data(self)",
"def remove(self, user):\n self.packet.send_room([\"rp\", user.get_int_id(self.rooms),\n user.data.id], user.room)\n self.rooms[user... | [
"0.6894938",
"0.68542784",
"0.685336",
"0.67998946",
"0.6638343",
"0.6393456",
"0.63634795",
"0.6293484",
"0.6282741",
"0.6280759",
"0.6247314",
"0.62332475",
"0.6231962",
"0.6227879",
"0.61912465",
"0.6178004",
"0.6158775",
"0.6148308",
"0.6134449",
"0.6126714",
"0.6120114",... | 0.7817377 | 0 |
Return the number of voters a user has contacted for the campaign. | def voterContactCount(self, user):
return self.votercontact_set.filter(user=user).count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_ver_sponsors(model):\n n_agents = len([k for k, v in model.schedule.agents_by_type['Customer'].items() if v.__class__.__name__ == 'VerificationSponsor'])\n return n_agents",
"def nay_voter_cnt(self):\n\n return len(self._nay_voters())",
"def present_voter_cnt(self):\n\n re... | [
"0.6371157",
"0.63698155",
"0.63018495",
"0.60611516",
"0.6054053",
"0.6027923",
"0.6018428",
"0.59854454",
"0.5949555",
"0.59482515",
"0.5914123",
"0.58427924",
"0.57395315",
"0.57395315",
"0.57389605",
"0.5730802",
"0.57079923",
"0.57007176",
"0.56978345",
"0.5668029",
"0.5... | 0.7715844 | 0 |
Returns an indented representation of the nested dictionary. | def pretty_repr(self, num_spaces=4):
def pretty_dict(x):
if not isinstance(x, dict):
return repr(x)
rep = ''
for key, val in x.items():
rep += f'{key}: {pretty_dict(val)},\n'
if rep:
return '{\n' + _indent(rep, num_spaces) + '}'
else:
return '{}'
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_dict(self, dict_, indent=0):\n prefix = indent*\" \"*4\n output = \"{\\n\"\n for key, val in sorted(dict_.items()):\n if isinstance(val, dict):\n rval = self._format_dict(val, indent+1)\n else:\n rval = repr(val)\n outp... | [
"0.73564094",
"0.7016583",
"0.7004065",
"0.69742304",
"0.69219863",
"0.6862406",
"0.68234503",
"0.6813462",
"0.6663069",
"0.6650337",
"0.66487944",
"0.6608814",
"0.65994126",
"0.65836185",
"0.6566666",
"0.6555802",
"0.6501829",
"0.6487838",
"0.6477041",
"0.6438375",
"0.643526... | 0.70187014 | 1 |
Create a new FrozenDict with additional or replaced entries. | def copy(
self, add_or_replace: Mapping[K, V] = MappingProxyType({})
) -> 'FrozenDict[K, V]':
return type(self)({**self, **unfreeze(add_or_replace)}) # type: ignore[arg-type] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze(xs: Mapping[Any, Any]) -> FrozenDict[Any, Any]:\n return FrozenDict(xs)",
"def fromkeys(iterable, value=None):\n return FrozenDict(dict.fromkeys(iterable, value))",
"def copy(\n x: Union[FrozenDict, Dict[str, Any]],\n add_or_replace: Union[FrozenDict[str, Any], Dict[str, Any]] = Frozen... | [
"0.7146128",
"0.68393993",
"0.65283275",
"0.6507282",
"0.5816068",
"0.5484915",
"0.5304193",
"0.5286141",
"0.5152492",
"0.5124631",
"0.5105132",
"0.50970227",
"0.5096764",
"0.5051437",
"0.5042281",
"0.49775112",
"0.49529138",
"0.4934736",
"0.49311805",
"0.48632023",
"0.485795... | 0.70710015 | 1 |
Deep copy unfrozen dicts to make the dictionary FrozenDict safe. | def _prepare_freeze(xs: Any) -> Any:
if isinstance(xs, FrozenDict):
# we can safely ref share the internal state of a FrozenDict
# because it is immutable.
return xs._dict # pylint: disable=protected-access
if not isinstance(xs, dict):
# return a leaf as is.
return xs
# recursively copy dicti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfreeze(x: Union[FrozenDict, Dict[str, Any]]) -> Dict[Any, Any]:\n if isinstance(x, FrozenDict):\n # deep copy internal state of a FrozenDict\n # the dict branch would also work here but\n # it is much less performant because jax.tree_util.tree_map\n # uses an optimized C implementation.\n ret... | [
"0.71733785",
"0.7037678",
"0.65864396",
"0.6474158",
"0.62573695",
"0.6152454",
"0.61428803",
"0.6087053",
"0.6052837",
"0.60174745",
"0.5997487",
"0.59899086",
"0.5918377",
"0.5899443",
"0.5898595",
"0.5892593",
"0.5735094",
"0.572419",
"0.5684948",
"0.56120795",
"0.5609732... | 0.7742294 | 0 |
Unfreeze a FrozenDict. Makes a mutable copy of a `FrozenDict` mutable by transforming it into (nested) dict. | def unfreeze(x: Union[FrozenDict, Dict[str, Any]]) -> Dict[Any, Any]:
if isinstance(x, FrozenDict):
# deep copy internal state of a FrozenDict
# the dict branch would also work here but
# it is much less performant because jax.tree_util.tree_map
# uses an optimized C implementation.
return jax.tre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_freeze(xs: Any) -> Any:\n if isinstance(xs, FrozenDict):\n # we can safely ref share the internal state of a FrozenDict\n # because it is immutable.\n return xs._dict # pylint: disable=protected-access\n if not isinstance(xs, dict):\n # return a leaf as is.\n return xs\n # recursive... | [
"0.678866",
"0.63871247",
"0.63075334",
"0.6243246",
"0.61387753",
"0.61324066",
"0.5833921",
"0.56678116",
"0.5610028",
"0.5581237",
"0.547987",
"0.528664",
"0.5166779",
"0.51488274",
"0.5131935",
"0.513004",
"0.5127286",
"0.51143354",
"0.5108335",
"0.5104038",
"0.50658894",... | 0.80311483 | 0 |
Create a new dict with additional and/or replaced entries. This is a utility function that can act on either a FrozenDict or regular dict and mimics the behavior of `FrozenDict.copy`. | def copy(
x: Union[FrozenDict, Dict[str, Any]],
add_or_replace: Union[FrozenDict[str, Any], Dict[str, Any]] = FrozenDict(
{}
),
) -> Union[FrozenDict, Dict[str, Any]]:
if isinstance(x, FrozenDict):
return x.copy(add_or_replace)
elif isinstance(x, dict):
new_dict = jax.tree_map(lambda x:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(\n self, add_or_replace: Mapping[K, V] = MappingProxyType({})\n ) -> 'FrozenDict[K, V]':\n return type(self)({**self, **unfreeze(add_or_replace)}) # type: ignore[arg-type]",
"def _prepare_freeze(xs: Any) -> Any:\n if isinstance(xs, FrozenDict):\n # we can safely ref share the internal stat... | [
"0.7882248",
"0.69423527",
"0.6703827",
"0.66988987",
"0.65337425",
"0.6381466",
"0.6357913",
"0.63407815",
"0.63111323",
"0.6289166",
"0.6279252",
"0.626923",
"0.62294686",
"0.61992794",
"0.6063225",
"0.60579437",
"0.6037078",
"0.6023079",
"0.5997253",
"0.59942675",
"0.59496... | 0.8017656 | 0 |
Create a new dict where one entry is removed. This is a utility function that can act on either a FrozenDict or regular dict and mimics the behavior of `FrozenDict.pop`. | def pop(
x: Union[FrozenDict, Dict[str, Any]], key: str
) -> Tuple[Union[FrozenDict, Dict[str, Any]], Any]:
if isinstance(x, FrozenDict):
return x.pop(key)
elif isinstance(x, dict):
new_dict = jax.tree_map(lambda x: x, x) # make a deep copy of dict x
value = new_dict.pop(key)
return new_dict, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, key: K) -> Tuple['FrozenDict[K, V]', V]:\n value = self[key]\n new_dict = dict(self._dict)\n new_dict.pop(key)\n new_self = type(self)(new_dict)\n return new_self, value",
"def dict_pop(d, key):\n return d.pop(key)",
"def remove_element( self, dictionary, key):\n\n _dict ... | [
"0.70482343",
"0.67293966",
"0.6490357",
"0.6465873",
"0.61706996",
"0.6144822",
"0.6001672",
"0.59998095",
"0.5967065",
"0.59639794",
"0.5955744",
"0.59308225",
"0.588004",
"0.58719283",
"0.58055025",
"0.57446265",
"0.57119524",
"0.56699175",
"0.5650597",
"0.56066054",
"0.55... | 0.7112404 | 0 |
Returns an indented representation of the nested dictionary. This is a utility function that can act on either a FrozenDict or regular dict and mimics the behavior of `FrozenDict.pretty_repr`. If x is any other dtype, this function will return `repr(x)`. | def pretty_repr(x: Any, num_spaces: int = 4) -> str:
if isinstance(x, FrozenDict):
return x.pretty_repr()
else:
def pretty_dict(x):
if not isinstance(x, dict):
return repr(x)
rep = ''
for key, val in x.items():
rep += f'{key}: {pretty_dict(val)},\n'
if rep:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_repr(self, num_spaces=4):\n\n def pretty_dict(x):\n if not isinstance(x, dict):\n return repr(x)\n rep = ''\n for key, val in x.items():\n rep += f'{key}: {pretty_dict(val)},\\n'\n if rep:\n return '{\\n' + _indent(rep, num_spaces) + '}'\n else:\n ... | [
"0.7736835",
"0.7247312",
"0.7021937",
"0.69802797",
"0.69656223",
"0.6918987",
"0.6832074",
"0.68211126",
"0.67912984",
"0.678275",
"0.67453086",
"0.6687921",
"0.66458195",
"0.654063",
"0.6504709",
"0.6453231",
"0.64472985",
"0.63632375",
"0.6358067",
"0.6356899",
"0.6325422... | 0.83444524 | 0 |
Load a subset of the COCO dataset. | def load_coco(self, dataset_dir, subset, year=DEFAULT_DATASET_YEAR, class_ids=None, class_names=None,
class_map=None, return_coco=False, auto_download=False):
if auto_download is True:
self.auto_download(dataset_dir, subset, year)
coco = COCO("{}/annotations/instances_{}{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cfg, train_mode, split, shot, query,\n bs, test_bs, num_workers, pin_memory,\n ret_name=False):\n if train_mode == \"train\":\n dataset = COCOTrain(cfg, split, shot, query, ret_name=ret_name)\n data_loader = DataLoader(dataset,\n batch_size=... | [
"0.62512195",
"0.6004767",
"0.5874558",
"0.5784675",
"0.57171506",
"0.56779504",
"0.5658244",
"0.5657759",
"0.56274396",
"0.5618919",
"0.5617201",
"0.55943984",
"0.55781955",
"0.55633026",
"0.55596197",
"0.5551278",
"0.54980606",
"0.54674935",
"0.5462153",
"0.54568654",
"0.54... | 0.64328516 | 0 |
Updates this store's current state with incoming data from the network. data should be a mapping containing 'metacontacts', 'order', and 'info' structures (see comment at top of file) | def update_data(self, data):
rebuild = False
# This method needs to substitute some defaultdicts for the normal
# dictionaries that come back from the server.
# Metacontact information
#if data['metacontacts']
mc_dict = data.get('metacontacts', {})
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_state_notification(self, data):\n\n self.channel_data.update(data)\n\n # synchronize DataManager data with processed update & entity data\n self.sync_data_update_ha()",
"def update(self, data):\n logging.info('update state', data)\n self._client.update_state(data)\n\n ... | [
"0.6476063",
"0.62110347",
"0.61491877",
"0.6079043",
"0.6079043",
"0.6079043",
"0.6079043",
"0.60150313",
"0.59856397",
"0.592851",
"0.5848428",
"0.58295083",
"0.58125436",
"0.579534",
"0.5732395",
"0.5716034",
"0.56988144",
"0.5688092",
"0.5683766",
"0.5636451",
"0.5636451"... | 0.70325893 | 0 |
Error in label only whitespace allowed, no tabs if checked label differs, raise an error | def CheckLabel(Line):
for i in Line:
if i == '\t': #can't detect leading tabs, stops at the first \
raise InputError(Line,"malformed input")
elif i != ' ':
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_label(self):\n nt = NewickTokenizer(newick=\"(a\\n'b',(b,c),(d,e));\")\n self.assertRaises(ValueError, nt.tokens)",
"def checkLabel(label):\n\n label = str(label)\n if not label:\n raise ValueError('label cannot be empty string')\n\n label = str(label)\n\n if not label:\... | [
"0.67585087",
"0.63081664",
"0.6136866",
"0.6121706",
"0.6079675",
"0.6045867",
"0.5986271",
"0.5970314",
"0.5936593",
"0.5910567",
"0.58990806",
"0.58863115",
"0.5881466",
"0.5871345",
"0.58665997",
"0.5764735",
"0.57456005",
"0.5732533",
"0.5719328",
"0.57080424",
"0.569958... | 0.7484639 | 0 |
parsing a given text file containing labels and sequences load file, tidy it, process each line in the file return the labels and sequences as list[tuple(string,string)] | def ParseSeqFile(FilePath):
SeqFile = rSeqFile(FilePath)
TidyFile = TidyLines(SeqFile)
result = []
for line in TidyFile:
t = ( ProcessLine(line) )
result.append(t)
return(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(filename):\n contents, labels = [], []\n with open_file(filename) as f:\n for line in f:\n try:\n label,content = line.strip().split('\\t')\n contents.append(list(content))\n labels.append(label)\n except:\n ... | [
"0.67697734",
"0.6637289",
"0.65705514",
"0.65653694",
"0.6479006",
"0.64705706",
"0.64496464",
"0.6351888",
"0.6281873",
"0.6273862",
"0.62096",
"0.6180452",
"0.6150285",
"0.6150257",
"0.61439294",
"0.612267",
"0.6109716",
"0.6100851",
"0.60979813",
"0.60872257",
"0.60840577... | 0.6663826 | 1 |
Return 'p1' if the current player is Player 1, and 'p2' if the current player is Player 2. | def get_current_player_name(self) -> str:
if self.p1_turn:
return 'p1'
return 'p2' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_player(cls, player):\n return 0 if player == 1 else 1",
"def checkval(self, P1, P2, winningval):\n if P1 == winningval:\n return \"Player 1\"\n elif P2 == winningval:\n return \"Player 2\"",
"def get_current_player(player_one_turn):\n \n # Get appropri... | [
"0.7322427",
"0.719487",
"0.71915984",
"0.71570975",
"0.7128614",
"0.7037134",
"0.7009901",
"0.69278514",
"0.6833396",
"0.6795355",
"0.6771366",
"0.6737287",
"0.64921343",
"0.6477016",
"0.63291126",
"0.63171285",
"0.62973",
"0.62973",
"0.62973",
"0.62903047",
"0.6243002",
"... | 0.73625857 | 0 |
Return whether move is a valid move for this GameState. | def is_valid_move(self, move: Any) -> bool:
return move in self.get_possible_moves() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_move(self, move):\n if self.game_state[move[0]][move[1]] is not None:\n return False\n return True",
"def valid_bool(self):\n return bool(self.piece.validate_move(self.board, self))",
"def is_valid_move(self, move):\n if type(move) == str:\n move... | [
"0.8282215",
"0.8074329",
"0.80526775",
"0.7981014",
"0.78986144",
"0.78754056",
"0.7871537",
"0.78681695",
"0.7756859",
"0.7713244",
"0.7703341",
"0.76398927",
"0.7610206",
"0.75776756",
"0.75525403",
"0.75510347",
"0.7432144",
"0.73722756",
"0.7332168",
"0.72985274",
"0.727... | 0.8471639 | 0 |
Return an estimate in interval [LOSE, WIN] of best outcome the current player can guarantee from state self. | def rough_outcome(self) -> float:
# HUYNH YOU PRICK WHY THE FUCK DO YOU MAKE US WRITE THIS SHIT EVEN IT'S NOT USED ANYWHERE
# pick move based on this may not be optimal but better than random
# return 1 if win immediately
# return -1 if all states reachable will result the other player w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rough_outcome(self) -> float:\n if is_win(self):\n return 1\n elif is_lose(self):\n return -1\n return 0",
"def rough_outcome_strategy(game: Any) -> Any:\n current_state = game.current_state\n best_move = None\n best_outcome = -2 # Temporarily -- just so w... | [
"0.7338502",
"0.7059583",
"0.7059583",
"0.7059583",
"0.7020939",
"0.6829376",
"0.6702647",
"0.6694379",
"0.66560304",
"0.6624065",
"0.6616302",
"0.6588654",
"0.6566183",
"0.6555869",
"0.6547012",
"0.6531186",
"0.6518109",
"0.6501664",
"0.6488798",
"0.6458663",
"0.6427033",
... | 0.73625016 | 0 |
Set common fields in layer to addressing dictonary. | def set_address_values(layer):
cursor = arcpy.SearchCursor(layer)
for row in cursor:
layer_fields = arcpy.ListFields(layer)
for x in range(len(layer_fields)):
layer_fields[x] = layer_fields[x].name
for key in address_dict:
if key in layer_fields and address_dict.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_attrs(self, **kwargs) -> None:\n self._obj.coords[GEO_MAP_COORD].attrs.update(**kwargs)",
"def update_asop_dict(asop_dict,region,coords,color,all_settings):\n # Set unique color\n asop_dict['color'] = color\n\n # Apply any general user settings\n asop_dict['grid_desc'] = all_settings.g... | [
"0.57628345",
"0.55964243",
"0.55274314",
"0.5520741",
"0.5513947",
"0.54532826",
"0.54528964",
"0.5352825",
"0.53380233",
"0.52978295",
"0.52767116",
"0.5263793",
"0.5233308",
"0.52296996",
"0.51820993",
"0.51604235",
"0.51503444",
"0.51213574",
"0.5110379",
"0.51047695",
"0... | 0.6680822 | 0 |
Get AWS ECS task information. For the puspose of getting the EC2 instance id by a given AWS ECS task name, for now, only the 'containerInstanceArn' is fetched from the AWS ECS task. | def get_tasks_information(
task: str,
list_tasks: str,
cluster=CLUSTER_NAME,
client=None,
region=REGION,
):
if not client:
session = boto3.session.Session()
client = session.client("ecs", region)
try:
# Get all tasks in the cluster.
cluster_tasks = client.list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(profile, cluster, tasks):\n client = boto3client.get(\"ecs\", profile)\n params = {}\n params[\"cluster\"] = cluster\n params[\"tasks\"] = tasks\n return client.describe_tasks(**params)",
"def get_task_details(self) -> task.TaskMetadata:\n return task.TaskMetadata(\n name... | [
"0.6348864",
"0.598766",
"0.5797471",
"0.5780299",
"0.57383114",
"0.56886894",
"0.56886894",
"0.56886894",
"0.56886894",
"0.5631942",
"0.55174756",
"0.5450972",
"0.5419298",
"0.54183954",
"0.54114175",
"0.5400899",
"0.53903484",
"0.53873485",
"0.5380392",
"0.53680474",
"0.536... | 0.68460375 | 0 |
Geeft bericht of iemand lang genoeg is voor de attractie. | def lang_genoeg(lengte):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substantiate():",
"def cliquer_sur_unité(self):",
"def makeGerund(self):\r\n clean_s = self.cleanString(self.text)\r\n LoW = clean_s.split()\r\n for x in LoW: \r\n if 'ing' in x and x not in self.gerund: \r\n self.gerund[x] = 1\r\n elif 'ing' in x a... | [
"0.6085675",
"0.60812867",
"0.5822387",
"0.5812007",
"0.56937695",
"0.56634116",
"0.5626631",
"0.56246907",
"0.56246907",
"0.56246907",
"0.56246907",
"0.56246907",
"0.5621488",
"0.5621488",
"0.5549839",
"0.55467236",
"0.5458848",
"0.5457804",
"0.5457804",
"0.54571193",
"0.545... | 0.7161606 | 0 |
Add a Pseudocode Operation at the actual active buffer. | def AddPseudoCode(self, pcode):
self.buffers[self.buffergrade].append(pcode) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_code(self, code):\n self.code += code",
"def add_operation(self):\n arg1 = self.memory[self.memory[self._cursor + 1]]\n arg2 = self.memory[self.memory[self._cursor + 2]]\n arg3 = self.memory[self._cursor + 3]\n self.memory[arg3] = arg1 + arg2\n # print(f'Cursor: ... | [
"0.5870351",
"0.5767791",
"0.57653064",
"0.5667283",
"0.5466743",
"0.54478973",
"0.52387804",
"0.52152646",
"0.5208209",
"0.5186463",
"0.51665425",
"0.51497793",
"0.51468796",
"0.5108849",
"0.5103262",
"0.50743014",
"0.5067011",
"0.50647295",
"0.5024439",
"0.50223887",
"0.498... | 0.7316713 | 0 |
Increment the BufferGrade and initialize a new empty buffer. | def IndentBuffer(self):
self.buffergrade += 1
self.buffers[self.buffergrade] = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fillBuffer():\n buff[bufferCounter].next = dataIn",
"def __init__(self, capacity):\n self.experiences = RingBuf(capacity)",
"def init_buffer(self):\n \n self.shape.buf = [pi3d.Buffer(self.shape, self.verts, self.texcoords, self.inds, self.norms)]\n self.shape.set_draw_det... | [
"0.58674264",
"0.5741333",
"0.5509345",
"0.54187745",
"0.537456",
"0.53408396",
"0.5315984",
"0.5291879",
"0.52720207",
"0.5246771",
"0.5140495",
"0.51366794",
"0.51127",
"0.5102545",
"0.5096625",
"0.5072083",
"0.5029141",
"0.5018385",
"0.4994677",
"0.4994677",
"0.4994677",
... | 0.730155 | 0 |
Decrement the BufferGrade and pop out the buffer active before. | def DeIndentBuffer(self):
if self.buffergrade == 0:
raise Exception("You can't deindent more.")
self.buffergrade -= 1
tmp = self.buffers[self.buffergrade + 1]
del self.buffers[self.buffergrade + 1]
return tmp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrease(self):\n self.score -= self.score",
"def decrement(self):\n self.data[self.pointer] -= 1\n self.data[self.pointer] %= 256",
"def IndentBuffer(self):\n self.buffergrade += 1\n self.buffers[self.buffergrade] = []",
"def RemoveGrade(self, grade):\n if not s... | [
"0.62998307",
"0.6187696",
"0.6057455",
"0.5972686",
"0.58809793",
"0.578995",
"0.5724787",
"0.57013",
"0.5689314",
"0.5660951",
"0.5610543",
"0.5608327",
"0.55659264",
"0.55524766",
"0.5540197",
"0.55076224",
"0.5456718",
"0.5449712",
"0.5409593",
"0.54038453",
"0.53746724",... | 0.71859 | 0 |
Get a reference to the actual buffer activated. | def RefBuffer(self):
return self.buffers[self.buffergrade] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_buffer(self):\n return self.layout.current_buffer",
"def getBuffer(self):\n return self.buffer",
"def buffer_backend(cls, *args, **kwargs):\n return cls._buffer_context",
"def current_buffer_app(self):\n return self.session.current_buffer",
"def buffer(self):\n ... | [
"0.70962286",
"0.69201726",
"0.67237633",
"0.6671908",
"0.6613722",
"0.62484485",
"0.61964005",
"0.61714095",
"0.61454296",
"0.61443",
"0.6099056",
"0.60289884",
"0.5986562",
"0.5955822",
"0.5955822",
"0.5955822",
"0.59430313",
"0.58911574",
"0.5882561",
"0.5830065",
"0.58167... | 0.7871913 | 0 |
Track a code indentation index for successive utilization. | def TrackIfIndex(self, index):
self.indentindex.append(index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_code_indent(self) -> None:\n self._parent_node.increase_code_indent()",
"def _increaseindentation(self):\n self._indentlist.append(self._curindent)\n if not self._equalsigns[-1]:\n self._curindent = self._curindent + self._indent",
"def getIndentationLevel(self, cod... | [
"0.61810654",
"0.60863245",
"0.5817759",
"0.5709027",
"0.5614261",
"0.5614261",
"0.5520226",
"0.55129415",
"0.54851073",
"0.54282254",
"0.53754544",
"0.53624535",
"0.532262",
"0.52931166",
"0.5262821",
"0.52572817",
"0.5244937",
"0.52138895",
"0.5192445",
"0.5161051",
"0.5153... | 0.70099694 | 0 |
Pop (get and remove) the last code indentation index tracked. | def PopIfIndex(self):
return self.indentindex.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decreaseindentation(self):\n self._curindent = self._indentlist.pop()",
"def pop(self) -> int:\n return self.stack.pop()",
"def pop(self) -> int:\n return self._stack.pop()",
"def pop(self) -> int:\n for i in range(len(self.stack) - 1):\n self.stack.append(self.sta... | [
"0.687736",
"0.662047",
"0.65572536",
"0.64603764",
"0.6362599",
"0.6348772",
"0.63447845",
"0.630998",
"0.6291612",
"0.6259269",
"0.624546",
"0.61962366",
"0.6184571",
"0.61161476",
"0.611117",
"0.60742784",
"0.6037302",
"0.60337037",
"0.60090023",
"0.59744895",
"0.5953556",... | 0.802693 | 0 |
Initialization of protected Operation Object attribute for subclasses. | def __init__(self):
self._OPERATION = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n self.operations = {}",
"def _init(self):\n raise NotImplementedError",
"def __init__(self):\r\n self.operation_map = {}",
"def init(self):\n raise NotImplementedError",
"def init(self):\n raise NotImplementedError",
"def __init__(self):\n ... | [
"0.69042325",
"0.6817324",
"0.66968143",
"0.65770996",
"0.65770996",
"0.6513839",
"0.6513839",
"0.6513839",
"0.6513839",
"0.64662194",
"0.6441285",
"0.642362",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",
"0.6404217",... | 0.7562495 | 0 |
Get the Operation Object generated by the command. | def getOp(self):
return self._OPERATION | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_operation_obect(self, method):\n pass",
"def get_operation(\n self,\n ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:\n # Generate a \"stub function\" on-the-fly which will actually make\n # the request.\n # gRPC handles serialization a... | [
"0.6874343",
"0.67712283",
"0.67712283",
"0.67712283",
"0.67545724",
"0.6746998",
"0.6746998",
"0.66104776",
"0.65664905",
"0.6563017",
"0.6563017",
"0.6541429",
"0.6439676",
"0.64120996",
"0.64114374",
"0.640891",
"0.64030427",
"0.6372547",
"0.6367869",
"0.6367869",
"0.63323... | 0.71553755 | 0 |
Creates a temporary image for manipulation, and handles optional RGB conversion. | def _create_tmp_image(self, content):
content.seek(0)
image = Image.open(content)
if self.force_rgb and image.mode not in ('L', 'RGB', 'RGBA'):
image = image.convert('RGB')
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temporary_unsupported_image(self):\n image = Image.new('RGB', (1, 1))\n tmp_file = tempfile.NamedTemporaryFile(suffix='.ppm')\n image.save(tmp_file, 'ppm')\n # important because after save(),\n # the fp is already at the end of the file\n tmp_file.seek(0) # retrieves ... | [
"0.67979735",
"0.6447679",
"0.6425846",
"0.6331001",
"0.6304116",
"0.6232688",
"0.6175286",
"0.60538095",
"0.6020988",
"0.6015573",
"0.59706867",
"0.59613866",
"0.5947222",
"0.5861616",
"0.5856823",
"0.5853021",
"0.5808916",
"0.5805031",
"0.57975703",
"0.5789881",
"0.57089484... | 0.70588124 | 0 |
Renders the image. Override this method when creating a custom renderer. | def _render(self, image):
raise NotImplementedError('Override this method to render images!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self) -> None:\n if self.native_rendering:\n self._render()\n else:\n self.renderer.render_image(self.get_rendered_image())",
"def _render(self):\n self.dirty = False\n self.image = self.font.render(self._text, self.aa, self.color_fg)\n self.rec... | [
"0.83629304",
"0.7514363",
"0.738157",
"0.71521425",
"0.7143713",
"0.7124317",
"0.7027804",
"0.69824153",
"0.697108",
"0.69224477",
"0.69172174",
"0.69109416",
"0.68451834",
"0.676605",
"0.6748223",
"0.66155213",
"0.660075",
"0.660075",
"0.65852135",
"0.64857286",
"0.64756054... | 0.86215574 | 0 |
Normalize, pad and batch the input images. | def preprocess_image(self, batched_inputs):
images = [x.to(self.device) for x in batched_inputs]
norms = [self.normalizer(x) for x in images]
size = (norms[0].shape[1],norms[0].shape[2])
images = ImageList.from_tensors(norms, self.backbone.size_divisibility)
return images, size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_images(data, blend_cat, Args):\n im = data['X_train']['blend_image']\n std = np.std(im)\n mean = np.mean(im)\n data['X_train']['blend_image'] = (im - mean) / std\n data['X_val']['blend_image'] = (data['X_val']['blend_image'] - mean) / std\n data['X_train'] = normalize_other_inputs(d... | [
"0.7097169",
"0.66408646",
"0.65812963",
"0.6465365",
"0.6464898",
"0.6406874",
"0.63755596",
"0.63661265",
"0.6324502",
"0.6318984",
"0.63017005",
"0.6297598",
"0.6261444",
"0.62284863",
"0.6226007",
"0.6213169",
"0.6194187",
"0.6189247",
"0.61866045",
"0.6185736",
"0.618346... | 0.67390656 | 1 |
Ensure that apigateway v1 and apigateway v2 actions are both present in the ses namespace | def test_services_with_multiple_pages_apigateway(self):
# API Gateway Management V1: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonapigatewaymanagement.html
self.assertTrue("apigateway:AddCertificateToDomain" in self.all_actions)
self.assertTrue("apigateway:Remove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gh_226_elasticloadbalancing_v1_and_v2(self):\n results = get_actions_for_service(\"elasticloadbalancing\")\n # print(json.dumps(results, indent=4))\n lb_v1_only_action = \"elasticloadbalancing:CreateTargetGroup\"\n lb_v2_only_action = \"elasticloadbalancing:SetSecurityGroups\"\... | [
"0.59183055",
"0.57958144",
"0.5341116",
"0.51459986",
"0.5056637",
"0.5025083",
"0.49718618",
"0.49709255",
"0.49639255",
"0.4939532",
"0.48318732",
"0.47402886",
"0.47391623",
"0.47184974",
"0.4717983",
"0.47155645",
"0.47113252",
"0.4703302",
"0.46926475",
"0.46769983",
"0... | 0.5989848 | 0 |
Ensure that awsmarketplace actions from all the different awsmarketplace SAR pages are present in the IAM definition. | def test_services_with_multiple_pages_aws_marketplace(self):
# Overlap: AWS Marketplace, Marketplace Catalog, and AWS Marketplace Entitlement service, AWS Marketplace Image Building Service, AWS Marketplace Metering Service, AWS Marketplace Private Marketplace, and AWS Marketplace Procurement Systems
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_actions_with_arn_type_and_access_level_case_3(self):\n desired_output = [\n 's3:PutAccountPublicAccessBlock',\n 's3:PutAccessPointPublicAccessBlock'\n ]\n output = get_actions_with_arn_type_and_access_level(\n # \"ram\", \"resource-share\", \"Write... | [
"0.58062184",
"0.57554114",
"0.5695702",
"0.5673701",
"0.5447731",
"0.5414008",
"0.53181934",
"0.5090683",
"0.5057209",
"0.49688128",
"0.49623215",
"0.49491638",
"0.49443293",
"0.49354288",
"0.4900723",
"0.48934472",
"0.48312107",
"0.48288488",
"0.47950754",
"0.4768656",
"0.4... | 0.66148233 | 0 |
Ensure that greengrass v1 and greengrass v2 actions are both present in the greengrass namespace | def test_services_with_multiple_pages_greengrass(self):
# Greengrass V1: https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotgreengrass.html
self.assertTrue("greengrass:CreateResourceDefinition" in self.all_actions)
# Greengrass V2: https://docs.aws.amazon.com/service-a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gh_226_elasticloadbalancing_v1_and_v2(self):\n results = get_actions_for_service(\"elasticloadbalancing\")\n # print(json.dumps(results, indent=4))\n lb_v1_only_action = \"elasticloadbalancing:CreateTargetGroup\"\n lb_v2_only_action = \"elasticloadbalancing:SetSecurityGroups\"\... | [
"0.62013024",
"0.5185163",
"0.51849663",
"0.50805354",
"0.50188154",
"0.49678308",
"0.49544063",
"0.49272656",
"0.49225903",
"0.49052584",
"0.4849131",
"0.48472935",
"0.47611517",
"0.4737386",
"0.47336262",
"0.46869755",
"0.46836528",
"0.4678428",
"0.46226096",
"0.46140948",
... | 0.6528508 | 0 |
Ensure that elb v1 and elb v2 actions are both present in the elasticloadbalancing namespace | def test_services_with_multiple_pages_elb(self):
results = get_actions_for_service("elasticloadbalancing")
actions = [
"elasticloadbalancing:ApplySecurityGroupsToLoadBalancer",
"elasticloadbalancing:AttachLoadBalancerToSubnets",
"elasticloadbalancing:ConfigureHealthCh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gh_226_elasticloadbalancing_v1_and_v2(self):\n results = get_actions_for_service(\"elasticloadbalancing\")\n # print(json.dumps(results, indent=4))\n lb_v1_only_action = \"elasticloadbalancing:CreateTargetGroup\"\n lb_v2_only_action = \"elasticloadbalancing:SetSecurityGroups\"\... | [
"0.7524008",
"0.5502818",
"0.53605366",
"0.5155062",
"0.50617534",
"0.5045359",
"0.49514994",
"0.4864293",
"0.48232004",
"0.47804296",
"0.47697622",
"0.4720676",
"0.47133136",
"0.4713231",
"0.47080573",
"0.4707765",
"0.47045755",
"0.46887946",
"0.46873748",
"0.4683964",
"0.46... | 0.5852793 | 1 |
Ensure that lex v1 and lex v2 actions are both present in the lex namespace | def test_services_with_multiple_pages_lex(self):
# Lex V1: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonlex.html
self.assertTrue("lex:DeleteUtterances" in self.all_actions)
# Lex V2: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_grammar_actions():\n grammar = \"\"\"\n S: A B C;\n @nonterm_action\n C: A B;\n A: \"a\";\n @term_action\n B: \"b\";\n \"\"\"\n\n called = [False, False]\n\n def nonterm_action(_, __):\n called[0] = True\n\n def term_action(_, __):\n called[1] = True\n\n... | [
"0.5523519",
"0.54551274",
"0.52533966",
"0.4947026",
"0.49150628",
"0.4877916",
"0.4869475",
"0.4861803",
"0.47912464",
"0.47661808",
"0.47431847",
"0.47416365",
"0.4730279",
"0.47081596",
"0.46722156",
"0.46685877",
"0.46628264",
"0.46338037",
"0.463026",
"0.46180958",
"0.4... | 0.6062302 | 0 |
Ensure that Kinesis Analytics V1 actions are both present in the ses namespace | def test_services_with_multiple_pages_kinesis_analytics(self):
# Kinesis Analytics V1
results = get_actions_for_service("kinesisanalytics")
actions = [
"kinesisanalytics:GetApplicationState", # Only in v1, not v2
"kinesisanalytics:ListApplications", # In both
]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_kafka_action_names_overlap_issue(self):\n # Kafka actions used to be in two pages but are now one. This verifies the current state.\n # results = get_actions_for_service(\"kafka\")\n # print(results)\n actions = [\n \"kafka:BatchAssociateScramSecret\",\n \... | [
"0.57531",
"0.5480236",
"0.5119307",
"0.5114083",
"0.50098765",
"0.49987218",
"0.4811319",
"0.47456703",
"0.4734747",
"0.4714206",
"0.4702901",
"0.4696541",
"0.46635452",
"0.46622923",
"0.4657708",
"0.46406722",
"0.46395832",
"0.45904428",
"0.45893326",
"0.45853838",
"0.45726... | 0.55055636 | 1 |
Ensure that ses v1 and ses v2 actions are both present in the ses namespace | def test_services_with_multiple_pages_ses(self):
# SES V1: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonses.html
self.assertTrue("ses:PutIdentityPolicy" in self.all_actions)
# SES V2: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gh_226_elasticloadbalancing_v1_and_v2(self):\n results = get_actions_for_service(\"elasticloadbalancing\")\n # print(json.dumps(results, indent=4))\n lb_v1_only_action = \"elasticloadbalancing:CreateTargetGroup\"\n lb_v2_only_action = \"elasticloadbalancing:SetSecurityGroups\"\... | [
"0.5713234",
"0.550883",
"0.5373594",
"0.53643465",
"0.5290291",
"0.5130985",
"0.5121447",
"0.48156258",
"0.479505",
"0.479243",
"0.47852328",
"0.47827813",
"0.47478974",
"0.4735454",
"0.4725077",
"0.47070414",
"0.46997523",
"0.4678125",
"0.46708792",
"0.4640849",
"0.46401328... | 0.62560695 | 0 |
Ensure that kafka actions are not overwritten in the IAM definition | def test_kafka_action_names_overlap_issue(self):
# Kafka actions used to be in two pages but are now one. This verifies the current state.
# results = get_actions_for_service("kafka")
# print(results)
actions = [
"kafka:BatchAssociateScramSecret",
"kafka:BatchDisa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_actions(self):\n raise NotImplementedError",
"def get_actions(self, request):\n actions = super().get_actions(request)\n if not settings.PUBLISHER_CODE:\n del actions['create_cwr']\n if 'delete_selected' in actions:\n del actions['delete_selected']\n ... | [
"0.57733667",
"0.5674129",
"0.5623118",
"0.55654687",
"0.54859173",
"0.5416407",
"0.53971905",
"0.5386766",
"0.5313959",
"0.5262459",
"0.52369434",
"0.5227309",
"0.5218352",
"0.5207143",
"0.51959413",
"0.51855755",
"0.5174657",
"0.51633334",
"0.51326454",
"0.51265115",
"0.506... | 0.67827463 | 0 |
1. Maintain a decreasing stack by scanning nums from left to right. 2. Then scan the nums from right to left and calculate the maxWidth between each ramp. | def maxWidthRamp(self, nums: list[int]) -> int:
maxWidth = 0
descStack = []
# Generate decreasing stack.
for i, num in enumerate(nums):
if not descStack or nums[descStack[-1]] > num:
descStack.append(i)
# Check elements from right to left.
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peg_width_per_levels(base_width):\n limiter = 2\n decrementer = -2\n decrementing_width = int(base_width)\n peg_count_per_level = []\n while decrementing_width >= limiter:\n peg_count_per_level.append(int(decrementing_width))\n decrementing_width += decrementer\n return peg_coun... | [
"0.6181188",
"0.61154115",
"0.61118263",
"0.58728755",
"0.5702233",
"0.5701698",
"0.5680999",
"0.55414397",
"0.553379",
"0.5523938",
"0.55195713",
"0.5513929",
"0.5513566",
"0.550096",
"0.54771763",
"0.5460938",
"0.5459851",
"0.5444232",
"0.5441669",
"0.54264915",
"0.54041374... | 0.8285866 | 0 |
Given an input (instance of the BenchInput tuple), constructs and validates a disjunctive ChaumPedersen proof, returning the time (in seconds) to do each operation. | def chaum_pedersen_bench(bi: BenchInput) -> Tuple[float, float]:
(keypair, r, s) = bi
ciphertext = get_optional(elgamal_encrypt(0, r, keypair.public_key))
start1 = timer()
proof = make_disjunctive_chaum_pedersen_zero(
ciphertext, r, keypair.public_key, ONE_MOD_Q, s
)
end1 = timer()
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part2(input):\n ps = PlanetSystem(input)\n c = ps.total_cycle_time()\n return c",
"def part_2():\n input_ = parse_input() + list(range(10, 1_000_001))\n cups = turn_input_into_cups(input_)\n cups = solve(cups, first_cup=cups[input_[0]], turns=10_000_000)\n\n return cups[1].next.number * ... | [
"0.57208085",
"0.54804933",
"0.5131725",
"0.50099516",
"0.49980843",
"0.49875277",
"0.4948482",
"0.49447292",
"0.49406472",
"0.4887707",
"0.4879715",
"0.48475006",
"0.48428223",
"0.4833638",
"0.48149478",
"0.48010787",
"0.4800391",
"0.4798947",
"0.47890905",
"0.47886792",
"0.... | 0.60869694 | 0 |
Test of function choosing if log rotation is needed | def test_need_to_rotate_log(self):
self.assertTrue(need_to_rotate_log(0, 20, 'daily', 15, 'daily'), 'rotate log by time')
self.assertFalse(need_to_rotate_log(10, 20, 'daily', 15, 'hourly'), 'do not rotate log by time')
self.assertTrue(need_to_rotate_log(10, 20, 'daily', 25, None), 'rotate log by... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_log_rotation(self):\n self.conveyer.execute(self.conveyer.log(\"{message: \\\"first\\\"}\"))\n self.conveyer.execute(self.conveyer.log(\"{message: \\\"second\\\"}\"))\n self.conveyer.execute(self.conveyer.log(\"{message: \\\"third\\\"}\"))\n filename = self.conveyer.rotate_logs... | [
"0.62220013",
"0.61344224",
"0.58783966",
"0.58642936",
"0.5808232",
"0.5750104",
"0.5715419",
"0.5713662",
"0.5678804",
"0.56212765",
"0.55951023",
"0.5573171",
"0.5567551",
"0.5551365",
"0.55413747",
"0.5514498",
"0.5495516",
"0.5494864",
"0.54912615",
"0.5475333",
"0.54750... | 0.7284713 | 0 |
Tests of try rotation with compress in configuration | def test_process_log_with_compress_in_configuration(self):
with tempfile.TemporaryDirectory() as sandbox:
with mock.patch('sys.stdout', new=io.StringIO()) as fake_stdout:
srcfile = Path(sandbox, 'pokus.log')
srcfile.touch()
destfile = Path(sandbox, 'ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compress_works(self):\n tau = 45.0\n mrate = 60.0\n Mrate = 100.0\n gain = 5\n\n tmax = 50.0\n dt = 0.2\n\n self.rule.tau = tau\n self.rule.min_rate = mrate\n self.rule.max_rate = Mrate\n self.rule.compress_rates = False\n self.rule.gain = gain\n\n self.motor.error_fct ... | [
"0.63947666",
"0.61248237",
"0.6114381",
"0.6083236",
"0.6082104",
"0.6062771",
"0.59740895",
"0.59541243",
"0.5930159",
"0.5895802",
"0.57862955",
"0.5755226",
"0.5731432",
"0.56462026",
"0.56308395",
"0.5578965",
"0.5572358",
"0.55638254",
"0.5525263",
"0.5516631",
"0.55155... | 0.62119424 | 1 |
Test get_spec_config on empty conf | def test_get_spec_config_empty(self):
spec_conf = get_spec_config({}, '')
self.assertEqual(spec_conf, {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_spec_config_defaults(self):\n spec_conf = get_spec_config({\n 'defaults': {\n 'foo': 'bar'\n }\n }, '')\n self.assertEqual(spec_conf, {'foo': 'bar'})",
"def test_config_spec(self):\n spec = self._gen.config_spec()\n self.assertIn('Numbe... | [
"0.76028246",
"0.7311133",
"0.72477543",
"0.7058012",
"0.69974715",
"0.69667923",
"0.68360406",
"0.6766845",
"0.67532086",
"0.6709966",
"0.6709966",
"0.66910833",
"0.66852343",
"0.6642581",
"0.6638022",
"0.6632264",
"0.66242176",
"0.661909",
"0.661713",
"0.6613062",
"0.660850... | 0.84538144 | 0 |
Test get_spec_config on conf with defaults | def test_get_spec_config_defaults(self):
spec_conf = get_spec_config({
'defaults': {
'foo': 'bar'
}
}, '')
self.assertEqual(spec_conf, {'foo': 'bar'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_spec_config_match(self):\n spec_conf = get_spec_config({\n 'defaults': {\n 'default_foo': 'default_bar',\n 'foo': 'bar'\n },\n 'specific': [\n {'mask': ['filenomatch'], 'foo': 'bar_nomatch'},\n {'mask':... | [
"0.77164143",
"0.7436098",
"0.7076511",
"0.7013907",
"0.6881537",
"0.6805723",
"0.678276",
"0.6729274",
"0.6729274",
"0.66931385",
"0.66794413",
"0.6565056",
"0.6563163",
"0.65287656",
"0.6503387",
"0.64884305",
"0.64868605",
"0.6484734",
"0.6454509",
"0.6409027",
"0.63939387... | 0.8287769 | 0 |
Test get_spec_config on matching conf | def test_get_spec_config_match(self):
spec_conf = get_spec_config({
'defaults': {
'default_foo': 'default_bar',
'foo': 'bar'
},
'specific': [
{'mask': ['filenomatch'], 'foo': 'bar_nomatch'},
{'mask': ['filematch'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_config_spec(self):\n spec = self._gen.config_spec()\n self.assertIn('Number of examples', spec)\n self.assertIn('Maximum number of columns to change', spec)\n self.assertIn('Regression threshold', spec)\n self.assertIn('Prediction key', spec)",
"def test_get_spec_config_defaults(self):\n ... | [
"0.7582333",
"0.67213416",
"0.6621223",
"0.66077214",
"0.6536261",
"0.65335846",
"0.64342177",
"0.6432759",
"0.6411313",
"0.6303535",
"0.62789136",
"0.6260329",
"0.62516683",
"0.6249136",
"0.6229848",
"0.6223742",
"0.6223742",
"0.62210363",
"0.61939514",
"0.617981",
"0.615186... | 0.8165602 | 0 |
Check that given modifier name is valid one. If not raise exception based on violation. | def _isValidModifier(self, modifiers, modifierName):
if Modifiers.ILLEGAL_MODIFIER_PATTER.search(modifierName):
msg = ('Modifier named "{0}" in sheet {1} contains illegal characters. '
'Supported characters are a to z, A to Z, 0 to 9 and underscore "_". '
'Space... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateName(name):\r\n if not name:\r\n raise IllegalName('Name can not be an empty string.')\r\n\r\n m = _NAME_RE.match(name)\r\n\r\n if m is None or m.group(0) != name:\r\n raise IllegalName('Name has to start with a letter followed by an '\r\n 'arbitrary numb... | [
"0.64032656",
"0.63721097",
"0.6336271",
"0.62860745",
"0.62444806",
"0.6232126",
"0.6111689",
"0.6085224",
"0.60028106",
"0.59533495",
"0.5930594",
"0.59233236",
"0.5870704",
"0.58153677",
"0.5802187",
"0.5795572",
"0.57821715",
"0.5776781",
"0.5740856",
"0.5735548",
"0.5728... | 0.78125316 | 0 |
Determines if a given datetime.datetime is aware. | def is_aware(value):
return value.tzinfo is not None and value.tzinfo.utcoffset(value) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_aware(value: datetime) -> bool:\n\n return value.utcoffset() is not None",
"def test_make_datetime_aware(settings):\n # Set the TIME_ZONE in the settings.\n settings.TIME_ZONE = \"America/New_York\"\n\n # Calling make_datetime_aware() returns a timezone-aware datetime referring\n # to the m... | [
"0.7423152",
"0.6706246",
"0.656491",
"0.65267324",
"0.6137775",
"0.60896856",
"0.6019291",
"0.59568536",
"0.57755363",
"0.57708514",
"0.5679119",
"0.5660917",
"0.56022364",
"0.55941117",
"0.5527686",
"0.55162454",
"0.54947275",
"0.5432787",
"0.5420078",
"0.5379313",
"0.53406... | 0.6891435 | 1 |
Define ZMQ connection and return socket to work with | def connect_to_worker():
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5555")
return socket | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_trader_connector():\n context = zmq.Context()\n socket = context.socket(zmq.REQ)\n socket.connect(SOCKET_LOCAL_HOST)\n return socket",
"def socket(self):\n if not hasattr(self, \"_socket\"):\n # create a new one\n self._socket = self.context.socke... | [
"0.7175116",
"0.70785046",
"0.6988766",
"0.690476",
"0.67760694",
"0.673751",
"0.664417",
"0.65480554",
"0.64834565",
"0.6372554",
"0.62621725",
"0.6188751",
"0.6151901",
"0.614989",
"0.6100526",
"0.60442936",
"0.6018518",
"0.60160136",
"0.59882885",
"0.5986249",
"0.5965816",... | 0.77242374 | 0 |
Used to handle not responding zmq server | def raise_timeout(*args, **kwargs):
raise ZMQNotResponding('ZMQ server is not responding') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_zmq_exit():\n import zmq\n ctx = zmq.Context.instance()\n ctx.term()",
"def test_recv_nomsg(self):\n flag, msg_recv = self.recv_instance.recv(timeout=self.sleeptime)\n assert(not flag)\n nt.assert_equal(msg_recv, self.recv_instance.eof_msg)",
"def connectionLost(reason):",... | [
"0.6562494",
"0.62199134",
"0.62131953",
"0.61594874",
"0.61404806",
"0.6073438",
"0.6002306",
"0.59552497",
"0.5933235",
"0.59127086",
"0.5870852",
"0.58468467",
"0.5773297",
"0.5767091",
"0.5763371",
"0.57514524",
"0.5717791",
"0.57169217",
"0.5679771",
"0.56770015",
"0.567... | 0.71370596 | 0 |
this functions creates a draft with the email data given the user id should be either 'me', either 'users/email.com' either 'users/{AAD_userId}', | def create_draft(auth, subject, body, addresses, user_id, cc_addresses=[], attachments_list=None):
data = {}
data['Subject'] = subject
data['Body'] = {}
data['Body']['ContentType'] = 'HTML'
data['Body']['Content'] = body
data['ToRecipients'] = [{'EmailAddress': {'Address': addr}} for addr ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_email(context, params):\n updated = {}\n for key in params:\n updated[camelcase_to_underscore(key)] = params[key]\n params = updated\n if not params.get('val') or params.get('is_deleted'):\n return None\n form_email = dict()\n if not params.get('label'):\n form_ema... | [
"0.6185358",
"0.5889587",
"0.56886303",
"0.563527",
"0.5423166",
"0.5389278",
"0.53863585",
"0.5356391",
"0.5334495",
"0.5330233",
"0.53246087",
"0.53019273",
"0.5286498",
"0.5276959",
"0.5267437",
"0.5240132",
"0.5237234",
"0.5231543",
"0.52308434",
"0.5228887",
"0.5216414",... | 0.73411775 | 0 |
iterator which goes through all the pages to find all the emails | def get_all_emails_it(auth, user_id, folder_id='AllItems', pages_limit=None, pages_size=50, **kwargs):
i = 0
args_dict = dict(kwargs, top=pages_size, skip=pages_size * i)
curr_emails = get_emails(auth, user_id, folder_id, **args_dict)
while len(curr_emails) != 0:
yield curr_emails
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_email_addresses(startdate, enddate, user, password):\n emails = []\n page = 1\n more_pages = True\n\n while more_pages:\n response = requests.get(\n 'https://restapi.surveygizmo.com/v2/survey/{survey}'\n '/surveyresponse?'\n 'filter[field][0]=datesubmitte... | [
"0.6516295",
"0.64715",
"0.6371025",
"0.6256334",
"0.6235852",
"0.61884665",
"0.61240774",
"0.6112633",
"0.6023784",
"0.60078543",
"0.59824973",
"0.59707236",
"0.5946463",
"0.5928901",
"0.5901219",
"0.58981884",
"0.5887079",
"0.5860919",
"0.5854434",
"0.58382696",
"0.5836329"... | 0.71289283 | 0 |
Calculate the masked ratio. | def get_masked_ratio(mask):
hist = mask.histogram()
return hist[0] / np.prod(mask.size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maskedFraction(self):\n\n\t\tif not self._masked:\n\t\t\treturn 0.0\n\t\telse:\n\t\t\treturn self._masked_fraction",
"def maskedFraction(self):\n\n\t\treturn self._masked_fraction",
"def bw_ratio(self):\r\n bw = self.bwstats.mean\r\n if bw == 0.0: return 0\r\n else: return self.bw/(1024.*bw)",
"... | [
"0.7183577",
"0.6947266",
"0.6375616",
"0.62425804",
"0.6177991",
"0.6146051",
"0.6002309",
"0.5985765",
"0.59175396",
"0.58450127",
"0.5783589",
"0.5759599",
"0.57562935",
"0.56993043",
"0.56441855",
"0.56413704",
"0.5576878",
"0.55284727",
"0.54961735",
"0.5492076",
"0.5457... | 0.78421235 | 0 |
Create a dictionary with domain architectures exclusive in a single pathogen type group. | def generateArchitectureDataStructure(db, collapse_pathogen_groups=False):
# Calculate total numbers of species and strains for each pathogen group
counts_species_pathogen_dict = defaultdict(lambda: defaultdict(int))
for row in db.getNumSpeciesPathogen():
counts_species_pathogen_dict[row['pathogen_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environments_of(groups):\n types = {}\n for group in groups:\n for env in group.environments:\n et = env.environmentType\n envs = types.setdefault((et.id, et.name), set())\n envs.add((env.id, env.name))\n return types",
"def build_groupings(idir: str) -> dict:... | [
"0.53147066",
"0.5278428",
"0.51913285",
"0.5105832",
"0.5089798",
"0.5063621",
"0.5043128",
"0.5004288",
"0.49817312",
"0.4942777",
"0.49404955",
"0.49214888",
"0.49084446",
"0.48987442",
"0.48879838",
"0.4885036",
"0.48838812",
"0.48718145",
"0.4864769",
"0.4852137",
"0.483... | 0.56843174 | 0 |
Boolean function to check if a given architecture is exclusive. | def exclusive_arch(pathogen_groups_set, collapse_pathogen_groups):
if len(pathogen_groups_set) == 1:
return True
# Only check pathogen grouping when the flag is on
if collapse_pathogen_groups:
if len(pathogen_groups_set) > 2:
return False
if 0 in pathogen_groups_set and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_logical(*args):\n return _ida_hexrays.is_logical(*args)",
"def __bool__(self):\n return any(self.smask)",
"def is_infrastructure (self):\n return sum([1 for i in self.infras]) != 0",
"def is_exclusive(self):\n return self.exclusive",
"def incompatible_architecture(self) -> bool:\n ... | [
"0.588355",
"0.5876618",
"0.58541375",
"0.58166057",
"0.5798117",
"0.5712255",
"0.5689939",
"0.5669322",
"0.5637539",
"0.5548849",
"0.5544105",
"0.5517736",
"0.54952157",
"0.5487494",
"0.5465993",
"0.5461534",
"0.54453385",
"0.5438241",
"0.5419825",
"0.53650993",
"0.53650993"... | 0.59786093 | 0 |
returns True if employee has rejoined otherwise False | def is_rejoinee(self):
return len(self._start_date) > 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_employee():\n return _is_member('uw_employee')",
"def is_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return (self.date_joined + expiration_date <= datetime.datetime.now())",
"def is_expired(self):\n expiration_date = datetime.tim... | [
"0.6680365",
"0.587085",
"0.58500487",
"0.57760894",
"0.5741819",
"0.57230127",
"0.56929135",
"0.56781346",
"0.56605685",
"0.5577466",
"0.55369276",
"0.5530934",
"0.55146056",
"0.55014586",
"0.54542553",
"0.5392969",
"0.5388207",
"0.53847474",
"0.5377452",
"0.53713554",
"0.53... | 0.61320335 | 1 |
Process the Exit of employee | def process_employee_exit(self):
if self.is_employee_serving():
self._end_date.append(datetime.now().isoformat())
print(f"Successfully processed exit for employee {self.name} on" \
f"{self._end_date[-1]}\nWe wish {self.name} for future endeavours")
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_exit(self, args):\n return -1",
"def identify_result_exit(self, record):\n return [\"exit\"]",
"def exit(self):\n pass",
"def _PExit(self, m):\n pass",
"def user_exit(cls):\n cls.exit_program(ErrorCodes.E_USER_EXIT)",
"def do_exit(self, line): \n sys.exit(0)... | [
"0.66456366",
"0.66187525",
"0.6506358",
"0.64646137",
"0.6454185",
"0.6431671",
"0.63921857",
"0.63420844",
"0.63289636",
"0.6281149",
"0.6274805",
"0.6250398",
"0.6227689",
"0.6203884",
"0.6194826",
"0.6160062",
"0.6157645",
"0.61544615",
"0.61414033",
"0.6138231",
"0.61304... | 0.8065909 | 0 |
Takes a full media url from Bandwidth and extracts the media id | def get_media_id(media_url):
split_url = media_url.split("/")
#Media urls of the format https://messaging.bandwidth.com/api/v2/users/123/media/file.png
if split_url[-2] == "media":
return split_url[-1]
#Media urls of the format https://messaging.bandwidth.com/api/v2/users/123/media/abc/0/file.pn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_id(self):\n try:\n return Html.toId(self.content)\n except:\n Mp3Error(1)",
"def _id_from_url(url):\n url = re.sub(r'\\?.*', '', url)\n video_id = url.split('/')[-2]\n return video_id",
"def media_content_id(self):\n return self._media_u... | [
"0.65878916",
"0.6518125",
"0.6397448",
"0.6382529",
"0.61623603",
"0.61505437",
"0.6048567",
"0.60049254",
"0.60015476",
"0.5999453",
"0.5963927",
"0.5951866",
"0.59363306",
"0.59259576",
"0.59230775",
"0.5900245",
"0.5842724",
"0.5811348",
"0.57866263",
"0.5779499",
"0.5772... | 0.79839915 | 0 |
Takes a full media url from Bandwidth and extracts the filename | def get_media_filename(media_url):
return media_url.split("/")[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_file_path(self, url):\n try:\n row = ET.fromstring(self._session.get(url, headers={\"Access-Token\":self._token}).text)[1][2][1]\n data = [row[1].text, row[1].text, row[2].text]\n if \" - S\" in data[0]:\n data[0] = data[0][0:data[1].rfind(\" - S\")]\... | [
"0.7303174",
"0.70052874",
"0.68807364",
"0.67521065",
"0.67236215",
"0.66535795",
"0.661498",
"0.6603966",
"0.6586546",
"0.6538387",
"0.6509765",
"0.64932483",
"0.64535576",
"0.6430052",
"0.638914",
"0.63559645",
"0.6279012",
"0.62202466",
"0.6168988",
"0.61595553",
"0.60698... | 0.7981755 | 0 |
Takes a list of media urls and downloads the media into the temporary storage | def download_media_from_bandwidth(media_urls):
downloaded_media_files = []
for media_url in media_urls:
media_id = get_media_id(media_url)
filename = get_media_filename(media_url)
with open(filename, "wb") as f:
try:
downloaded_media = messaging_client.get_med... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downloadLocal(url_list,path):\n print(\"You are downloading {} images\".format(parser_arguments().limit),end=\" \");print(\"of {} class.\".format(parser_arguments().classes))\n print(\"Please, be patient :)\")\n for i in range(len(url_list)):\n filename= url_list[i].split(\"/\")[-1] # name of t... | [
"0.66829646",
"0.6647512",
"0.6639991",
"0.6638432",
"0.66363764",
"0.6452788",
"0.6394921",
"0.63525635",
"0.6312523",
"0.6243412",
"0.6240311",
"0.61974305",
"0.6190884",
"0.61289537",
"0.6114882",
"0.6058402",
"0.6052626",
"0.6050897",
"0.59977293",
"0.5993598",
"0.5966962... | 0.75554264 | 0 |
Takes a list of media files and uploads them to Bandwidth The media file names are used as the media id | def upload_media_to_bandwidth(media_files):
for filename in media_files:
with open(filename, "rb") as f:
file_content = f.read()
try:
##Note: The filename is doubling as the media id##
response = messaging_client.upload_media(MESSAGING_ACCOUNT_ID, file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_files(self, files):\n\n for f in files:\n self.scp.put(f, recursive=True)",
"def upload(self, folder_list, files):\n current_folder_id = self.top_folder_id\n for fname in folder_list:\n current_folder_id = self._fetch_or_create_folder(fname, current_folder_id)\n for fil... | [
"0.619183",
"0.60925543",
"0.6053126",
"0.5934323",
"0.59186196",
"0.57231236",
"0.5704533",
"0.57031876",
"0.57009745",
"0.56800365",
"0.5639666",
"0.5630675",
"0.56029576",
"0.56010246",
"0.55941606",
"0.5494556",
"0.54650325",
"0.54639095",
"0.5461023",
"0.5386679",
"0.536... | 0.8371117 | 0 |
Removes all of the given files | def remove_files(files):
for file_name in files:
os.remove(file_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_files(self, files: Set[str]) -> None:\n for f in files:\n src = os.path.join(self.get_directory(), f)\n os.remove(src)",
"def clean(files):\n\tfor file in files:\n\t\ttry:\n\t\t\tos.remove(file)\n\t\texcept Exception as e:\n\t\t\tprint(e)",
"def remove_files(file_list):\... | [
"0.8326417",
"0.8259835",
"0.7764254",
"0.7697654",
"0.76045775",
"0.76031864",
"0.7492463",
"0.7479637",
"0.7377181",
"0.73686516",
"0.7330737",
"0.7330138",
"0.7317665",
"0.7217544",
"0.72154135",
"0.720359",
"0.719617",
"0.71945643",
"0.71943825",
"0.71901155",
"0.71693027... | 0.8486456 | 0 |
Takes information from a Bandwidth inbound message callback that includes media and responds with a text message containing the same media sent through Bandwidth's media resource. | def handle_inbound_media_mms(to, from_, media):
downloaded_media_files = download_media_from_bandwidth(media)
upload_media_to_bandwidth(downloaded_media_files)
remove_files(downloaded_media_files)
body = MessageRequest()
body.application_id = MESSAGING_APPLICATION_ID
body.to = [from_]
body.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_inbound_message():\n data = json.loads(request.data)\n\n if data[0][\"type\"] == \"message-received\":\n if \"call me\" in data[0][\"message\"][\"text\"]:\n handle_inbound_sms_call_me(data[0][\"message\"][\"to\"][0], data[0][\"message\"][\"from\"])\n elif \"media\" in data... | [
"0.6259964",
"0.6026629",
"0.586778",
"0.5793742",
"0.5789032",
"0.5778347",
"0.56937456",
"0.56709975",
"0.5563751",
"0.55476165",
"0.5544929",
"0.5535647",
"0.55325127",
"0.55144805",
"0.55017763",
"0.5446944",
"0.5444091",
"0.5428671",
"0.5415789",
"0.54080504",
"0.5401289... | 0.68463576 | 0 |
Takes information from a Bandwidth inbound message callback and initiates a call | def handle_inbound_sms_call_me(to, from_):
handle_call_me(to, from_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def on_call(message, client):\n pass",
"def _call(self, msg, cb, *args):\r\n if not self._status:\r\n raise InterfaceDisabledError('A disabled interface should not be '\r\n 'called.')\r\n\r\n if not callable(cb):\r\n raise T... | [
"0.63667405",
"0.60182863",
"0.59576505",
"0.59576505",
"0.59211445",
"0.589763",
"0.589763",
"0.589763",
"0.5851596",
"0.5813852",
"0.5791376",
"0.57506865",
"0.57401466",
"0.5735596",
"0.5733125",
"0.57320815",
"0.571448",
"0.5710372",
"0.570059",
"0.5682062",
"0.5653709",
... | 0.62250584 | 1 |
A method for showing how to handle Bandwidth messaging callbacks. For inbound SMS that contains the phrase "call me", a phone call is made and the user is asked to forward the call to another number For inbound SMS that doesn't contain the phrase "call me", the response is a SMS with the date and time. For inbound MMS ... | def handle_inbound_message():
data = json.loads(request.data)
if data[0]["type"] == "message-received":
if "call me" in data[0]["message"]["text"]:
handle_inbound_sms_call_me(data[0]["message"]["to"][0], data[0]["message"]["from"])
elif "media" in data[0]["message"]:
han... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_inbound_sms_call_me(to, from_):\n handle_call_me(to, from_)",
"def handle_inbound_media_mms(to, from_, media):\n downloaded_media_files = download_media_from_bandwidth(media)\n upload_media_to_bandwidth(downloaded_media_files)\n remove_files(downloaded_media_files)\n body = MessageReque... | [
"0.6835022",
"0.60718656",
"0.59854895",
"0.59607",
"0.5945775",
"0.5932107",
"0.5932107",
"0.5917332",
"0.5839464",
"0.5817131",
"0.5794533",
"0.574719",
"0.5722084",
"0.5713493",
"0.57134485",
"0.5699287",
"0.5698061",
"0.56944233",
"0.5692819",
"0.5692426",
"0.56885827",
... | 0.6912686 | 0 |
Formats |record| with color. | def format(self, record):
msg = super(ColoredFormatter, self).format(record)
color = self._COLOR_MAPPING.get(record.levelname)
if self._use_colors and color:
msg = '%s%s%s' % (color, msg, self._RESET)
return msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(self, record):\n\n\t\t# Use copy.copy - c.f. https://stackoverflow.com/a/7961390\n\t\tcolored_record = copy.copy(record)\n\n\t\tcolor = None\n\t\ttry:\n\t\t\tcolor = record.color\n\t\texcept AttributeError as e:\n\t\t\tpass\n\n\t\tif color is not None:\n\t\t\tif color is None or not color or color == \"... | [
"0.8311548",
"0.7502058",
"0.74881405",
"0.7452882",
"0.7222441",
"0.7179237",
"0.7129312",
"0.70246935",
"0.6647282",
"0.6643303",
"0.6622566",
"0.6554629",
"0.6488578",
"0.64701414",
"0.64188516",
"0.6313016",
"0.6285745",
"0.61440796",
"0.59593135",
"0.59322673",
"0.592492... | 0.76215637 | 1 |
Always symlink |path| to a relativized |target|. | def symlink(target, path):
unlink(path)
path = os.path.realpath(path)
target = os.path.relpath(os.path.realpath(target), os.path.dirname(path))
logging.info('Symlinking %s -> %s', path, target)
os.symlink(target, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symlink(path, v=False):\r\n if not os.path.exists(path):\r\n err(path + ' : no such file or directory')\r\n elif not os.path.isdir(path):\r\n err(path + ' : not a directory')\r\n else:\r\n theme_name = os.path.basename(os.path.normpath(path))\r\n theme_path = os.path.join(_... | [
"0.7404254",
"0.7402173",
"0.7312787",
"0.72121716",
"0.7204278",
"0.71373194",
"0.71331364",
"0.71290386",
"0.71224445",
"0.70757365",
"0.69786334",
"0.69786334",
"0.69290304",
"0.68298745",
"0.6800475",
"0.6755648",
"0.67269856",
"0.67166317",
"0.6690445",
"0.66393733",
"0.... | 0.8573706 | 0 |
Return sha256 hex digest of |path|. | def sha256(path: Union[Path, str]) -> str:
# The file shouldn't be too big to load into memory, so be lazy.
with open(path, 'rb') as fp:
data = fp.read()
m = hashlib.sha256()
m.update(data)
return m.hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hash(path: Path) -> str:\n m = hashlib.sha256()\n m.update(path.read_bytes())\n return m.hexdigest()",
"def _get_hash(self, path):\n with open(path, \"r\") as fp:\n content = fp.read()\n\n return sha256(content).hexdigest()",
"def hash_of_file(path):\n with open(pat... | [
"0.84448147",
"0.7994854",
"0.7628011",
"0.7436823",
"0.73758745",
"0.72930205",
"0.72381604",
"0.7233479",
"0.72159195",
"0.70954305",
"0.70228964",
"0.69657105",
"0.695293",
"0.6945403",
"0.69420445",
"0.6941568",
"0.6924218",
"0.68792206",
"0.68724394",
"0.68499297",
"0.68... | 0.83290803 | 1 |
Unpack |archive| into |cwd|. | def unpack(archive: Union[Path, str],
cwd: Optional[Path] = None,
files: Optional[List[Union[Path, str]]] = ()):
archive = Path(archive)
if cwd is None:
cwd = Path.cwd()
if files:
files = ['--'] + list(files)
else:
files = []
# Try to make symlink usage... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unpack_archive(self):\n with zipfile.ZipFile(self._archive_full_path, 'r') as zip_ref:\n zip_ref.extractall(self._storage_path)\n\n _logger.debug('Archive has been unpacked.')",
"def unpack_dir(indir, outdir, bands=None, clouds=None):\r\n archives = glob.glob(indir + '*.tar.gz')\... | [
"0.72888505",
"0.6926044",
"0.6809945",
"0.6746972",
"0.6636526",
"0.65584207",
"0.6507182",
"0.6496216",
"0.6464963",
"0.6461252",
"0.64201564",
"0.63850856",
"0.6347677",
"0.63212836",
"0.6308422",
"0.6223524",
"0.6171321",
"0.61497027",
"0.61496353",
"0.614074",
"0.6140402... | 0.7522544 | 0 |
Create an |archive| with |paths| in |cwd|. The output will use XZ compression. | def pack(archive: Union[Path, str],
paths: List[Union[Path, str]],
cwd: Optional[Path] = None,
exclude: Optional[List[Union[Path, str]]] = ()):
archive = Path(archive)
if cwd is None:
cwd = Path.cwd()
if archive.suffix == '.xz':
archive = archive.with_suffix('')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_archive_file(location, paths, environment=None, compression=None, archive_format=None):\n if archive_format == 'zip':\n archive = ZipTarWrapper(location.name, 'w', zipfile.ZIP_DEFLATED)\n else:\n write_type = \"w\"\n if compression:\n write_type = \"w|{0}\".format... | [
"0.6538356",
"0.6479174",
"0.64458525",
"0.6059645",
"0.6056643",
"0.5963025",
"0.596087",
"0.5931735",
"0.5828145",
"0.5716116",
"0.57026917",
"0.56945693",
"0.56655836",
"0.5658968",
"0.5611987",
"0.5595439",
"0.5587479",
"0.5581423",
"0.55702585",
"0.5558787",
"0.5543491",... | 0.720668 | 0 |
Fetch |uri| and write the results to |output| (or return BytesIO). | def fetch_data(uri: str, output=None, verbose: bool = False, b64: bool = False):
# This is the timeout used on each blocking operation, not the entire
# life of the connection. So it's used for initial urlopen and for each
# read attempt (which may be partial reads). 5 minutes should be fine.
TIMEOUT ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(uri, output, b64=False):\n output = os.path.abspath(output)\n distdir, name = os.path.split(output)\n if os.path.exists(output):\n logging.info('Using existing download: %s', name)\n return\n\n logging.info('Downloading %s to %s', uri, output)\n os.makedirs(distdir, exist_ok=... | [
"0.6911675",
"0.6535504",
"0.6211069",
"0.60043406",
"0.59758717",
"0.58903176",
"0.5829563",
"0.5752656",
"0.57295847",
"0.5723706",
"0.57197624",
"0.5693564",
"0.5693242",
"0.56680185",
"0.5658385",
"0.56308764",
"0.5616187",
"0.5565478",
"0.5563205",
"0.5561096",
"0.554989... | 0.7404381 | 0 |
Download our copies of node & npm to our tree and updates env ($PATH). | def node_and_npm_setup():
# We have to update modules first as it'll nuke the dir node lives under.
node.modules_update()
node.update() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_requirements():\n with cd(REMOTE_REPO_DIR):\n cmd = ['npm install']\n # cmd += ['--requirement %s' % os.path.join(CODE_DIR,'requirements.txt')]\n run(' '.join(cmd))",
"def InstallNodeDependencies():\n logging.info('entering ...')\n # Install the project dependencies specifie... | [
"0.6407233",
"0.63381755",
"0.6324544",
"0.6251576",
"0.6231938",
"0.6057195",
"0.5836138",
"0.5828892",
"0.5789863",
"0.5718106",
"0.56944567",
"0.56539077",
"0.5616942",
"0.5609459",
"0.5526702",
"0.5480729",
"0.5467356",
"0.54643357",
"0.5417278",
"0.5364148",
"0.53312916"... | 0.7617056 | 0 |
Load a module from the filesystem. | def load_module(name, path):
loader = importlib.machinery.SourceFileLoader(name, path)
module = types.ModuleType(loader.name)
loader.exec_module(module)
return module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_module(module_name: str, module_path: str) -> object:\n spec = module_util.spec_from_file_location(module_name, module_path)\n module = module_util.module_from_spec(spec)\n spec.loader.exec_module(module) # type: ignore\n return module",
"def load_module(path):\n spec = spec_from_file_location(\"... | [
"0.7140824",
"0.7115812",
"0.7082071",
"0.7029506",
"0.7029197",
"0.6992073",
"0.6935706",
"0.6864377",
"0.6848782",
"0.6841059",
"0.68201846",
"0.6806607",
"0.67745715",
"0.6732326",
"0.6725582",
"0.6686308",
"0.6678542",
"0.6671717",
"0.6595986",
"0.6595986",
"0.6583503",
... | 0.74431866 | 0 |
Load & cache the program module. | def _module(self):
if self._module_cache is None:
self._module_cache = load_module(self._name, self._path)
return self._module_cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n\n\t\tif self.module is None:\n\t\t\t# Cause the interpreter to load the module in local namespace ...\n\t\t\texec \"import \" + self.name\n\n\t\t\t# Store the module object ...\n\t\t\tobject.__setattr__(self, 'module', eval(self.name))",
"def load(self):\n \"\"\"Load a program into memor... | [
"0.64689153",
"0.63654965",
"0.62676257",
"0.62425035",
"0.62108284",
"0.62063473",
"0.61392486",
"0.6114491",
"0.602539",
"0.60204077",
"0.60017616",
"0.59714663",
"0.588076",
"0.5877579",
"0.58205396",
"0.5767681",
"0.5746382",
"0.57439184",
"0.57372934",
"0.5737229",
"0.57... | 0.6589164 | 0 |
Set the packet length. | def _set_packet_len(self, packet_len):
self._packet_len = packet_len | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPacketLength(self):\n self.packetLength = len(self) - PRIMARY_HEADER_BYTE_SIZE - 1",
"def setLength(self, new_length):\n\n self.length = new_length",
"def length(self, length):\n\n self._length = length",
"def set_length(self, ak_tpl: BKT, newLength: float): # -> None:\n ...",
... | [
"0.7967779",
"0.7632073",
"0.72674304",
"0.7185319",
"0.7084449",
"0.70364594",
"0.6882304",
"0.66527474",
"0.6593729",
"0.6497038",
"0.64803594",
"0.6373639",
"0.63581616",
"0.63335747",
"0.6284977",
"0.6236442",
"0.6221398",
"0.6134403",
"0.6132038",
"0.6003637",
"0.597266"... | 0.8634613 | 0 |
Creates a XCP Ethernet frame | def create_message(self, packet):
self._header.packet_len = len(bytes(packet))
frame_bytes = super(EthernetTransport, self).create_message(packet)
# Update control counter for next frame
self._header.update_control()
return bytes(frame_bytes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_ieee_packet(self, data):\n\t\tpacket = Dot15d4FCS() / Dot15d4Data() / Raw(load=data)\n\n\t\tpacket.fcf_srcaddrmode = 2\n\t\tpacket.fcf_destaddrmode = 2\n\n\t\tpacket.fcf_panidcompress = True\n\t\tpacket.fcf_ackreq = True\n\t\tpacket.seqnum = self.seqnum\n\n\t\tpacket.dest_panid = self.link_config.dest_pani... | [
"0.58488214",
"0.5700761",
"0.56956196",
"0.56287456",
"0.56241447",
"0.56202054",
"0.54626226",
"0.5419994",
"0.5410478",
"0.53642374",
"0.53623325",
"0.531552",
"0.52997607",
"0.526246",
"0.5247345",
"0.5247104",
"0.5242202",
"0.5209782",
"0.5174515",
"0.5075918",
"0.503412... | 0.6318154 | 0 |
Computes the pickup_features feature group. To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs. | def pickup_features_fn(df, ts_column, start_date, end_date):
df = filter_df_by_ts(
df, ts_column, start_date, end_date
)
pickupzip_features = (
df.groupBy(
"pickup_zip", window("tpep_pickup_datetime", "1 hour", "15 minutes")
) # 1 hour window, sliding every 15 minutes
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropoff_features_fn(df, ts_column, start_date, end_date):\n df = filter_df_by_ts(\n df, ts_column, start_date, end_date\n )\n dropoffzip_features = (\n df.groupBy(\"dropoff_zip\", window(\"tpep_dropoff_datetime\", \"30 minute\"))\n .agg(count(\"*\").alias(\"count_trips_window_30m... | [
"0.6709174",
"0.59639823",
"0.5956674",
"0.57902575",
"0.5713756",
"0.5689175",
"0.5615991",
"0.5600183",
"0.5599253",
"0.5595833",
"0.55765986",
"0.55623573",
"0.5488219",
"0.5388274",
"0.53792185",
"0.5378838",
"0.5333837",
"0.53081375",
"0.53008443",
"0.5289871",
"0.525374... | 0.7756553 | 0 |
Computes the dropoff_features feature group. To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs. | def dropoff_features_fn(df, ts_column, start_date, end_date):
df = filter_df_by_ts(
df, ts_column, start_date, end_date
)
dropoffzip_features = (
df.groupBy("dropoff_zip", window("tpep_dropoff_datetime", "30 minute"))
.agg(count("*").alias("count_trips_window_30m_dropoff_zip"))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickup_features_fn(df, ts_column, start_date, end_date):\n df = filter_df_by_ts(\n df, ts_column, start_date, end_date\n )\n pickupzip_features = (\n df.groupBy(\n \"pickup_zip\", window(\"tpep_pickup_datetime\", \"1 hour\", \"15 minutes\")\n ) # 1 hour window, sliding... | [
"0.66726613",
"0.5643213",
"0.55374706",
"0.5524301",
"0.5516429",
"0.54855764",
"0.5438203",
"0.538857",
"0.53348887",
"0.53311694",
"0.5320984",
"0.5259109",
"0.5249251",
"0.52357846",
"0.52223134",
"0.5205125",
"0.5173679",
"0.5165818",
"0.51619375",
"0.5140185",
"0.513639... | 0.75834435 | 0 |
Ceilings datetime dt to interval num_minutes, then returns the unix timestamp. | def rounded_unix_timestamp(dt, num_minutes=15):
nsecs = dt.minute * 60 + dt.second + dt.microsecond * 1e-6
delta = math.ceil(nsecs / (60 * num_minutes)) * (60 * num_minutes) - nsecs
return int((dt + timedelta(seconds=delta)).timestamp()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _time_ms(self, dt):\n if dt.tzinfo is None:\n dt = dt.replace(tzinfo=pytz.utc)\n return int((dt - self._EPOCH).total_seconds() * 1000)",
"def _time_ms(dt):\n epoch = datetime.datetime.utcfromtimestamp(0)\n diff = dt - epoch\n return diff.total_seconds() * 1000",
"def _get_... | [
"0.57981074",
"0.5748822",
"0.5663159",
"0.56519955",
"0.5603236",
"0.5469628",
"0.5442284",
"0.54418385",
"0.5433084",
"0.5365743",
"0.5359583",
"0.53497386",
"0.53274846",
"0.5236749",
"0.5208083",
"0.520233",
"0.51816577",
"0.5176535",
"0.51646566",
"0.51259786",
"0.510066... | 0.7375313 | 0 |
Return current sample rate in Sa/s | def sample_rate(self):
return self.query_float('ENTER Current Sample Rate (Sa/s)') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_rate(self):\r\n return self.config.sample_rate",
"def sample_rate(self):\n return self._sample_rate",
"def sample_rate(self):\n return self._sample_rate",
"def sample_rate(self):\n return self._sample_rate",
"def sample_rate(self, sr=None):\n return self._sample_ra... | [
"0.81212515",
"0.8000023",
"0.8000023",
"0.7969299",
"0.7864392",
"0.7847092",
"0.782177",
"0.7783444",
"0.7727639",
"0.76789045",
"0.763086",
"0.74798954",
"0.7479725",
"0.7386037",
"0.7357198",
"0.73316765",
"0.7272404",
"0.72663385",
"0.7222648",
"0.70849174",
"0.6931208",... | 0.86877906 | 0 |
assert unexpected_content has not been written to stdout | def assertStdoutDoesNotContain(self, unexpected_content):
if type(unexpected_content) is not types.ListType:
unexpected_content = [ unexpected_content ]
stdout_message = sys.stdout.getvalue()
for the_text in unexpected_content:
self.assertNotIn(the_text, stdout_message,('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_cot_output(self, expected):\n sys.stdout = StringIO.StringIO()\n output = None\n try:\n self.instance.run()\n except (TypeError, ValueError, SyntaxError, LookupError):\n self.fail(traceback.format_exc())\n finally:\n output = sys.stdout.... | [
"0.6872373",
"0.65048116",
"0.6423676",
"0.6372315",
"0.63059235",
"0.6282092",
"0.62726283",
"0.62563837",
"0.61430126",
"0.6134692",
"0.61007786",
"0.60741216",
"0.6065867",
"0.60580695",
"0.6008732",
"0.597988",
"0.58616245",
"0.58479875",
"0.5832719",
"0.5825116",
"0.5822... | 0.69911766 | 0 |
Render the image represented by (rgbobj) at dst_x, dst_y in the offscreen pixmap. | def render_image(self, rgbobj, dst_x, dst_y):
self.logger.debug("redraw pixmap=%s" % (self.pixmap))
if self.pixmap is None:
return
self.logger.debug("drawing to pixmap")
# Prepare array for rendering
arr = rgbobj.get_array(self.rgb_order, dtype=np.uint8)
(hei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self):\r\n self.screen.blit(self.image, self.image.get_rect())",
"def draw(self, surface):\r\n surface.blit(self.image, self.rect)",
"def draw(self):\n self.screen.blit(self.image, self.rect)",
"def draw(self, surface):\n surface.blit(self.image, self.rect)",
"def draw(... | [
"0.61686844",
"0.5998365",
"0.5990171",
"0.59325355",
"0.59325355",
"0.5924451",
"0.5898981",
"0.5876628",
"0.58228207",
"0.5799751",
"0.5746103",
"0.5726643",
"0.5718437",
"0.56835777",
"0.565392",
"0.5641117",
"0.5641117",
"0.5641117",
"0.5641117",
"0.56196475",
"0.5606678"... | 0.8753144 | 0 |
Called when a mouse button is pressed in the widget. Adjust method signature as appropriate for callback. | def button_press_event(self, widget, event):
x, y = event.x, event.y
# x, y = coordinates where the button was pressed
self.last_win_x, self.last_win_y = x, y
button = 0
# Prepare a button mask with bits set as follows:
# left button: 0x1
# middle button: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_press(self, x, y, button):\n\n pass",
"def ev_mousebuttondown(self, event: MouseButtonDown) -> None:",
"def handle_mouse_press(self, event):",
"def mouse_press_event(self, x: int, y: int, button: int):\n pass",
"def on_mouse_press(self, x, y, button, key_modifiers):\r\n pa... | [
"0.8186688",
"0.7803107",
"0.7685904",
"0.7667033",
"0.7550329",
"0.75264764",
"0.74540734",
"0.74537903",
"0.7434162",
"0.71306",
"0.71141076",
"0.7086629",
"0.70717835",
"0.70475805",
"0.70216006",
"0.70136315",
"0.69730556",
"0.69179136",
"0.69159424",
"0.69106615",
"0.690... | 0.786055 | 1 |
Called when a drop (drag/drop) event happens in the widget. Adjust method signature as appropriate for callback. | def drop_event(self, widget, event):
# make a call back with a list of URLs that were dropped
#self.logger.debug("dropped filename(s): %s" % (str(paths)))
#self.make_ui_callback('drag-drop', paths)
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropEvent(self, de):\n # dragging a track\n if hasattr(Globals.dragObject, \"trackFrame\"):\n de.accept()\n trackFrame = Globals.dragObject.trackFrame\n oldParent = trackFrame.parentWidget()\n if oldParent:\n args = (trackFrame, self, old... | [
"0.72224736",
"0.7178574",
"0.7033632",
"0.69308865",
"0.69137365",
"0.68517953",
"0.66538286",
"0.660371",
"0.6481881",
"0.6399347",
"0.6314507",
"0.63019335",
"0.6220606",
"0.6072313",
"0.60482043",
"0.6036351",
"0.59223694",
"0.59200025",
"0.58687717",
"0.58277893",
"0.573... | 0.81672764 | 0 |
Gets details on currently logged in athlete. | def get_athlete(token):
url = "https://www.strava.com/api/v3/athlete"
params = {'access_token': token}
response = return_json(url, "GET", parameters=params, timeout=10)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_athlete(response):\n name = response['athlete']['firstname'] + \" \" + response['athlete']['lastname']\n athlete = {\n 'id': response['athlete']['id'],\n 'name': name,\n 'access_token': response['access_token'],\n 'refresh_to... | [
"0.62125313",
"0.603639",
"0.5979062",
"0.5663854",
"0.5658526",
"0.5654593",
"0.55721027",
"0.5450002",
"0.5400566",
"0.5396792",
"0.5345879",
"0.5323987",
"0.53042555",
"0.52950203",
"0.5274707",
"0.5259616",
"0.52581507",
"0.5236326",
"0.52285975",
"0.52084494",
"0.519947"... | 0.636169 | 0 |
Stores athlete's id, first name, last name, weight and ftp into strava_athlete KV Store collection. | def kvstore_save_athlete(session_key, athlete_id, firstname, lastname, weight, ftp): # pylint: disable=too-many-arguments
url = 'https://localhost:8089/servicesNS/nobody/TA-strava-for-splunk/storage/collections/data/strava_athlete/batch_save'
headers = {'Content-Type': 'application/json', 'Auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_athlete(response):\n name = response['athlete']['firstname'] + \" \" + response['athlete']['lastname']\n athlete = {\n 'id': response['athlete']['id'],\n 'name': name,\n 'access_token': response['access_token'],\n 'refresh_to... | [
"0.65488034",
"0.5803945",
"0.56478375",
"0.52747154",
"0.5271561",
"0.52378386",
"0.51092994",
"0.50849545",
"0.50378954",
"0.5033445",
"0.4992036",
"0.49815983",
"0.4975764",
"0.4963135",
"0.49445814",
"0.48963758",
"0.48822185",
"0.48742172",
"0.48721516",
"0.48705444",
"0... | 0.8156723 | 0 |
Creates dict with athlete details, including token expiry. | def set_athlete(response):
name = response['athlete']['firstname'] + " " + response['athlete']['lastname']
athlete = {
'id': response['athlete']['id'],
'name': name,
'access_token': response['access_token'],
'refresh_token': respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_athlete(token):\n url = \"https://www.strava.com/api/v3/athlete\"\n params = {'access_token': token}\n response = return_json(url, \"GET\", parameters=params, timeout=10)\n return response",
"def asdict(self):\n return {\n \"access_token\": se... | [
"0.6095435",
"0.5521886",
"0.5451787",
"0.5388297",
"0.5352944",
"0.5180581",
"0.5166357",
"0.5155647",
"0.5131322",
"0.51014733",
"0.50938517",
"0.50851166",
"0.5080323",
"0.5078669",
"0.505904",
"0.50572944",
"0.5016414",
"0.50079054",
"0.49948767",
"0.49728522",
"0.4964966... | 0.7620931 | 0 |
Writes activity to Splunk index. | def write_to_splunk(**kwargs):
event = helper.new_event(**kwargs)
ew.write_event(event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, data):\n activities = [json.loads(activity['Json']) for activity in data]\n\n for i in range(len(activities)):\n activities[i]['created_at'] = to_datetime(activities[i]['created_at'])\n\n with Elastic(index='wink', doc_type='activity') as elastic:\n elastic... | [
"0.6238934",
"0.5661036",
"0.56116706",
"0.55407304",
"0.54127765",
"0.5401947",
"0.5389567",
"0.5381006",
"0.53470606",
"0.53407896",
"0.5288701",
"0.5285223",
"0.5240927",
"0.5197521",
"0.5191341",
"0.51774335",
"0.5176707",
"0.51560175",
"0.5123677",
"0.50669056",
"0.50669... | 0.5662735 | 1 |
objectiin querysetiig avna. Tuhain querysetiin date_time uy deh datag excel export hiine | def export_to_excel(self, worksheet, row_start, col_start, queryset, date_time=timezone.now()):
if queryset:
[row_write, col_write] = self.excel_write_header_and_format(worksheet, row_start, col_start)
for q in queryset:
# object_excel_write function---date_time uyiin history objectiig excel -ruu horvuulne
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_ho_dan_as_excel_action(fields=None, exclude=None, header=True):\n def export_as_excel(modeladmin, request, queryset):\n opts = modeladmin.model._meta\n field_names = [\"name\", \"status\", \"location\", \"tinh\",\n \"xa\", \"huyen\", \"phone\", \"cuuho\", \"update_... | [
"0.679835",
"0.6526606",
"0.6513021",
"0.63559425",
"0.6347008",
"0.6267613",
"0.61500996",
"0.604096",
"0.59455335",
"0.5921458",
"0.58053875",
"0.5804869",
"0.57998806",
"0.5739592",
"0.57366",
"0.5705012",
"0.5652193",
"0.5652061",
"0.564152",
"0.56380385",
"0.5635472",
... | 0.75960785 | 0 |
Durations are 'dict string keys'. The keys need to be converted to floats. The keys need to be ordered and the scenes returned with calculated durations | def parse_scene_order(self, data, timesigniture):
if not data:
return ()
num_scenes = len(data)
def attempt_parse_key_timecode(value):
if not value:
return value
try:
return float(value)
except (ValueError, TypeErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise_duration(index):\n key = sorted_keys[index]\n item = data_float_indexed[key]\n if not item:\n item = {'duration': 'auto'}\n data_float_indexed[key] = item\n duration = attempt_parse_key_timecode(item.get('duration'))\n ... | [
"0.6176038",
"0.59368414",
"0.5897897",
"0.58419317",
"0.5807034",
"0.5672501",
"0.56141585",
"0.5577464",
"0.555346",
"0.5521533",
"0.5519391",
"0.55059147",
"0.5491283",
"0.54520303",
"0.5369046",
"0.5366904",
"0.53086877",
"0.52912253",
"0.52870804",
"0.5256063",
"0.522170... | 0.6748647 | 0 |
Once the order of the items is known, we can iterate over the scenes calculating/prerendering the dmx state for each section This make seeking much faster | def pre_render_scene_item(self, current_scene_item, previous_scene_item):
assert current_scene_item
current_scene_dmx = current_scene_item.setdefault(Scene.SCENE_ITEM_DMX_STATE_KEY, {})
# Aquire a reference to the previous DMX state
current_scene_dmx['previous'] = copy.copy(previous_scen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n scene = lm.scene_object()\n copy_latest_low()\n copy_latest_high()",
"def loadData(self, actions):\n # begin to clear the scene\n self.scene.clear()\n self.scene.drawGrid()\n \n # and draw all items\n maxItemId = self.itemId\n for graphicalIt... | [
"0.5440126",
"0.5405451",
"0.5320529",
"0.5313562",
"0.5288161",
"0.52768517",
"0.52676857",
"0.52513534",
"0.52176017",
"0.521186",
"0.5171025",
"0.5155609",
"0.5147708",
"0.51323056",
"0.51169014",
"0.5096112",
"0.5093142",
"0.5089115",
"0.50864947",
"0.5068929",
"0.5037355... | 0.56032324 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.