query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Set the friendly name of a scene. | def set_scene_name(scene_num: int, name: str):
_scene_names[scene_num] = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setObjectName( self, name ):\n scene = self.scene()\n if ( scene ):\n name = scene.uniqueNodeName(name)\n self._objectName = name\n self._titleFont = None\n self.update()",
"def updateSceneName(*args):\n pi.openSceneFullPath = cmds.file(q=True, sn=True)\n p... | [
"0.736499",
"0.6819682",
"0.65995824",
"0.65656346",
"0.65460163",
"0.65423506",
"0.6490112",
"0.64742696",
"0.6442343",
"0.643475",
"0.64257276",
"0.6391015",
"0.6384253",
"0.63751686",
"0.63751686",
"0.63751686",
"0.63751686",
"0.6343902",
"0.6335318",
"0.6335318",
"0.63353... | 0.7691896 | 0 |
r""" Return the mean of the model. | def mean(self):
return self._mean | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\n return self._lift(\"mean\")",
"def getMean(self):\n return self.mean",
"def mean(self):\n return self._mean_func",
"def mean(self):\n return self.mu",
"def mean(self):\n return self.vmean",
"def modelmean(self, model_params, this_data, this_suff_stat):... | [
"0.8413452",
"0.82731175",
"0.81881654",
"0.81490177",
"0.81417876",
"0.8072013",
"0.8052937",
"0.8044909",
"0.80283767",
"0.7960688",
"0.7907659",
"0.78985846",
"0.78470564",
"0.781608",
"0.78025645",
"0.77440906",
"0.77248245",
"0.77014965",
"0.77007467",
"0.768167",
"0.760... | 0.83098125 | 2 |
get the value of property _State | def State(self):
if self.force_auto_sync:
self.get('State')
return self._State | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def... | [
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263",
"0.83590263"... | 0.0 | -1 |
get the value of property _LeaseTime | def LeaseTime(self):
if self.force_auto_sync:
self.get('LeaseTime')
return self._LeaseTime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MinLeaseTime(self):\n if self.force_auto_sync:\n self.get('MinLeaseTime')\n return self._MinLeaseTime",
"def lease_duration(self) -> str:\n return pulumi.get(self, \"lease_duration\")",
"def get_time(self):\n return self._time",
"def get_time(self):\n return ... | [
"0.7079596",
"0.7068743",
"0.68648225",
"0.68648225",
"0.68648225",
"0.6838564",
"0.6725396",
"0.671128",
"0.67063874",
"0.66243255",
"0.6540618",
"0.6540618",
"0.64857495",
"0.64857495",
"0.64857495",
"0.64857495",
"0.64857495",
"0.64857495",
"0.64641875",
"0.6438324",
"0.64... | 0.80563843 | 0 |
get the value of property _RenewTime | def RenewTime(self):
if self.force_auto_sync:
self.get('RenewTime')
return self._RenewTime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ExpireTime(self):\n if self.force_auto_sync:\n self.get('ExpireTime')\n return self._ExpireTime",
"def LeaseTime(self):\n if self.force_auto_sync:\n self.get('LeaseTime')\n return self._LeaseTime",
"def get_time(self):\n return self._time",
"def ge... | [
"0.667307",
"0.66344386",
"0.6580426",
"0.6580426",
"0.6580426",
"0.6565816",
"0.65193915",
"0.64963865",
"0.6487867",
"0.6468324",
"0.644163",
"0.63699234",
"0.6347196",
"0.6330478",
"0.63255614",
"0.63212377",
"0.63212377",
"0.63165146",
"0.6304175",
"0.6296504",
"0.6294682... | 0.8216229 | 0 |
get the value of property _MinLeaseTime | def MinLeaseTime(self):
if self.force_auto_sync:
self.get('MinLeaseTime')
return self._MinLeaseTime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_time(self) -> str:\n return self._min_time",
"def min_time(self):\n return self._ll_tree_sequence.get_min_time()",
"def MinLifetime(self):\r\n\t\treturn self._get_attribute('minLifetime')",
"def reservetime_min(self):\n return self._get_time_info([\"Reserve_Time_M\", \"reserveTim... | [
"0.7321576",
"0.71592706",
"0.7150514",
"0.71164584",
"0.69542754",
"0.69331163",
"0.683981",
"0.67600757",
"0.67418724",
"0.6740244",
"0.668717",
"0.6660195",
"0.66200835",
"0.6568898",
"0.6549413",
"0.65324664",
"0.65324664",
"0.65021324",
"0.6454619",
"0.6406164",
"0.63793... | 0.86647534 | 0 |
Returns `True' if the protocol state is valid, i.e., if the life time has not expired yet. Otherwise, `False' is returned. | def isValid( self ):
assert self.issueDate
now = int(time.time())
if (now - self.issueDate) > const.SESSION_TICKET_LIFETIME:
log.debug("Ticket is not valid anymore.")
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self):\n return self.is_signed and not self.is_expired",
"def valid(self):\n return self.expiry > timezone.now()",
"def is_valid(self):\n return self.startTime <= ApiKey.get_now() < self.endTime",
"def isValidState(self, state):\n validStates = [STATE_INACTIVE, STATE_... | [
"0.70828533",
"0.6860852",
"0.671874",
"0.6611087",
"0.65304226",
"0.64390063",
"0.6417083",
"0.64134914",
"0.6408846",
"0.63265926",
"0.63169956",
"0.6301628",
"0.629391",
"0.6282165",
"0.62502635",
"0.62391526",
"0.6238167",
"0.6232668",
"0.62212104",
"0.6218563",
"0.621399... | 0.666025 | 3 |
Linearly scale Val to y1 and y2 from x1 and x2 range x1 and y1 are low values | def lin_scale( val, x1, y1, x2, y2 ):
x_range = (x2 - x1)
new_val = 0
if x_range is 0:
new_val = y1
else:
y_range = ( y2 - y1 )
new_val = ( ( ( val - x1 ) * y_range ) / x_range ) + y1
return new_val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linearscale(input, boundfrom, boundto, extrema=None):\n\n\tminfrom,maxfrom = boundfrom\n\tminto,maxto = boundto\n\n\t### default from bounds are min,max of the input\n\tif minfrom is None:\n\t\tif extrema:\n\t\t\tminfrom = extrema[0]\n\t\telse:\n\t\t\tminfrom = arraystats.min(input)\n\tif maxfrom is None:\n\t\... | [
"0.6553931",
"0.64390045",
"0.6413466",
"0.6246256",
"0.62345225",
"0.6115074",
"0.60944426",
"0.60672504",
"0.606105",
"0.60555506",
"0.6031617",
"0.6022795",
"0.6007552",
"0.6007142",
"0.5999376",
"0.5968791",
"0.59579855",
"0.5949993",
"0.5945295",
"0.5939555",
"0.5924955"... | 0.8562407 | 0 |
Get the maximum number of individuals which should be permitted based upon group size and count. | def max_individuals(self) -> int:
return self.group_size.upper * self.groups_allowed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_individuals_count_of_generation_number(self, generation_number):\n\n\t\treturn self.individuals_per_generation[generation_number-1]",
"def data_size( self, groups ):\n #if len(groups) == 0:\n # return 0\n return max( groups.values() )",
"def max(self) -> int:\n return... | [
"0.6829581",
"0.65898097",
"0.6558657",
"0.6442366",
"0.6440042",
"0.6390008",
"0.6390008",
"0.6390008",
"0.6390008",
"0.6390008",
"0.6304808",
"0.6294226",
"0.6280366",
"0.6198952",
"0.6180253",
"0.6151519",
"0.6112058",
"0.6106987",
"0.61047906",
"0.61047906",
"0.6072633",
... | 0.8241399 | 0 |
Return a new Creature with a different rarity score. | def clone(self) -> Creature:
return Creature(
active_periods=self.active_periods,
entity_id=self.entity_id,
group_size=self.group_size,
groups_allowed=self.groups_allowed,
loot_list=self.loot_list,
rarity=self.rarity,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_rarity(self, rarity: int) -> Creature:\n result = self.clone()\n result.rarity\n return result",
"async def random_skill_score(self, card_rarity):\n if card_rarity == \"common\":\n random.randint(1, 20)\n elif card_rarity == \"uncommon\":\n random... | [
"0.84581256",
"0.53526497",
"0.5091108",
"0.49989107",
"0.49667493",
"0.49579054",
"0.4918436",
"0.49032104",
"0.4896907",
"0.48554677",
"0.4821494",
"0.48161387",
"0.47791076",
"0.47184214",
"0.47090432",
"0.46684515",
"0.46287483",
"0.4625443",
"0.46208242",
"0.4619833",
"0... | 0.6166507 | 1 |
Return a new Creature with a different rarity score. | def with_rarity(self, rarity: int) -> Creature:
result = self.clone()
result.rarity
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self) -> Creature:\n return Creature(\n active_periods=self.active_periods,\n entity_id=self.entity_id,\n group_size=self.group_size,\n groups_allowed=self.groups_allowed,\n loot_list=self.loot_list,\n rarity=self.rarity,\n )... | [
"0.6166414",
"0.5352428",
"0.5091952",
"0.49984735",
"0.49671257",
"0.4958161",
"0.4918341",
"0.49028686",
"0.48969826",
"0.4854182",
"0.4821092",
"0.48155612",
"0.47788063",
"0.47185913",
"0.47086024",
"0.4668522",
"0.46275893",
"0.46254885",
"0.46201208",
"0.46199286",
"0.4... | 0.84576464 | 0 |
quote('abc def') > 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. | def quote(s, safe='/', encoding=None, errors=None):
# fastpath
if not s:
return s
if encoding is not None or isinstance(s, unicode):
if encoding is None:
encoding = 'utf-8'
if errors is None:
errors = 'strict'
s = s.encode(encoding, errors)
if isi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlQuote(string):\r\n return quote(string.encode(\"utf-8\"))",
"def url_quote_part(s, safechars='/', encoding=None):\n if isinstance(s, unicode):\n if encoding is None:\n encoding = url_encoding\n s = s.encode(encoding, 'ignore')\n return urllib.quote(s, safechars)",
"... | [
"0.7727329",
"0.7549331",
"0.73220825",
"0.72719216",
"0.7215815",
"0.7200697",
"0.7135425",
"0.71222466",
"0.7106083",
"0.7006834",
"0.6998326",
"0.6923226",
"0.68766606",
"0.68338174",
"0.682162",
"0.67332083",
"0.6659755",
"0.6624627",
"0.661697",
"0.65920717",
"0.6574367"... | 0.6240505 | 29 |
Quote the query fragment of a URL; replacing ' ' with '+' | def quote_plus(s, safe='', encoding=None, errors=None):
if ' ' in s:
s = quote(s, safe + ' ', encoding, errors)
return s.replace(' ', '+')
return quote(s, safe, encoding, errors) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_escape(value, plus=True):\r\n quote = urllib_parse.quote_plus if plus else urllib_parse.quote\r\n return quote(utf8(value))",
"def urlQuote(string):\r\n return quote(string.encode(\"utf-8\"))",
"def format_query(query, option=''):\n q_tmp = []\n for s in query:\n if option != ... | [
"0.71631026",
"0.7115743",
"0.7083949",
"0.6980745",
"0.6910441",
"0.6775542",
"0.6743839",
"0.6742581",
"0.6707673",
"0.6707673",
"0.6682814",
"0.6672246",
"0.6627611",
"0.6580458",
"0.6572045",
"0.6568193",
"0.6542396",
"0.6533632",
"0.6530424",
"0.65260977",
"0.64762306",
... | 0.0 | -1 |
Encode a sequence of twoelement tuples or dictionary into a URL query string. If the query arg is a sequence of twoelement tuples, the order of the parameters in the output will match the order of parameters in the input. | def urlencode(query):
if hasattr(query, 'items'):
# mapping objects
query = query.items()
l = []
for k, v in query:
k = quote_plus(k)
if isinstance(v, basestring):
v = quote_plus(v)
l.append(k + '=' + v)
else:
v = quote_plus(unicod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlencode(query, doseq=0):\r\n if hasattr(query, 'items'):\r\n query = query.items()\r\n\r\n return original_urlencode(\r\n [(force_str(k),\r\n [force_str(i) for i in v] if isinstance(v, (list,tuple)) else force_str(v))\r\n for k, v in query],\r\n doseq)",
"def q... | [
"0.762284",
"0.750115",
"0.73277026",
"0.68043315",
"0.68010056",
"0.6721123",
"0.66955036",
"0.6586925",
"0.65574735",
"0.6461868",
"0.6450649",
"0.6427401",
"0.6406831",
"0.6391107",
"0.6375627",
"0.6358444",
"0.63017106",
"0.6255624",
"0.62428766",
"0.6196875",
"0.61835796... | 0.7394032 | 2 |
Update config file with the given data. | def update_config(self, data):
self.config.data = dict_merge(self.config.data, data)
self.config.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.save_config_file()",
"def update_config_file(**kwargs):\n config_file = try_read_file()\n config_file.update(kwargs)\n config_file = {key: value for key, value in config_file.items() if value is not None}\n logging.info('open config file %s', config_file_path)\n wit... | [
"0.7576278",
"0.71342003",
"0.6927803",
"0.68982965",
"0.6841013",
"0.6840025",
"0.6720955",
"0.6715679",
"0.667692",
"0.66759175",
"0.6666382",
"0.66445744",
"0.6629904",
"0.6626489",
"0.6576087",
"0.6537789",
"0.652745",
"0.64435184",
"0.6415863",
"0.6407324",
"0.6394025",
... | 0.8345362 | 0 |
Update the mount state for each host. | def _update_mount_state(self):
state = {
"mounted": NodeSet(),
"unmounted": NodeSet(),
"nodirectory": NodeSet(),
"rogue": NodeSet()
}
self.log.info("Checking which hosts have the mount point directory created")
command = f"test -d {self.mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_up(self, host):\n with self.cond:\n if self.state is not None:\n LOG.warning(\"host_up called, but we think host is already up\")\n self._host_down()\n\n # Wait until all operations using a previous state generation are\n # complete bef... | [
"0.63614225",
"0.62531316",
"0.59802324",
"0.59656864",
"0.5872148",
"0.57357365",
"0.57185787",
"0.5664235",
"0.5607055",
"0.55639845",
"0.5547378",
"0.54874724",
"0.54578435",
"0.5440539",
"0.5370309",
"0.5361698",
"0.5335429",
"0.53253216",
"0.53147936",
"0.52973133",
"0.5... | 0.789063 | 0 |
This will concatenate a list of Vertices with the Vertex Array for the given layer index. | def _Add_To_Mesh(self, layer, lVertices):
self._mesh[layer] += lVertices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertices(self, vertices_list):\n for vertex in vertices_list:\n self.add_vertex(vertex)",
"def drawVectors(self, index, color):\n graph = self.graphs[index]\n for i in range(len(graph) - 1):\n v = Vector.createFromTwoTuples(graph[i], graph[i + 1], color=color)\n... | [
"0.5781591",
"0.56564015",
"0.55158335",
"0.5452877",
"0.5406261",
"0.5362405",
"0.521514",
"0.51968896",
"0.51588446",
"0.51068157",
"0.50934255",
"0.5039812",
"0.5035995",
"0.50323033",
"0.50307673",
"0.5021856",
"0.5021013",
"0.50198966",
"0.5017682",
"0.5012401",
"0.50024... | 0.5266493 | 6 |
The coordinate of this starting location. | def point(self) -> Point:
return Point.from_np_array(self.position) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coord(self):\n return self.coord",
"def location(self):\n return self.geometry.location",
"def start_location(self) -> Point2:\n return self._game_info.player_start_location",
"def coord(self):\r\n return self.model.coord",
"def get_origin(self):\n return self.coo... | [
"0.8078699",
"0.78237444",
"0.78104395",
"0.7771976",
"0.7655221",
"0.76090926",
"0.7535836",
"0.7531385",
"0.7505909",
"0.74364",
"0.74240035",
"0.74058086",
"0.7367615",
"0.7329546",
"0.7325664",
"0.73126185",
"0.7310607",
"0.7303615",
"0.7303615",
"0.72908527",
"0.7279785"... | 0.0 | -1 |
Get the state of this plan. | def frame(self) -> PlanFrame:
assert self._mission
return PlanFrame(
road_ids=self._route.road_ids if self._route else [], mission=self._mission
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.state",
"def get_state(self):\n return self.state",
"def state(self):\n result = self.getResult()\n return result.state",
"def getState(self):\n return self.state",
"def getState(self):\n return self.state",
"def getState(self):... | [
"0.77218986",
"0.77218986",
"0.76877433",
"0.7647401",
"0.7647401",
"0.7647401",
"0.7635092",
"0.76125926",
"0.760397",
"0.760397",
"0.760397",
"0.760397",
"0.760397",
"0.7578655",
"0.7578655",
"0.755482",
"0.7532972",
"0.7532972",
"0.7492836",
"0.74060977",
"0.74060977",
"... | 0.0 | -1 |
Plot clusters for clustering. | def plot_clusters(ax, component1, component2, df, name):
# Plot input data onto first two components at given axes
y_colors = sns.color_palette('hls', len(np.unique(df['y'])))
c_colors = sns.color_palette('hls', len(np.unique(df['c'])))
sns.scatterplot(x=component1, y=component2, hue='y', palette=y_col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_clusters(self):\n pass",
"def plotClusters(self):\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n fig.set_size_inches(18.5, 9.5)\n ax.set_title('Identification of Cluster Particles with Voronoi Volumes', fontsize=22)\n ax.set_xlabel('x [m]', ... | [
"0.88072544",
"0.85386676",
"0.8215624",
"0.7839966",
"0.77590936",
"0.7660864",
"0.7536083",
"0.74911845",
"0.74713933",
"0.7470934",
"0.7427409",
"0.73683476",
"0.7340834",
"0.7339011",
"0.73347133",
"0.7302822",
"0.72959346",
"0.72154164",
"0.7167083",
"0.7161983",
"0.7075... | 0.75853246 | 6 |
(str) Name of the signal. Primarily used for debugging. | def name(self):
return self._name if self._name is not None else ("0x%x" % id(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return signal_base_get_name(self.obj)",
"def getName(self):\n return signal_base_get_name(self.obj)",
"def name(self):\n return f'{self._vehicle.name} {self.wan_name} Signal'",
"def getSignalName(sig):\n try:\n return sig._name\n except AttributeError:\n ... | [
"0.8523746",
"0.8153488",
"0.7853298",
"0.7643534",
"0.7643534",
"0.71697146",
"0.7146038",
"0.7101834",
"0.70716125",
"0.69314754",
"0.6645807",
"0.6550978",
"0.6517696",
"0.651284",
"0.65111375",
"0.6485195",
"0.6485195",
"0.6485195",
"0.6485195",
"0.6485195",
"0.6485195",
... | 0.0 | -1 |
(bool) Whether associated live data can be changed. | def readonly(self):
return self._readonly | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_changed(self):\n return bool(self.changed_data)",
"def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return False\r\n\r\n # if not self.hasBeenUpdatedOnce:\r\n # self.hasBeenUpdat... | [
"0.7664667",
"0.72236025",
"0.7221693",
"0.71634007",
"0.7153708",
"0.71230614",
"0.69400084",
"0.69392246",
"0.6904709",
"0.69043034",
"0.69043034",
"0.68862987",
"0.6873543",
"0.68681735",
"0.6852447",
"0.6832046",
"0.681729",
"0.68070257",
"0.68070257",
"0.6780863",
"0.677... | 0.0 | -1 |
Reset ndarray to the base value of the signal that maps to it | def reset(self, signal):
if not signal.readonly:
self[signal] = signal.initial_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self) -> np.array:\n raise NotImplementedError",
"def reset(self):\r\n self.A = np.zeros(self.A.shape)",
"def reset_values(self):\n\n self.values = np.array([])",
"def reset(self):\n self.x_prev = np.zeros_like(self.mu)",
"def reset_state(self):\n self.s = np.co... | [
"0.6604181",
"0.64188147",
"0.6362876",
"0.6316145",
"0.62479174",
"0.6156489",
"0.61177236",
"0.607323",
"0.6030172",
"0.5971335",
"0.59388685",
"0.59350777",
"0.59052515",
"0.5846195",
"0.5832709",
"0.5803816",
"0.58018315",
"0.57863855",
"0.5777171",
"0.5768362",
"0.573181... | 0.57667273 | 20 |
Format time as human readable with two units. | def format_human_readable(seconds):
formatted = []
units = [
(60, 'second'),
(60, 'minute'),
(60, 'hour'),
(24, 'day'),
(365, 'year'),
]
remaining = seconds
for unit in units:
amount = remaining % unit[0]
if amount != 0:
formatte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(t):\n m, s = divmod(t, 60)\n h, m = divmod(m, 60)\n if h:\n return f\"{h:2.0f}hr {m:2.0f}min {s:4.1f}s\"\n elif m:\n return f\"{m:2.0f}min {s:4.1f}s\"\n else:\n return f\"{s:4.1f}s\"",
"def get_time_human_readable():\n return time.strftime(\"%A, %H:%M\")",
... | [
"0.7318539",
"0.7229094",
"0.7218902",
"0.7205436",
"0.7149427",
"0.7082788",
"0.7080231",
"0.70451623",
"0.7007278",
"0.6979167",
"0.6938128",
"0.69149363",
"0.6897457",
"0.6868326",
"0.68674266",
"0.68524367",
"0.68157226",
"0.6812967",
"0.67846733",
"0.6780671",
"0.6779049... | 0.6210963 | 64 |
Test logging nothing when events do not overlap. | def test_non_overlapping_events(sample_events, woodshop, caplog):
caplog.set_level(logging.INFO)
event1, event2 = sample_events.make_non_overlapping_events()
woodshop.start_event(event1)
woodshop.log_conflicts(event1.start_time)
woodshop.end_event(event1)
woodshop.log_conflicts(event1.end_time)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_overlapping_events_unchecked(sample_events, lobby, caplog):\n caplog.set_level(logging.INFO)\n event1, event2 = sample_events.make_overlapping_events()\n overlap_events(event1, event2, lobby, lobby, [lobby])\n assert len(caplog.messages) == 0",
"def test_consecutive_events(sample_events, woo... | [
"0.78422534",
"0.7332112",
"0.7111064",
"0.70400584",
"0.68922204",
"0.66992307",
"0.66137105",
"0.65962005",
"0.659173",
"0.65630174",
"0.65389043",
"0.6432229",
"0.63447213",
"0.6206858",
"0.6170935",
"0.59786797",
"0.5975548",
"0.59500444",
"0.59217006",
"0.5913639",
"0.58... | 0.82447785 | 0 |
Test logging when events overlap. | def test_overlapping_events(sample_events, woodshop, caplog):
caplog.set_level(logging.INFO)
event1, event2 = sample_events.make_overlapping_events()
overlap_events(event1, event2, woodshop, woodshop, [woodshop])
assert len(caplog.messages) == 1
message = caplog.messages[0]
assert "Schedule conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_overlapping_events(sample_events, woodshop, caplog):\n caplog.set_level(logging.INFO)\n event1, event2 = sample_events.make_non_overlapping_events()\n woodshop.start_event(event1)\n woodshop.log_conflicts(event1.start_time)\n woodshop.end_event(event1)\n woodshop.log_conflicts(event1... | [
"0.8093412",
"0.7614708",
"0.7564919",
"0.7351385",
"0.7246044",
"0.70633316",
"0.70509565",
"0.70035",
"0.6748311",
"0.66106915",
"0.61616695",
"0.60896856",
"0.60413057",
"0.59821135",
"0.59428275",
"0.58326954",
"0.58228695",
"0.58201545",
"0.58099663",
"0.5804145",
"0.576... | 0.7658214 | 1 |
Test logging when events overlap. | def test_overlapping_events_unchecked(sample_events, lobby, caplog):
caplog.set_level(logging.INFO)
event1, event2 = sample_events.make_overlapping_events()
overlap_events(event1, event2, lobby, lobby, [lobby])
assert len(caplog.messages) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_overlapping_events(sample_events, woodshop, caplog):\n caplog.set_level(logging.INFO)\n event1, event2 = sample_events.make_non_overlapping_events()\n woodshop.start_event(event1)\n woodshop.log_conflicts(event1.start_time)\n woodshop.end_event(event1)\n woodshop.log_conflicts(event1... | [
"0.8093412",
"0.7658214",
"0.7614708",
"0.7351385",
"0.7246044",
"0.70633316",
"0.70509565",
"0.70035",
"0.6748311",
"0.66106915",
"0.61616695",
"0.60896856",
"0.60413057",
"0.59821135",
"0.59428275",
"0.58326954",
"0.58228695",
"0.58201545",
"0.58099663",
"0.5804145",
"0.576... | 0.7564919 | 3 |
Splits data into train, validation and test set | def data_split(data, labels, train_ratio=0.5, rand_seed=42):
assert 0 <= train_ratio <= 1, "Error: training set ratio must be between 0 and 1"
x_train, x_temp, y_train, y_temp = train_test_split(data,
labels,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_split(raw_training_data, test_size=0.2, random_state=42)\n return train_set, test_set",
"def DataSplit(self, data):\n train_X,test_X,train_y,test_y=train_test_split(data[0],data[1], random_state=2)\n val... | [
"0.85447806",
"0.8493923",
"0.83882785",
"0.8343567",
"0.81740195",
"0.8126246",
"0.81160015",
"0.796242",
"0.7943654",
"0.7903312",
"0.7867195",
"0.77971345",
"0.7780968",
"0.77794904",
"0.77479666",
"0.7723619",
"0.7705078",
"0.7664957",
"0.7651086",
"0.7621758",
"0.7521416... | 0.7642893 | 19 |
Test if there are temporal relation in the graph. | def graph_has_temporal(g):
return any(any(edge.get(p) == 'time' for p in {'argmax', 'argmin', 'type'}) or 'num' in edge for edge in g.get('edgeSet', [])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_t(self):\n return any(map(lambda s: s.is_temporal, self))",
"def is_temporal(self, e):\n if e in self.temporal:\n return True",
"def has_data_flow(self) -> bool:\n return self.graph_count and not self.data_flow_null_count",
"def is_temporal(axis):\n return (axis.lower()... | [
"0.6949356",
"0.6732171",
"0.6202478",
"0.617535",
"0.58112055",
"0.5701779",
"0.5688753",
"0.56867164",
"0.5646803",
"0.56201804",
"0.5532245",
"0.55285877",
"0.5502352",
"0.5486662",
"0.54823154",
"0.54660666",
"0.5462605",
"0.54212254",
"0.5369836",
"0.5356995",
"0.5349476... | 0.7878967 | 0 |
Test if the given graphs only uses the allowed extensions. | def if_graph_adheres(g, allowed_extensions=set()):
allowed_extensions = set(allowed_extensions)
if 'v-structure' not in allowed_extensions and 'v-structure' in {e.get('type', "direct") for e in g.get('edgeSet', [])}:
return False
if 'temporal' not in allowed_extensions and graph_has_temporal(g):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)",
"def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)",
"def graph_issubset(graph1, graph2):\n\n # Validate if all arguments are Graphs\n check_grap... | [
"0.6065724",
"0.6065724",
"0.60316604",
"0.60111684",
"0.6009983",
"0.59923023",
"0.5982447",
"0.59039724",
"0.5902276",
"0.58919746",
"0.5781829",
"0.57775843",
"0.57775843",
"0.57654876",
"0.5765398",
"0.57533365",
"0.57504195",
"0.5739063",
"0.57363665",
"0.57212067",
"0.5... | 0.7062963 | 0 |
Shrink current window down Will shrink all secondary clients below the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized. Any amount that was unable to be applied to the clients is returned. | def shrink_down(self, cidx, amt):
left = amt # track unused shrink amount
# for each client after specified index
for idx in range(cidx + 1, len(self.relative_sizes)):
# shrink by current total left-over amount
left -= left - self._shrink(idx, left)
# return unus... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_secondary(self, amt):\n # get focused client\n client = self.clients[self.focused]\n\n # get default change size\n change = amt\n\n # get left-over height after change\n left = client.width - amt\n # if change would violate min_secondary_size\n if... | [
"0.67992985",
"0.6795239",
"0.6521221",
"0.6307644",
"0.6207567",
"0.6206843",
"0.61276096",
"0.6001164",
"0.59807885",
"0.57549524",
"0.55938506",
"0.5511365",
"0.53897417",
"0.5349745",
"0.5121988",
"0.48835444",
"0.46778956",
"0.46377677",
"0.46206918",
"0.45929945",
"0.45... | 0.65553856 | 2 |
Swap current window with closest window to the left | def swap_left(self):
win = self.clients.current_client
x, y = win.x, win.y
candidates = [c for c in self.clients if c.info()["x"] < x]
target = self._get_closest(x, y, candidates)
self.swap(win, target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window():\n\tif SLIDING_WINDOW:\n\t\t# get the chosen predicates\n\t\tpred = Predicate.objects.filter(pk__in=[p+1 for p in toggles.CHOSEN_PREDS])\n\n\t\t# handle window properties\n\t\tfor p in pred:\n\t\t\tp.move_window()",
"def swap_left(self):\n win = self.clients.current_client\n x, y ... | [
"0.7203738",
"0.6793183",
"0.66878366",
"0.63805354",
"0.63805354",
"0.635756",
"0.63549966",
"0.62852836",
"0.6202336",
"0.6189263",
"0.61566764",
"0.6140997",
"0.61312133",
"0.61020553",
"0.6087673",
"0.6040562",
"0.6019785",
"0.6012512",
"0.6012512",
"0.6007547",
"0.597211... | 0.70630604 | 1 |
Swap current window with closest window to the right | def swap_right(self):
win = self.clients.current_client
x, y = win.x, win.y
candidates = [c for c in self.clients if c.info()["x"] > x]
target = self._get_closest(x, y, candidates)
self.swap(win, target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window():\n\tif SLIDING_WINDOW:\n\t\t# get the chosen predicates\n\t\tpred = Predicate.objects.filter(pk__in=[p+1 for p in toggles.CHOSEN_PREDS])\n\n\t\t# handle window properties\n\t\tfor p in pred:\n\t\t\tp.move_window()",
"def swap_windows(window1,window2):\n window1_area = map(lambda y:int(y),get... | [
"0.7142098",
"0.6746179",
"0.6708299",
"0.6554204",
"0.6464042",
"0.6400142",
"0.63638383",
"0.62892324",
"0.62677294",
"0.62653357",
"0.62653357",
"0.6254421",
"0.6181581",
"0.6171001",
"0.6167619",
"0.6078853",
"0.60516375",
"0.60308003",
"0.6030217",
"0.6026241",
"0.600219... | 0.6981272 | 1 |
Configure the left column | def _configure_left(self, client, index):
width = self._get_secondary_widths()[0]
height = self._get_secondary_height(index)
left = self.screen_rect.x
top = self.screen_rect.y + self._get_relative_sizes_above(index)
if not self.main_centered or len(self.clients) == 2:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetValueLeft(self, *args, **kwargs):\n pass",
"def make_empty_left(self, e=0):\n self.make_empty_side(u'left')",
"def set_left(self, left):\n self.left = left",
"def get_left_side(grid):\n right = int(grid.width / 2)\n left_side = Grid(\n grid=grid, crop=Crop(left=0, rig... | [
"0.63195825",
"0.6086111",
"0.6077265",
"0.5996412",
"0.5920634",
"0.5807526",
"0.58066976",
"0.5735618",
"0.57232714",
"0.5686847",
"0.5674994",
"0.5672776",
"0.5672776",
"0.5653484",
"0.5637909",
"0.563178",
"0.56097245",
"0.5602208",
"0.5592556",
"0.5558909",
"0.5556237",
... | 0.66508955 | 0 |
Place a client on the screen Will prevent double margins by applying east and south margins only when the client is the rightmost or the bottommost window. | def _place_client(self, client, left, top, width, height):
# Create a temporary margin list for the client
if isinstance(self.margin, int):
margin = [self.margin] * 4
else:
# We need to copy this list otherwise we'd be modifying self.margin!
margin = self.mar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _configure_main(self, client):\n width = self._get_main_width()\n height = self.screen_rect.height\n left = self.screen_rect.x\n top = self.screen_rect.y\n\n if self.main_centered and len(self.clients) > 2:\n left += (self.screen_rect.width - width) // 2\n\n ... | [
"0.75539875",
"0.67920446",
"0.6782173",
"0.6717248",
"0.67088723",
"0.6532626",
"0.6277888",
"0.62567747",
"0.62149477",
"0.610243",
"0.6094332",
"0.59938514",
"0.5988378",
"0.5969192",
"0.5961537",
"0.59436643",
"0.58513707",
"0.58424866",
"0.5833053",
"0.5833053",
"0.58291... | 0.7591064 | 0 |
Tell if user is authorized to perform an operation on an object / repo | def is_authorized(self, organization: str, repo: str, permission: Permission, oid: Optional[str] = None) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authorized(self, request, obj=None):\r\n return True",
"def has_object_permission(self, request, view, obj):\n if request.user.is_superuser:\n return True\n if request.user.profile.role == UserRole.CLIENT and obj.owner != request.user:\n return False\n if ... | [
"0.7524522",
"0.73527783",
"0.73342746",
"0.7287169",
"0.72329104",
"0.7111462",
"0.709465",
"0.706015",
"0.7040911",
"0.70273584",
"0.70273584",
"0.6986406",
"0.69847655",
"0.69780433",
"0.69685835",
"0.6936195",
"0.693598",
"0.69347084",
"0.6912802",
"0.6912274",
"0.6899886... | 0.71538675 | 5 |
Check that the compulsory columns are present on the DataFrame. Any other columns within the DataFrame are ignored. | def _dataframe_column_check(df: DataFrame, compulsory_columns: Sequence) -> None:
if not set(compulsory_columns).issubset(df.columns):
diff = set(compulsory_columns).difference(df.columns)
msg = (
"The following compulsory column(s) are missing from the "
f"DataFrame: {diff}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_missing_columns(self, df: pd.DataFrame) -> None:\n if any([c not in df.columns for c in REQUIRED_COLUMNS]):\n raise ValueError(\"Missing columns in dataset.\"\n f\"Columns: {df.columns}\"\n f\"Required: {REQUIRED_COLUMNS}\")",
"... | [
"0.81305635",
"0.78329897",
"0.7660651",
"0.75005776",
"0.7425309",
"0.74197876",
"0.72678596",
"0.7239387",
"0.7127136",
"0.70580316",
"0.701105",
"0.6953294",
"0.69302094",
"0.6899149",
"0.6857188",
"0.68193567",
"0.67958313",
"0.6782587",
"0.67810744",
"0.67645425",
"0.671... | 0.84855485 | 0 |
Preprocess the columns with temporal dtype to convert from numpy datetime objects to pandas datetime objects. Casting the dtype of the columns to object type results in columns of dtype "object" with the contents of the columns being pandas datetime objects, rather than numpy datetime objects. | def _preprocess_temporal_columns(df: DataFrame) -> DataFrame:
for col in df.select_dtypes(include=["datetime64[ns, UTC]"]):
df = df.astype({col: "O"})
for col in df.select_dtypes(include="timedelta64[ns]"):
df = df.astype({col: "O"})
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if column in c.dates:\n frame[column] = frame[column].astype('datetime64')\n return frame",
"def recognize_dates(dframe):\n for i, dtype in enumerate(dframe.dtypes):\n if dtype... | [
"0.74709755",
"0.7033335",
"0.6733504",
"0.659353",
"0.64212334",
"0.6386969",
"0.63688743",
"0.63353765",
"0.63305885",
"0.6291442",
"0.6264255",
"0.60583246",
"0.6027275",
"0.60056144",
"0.59894425",
"0.5982113",
"0.5968225",
"0.59520805",
"0.59478825",
"0.5935167",
"0.5865... | 0.8187906 | 0 |
helper function format that converts time | def format(time_in_seconds):
""" in tenths of seconds into formatted string A:BC.D """
# A ten of minutes
A = time_in_seconds // 600
Intermediate_Operation = time_in_seconds // 10
amount_of_seconds = Intermediate_Operation %60
# B Unity of minutes
B = amount_of_seconds // 10
# C ten o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def __format_time(in_time):\n logging.debug(\"in_time = %s\", in_time)\n out = in_time.strftime(\"%a, %d %b %Y %H:%M:%S %z+0000\")\n logging.de... | [
"0.80753815",
"0.78916687",
"0.7760521",
"0.7726221",
"0.7718569",
"0.7677393",
"0.7623019",
"0.7544477",
"0.7486131",
"0.74268425",
"0.742128",
"0.7410823",
"0.73338574",
"0.7297183",
"0.72908336",
"0.7281866",
"0.7246052",
"0.7245116",
"0.72278744",
"0.7192817",
"0.7164283"... | 0.6411065 | 100 |
The IDP Metadata URL. Note that either `idp_metadata_url` or `idp_metadata_xml` (but not both) must be specified. | def idp_metadata_url(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_metadata_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_metadata_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_metadata_url\")",
"def metadata_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"metadata_url\")",
"def idp_metadata_xml(self) -> Optional[pulumi.Input[str]]:\n return pulumi.ge... | [
"0.88143337",
"0.77208996",
"0.69850427",
"0.69850427",
"0.6940839",
"0.655783",
"0.64734745",
"0.61319673",
"0.5966178",
"0.5825402",
"0.5802312",
"0.5780511",
"0.56919533",
"0.56919533",
"0.56362516",
"0.56362516",
"0.56137985",
"0.5597476",
"0.5585035",
"0.5585035",
"0.558... | 0.892841 | 0 |
The IDP Metadata URL. Note that either `idp_metadata_url` or `idp_metadata_xml` (but not both) must be specified. | def idp_metadata_url(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_metadata_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_metadata_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_metadata_url\")",
"def metadata_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"metadata_url\")",
"def idp_metadata_xml(self) -> Optional[pulumi.Input[str]]:\n return pulumi.ge... | [
"0.8815419",
"0.7720322",
"0.6985402",
"0.6985402",
"0.6941505",
"0.6558796",
"0.647289",
"0.6130445",
"0.59652656",
"0.5824618",
"0.58035105",
"0.5779413",
"0.569295",
"0.569295",
"0.5635098",
"0.5635098",
"0.5613696",
"0.5596113",
"0.55840826",
"0.55840826",
"0.55840826",
... | 0.8929303 | 1 |
The status of the SAML configuration. | def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> pulumi.Output['outputs.AssessmentStatusResponse']:\n return pulumi.get(self, \"status\")",
"def status(self) -> pulumi.Output['outputs.AssessmentStatusResponseResponse']:\n return pulumi.get(self, \"status\")",
"def status():\n with spinner():\n is_enabled = is_witne... | [
"0.7058781",
"0.6983164",
"0.6817036",
"0.6783692",
"0.67710745",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
... | 0.0 | -1 |
Get an existing WorkspaceSamlConfiguration resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
admin_role_values: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
allowed_organizations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n arn: Optional[pulumi.Input[str]] = None,\n auth_mode: Optional[pulumi.Input[str]] = None,\n default_s3_location: Optional[pulumi.Input[str]] = None,\n ... | [
"0.5538515",
"0.54990077",
"0.54566634",
"0.5317396",
"0.52680546",
"0.5262775",
"0.52016664",
"0.5139147",
"0.5115766",
"0.51015955",
"0.5100212",
"0.50605243",
"0.5002299",
"0.4928875",
"0.49048665",
"0.4883968",
"0.48664626",
"0.48504826",
"0.48420328",
"0.4830552",
"0.482... | 0.75696605 | 0 |
The IDP Metadata URL. Note that either `idp_metadata_url` or `idp_metadata_xml` (but not both) must be specified. | def idp_metadata_url(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "idp_metadata_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_metadata_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"idp_metadata_url\")",
"def idp_metadata_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"idp_metadata_url\")",
"def metadata_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi... | [
"0.8927949",
"0.8927949",
"0.7721125",
"0.6984451",
"0.6984451",
"0.69399685",
"0.65574515",
"0.64741915",
"0.6130745",
"0.59659696",
"0.5825923",
"0.58000207",
"0.5780518",
"0.5689842",
"0.5689842",
"0.5636517",
"0.5636517",
"0.5614861",
"0.5598212",
"0.5585309",
"0.5585309"... | 0.88136303 | 2 |
The status of the SAML configuration. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> pulumi.Output['outputs.AssessmentStatusResponse']:\n return pulumi.get(self, \"status\")",
"def status(self) -> pulumi.Output['outputs.AssessmentStatusResponseResponse']:\n return pulumi.get(self, \"status\")",
"def status():\n with spinner():\n is_enabled = is_witne... | [
"0.7058781",
"0.6983164",
"0.6817036",
"0.6783692",
"0.67710745",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
"0.67552096",
... | 0.66962016 | 47 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input('Would you like to see data for Chicago, New York City, Washington?').lower()
print(city)
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.58150685 | 58 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# sub program to display raw data
filename = ("{}.csv".format(city.replace(" ","_")))
print(filename)
df = pd.read_csv(filename)
df['Start Time'] = pd.to_datetime(df['Start Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.0 | -1 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
popular_month = df['month'].mode().values[0]
print('most popular month: {} '.format(popular_month))
# TO DO: display the most common day of week
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80235124",
"0.80223495",
"0.7914819",
"0.78260994",
"0.7821642",
"0.78139323",
"0.77653635",
"0.7739615",
"0.77358055",
"0.7733576",
"0.7686211",
"0.7667902",
"0.76510555",
"0.76440334",
"0.76391727",
"0.7636328",
"0.7624661",
"0.7622607",
"0.76119757",
"0.7599401",
"0.758... | 0.7527221 | 27 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
popular_start_station = df['Start Station'].mode().values[0]
print('Popular start station: {} '.format(popular_start_station))
# TO ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.72894394 | 29 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
df['End Time'] = pd.to_datetime(df['End Time'])
df['Duration'] = df['End Time'] - df['Start Time']
# TO DO: display total travel time
print('total time travel:',(df['Duration'].sum()))
# T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7528124 | 98 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix'
else:
title = 'Confusion matrix,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81922984",
"0.80933887",
"0.80272716",
"0.8016492",
"0.79913706",
"0.79885876",
"0.79777396",
"0.79729784",
"0.7958926",
"0.7954523",
"0.79347897",
"0.7931899",
"0.7931772",
"0.7928666",
"0.7923684",
"0.7921764",
"0.79213995",
"0.7920191",
"0.792016",
"0.7919876",
"0.79153... | 0.0 | -1 |
Deserialize registration model from a file containing JSON. Assumes a JSON formatted registration model, with keys 'regmethod' and 'transclass' specifying the registration method used and the transformation type as strings, and 'transformations' containing the transformations. The format of the transformations will dep... | def load(file):
import json
import importlib
f = open(file, 'r')
input = json.loads(f.read())
# import the appropriate transformation class
regMethod = str(input['regMethod'])
className = str(input['transClass'])
transClass = getattr(importlib.import_mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(file):\n\n return RegistrationModel.load(file)",
"def json2register(self):\n try:\n with open('registered.json', 'r') as file:\n self.final_dicc = json.load(file)\n except (FileNotFoundError, ValueError, json.decoder.JSONDecodeError):\n pass",
... | [
"0.6152679",
"0.5517744",
"0.5454677",
"0.52596986",
"0.51930666",
"0.5169601",
"0.50803816",
"0.50481814",
"0.5048122",
"0.50383097",
"0.502685",
"0.5015702",
"0.5006676",
"0.4995949",
"0.49528322",
"0.4947995",
"0.49237466",
"0.49138537",
"0.49093756",
"0.4899112",
"0.48791... | 0.82451445 | 0 |
Test that the result of _public_repos_url is the expected one based on the mocked payload | def test_public_repos_url(self, org, expected):
with patch('client.get_json') as mock:
instance = GithubOrgClient(org)
mock.return_value = expected
self.assertEqual(instance._public_repos_url, expected["repos_url"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_public_repos(self, mock_json):\n\n Response_payload = [{\"name\": \"Google\"}]\n mock_json.return_value = Response_payload\n\n with patch('client.GithubOrgClient._public_repos_url',\n new_callable=PropertyMock) as mock_public:\n\n mock_public.return_value ... | [
"0.8165539",
"0.7519236",
"0.6719071",
"0.6716822",
"0.6522895",
"0.648663",
"0.6443497",
"0.6414371",
"0.61882615",
"0.6184085",
"0.6174079",
"0.6146442",
"0.6130969",
"0.6115983",
"0.60996205",
"0.60840577",
"0.6066543",
"0.6057088",
"0.6020417",
"0.5977149",
"0.59506327",
... | 0.80628514 | 1 |
Return equality between itself and argument | def __eq__(self, matrix: 'MatrixBoolean') -> bool:
if not isinstance(matrix, MatrixBoolean) or \
self.dimM != matrix.dimM or self.dimN != matrix.dimN or self.matrix != matrix.matrix:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, argument):\n return super().__eq__(argument)",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __e... | [
"0.7924894",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"0.7452219",
"... | 0.0 | -1 |
Return value of the cell at position m, n | def get_value(self, m: int, n: int) -> int:
return self.matrix[m][n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_value(self, index):\n x, y = index\n return self.grid[y][x]",
"def get_cell(self, key):\n\n val = 0\n\n # -------------------------------------------------------------------------\n # YOUR CODE GOES HERE\n #\n \n #h = key[0]\n #e = key[1... | [
"0.69836324",
"0.65525454",
"0.6487007",
"0.6443801",
"0.63799673",
"0.6315123",
"0.63149637",
"0.6284218",
"0.627854",
"0.6245651",
"0.62431604",
"0.62148076",
"0.6214526",
"0.61991215",
"0.6199037",
"0.6194864",
"0.61790216",
"0.61664265",
"0.6159156",
"0.6154935",
"0.61500... | 0.82471144 | 0 |
Set an empty matrix containing only 0 | def set_from_empty(self, empty: int) -> None:
dimM, dimN = empty
self._set_dim(dimM, dimN)
self.matrix = [[0 for _ in range(dimN) ] for _ in range(dimM)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setZeroes(self, matrix) -> None:\n if not matrix: return\n h, w = len(matrix), len(matrix[0])\n col0 = False\n for i in range(h):\n if matrix[i][0] == 0:\n col0 = True # 第一列是否要全置为0\n for j in range(1, w): # 从第二列开始\n if matrix[i][... | [
"0.7923586",
"0.7900355",
"0.7863084",
"0.7853867",
"0.78464204",
"0.78248113",
"0.7799413",
"0.7768714",
"0.775196",
"0.77210057",
"0.77202976",
"0.7719934",
"0.7710213",
"0.77064663",
"0.768912",
"0.7687898",
"0.76852566",
"0.767767",
"0.7675788",
"0.7665884",
"0.7652749",
... | 0.7532405 | 29 |
Creation Date for the Log Analytics Query, in ISO 8601 format. | def time_created(self) -> str:
return pulumi.get(self, "time_created") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date_time(self) -> Optional[str]:\n... | [
"0.7202839",
"0.7202839",
"0.7202839",
"0.6736525",
"0.6709503",
"0.66336286",
"0.6597363",
"0.6597363",
"0.6597363",
"0.6573073",
"0.6510829",
"0.64769626",
"0.64713496",
"0.64713496",
"0.64713496",
"0.6438459",
"0.6438459",
"0.6438459",
"0.6438459",
"0.6438459",
"0.6438459"... | 0.57939404 | 97 |
Write translation JSON file. | def write_json_file(path, app_messages):
with open(path, 'w', encoding="utf8", newline=os.linesep) as msgfile:
json.dump(app_messages, msgfile, ensure_ascii=False, indent=4, sort_keys=True)
msgfile.write(os.linesep) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json(self, outputfile):\n outputfile.write(json.dumps(self.translations,\n sort_keys=True, indent=4))",
"def write_translations_file(app, lang, app_messages=None):\n\tif not app_messages:\n\t\tapp_messages = get_messages_for_app(app)\n\n\tif not app_messages:\n\t\treturn\n\n\ttpath = frappe... | [
"0.7920048",
"0.72325045",
"0.72279346",
"0.7196365",
"0.7175183",
"0.6968843",
"0.69429517",
"0.6920029",
"0.6920029",
"0.6887245",
"0.68823844",
"0.6853503",
"0.6749535",
"0.6734055",
"0.67087567",
"0.67016655",
"0.66422325",
"0.6624843",
"0.65717566",
"0.6565238",
"0.65651... | 0.6887478 | 9 |
A faster cumsum, for vectors of size < 8192. | def _cumsum_einsum(x, precision=jax.lax.Precision.DEFAULT):
mask = jnp.triu(jnp.ones(x.shape, dtype=jnp.bool_))
return jnp.einsum("ij,jk", x, mask, precision=precision) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cumsum(self) -> np.ndarray:\n\n if not hasattr(self, \"__cumsum\"):\n self.__cumsum = np.insert(np.cumsum(self.sizes), 0, 0)\n return self.__cumsum",
"def _cumulative_sum(xs):\r\n cumsum = 0\r\n for x in xs:\r\n cumsum += x\r\n yield cumsum",
"def cumulative_su... | [
"0.7096713",
"0.69426435",
"0.6849122",
"0.6789896",
"0.6752854",
"0.6742231",
"0.67084485",
"0.66521716",
"0.65112877",
"0.6510565",
"0.6504534",
"0.64434093",
"0.6429902",
"0.6397713",
"0.6321388",
"0.6298271",
"0.6298271",
"0.6298271",
"0.62788266",
"0.62781227",
"0.622553... | 0.6570658 | 8 |
Displays current server time | def time( self, mess, args):
return str(datetime.datetime.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def servertime(self):\r\n return servertime.Servertime(self)",
"def time_at_server():\n return time.asctime()",
"def now():\n print(strftime(\"%Y-%m-%d %H:%M:%S\", gmtime()))",
"def currentTime():\n return strftime(\"%H:%M:%S\", time.localtime())",
"async def server_time(self):\n uri... | [
"0.76804984",
"0.7634974",
"0.744474",
"0.73868763",
"0.7247567",
"0.7243079",
"0.7138182",
"0.7100776",
"0.70977163",
"0.7066082",
"0.70605445",
"0.703727",
"0.69715315",
"0.6967022",
"0.6944744",
"0.69272226",
"0.6922758",
"0.691844",
"0.68838453",
"0.68630517",
"0.68524677... | 0.6470981 | 66 |
Replaces ${MODULE_DIR} in a POSIX path and returns the platformdependent path string. | def _replace_module_dir_placeholder(value: str) -> str:
parts = pathlib.PurePosixPath(value).parts
if MODULE_DIR_VARIABLE not in parts:
return value
if parts[0] != MODULE_DIR_VARIABLE:
raise ValueError(
f"'{MODULE_DIR_VARIABLE}' nee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def system_path(path):\n if is_windows(): return path.replace('/', '\\\\')\n else: return path.replace('\\\\', '/')",
"def convertString(path):\n if (\"win\" in sys.platform):\n return path.replace(\"/\",\"\\\\\")\n elif (\"linux\" in sys.platform):\n return path.replace(\"\\\\\",\"/\")... | [
"0.6401663",
"0.6372536",
"0.6366904",
"0.6243135",
"0.6237686",
"0.61687243",
"0.6126809",
"0.60327554",
"0.599607",
"0.5904811",
"0.58830845",
"0.5872023",
"0.58660454",
"0.5845637",
"0.5812143",
"0.5791789",
"0.57478946",
"0.5746082",
"0.5716666",
"0.5695854",
"0.56807786"... | 0.7529465 | 0 |
Returns the IREE run module flags of the input model and execution config. | def generate_run_flags(
imported_model: ImportedModel,
input_data: common_definitions.ModelInputData,
module_execution_config: ModuleExecutionConfig,
gpu_id: str = "0",
with_driver: bool = True,
) -> List[str]:
model = imported_model.model
run_flags = [f"--function={model.entry_function}"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getdefflags(config_nm):\n if config_nm is 'train':\n user_params = user_params_train\n elif config_nm is 'eval':\n user_params = user_params_eval\n elif config_nm is 'tfrecorder':\n user_params = user_params_recorder\n else:\n print('Unrecognized configuration name : %s,... | [
"0.59311867",
"0.5843983",
"0.5841181",
"0.5793107",
"0.57462883",
"0.56632704",
"0.5601686",
"0.5566324",
"0.55531895",
"0.55361235",
"0.5514968",
"0.54272187",
"0.54206955",
"0.53971255",
"0.53658414",
"0.52972007",
"0.5278759",
"0.5241683",
"0.52289045",
"0.52036625",
"0.5... | 0.6648862 | 0 |
Gets if a product is revisable or not. | def IsRevisable(self, ids=[], default=None):
ret=False
for tmpObject in self.browse(getListIDs(ids)):
if isAnyReleased(self, tmpObject.id):
ret=True
break
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_revelant(self):\n return getattr(self, 'revelant', self.__class__._revelant_)",
"async def is_premium(self) -> bool:\n e = await self.request.request(url=f'https://www.roblox.com/mobileapi/userinfo', method='get')\n return e['IsPremium']",
"def __nonzero__(self):\n return boo... | [
"0.6547502",
"0.6181641",
"0.6129152",
"0.60451126",
"0.5835326",
"0.58311665",
"0.57051295",
"0.57051295",
"0.5677906",
"0.5651899",
"0.56397504",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217",
"0.5581217"... | 0.57611775 | 6 |
Return a string representation of the model. | def __str__(self):
return self.text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadat... | [
"0.8550562",
"0.78680784",
"0.7859392",
"0.7820475",
"0.78200865",
"0.78200865",
"0.78024864",
"0.7667491",
"0.7658678",
"0.7652298",
"0.7619285",
"0.75894105",
"0.7587887",
"0.7541158",
"0.75327915",
"0.75327915",
"0.75173604",
"0.7495425",
"0.7490489",
"0.7479993",
"0.74670... | 0.0 | -1 |
Return a string representation of the model. | def __str__(self):
return self.text[:50] + "..." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadat... | [
"0.8550562",
"0.78680784",
"0.7859392",
"0.7820475",
"0.78200865",
"0.78200865",
"0.78024864",
"0.7667491",
"0.7658678",
"0.7652298",
"0.7619285",
"0.75894105",
"0.7587887",
"0.7541158",
"0.75327915",
"0.75327915",
"0.75173604",
"0.7495425",
"0.7490489",
"0.7479993",
"0.74670... | 0.0 | -1 |
Retrieves a User object with the id linked to it | def get_user(user_id=None):
users = storage.all('User')
user = users.get('User' + "." + user_id)
if user is None:
abort(404)
else:
return jsonify(user.to_dict()), 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]",
"def get(id):\n return User.query.filter_by(id=id).first()",
"def get(self, user_id):\n return User.get(user_id)",
"... | [
"0.8460531",
"0.84129167",
"0.8363828",
"0.8228979",
"0.8196091",
"0.8152984",
"0.8152285",
"0.81419647",
"0.81419647",
"0.81419647",
"0.81419647",
"0.8127679",
"0.8112537",
"0.81110734",
"0.8087793",
"0.80669117",
"0.80636716",
"0.80591726",
"0.8052434",
"0.8052434",
"0.8052... | 0.7390201 | 97 |
Return the slope of line. If vertical, return infinity | def slope(l):
if l[1] == l[0]:
return float("inf")
else:
return float(l[3]-l[2])/(l[1]-l[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slope(self):\n if self.b == 0:\n return None\n else:\n return (-1) * self.a/self.b",
"def slope(start, end):\n\tx1 = start[0]\n\ty1 = start[1]\n\tx2 = end[0]\n\ty2 = end[1]\n\ttop = float(y2 - y1) \n\tbot = float(x2 - x1)\n\tif bot == 0:\n\t\treturn None\n\telse:\n\t\tretu... | [
"0.78768456",
"0.7504399",
"0.7434203",
"0.74321777",
"0.7431112",
"0.7312253",
"0.7107018",
"0.7074267",
"0.7048968",
"0.70196927",
"0.6911064",
"0.6902746",
"0.68834984",
"0.68247545",
"0.68240714",
"0.6742568",
"0.6741415",
"0.6647917",
"0.6641746",
"0.661496",
"0.65463865... | 0.7810303 | 1 |
Takes 2dimensional data and returns the superposition of the derivative for x and the derivative for y. | def x_y_derivator(data, x=None, y=None):
if x is None or y is None:
x = np.arange(0, len(data[:, 0]))
y = np.arange(0, len(data[0, :]))
d_measure_x = np.diff(data, axis=0)
d_measure_y = np.diff(data, axis=1)
dx = np.diff(x)
dy = np.diff(y)
ddx = (d_measure_x.T / dx).T
ddy ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(xi, x, y):\n yi = ((xi-x[1])+(xi-x[2]))/((x[0]-x[1])*(x[0]-x[2])) * y[0]\\\n +((xi-x[0])+(xi-x[2]))/((x[1]-x[0])*(x[1]-x[2])) * y[1]\\\n +((xi-x[0])+(xi-x[1]))/((x[2]-x[0])*(x[2]-x[1])) * y[2]\n return yi",
"def eval_Dxy(self):\n\n return self.X - self.Y",
"def derivat... | [
"0.6938651",
"0.6718694",
"0.67182934",
"0.666574",
"0.6613897",
"0.6407551",
"0.63130546",
"0.6270544",
"0.61832285",
"0.6169441",
"0.6158775",
"0.6095087",
"0.60663843",
"0.60353935",
"0.603533",
"0.6026558",
"0.6024889",
"0.5936687",
"0.5918605",
"0.58918214",
"0.5829386",... | 0.7077721 | 0 |
Return a logger which writes everything to stdout. | def loggerSetup(logLevel=logging.INFO):
logger = logging.getLogger(__name__)
outHandler = logging.StreamHandler(sys.stdout)
outHandler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(module)s: %(message)s"))
outHandler.setLevel(logLevel)
logger.addHandler(outHandler)
logger.setLevel(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _logger(self):\n logger = logging.getLogger(self.NAME)\n logger.setLevel(self.LOG_LEVEL)\n shandler = logging.StreamHandler(sys.stdout)\n fmt = '\\033[1;32m%(levelname)-5s %(module)s:%(funcName)s():'\n fmt += '%(lineno)d %(asctime)s\\033[0m| %(message)s'\n shandler.set... | [
"0.7316038",
"0.709956",
"0.6898612",
"0.68376845",
"0.6818234",
"0.67856514",
"0.671446",
"0.67142963",
"0.6636028",
"0.6625081",
"0.65867305",
"0.65808034",
"0.65178365",
"0.64889306",
"0.6424482",
"0.64230144",
"0.6409482",
"0.6404034",
"0.6381939",
"0.6312757",
"0.6305472... | 0.6843126 | 3 |
Checks whether the elements of an array are strictly increasing. | def is_strictly_increasing(a):
return np.all(np.diff(a) > 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted_array(arr, increasing=True):\n # If only 1\n if len(arr) == 0:\n return True\n # If multiple values\n if increasing:\n return np.all(np.diff(arr) >= 0)\n else:\n return np.all(np.diff(arr) <= 0)",
"def increasing(data):\n return (np.diff(data) > 0).all() == Tr... | [
"0.7699243",
"0.7627975",
"0.7175153",
"0.71117735",
"0.7087826",
"0.70144826",
"0.683785",
"0.67904943",
"0.6783914",
"0.6709119",
"0.6680873",
"0.655088",
"0.6538169",
"0.6526585",
"0.6522076",
"0.6502252",
"0.64690286",
"0.6435398",
"0.6381961",
"0.6369455",
"0.62817544",
... | 0.80792975 | 0 |
Returns the magnitude of a Quantity or number. | def magnitude(x):
return x.magnitude if hasattr(x, 'magnitude') else x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(*args):\r\n return sqrt(dot(args, args))",
"def magnitude(self):\n return self.real ** 2 + numpy.inner(self.pure, self.pure)",
"def magnitude(self): # @todo @caution check: something wrong?\n\n return (math.sqrt(reduce(lamb... | [
"0.7077792",
"0.70125926",
"0.68785787",
"0.68625635",
"0.6815076",
"0.67330873",
"0.6645811",
"0.6520507",
"0.6463618",
"0.63547575",
"0.6327381",
"0.6324424",
"0.62734187",
"0.62501884",
"0.6218764",
"0.6218194",
"0.6217566",
"0.6212252",
"0.62004584",
"0.62004066",
"0.6180... | 0.73513764 | 0 |
Unit vector in the direction of v. | def vector_hat(v):
# check if the magnitude of the Quantity is 0
mag = vector_mag(v)
if mag == 0:
return v
else:
return v / mag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_unit_vector(self, v):\n return v / np.linalg.norm(v)",
"def unit_vec(v):\n vlen = np.linalg.norm(v)\n if np.isclose(vlen, 0):\n raise ValueError('Cannot make unit vector from zero vector.')\n else:\n return v / vlen",
"def unit_vector(v):\n h = ((v[0]**2)+(v[1]**2))**0... | [
"0.876196",
"0.8152993",
"0.8148603",
"0.7971984",
"0.7936508",
"0.79334545",
"0.7881249",
"0.7872178",
"0.78442323",
"0.78442323",
"0.78442323",
"0.7830655",
"0.7821232",
"0.77987015",
"0.7793998",
"0.7759176",
"0.7738089",
"0.7738089",
"0.7738089",
"0.7738089",
"0.7738089",... | 0.0 | -1 |
Perpendicular Vector (rotated left). Only works with 2D Vectors. | def vector_perp(v):
assert len(v) == 2
x, y = v
return Vector(-y, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicularTo(self, vector):\n perpendicular = self.subtractVector(self.parallelTo(vector))\n return perpendicular",
"def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n raise ValueError(\"zero vector\")\n else:\n return np.cross... | [
"0.8416795",
"0.84082466",
"0.8146965",
"0.80611336",
"0.7819039",
"0.7711964",
"0.761575",
"0.7277041",
"0.72417593",
"0.7024806",
"0.69228154",
"0.68911976",
"0.68653077",
"0.67755646",
"0.6598421",
"0.65955156",
"0.6578948",
"0.65578604",
"0.65521973",
"0.63305825",
"0.619... | 0.7179226 | 9 |
Test that ConnectorLoopError is thrown when Connector.connect is called with event loop running in current thread. | async def test_connect_ConnectorLoopError() -> None:
current_loop = asyncio.get_running_loop()
connector = Connector(loop=current_loop)
# try to connect using current thread's loop, should raise error
pytest.raises(
ConnectorLoopError,
connector.connect,
"my-project:my-region:my-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_connect_error_with_no_server(event_loop):\n client = SMTP(hostname=\"127.0.0.1\", port=65534, loop=event_loop)\n\n with pytest.raises(SMTPConnectError):\n await client.connect(timeout=0.1)",
"def test_startconnector_with_noretry_on_con_failure(self):\n\n yield self.connect('127... | [
"0.6947779",
"0.68460256",
"0.65138566",
"0.6482847",
"0.6448226",
"0.6438702",
"0.63926756",
"0.63752186",
"0.63597155",
"0.635074",
"0.6311952",
"0.6292978",
"0.62809366",
"0.6269353",
"0.62270355",
"0.6209838",
"0.61868274",
"0.6183249",
"0.6162814",
"0.61423254",
"0.61079... | 0.88154346 | 0 |
This function returns the list of all products from the API. | def list_all_products():
all_products = []
max_pages = 1000
page_num = 1
while page_num < max_pages:
param = {
'per_page': 100,
'page': page_num,
}
rs_api = woo_request_helper().get_details(wc_endpoint='products', params=param)
if rs_api:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_all_products():\n products = []\n client = ProductsClient()\n for product in client.get_products():\n products.append(Product(\n base_currency=product[0],\n quote_currency=product[1],\n ))\n return products",
"def get_all_products():\n data = order_obj... | [
"0.8298007",
"0.82738745",
"0.8251436",
"0.8233669",
"0.8157878",
"0.8154259",
"0.8032464",
"0.8028842",
"0.7957147",
"0.78499264",
"0.7720971",
"0.7705617",
"0.7637103",
"0.7636632",
"0.75827783",
"0.75748986",
"0.75737715",
"0.7553478",
"0.74817824",
"0.7467059",
"0.7436524... | 0.8170335 | 4 |
Create instance Main window to create the main window of Application. | def main():
import sys
apps = QtWidgets.QApplication(sys.argv)
window = ControllerMainApps()
window.show()
sys.exit(apps.exec_()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_main_window():\n main_win = MainWindow()\n main_windows.append(main_win)\n available_geometry = app.desktop().availableGeometry(main_win)\n main_win.resize(available_geometry.width() * 2 / 3,\n available_geometry.height() * 2 / 3)\n main_win.show()\n return main_win"... | [
"0.8074604",
"0.77945703",
"0.74060464",
"0.736164",
"0.736164",
"0.736164",
"0.7301354",
"0.72590005",
"0.7209125",
"0.71755886",
"0.71612227",
"0.7159483",
"0.71347713",
"0.7119588",
"0.7070056",
"0.7040067",
"0.70168006",
"0.6950666",
"0.69227606",
"0.68792033",
"0.6821610... | 0.68440044 | 20 |
Calculates income after taxes and cash transfers. Defined as aftertax_income minus noncash benefits. | def cash_income(df):
return (df.aftertax_income -
(1 - tc.HOUSING_CASH_SHARE) * df.housing_ben -
(1 - tc.MCAID_CASH_SHARE) * df.mcaid_ben -
(1 - tc.MCARE_CASH_SHARE) * df.mcare_ben -
(1 - tc.OTHER_CASH_SHARE) * df.other_ben -
(1 - tc.SNAP_CASH_SHARE) * df.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthly_net_income(gross_income, income_tax):\n return gross_income - income_tax",
"def before_tax_profit(self):\n\n _before_tax_profit = self.net_revenue() - self.depreciation()\n return _before_tax_profit",
"def after_tax_profit(self):\n _after_tax_profit = self.before_tax_profit(... | [
"0.6502832",
"0.64841217",
"0.63989854",
"0.6217795",
"0.61582565",
"0.6105369",
"0.5936392",
"0.5826362",
"0.58258766",
"0.5792423",
"0.5729272",
"0.5714489",
"0.5661098",
"0.5655638",
"0.5633946",
"0.5602791",
"0.55662984",
"0.5536809",
"0.5504084",
"0.5497639",
"0.5496065"... | 0.72147006 | 0 |
Approximates Tax Policy Center's Expanded Cash Income measure. Subtracts WIC, housing assistance, veteran's benefits, Medicare, and Medicaid from expanded_income. ECI adds income measures not modeled in TaxCalculator, so these are ignored and will create a discrepancy compared to TPC's ECI. | def tpc_eci(df):
return df.expanded_income - df[mdf.ECI_REMOVE_COLS].sum(axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_ordinary_income(taxinc_change, calc):\n # compute AGI minus itemized deductions, agi_m_ided\n agi = calc.array('c00100')\n ided = np.where(calc.array('c04470') < calc.array('standard'),\n 0., calc.array('c04470'))\n agi_m_ided = agi - ided\n # a... | [
"0.63575685",
"0.61947",
"0.5838606",
"0.5754118",
"0.5631078",
"0.54414266",
"0.5274697",
"0.52616",
"0.5242341",
"0.5241744",
"0.5208719",
"0.5192135",
"0.5163222",
"0.51623523",
"0.51258457",
"0.5102183",
"0.50571877",
"0.50395715",
"0.5017013",
"0.5012186",
"0.49937758",
... | 0.5733739 | 4 |
validates ip address format | def validate_ip(ip):
valid_ip = ''
try:
valid_ip = str(ipaddress.ip_address(ip))
except ValueError:
logging.error('ip address \'{}\' is not valid: '.format(ip))
return valid_ip | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ip_format(self, ip_address):\n # regex for validating an Ip-address \n ip_regex = \"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/([0-9]|[1-2][0-9]|3[0-2]))?$\"\n\n # validate ip address\n r = re.compile(ip_regex)\... | [
"0.8194823",
"0.76122284",
"0.7550071",
"0.75436187",
"0.7410464",
"0.7329071",
"0.7280199",
"0.7267632",
"0.7255606",
"0.72446436",
"0.7235161",
"0.7197597",
"0.71690744",
"0.7164797",
"0.7104662",
"0.70866674",
"0.7076848",
"0.70563567",
"0.70498806",
"0.69903475",
"0.69893... | 0.73847663 | 5 |
validate ip address with cidr format. defaults to /24 if only IP is given | def validate_network_cidr(network_cidr):
compressed_network_cidr = ''
while True:
try:
compressed_network_cidr = ipaddress.ip_network(network_cidr)
break
except ValueError:
logging.warn('input should be in format x.x.x.x/x')
network_cidr = input('e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_cidr(cidr):\n check_integer = ''\n while not check_integer:\n check_integer = check_user_input_if_integer(cidr) \n if check_integer and check_integer < 32:\n pass\n else:\n cidr = input('user input has to be an integer and less than 32: ')\n ... | [
"0.7101074",
"0.70184755",
"0.68896466",
"0.68324304",
"0.68313074",
"0.6806895",
"0.6802307",
"0.6781137",
"0.6773412",
"0.6717731",
"0.6716789",
"0.6716789",
"0.67142653",
"0.66491306",
"0.66491306",
"0.66009504",
"0.6510521",
"0.65094715",
"0.6486576",
"0.6465099",
"0.6425... | 0.7482977 | 0 |
Returns leading coefficient of f. | def poly_LC(f):
if not f:
return INT_ZERO
else:
return f[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficient(self) -> float:\n ...",
"def coeffs(f):\n return dmp_coeffs(f.rep, f.lev, f.dom)",
"def iir_firstorder_freq_to_coef(f = 0.1):\n a = np.cos(f) - 1 - np.sqrt(np.cos(f)**2 - 4 * np.cos(f) + 3)\n a = np.abs(a)\n b = 1 - a\n return b, a",
"def f(self, X):\n\n retur... | [
"0.68067116",
"0.67108554",
"0.66341895",
"0.66190064",
"0.65667504",
"0.65371764",
"0.6503691",
"0.6419352",
"0.6413542",
"0.6389451",
"0.63540816",
"0.6267388",
"0.62656873",
"0.62519294",
"0.62496334",
"0.62341577",
"0.62002504",
"0.6183896",
"0.61793876",
"0.6176155",
"0.... | 0.59243304 | 39 |
Returns trailing coefficient of f. | def poly_TC(f):
if not f:
return INT_ZERO
else:
return f[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(y):\n \n\n k = 1.0\n return y*(1-y)",
"def evaluate(f, a):\n if f == []:\n return 0\n result = f[-1] # begin with leading coefficient\n i = len(f) - 1 # number of times to iterate \n while i >= 0:\n result = f[i] + a*result\n i -= 1\n return result",
"def _fv(... | [
"0.61605144",
"0.6077934",
"0.5969837",
"0.5947496",
"0.5921533",
"0.5921533",
"0.5905034",
"0.59044874",
"0.58646727",
"0.5864177",
"0.58433276",
"0.5835778",
"0.5786339",
"0.57820654",
"0.5752609",
"0.5752391",
"0.5751712",
"0.57513165",
"0.57398295",
"0.5739353",
"0.571015... | 0.5584072 | 35 |
Returns nth coefficient of f. | def poly_nth(f, n):
if n < 0 or n > len(f)-1:
raise IndexError
else:
return f[zzx_degree(f)-n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Coef(expr, n,i):\n return int(expr.coeff_monomial(x**(i+n)*y**n))",
"def f(i):\n return e(2**N-1-i) ^ 2**(N-1)",
"def evaluate(f, a):\n if f == []:\n return 0\n result = f[-1] # begin with leading coefficient\n i = len(f) - 1 # number of times to iterate \n while i >= 0:\n r... | [
"0.7056215",
"0.7050887",
"0.69566965",
"0.67553794",
"0.6707752",
"0.6696093",
"0.6630105",
"0.66094106",
"0.6600523",
"0.6504286",
"0.6456364",
"0.6427401",
"0.63642055",
"0.6362384",
"0.63592935",
"0.6350223",
"0.63102573",
"0.63026184",
"0.6237878",
"0.61649144",
"0.61449... | 0.73746616 | 0 |
Returns True if f is zero in Z[X]. | def zzX_zero_p(f):
if poly_univariate_p(f):
return not f
else:
if len(f) == 1:
return zzX_zero_p(f[0])
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fun(self, x):\n if np.any(x[self._z] != 0):\n return np.inf\n else:\n return 0",
"def is_zero(f):\n return dmp_zero_p(f.rep, f.lev)",
"def has_z(self): # -> bool:\n ...",
"def isZero(self):\n\t\treturn (self.p.isZero() & (self.q.isZero() == False))",
"... | [
"0.72440785",
"0.70402265",
"0.6390811",
"0.6329779",
"0.63218135",
"0.62462336",
"0.6222576",
"0.62079483",
"0.62048215",
"0.6146138",
"0.61352956",
"0.6050971",
"0.5987397",
"0.595638",
"0.59485096",
"0.59373397",
"0.5934698",
"0.5923522",
"0.588555",
"0.58643323",
"0.58572... | 0.6950707 | 2 |
Subtract cxk from f in Z[x]. | def zzx_sub_term(f, c, k=0):
if not c:
return f
n = len(f)
m = n-k-1
if k == n-1:
return zzx_strip([f[0]-c] + f[1:])
else:
if k >= n:
return [-c] + [INT_ZERO]*(k-n) + f
else:
return f[:m] + [f[m]-c] + f[m+1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzx_sub(f, g):\n if not g:\n return f\n if not f:\n return zzx_neg(g)\n\n df = zzx_degree(f)\n dg = zzx_degree(g)\n\n if df == dg:\n return zzx_strip([ a - b for a, b in zip(f, g) ])\n else:\n k = abs(df - dg)\n\n if df > dg:\n h, f = f[:k], f[k:]... | [
"0.65491664",
"0.6192572",
"0.60566866",
"0.5968153",
"0.5962163",
"0.5939183",
"0.59240633",
"0.58609855",
"0.5851643",
"0.5826591",
"0.58083516",
"0.57662076",
"0.5744788",
"0.57186055",
"0.56572986",
"0.565209",
"0.5609364",
"0.55824673",
"0.5579653",
"0.5557265",
"0.55479... | 0.63576776 | 1 |
Subtract cxk from f in Z[X]. | def zzX_sub_term(f, c, k=0):
return zzX_add_term(f, zzX_neg(c), k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzx_sub(f, g):\n if not g:\n return f\n if not f:\n return zzx_neg(g)\n\n df = zzx_degree(f)\n dg = zzx_degree(g)\n\n if df == dg:\n return zzx_strip([ a - b for a, b in zip(f, g) ])\n else:\n k = abs(df - dg)\n\n if df > dg:\n h, f = f[:k], f[k:]... | [
"0.64574474",
"0.62853634",
"0.60615396",
"0.6052799",
"0.6050572",
"0.5987769",
"0.57797927",
"0.57410425",
"0.5685736",
"0.56525683",
"0.56501037",
"0.56167096",
"0.5603385",
"0.55749017",
"0.55726856",
"0.55049276",
"0.5498131",
"0.5446875",
"0.5440292",
"0.54340875",
"0.5... | 0.62080353 | 2 |
Raise f to the nth power in Z[x]. | def zzx_pow(f, n):
if not n:
return [INT_ONE]
if n == 1 or f == [] or f == [1]:
return f
g = [INT_ONE]
while True:
n, m = n//2, n
if m & 1:
g = zzx_mul(g, f)
if n == 0:
break
f = zzx_sqr(f)
return g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzX_pow(f, n):\n if poly_univariate_p(f):\n return zzx_pow(f, n)\n if not n:\n return zzX_const_of(f, 1)\n if n == 1 or zzX_zero_p(f) or zzX_one_p(f):\n return f\n\n g = zzX_const_of(f, 1)\n\n while True:\n n, m = n//2, n\n\n if m & 1:\n g = zzX_mul(... | [
"0.7477932",
"0.73431796",
"0.70889837",
"0.7078694",
"0.7066896",
"0.70379096",
"0.70142376",
"0.6844157",
"0.6833018",
"0.6828619",
"0.67335033",
"0.67156863",
"0.67114174",
"0.6674375",
"0.6639195",
"0.65672934",
"0.655759",
"0.6553508",
"0.64179116",
"0.64179116",
"0.6398... | 0.71944225 | 2 |
Raise f to the nth power in Z[X]. | def zzX_pow(f, n):
if poly_univariate_p(f):
return zzx_pow(f, n)
if not n:
return zzX_const_of(f, 1)
if n == 1 or zzX_zero_p(f) or zzX_one_p(f):
return f
g = zzX_const_of(f, 1)
while True:
n, m = n//2, n
if m & 1:
g = zzX_mul(g, f)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pow(f, n):\n return f.per(dmp_pow(f.rep, n, f.lev, f.dom))",
"def zzx_pow(f, n):\n if not n:\n return [INT_ONE]\n if n == 1 or f == [] or f == [1]:\n return f\n\n g = [INT_ONE]\n\n while True:\n n, m = n//2, n\n\n if m & 1:\n g = zzx_mul(g, f)\n\n ... | [
"0.732194",
"0.7110891",
"0.70446986",
"0.69497335",
"0.6943896",
"0.69369024",
"0.69259584",
"0.681598",
"0.6739879",
"0.67289054",
"0.6727927",
"0.6680388",
"0.6616513",
"0.65826035",
"0.6541072",
"0.6437504",
"0.6396418",
"0.63798684",
"0.6339265",
"0.63387877",
"0.6330188... | 0.7451823 | 0 |
Returns maximum norm of a polynomial in Z[x]. | def zzx_max_norm(f):
if not f:
return INT_ZERO
else:
return max(zzx_abs(f)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzX_max_norm(f):\n if poly_univariate_p(f):\n return zzx_max_norm(f)\n else:\n return max([ zzX_max_norm(coeff) for coeff in f ])",
"def max_norm() -> float:\n return 1.0",
"def norm(x):\n return inner_prod(x, x)[0].sqrt_()",
"def norm_sqr(x):\n return inner_prod(x, x)[0]",
"... | [
"0.7676479",
"0.67081606",
"0.6429065",
"0.6397484",
"0.63679093",
"0.6361638",
"0.6344008",
"0.6340044",
"0.633521",
"0.62989974",
"0.6297091",
"0.6288976",
"0.617381",
"0.61337125",
"0.6115138",
"0.6100051",
"0.6100051",
"0.6092006",
"0.6067748",
"0.60584384",
"0.6003973",
... | 0.6763031 | 1 |
Returns maximum norm of a polynomial in Z[X]. | def zzX_max_norm(f):
if poly_univariate_p(f):
return zzx_max_norm(f)
else:
return max([ zzX_max_norm(coeff) for coeff in f ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_norm() -> float:\n return 1.0",
"def zzx_max_norm(f):\n if not f:\n return INT_ZERO\n else:\n return max(zzx_abs(f))",
"def norms(Z):\n return Z.view(Z.shape[0], -1).norm(dim=1)[:,None,None,None]",
"def normP(z):\n a = abs(float(z))\n if a >= 8.3:\n sum = 0.5\n ... | [
"0.6703867",
"0.6691624",
"0.65342957",
"0.63917094",
"0.63875395",
"0.6378613",
"0.6371709",
"0.63692665",
"0.634451",
"0.6282344",
"0.6230944",
"0.6225322",
"0.6217385",
"0.61546063",
"0.61530846",
"0.61375695",
"0.6108851",
"0.6108851",
"0.605075",
"0.60412884",
"0.5984149... | 0.7637313 | 0 |
Returns l1 norm of a polynomial in Z[x]. | def zzx_l1_norm(f):
if not f:
return INT_ZERO
else:
return sum(zzx_abs(f)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzX_l1_norm(f):\n if poly_univariate_p(f):\n return zzx_l1_norm(f)\n else:\n return sum([ zzX_l1_norm(coeff) for coeff in f ])",
"def l1(vec):\n return np.linalg.norm(vec, ord=1)",
"def L1Norm(X):\n return max(np.sum(X,axis=0))",
"def L1(X):\n \n sanitycheck(X,np.ndarray)\... | [
"0.7844401",
"0.7328825",
"0.71581227",
"0.712899",
"0.7107472",
"0.68653864",
"0.6814324",
"0.67756003",
"0.6774308",
"0.6737321",
"0.6716745",
"0.66532063",
"0.6628349",
"0.66172665",
"0.66081995",
"0.649694",
"0.6494543",
"0.64607596",
"0.6405793",
"0.6394973",
"0.6386501"... | 0.6881367 | 5 |
Returns l1 norm of a polynomial in Z[X]. | def zzX_l1_norm(f):
if poly_univariate_p(f):
return zzx_l1_norm(f)
else:
return sum([ zzX_l1_norm(coeff) for coeff in f ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l1(vec):\n return np.linalg.norm(vec, ord=1)",
"def L1Norm(X):\n return max(np.sum(X,axis=0))",
"def norm1(X):\r\n # pass\r\n if X.shape[0]*X.shape[1] == 0:\r\n return 0\r\n return abs(X).sum()\r\n # return LA.norm(X, 1)\r",
"def L1(X):\n \n sanitycheck(X,np.ndarray)\n r... | [
"0.7400679",
"0.723374",
"0.72229683",
"0.7202876",
"0.69178206",
"0.6877627",
"0.6835889",
"0.6834067",
"0.6809726",
"0.67698973",
"0.6706666",
"0.66810614",
"0.6680159",
"0.6630256",
"0.6602132",
"0.65969056",
"0.65755683",
"0.6462875",
"0.6444661",
"0.63563305",
"0.6343032... | 0.7832138 | 0 |
mth order derivative of a polynomial in Z[x]. | def zzx_diff(f, m=1):
n, deriv = zzx_degree(f), []
n = zzX_degree(f)
if n < m:
return []
deriv, c = [], INT_ONE
for i in xrange(0, m):
c, n = c*n, n-1
for coeff in f[:-m]:
deriv.append(coeff*c)
c, n = n*(c//(n+m)), n-1
return deriv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _derZ(self, x, y, z):\n m = len(x)\n temp = np.zeros((m, self.funcCount))\n for j in range(self.funcCount):\n temp[:, j] = self.functions[j](x, y, z)\n i = self.argcompare(temp, axis=1)\n y = temp[np.arange(m), i]\n dfdz = np.zeros_like(x)\n for j in ... | [
"0.69404477",
"0.6908545",
"0.68533975",
"0.681335",
"0.67528856",
"0.67230815",
"0.6700251",
"0.6641134",
"0.654892",
"0.6538333",
"0.6527875",
"0.6526804",
"0.65219885",
"0.6506436",
"0.64684093",
"0.64621884",
"0.6444908",
"0.6411884",
"0.6409387",
"0.6390736",
"0.6369589"... | 0.7049844 | 0 |
mth order derivative in x_k of a polynomial in Z[X]. | def zzX_diff_for(f, k, m=1):
if k < 0:
k += poly_level(f) + 1
if k == 1:
return zzX_diff(f, m)
def rec_diff(g, l):
if l == k:
return zzX_diff(g, m)
else:
return zzX_strip([ rec_diff(coeff, l+1) for coeff in g ])
return rec_diff(f, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zzX_diff_eval(f, k, m, x):\n if k < 0:\n k += poly_level(f) + 1\n\n if k == 1:\n return zzX_eval(zzX_diff(f, m), x)\n\n def rec_eval(g, l):\n if l == k:\n return zzX_eval(zzX_diff(g, m), x)\n else:\n return zzX_strip([ rec_eval(coeff, l+1) for coeff in... | [
"0.6870524",
"0.66385525",
"0.6337095",
"0.62586904",
"0.6247389",
"0.61913675",
"0.60805315",
"0.6015209",
"0.6011528",
"0.6003042",
"0.5988012",
"0.5969743",
"0.5950972",
"0.5926677",
"0.5915538",
"0.58842486",
"0.5876771",
"0.5820747",
"0.579722",
"0.57847553",
"0.5760495"... | 0.68088853 | 1 |
Evaluate f(x) in Z[x] using Horner scheme. | def zzx_eval(f, x):
result = INT_ZERO
if not x:
return poly_TC(f)
for a in f:
result *= x
result += a
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_numerical_gradient(f, x, verbose=True, h=0.00001):\n\n fx = f(x) # evaluate function value at original point\n grad = np.zeros_like(x)\n # iterate over all indexes in x\n it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite'])\n while not it.finished:\n\n # evaluate functio... | [
"0.63460684",
"0.62573415",
"0.62205976",
"0.62145764",
"0.61654454",
"0.61396074",
"0.6139041",
"0.61204016",
"0.60601825",
"0.5955203",
"0.59275115",
"0.5910847",
"0.59042245",
"0.57765585",
"0.5759126",
"0.5754126",
"0.5714853",
"0.5668366",
"0.5658677",
"0.56582755",
"0.5... | 0.59313357 | 10 |
Evaluate f in Z[X] in variable x_1, using Horner scheme. | def zzX_eval(f, x):
if hasattr(x, '__iter__'):
return zzX_eval_list(f, x)
if poly_univariate_p(f):
return zzx_eval(f, x)
if not x:
return poly_TC(f)
result = poly_LC(f)
for coeff in f[1:]:
result = zzX_mul_const(result, x)
result = zzX_add(result, coeff)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f1(x):\n return x**3 - 2*x + 2",
"def horner(poly: Sequence[float], x: float) -> float:\n result = 0.0\n for coeff in reversed(poly):\n result = result * x + coeff\n return result",
"def eval_numerical_gradient(f, x, verbose=True, h=0.00001):\n\n fx = f(x) # evaluate function value a... | [
"0.6301516",
"0.6086152",
"0.6085154",
"0.6078058",
"0.60761476",
"0.599915",
"0.59574884",
"0.59230375",
"0.5922305",
"0.59212714",
"0.58689886",
"0.58516985",
"0.58236176",
"0.5813196",
"0.5812005",
"0.5777729",
"0.57619",
"0.57413137",
"0.5729096",
"0.5706535",
"0.5689789"... | 0.60219145 | 5 |
Divides all coefficients by polynomial content. | def zzX_primitive(f):
cont = zzX_content(f)
if zzX_one_p(cont):
return cont, f
else:
return cont, [ zzX_quo(coeff, cont) for coeff in f ] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide(self, P):\n if P.getDegree() == -1:\n raise PolynomialError(\"Impossible to divide by 0\")\n return\n \n remainder = Polynomial(self.__coefficients) #Generate a copy of self and assign it to remainder\n \n if self.getDegree() < P.getDegree():\... | [
"0.6044631",
"0.5843627",
"0.5542578",
"0.5382521",
"0.5338407",
"0.5337228",
"0.53105533",
"0.52908397",
"0.52908397",
"0.52769446",
"0.52437663",
"0.5228222",
"0.5201172",
"0.5160551",
"0.51473844",
"0.514249",
"0.51404566",
"0.51333195",
"0.5128716",
"0.5064503",
"0.505992... | 0.0 | -1 |
Returns a onehot tensor. This is a PyTorch equivalent of Tensorflow's tf.one_hot. | def one_hot(indices, depth):
# print(indices)
encoded_indices = torch.zeros(indices.size() + torch.Size([depth])).cuda()
index = indices.view(indices.size()+torch.Size([1]))
encoded_indices = encoded_indices.scatter_(1,index,1)
return encoded_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot(t, num_classes, device='cpu'):\n return torch.zeros(t.size()[0], num_classes).to(device).scatter_(1, t.view(-1, 1), 1)",
"def _one_hot(tensor: torch.Tensor, num_classes: int = -1, dim: int = -1) -> torch.Tensor:\n if not check_for_index_targets(tensor):\n raise ValueError(f'tensor must be... | [
"0.7789414",
"0.7704868",
"0.76986057",
"0.76597536",
"0.7629563",
"0.7553897",
"0.75398374",
"0.74877393",
"0.74762434",
"0.7469148",
"0.74602",
"0.74449766",
"0.74236",
"0.73929656",
"0.7385945",
"0.7382963",
"0.7356756",
"0.7319632",
"0.72946125",
"0.72945786",
"0.7265763"... | 0.6733651 | 73 |
Get outputs with additional unlock conditions. | def get_outputs_with_additional_unlock_conditions(self, outputs_to_claim):
return self._call_account_method(
'getOutputsWithAdditionalUnlockConditions', {
'outputsToClaim': outputs_to_claim
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _list_outputs(self):\n \n outputs = self._outputs().get()\n return outputs",
"def get_outputs():\n outputs = {}\n for obj in vars(acsploit.output).values():\n if hasattr(obj, 'OUTPUT_NAME'):\n outputs[obj.OUTPUT_NAME] = obj\n\n return outputs",
"def get_outpu... | [
"0.6029543",
"0.5978834",
"0.595764",
"0.59557635",
"0.58315384",
"0.57428867",
"0.5715514",
"0.5687862",
"0.5673937",
"0.56377727",
"0.5630134",
"0.55974096",
"0.5584727",
"0.5545749",
"0.55104816",
"0.5496828",
"0.5495693",
"0.5490033",
"0.54719263",
"0.54620355",
"0.544653... | 0.7448071 | 0 |
Returns all unspent outputs of the account. | def unspent_outputs(self, filter_options=None):
return self._call_account_method(
'unspentOutputs', {
'filterOptions': filter_options
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unspent_outputs(self, crypto, address):\n raise NotImplementedError(\n \"This service does not support getting unspent outputs. \"\n \"Or rather it has no defined 'get_unspent_outputs' method.\"\n )",
"def get_unspent_outputs(self, address):\n\n raise NotImpleme... | [
"0.80590487",
"0.7758299",
"0.74471706",
"0.7018622",
"0.6618164",
"0.65917027",
"0.6520653",
"0.61917466",
"0.617753",
"0.61040336",
"0.59494156",
"0.5922694",
"0.5908892",
"0.5908892",
"0.5908892",
"0.5908892",
"0.5908892",
"0.5908892",
"0.5908892",
"0.585725",
"0.57359296"... | 0.83500385 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.