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 |
|---|---|---|---|---|---|---|
Tokenizes a piece of text into its word pieces. This uses a greedy longestmatchfirst algorithm to perform tokenization using the given vocabulary. | def tokenize(self, text):
text = convert_to_unicode(text)
output_tokens = []
for token in whitespace_tokenize(text):
chars = list(token)
if len(chars) > self.max_input_chars_per_word:
output_tokens.append(self.unk_token)
continue
is_bad = False
start = 0
sub_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_tokenize(text):\n for (regexp, replacement) in RULES1:\n text = sub(regexp, replacement, text)\n # add extra space to make things easier\n text = \" \" + text + \" \"\n for (regexp, replacement) in RULES2:\n text = sub(regexp, replacement, text)\n for regexp in CONTRACTIONS:\n... | [
"0.6765013",
"0.65806097",
"0.6558591",
"0.65464544",
"0.65382236",
"0.65292895",
"0.650777",
"0.6502975",
"0.64893436",
"0.64685136",
"0.644402",
"0.64103246",
"0.6393775",
"0.6369262",
"0.63676906",
"0.6361103",
"0.63583905",
"0.6344288",
"0.63388896",
"0.6334311",
"0.63234... | 0.63624436 | 15 |
Return local timezone as datetime.timezone tzinfo for dt | def get_local_tz(dt):
if not datetime_has_tz(dt):
return dt.astimezone().tzinfo
else:
raise ValueError("dt must be naive datetime.datetime object") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_timezone(dt, tz):\n return dt.astimezone(timezonize(tz))",
"def GetLocalTime(dt, tz):\n return dt.replace(tzinfo=pytz.utc).astimezone(tz)",
"def add_local_timezone(dt):\n assert dt.tzinfo is None\n localtz = tzlocal.get_localzone()\n logging.warning(\"Assuming timezone for {} is {}\".format... | [
"0.7739292",
"0.7662554",
"0.74670464",
"0.7302688",
"0.72773224",
"0.7249042",
"0.7194538",
"0.7154571",
"0.71295494",
"0.71192306",
"0.7051751",
"0.69687104",
"0.69241166",
"0.69189954",
"0.68927354",
"0.6827622",
"0.6792189",
"0.6769082",
"0.6747714",
"0.67452216",
"0.6727... | 0.8099729 | 0 |
Convert datetime.datetime object with timezone to UTC timezone | def datetime_tz_to_utc(dt):
if type(dt) != datetime.datetime:
raise TypeError(f"dt must be type datetime.datetime, not {type(dt)}")
if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None:
return dt.replace(tzinfo=dt.tzinfo).astimezone(tz=datetime.timezone.utc)
else:
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utc(dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=pytz.utc)\n else:\n return dt.astimezone(pytz.utc)",
"def tz_as_utc(dt: datetime) -> datetime:\n if dt.tzinfo is None:\n return dt.replace(tzinfo=tzutc())\n return dt.astimezone(tzutc())",
"def toutc(dateobj, ti... | [
"0.79623365",
"0.7950574",
"0.7781917",
"0.7578482",
"0.7578482",
"0.7578482",
"0.7529533",
"0.743937",
"0.73045933",
"0.7299864",
"0.7267573",
"0.72523016",
"0.7214165",
"0.7167773",
"0.71260893",
"0.7097819",
"0.7054177",
"0.7052965",
"0.70453143",
"0.7044592",
"0.700184",
... | 0.74979043 | 7 |
Remove timezone from a datetime.datetime object | def datetime_remove_tz(dt):
if type(dt) != datetime.datetime:
raise TypeError(f"dt must be type datetime.datetime, not {type(dt)}")
return dt.replace(tzinfo=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tz_aware(value: datetime) -> datetime:\n if settings.USE_TZ:\n value = value.replace(tzinfo=timezone.utc)\n\n return value",
"def remove_time_zone(self, time_stamp):\n return iso8601.parse_date(time_stamp).replace(tzinfo=None).isoformat()",
"def make_naive_utc(date_time: datetime.dateti... | [
"0.7175989",
"0.69294244",
"0.67877424",
"0.67358077",
"0.6735459",
"0.6733476",
"0.6705074",
"0.66887933",
"0.6447648",
"0.64427304",
"0.637878",
"0.6363917",
"0.63603777",
"0.6343847",
"0.6337315",
"0.63221085",
"0.63089275",
"0.630047",
"0.630047",
"0.630047",
"0.62686706"... | 0.8354872 | 0 |
Convert naive (timezone unaware) datetime.datetime to aware timezone in UTC timezone | def datetime_naive_to_utc(dt):
if type(dt) != datetime.datetime:
raise TypeError(f"dt must be type datetime.datetime, not {type(dt)}")
if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None:
# has timezone info
raise ValueError(
"dt must be naive/timezone unaware:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tz_as_utc(dt: datetime) -> datetime:\n if dt.tzinfo is None:\n return dt.replace(tzinfo=tzutc())\n return dt.astimezone(tzutc())",
"def convert_timezone(dt: datetime, tz_info: tzinfo = UTC) -> datetime:\n if dt.tzinfo is None:\n raise ValueError(f\"{dt} is a naive datetime\")\n retu... | [
"0.7858916",
"0.7739093",
"0.7653985",
"0.75487655",
"0.73740417",
"0.7288646",
"0.72490877",
"0.7237265",
"0.72333544",
"0.7226919",
"0.7223748",
"0.7190736",
"0.71677727",
"0.71677727",
"0.71677727",
"0.70960903",
"0.70765847",
"0.7024692",
"0.7020663",
"0.69640076",
"0.694... | 0.7696817 | 2 |
Convert naive (timezone unaware) datetime.datetime to aware timezone in local timezone | def datetime_naive_to_local(dt):
if type(dt) != datetime.datetime:
raise TypeError(f"dt must be type datetime.datetime, not {type(dt)}")
if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None:
# has timezone info
raise ValueError(
"dt must be naive/timezone unawar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_local_timezone(dt, timezone=\"America/New_York\", from_timezone=\"UTC\"):\n from_zone = tz.gettz(from_timezone)\n to_zone = tz.gettz(timezone)\n dt = dt.replace(tzinfo=from_zone)\n return dt.astimezone(to_zone)",
"def make_tz_aware(local_dt):\n aware_dt = timezone('US/Eastern').loc... | [
"0.75842094",
"0.7551611",
"0.7482618",
"0.73640776",
"0.7319316",
"0.7285283",
"0.72314686",
"0.72203916",
"0.71818566",
"0.71705645",
"0.71607035",
"0.7128994",
"0.71104604",
"0.70380706",
"0.70281225",
"0.7020472",
"0.69619054",
"0.69597244",
"0.6958899",
"0.69421554",
"0.... | 0.7702224 | 0 |
Convert datetime.datetime object in UTC timezone to local timezone | def datetime_utc_to_local(dt):
if type(dt) != datetime.datetime:
raise TypeError(f"dt must be type datetime.datetime, not {type(dt)}")
if dt.tzinfo is not datetime.timezone.utc:
raise ValueError(f"{dt} must be in UTC timezone: timezone = {dt.tzinfo}")
return dt.replace(tzinfo=datetime.tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def utc_to_local(t):\n # set utc tzinfo\n t = t.replace(tzinfo=tz.tzutc())\n # convert to local timezone\n return t.astimezone(tz.tzlocal())",
"def localize_utc(value):\n if isinstance(value, datetime):\n return value.... | [
"0.77216816",
"0.77073115",
"0.7663696",
"0.763669",
"0.76251507",
"0.76251507",
"0.76251507",
"0.76101923",
"0.75453734",
"0.7514531",
"0.7496808",
"0.7470185",
"0.74353176",
"0.7287574",
"0.72782207",
"0.7245649",
"0.72126806",
"0.7208725",
"0.71538925",
"0.7145654",
"0.708... | 0.768446 | 2 |
Register extensions with this instance of Markdown. | def registerExtensions(self, extensions, configs):
for ext in extensions:
try:
if isinstance(ext, util.string_type):
ext = self.build_extension(ext, configs.get(ext, []))
if isinstance(ext, Extension):
ext.extendMarkdown(self, g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extendMarkdown(self, md):\n hiliter = HiliteTreeprocessor(md)\n hiliter.config = self.getConfigs()\n if \"hilite\" in md.treeprocessors:\n logger.warning(\n \"Replacing existing 'hilite' extension - please remove \"\n \"'codehilite' from WIKI_MARKDO... | [
"0.7204857",
"0.71846044",
"0.70897174",
"0.6708119",
"0.6692719",
"0.6637423",
"0.65044355",
"0.63096255",
"0.6245698",
"0.62309545",
"0.61911505",
"0.6166153",
"0.6107127",
"0.59573793",
"0.5952195",
"0.5948156",
"0.58963215",
"0.58298516",
"0.5825056",
"0.5811948",
"0.5806... | 0.8238789 | 0 |
Calculates topography metrics at point OR within buffer of point if buf > 0 OR within polygon if poly = 1 | def GEEtopoPts(ptsFile,metric,buf,poly,username,folderOut, scalePix = 30):
# load required libraries
import ee
import math
# Initialize the Earth Engine object, using the authentication credentials.
ee.Initialize()
ID_field = "geeID"
#load pts or poly file
pts1 = ee.F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topography(x,y):\n \n z = -x/10\n \n N = len(x)\n for i in range(N):\n # Step\n if 10 < x[i] < 12:\n z[i] += 0.4 - 0.05*y[i]\n \n # Constriction\n if 27 < x[i] < 29 and y[i] > 3:\n z[i] += 2\n \n ... | [
"0.5641415",
"0.5442369",
"0.5405515",
"0.53786445",
"0.53624314",
"0.5322205",
"0.52940977",
"0.5281894",
"0.5246555",
"0.52168465",
"0.51830745",
"0.51610804",
"0.51483154",
"0.5049854",
"0.50438964",
"0.5015406",
"0.5005385",
"0.49864638",
"0.49695382",
"0.4968517",
"0.496... | 0.48394364 | 32 |
Adds a new vertex to the graph if one with the same name doesn't already exist | def add_vertex(self, v: str) -> None:
if self.contains_vertex(v):
return
else:
self.adj_list[v] = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex_name: n):\n new_vertex = Vertex(vertex_name)\n self._graph[new_vertex.name] = new_vertex",
"def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex",
"def add_vertex(self, vertex_id): # O(1) time c... | [
"0.8184778",
"0.809636",
"0.79678255",
"0.78457737",
"0.7835952",
"0.7835952",
"0.7831543",
"0.7781145",
"0.774286",
"0.76729894",
"0.76266474",
"0.75755197",
"0.755517",
"0.7521082",
"0.7510323",
"0.74895126",
"0.7463465",
"0.7454165",
"0.7446354",
"0.7335446",
"0.73114604",... | 0.7468866 | 16 |
Adds edge to the graph between specified vertices. If the vertices don't already exist, they are created. | def add_edge(self, u: str, v: str) -> None:
if (u == v):
return
else:
# add_vertex handles the checks
# for if the vertices already
# exist and if they already do,
# nothing happens. Else it adds them
self.add_vertex(u)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, vertices: Iterable[\"Vertex\"]) -> None:\n vertices = list(vertices)\n if len(vertices) == 2:\n self.edges.append(self.add_vertices(vertices)) # type: ignore\n else:\n raise DXFValueError(\n \"Invalid vertices count, expected two vertice... | [
"0.81610715",
"0.8115509",
"0.7784109",
"0.7619617",
"0.7592272",
"0.7578583",
"0.75477964",
"0.75330937",
"0.7530788",
"0.75050527",
"0.7486117",
"0.74607503",
"0.74414086",
"0.7339135",
"0.731722",
"0.72986317",
"0.72307855",
"0.7226022",
"0.7126815",
"0.71229124",
"0.70944... | 0.6727529 | 41 |
Returns list of vertices in the graph | def get_vertices(self) -> []:
return [i for i in self.adj_list] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def list_vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return list(s... | [
"0.89286643",
"0.88594735",
"0.87036836",
"0.861347",
"0.8574159",
"0.8574159",
"0.8574159",
"0.8564735",
"0.8556486",
"0.82989085",
"0.8259296",
"0.81993735",
"0.8163624",
"0.8135405",
"0.81038254",
"0.8022621",
"0.80004746",
"0.79800326",
"0.79292494",
"0.79292494",
"0.7915... | 0.8227959 | 11 |
Returns a list of vertices visited during DFS search Vertices are picked in alphabetical order | def dfs(self, v_start, v_end=None) -> []:
if not self.contains_vertex(v_start):
return []
if v_end is not None:
if not self.contains_vertex(v_end):
v_end = None
traversed_vertices = []
stack = [v_start]
while len(stack) != 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertices(self):\n return self.vertList.keys()",
"def select_vertices(self):\n _filter = compas_rhino.rs.filter.point\n guids = compas_rhino.rs.GetObjects(message=\"Select Vertices.\", preselect=True, select=True, group=False, filter=_filter)\n if guids:\n guid_verte... | [
"0.71311253",
"0.7070461",
"0.70640194",
"0.704897",
"0.70404315",
"0.7034558",
"0.7026846",
"0.6994505",
"0.6984235",
"0.6984235",
"0.6984235",
"0.6967085",
"0.69288427",
"0.6928561",
"0.68701726",
"0.6855713",
"0.6805385",
"0.67575324",
"0.67315227",
"0.67296195",
"0.659599... | 0.6577504 | 22 |
Returns number of connected componets in the graph | def count_connected_components(self):
connected_components = []
for i in self.adj_list:
vertex = i
already_counted = False
if len(connected_components) == 0:
connected_components.append(self.bfs(vertex))
else:
for j in conne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _num_conn_comp(graph):\n\n return nx.number_connected_components(graph)",
"def connected_components(self) -> int:\n # visited = set()\n def get_component(vert: Tuple[int, int]) -> Set[Tuple[int, int]]:\n \"\"\" \"\"\"\n nonlocal visited\n visited.add(vert... | [
"0.8822466",
"0.8297858",
"0.81484544",
"0.81259984",
"0.76890093",
"0.76748675",
"0.7553796",
"0.7407962",
"0.73617536",
"0.727331",
"0.7171971",
"0.6957427",
"0.69539744",
"0.6863146",
"0.683783",
"0.68129975",
"0.6807647",
"0.677877",
"0.6772717",
"0.67449003",
"0.6727102"... | 0.7820926 | 4 |
Return True if graph contains a cycle, False otherwise | def has_cycle(self):
traversed = dict()
for i in self.adj_list:
traversed[i] = False
for i in self.adj_list:
if not traversed[i]:
if self.has_cycle_helper(i, traversed, -1):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cycle(graph):\n ds = DisjointSet()\n\n # creates a set of all graph nodes\n node_set = set()\n for edge in graph:\n node_set.add(edge.node1)\n node_set.add(edge.node2)\n\n for item in node_set:\n ds.make_set(item)\n\n for edge in graph:\n same_set = ds.union(ed... | [
"0.81599617",
"0.80148774",
"0.7984649",
"0.78512114",
"0.76934963",
"0.76202893",
"0.76168364",
"0.7574342",
"0.7356427",
"0.7298256",
"0.72600365",
"0.72592294",
"0.71869975",
"0.71603096",
"0.7136772",
"0.7066235",
"0.70621866",
"0.7037547",
"0.69446653",
"0.6934641",
"0.6... | 0.8192979 | 0 |
take a list of immediate rewards r(s,a) for the whole session compute cumulative rewards R(s,a) (a.k.a. G(s,a) in Sutton '16) R_t = r_t + gammar_{t+1} + gamma^2r_{t+2} + ... The simple way to compute cumulative rewards is to iterate from last to first time tick and compute R_t = r_t + gammaR_{t+1} recurrently You must ... | def get_cumulative_rewards(rewards, # rewards at each step
gamma=0.99 # discount for reward
):
cumulative_rewards = np.empty_like(rewards)
cumulative_rewards = cumulative_rewards.astype(float)
cumulative_rewards[-1] = rewards[-1]
for index in ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cumulative_rewards(rewards, # rewards at each step\r\n gamma=0.99 # discount for reward\r\n ):\r\n cumulative_rewards = []\r\n prev = 0\r\n\r\n for r in reversed(rewards):\r\n prev = r + gamma * prev\r\n cumulative_rewards.appe... | [
"0.8074708",
"0.7079752",
"0.70018417",
"0.6979368",
"0.69716865",
"0.69628114",
"0.69270927",
"0.6911457",
"0.69067216",
"0.6898197",
"0.6889973",
"0.6887313",
"0.688198",
"0.68373823",
"0.68326706",
"0.6778826",
"0.67230827",
"0.67230827",
"0.6710301",
"0.67027104",
"0.6699... | 0.81940866 | 0 |
Insert a child corresponding to child key | def insertChild(self, childKey, childNode, overWrite = False) :
if not overWrite and self.childrenMap.get(childKey) != None :
raise Exception("Child corresponding to key " + childKey + " already exists")
self.childrenMap[childKey] = childNode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, child, key):\n childNode = BTNode(key)\n if child == \"left\":\n self.left = childNode\n elif child == \"right\":\n self.right = childNode",
"def _insert(self, key):\n self.tree.insert(key)",
"def insert(self,node,key):\n position=self.f... | [
"0.76640046",
"0.7323092",
"0.7099538",
"0.7087409",
"0.70723164",
"0.7042357",
"0.702021",
"0.69809896",
"0.69671565",
"0.69208544",
"0.6908862",
"0.6860473",
"0.67085844",
"0.6665037",
"0.6650078",
"0.65872484",
"0.6520016",
"0.649807",
"0.6480135",
"0.6473125",
"0.64702046... | 0.72806364 | 2 |
Addons with a guid ending with reserved suffixes can only be submitted by people with the right permission. | def reserved_guid_addon_submission_allowed(user, parsed_addon_data):
guid = parsed_addon_data.get('guid') or ''
return not guid.lower().endswith(amo.RESERVED_ADDON_GUIDS) or action_allowed_for(
user, amo.permissions.SYSTEM_ADDON_SUBMIT
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_addon_entry(guid):\n guid_suffix = guid.split(\"-\")[-1]\n addon_type = guid_suffix if guid_suffix.startswith(\"bad\") else \"good\"\n entry = dict(ADDON_TEMPLATES[addon_type])\n entry[\"addon_id\"] = guid\n return entry",
"def valid_addon(value: Any) -> str:\n value = cv.slug(valu... | [
"0.56487966",
"0.5638465",
"0.53085506",
"0.5290045",
"0.5122346",
"0.5094578",
"0.5087514",
"0.50831133",
"0.50711316",
"0.5044786",
"0.4985791",
"0.49811593",
"0.4961219",
"0.4941136",
"0.4886615",
"0.4881525",
"0.48756516",
"0.48349494",
"0.4826746",
"0.48000163",
"0.47998... | 0.72954583 | 0 |
Return True if the user is an addons reviewer, or a theme reviewer and the addon is a theme. If allow_content_reviewers is passed and False (defaults to True), then having content review permission is not enough to be considered an addons reviewer. | def is_reviewer(user, addon, allow_content_reviewers=True):
if addon.type == amo.ADDON_STATICTHEME:
return is_static_theme_reviewer(user)
return is_listed_addons_reviewer(
user, allow_content_reviewers=allow_content_reviewers
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_change_external_reviewers(user, submission) -> bool:\n # check if all submissions have external review enabled\n if not submission.stage.has_external_review:\n return False\n\n if user.is_superuser:\n return True\n\n if settings.GIVE_STAFF_LEAD_PERMS and user.is_apply_staff:\n ... | [
"0.62482756",
"0.6241037",
"0.6193854",
"0.6107501",
"0.607648",
"0.5975823",
"0.5962169",
"0.5934883",
"0.5920278",
"0.5825284",
"0.58113205",
"0.58113205",
"0.5803326",
"0.5779962",
"0.57629716",
"0.57373667",
"0.5708447",
"0.5700894",
"0.56867445",
"0.5685974",
"0.56532276... | 0.86359924 | 0 |
Padding the data into training data | def padding(data):
for sample in data:
assert isinstance(sample, list)
feats_length = torch.tensor([x["feat"].size(0) for x in sample], dtype=torch.int32)
order = torch.argsort(feats_length, descending=True)
feats_lengths = torch.tensor([sample[i]["feat"].size(0) for i in order], dty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_dataset(dataset, padding=0):\n max_l = max(len(x) for x in dataset[\"input_ids\"])\n for name in PADDED_INPUTS:\n dataset[name] = [x + [padding if name != \"lm_labels\" else -100] * (max_l - len(x)) for x in dataset[name]]\n return dataset",
"def _pad_data(data, pad_length, padding_type='... | [
"0.7216314",
"0.6950137",
"0.67736936",
"0.6739815",
"0.66569245",
"0.6636999",
"0.659703",
"0.65548825",
"0.64956224",
"0.64912593",
"0.64624166",
"0.64252204",
"0.64164734",
"0.6399991",
"0.6361912",
"0.63517576",
"0.63414735",
"0.6335726",
"0.6332793",
"0.6299683",
"0.6293... | 0.66389626 | 5 |
Get attributes cutting threshold | def get_attributes_threshold(alist, decreasing_factor, min_activity_count=1, max_activity_count=25):
index = max(0, min(min_activity_count - 1, len(alist) - 1))
threshold = alist[index][1]
index = index + 1
for i in range(index, len(alist)):
value = alist[i][1]
if value > threshold * dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getThreshold(self): # real signature unknown; restored from __doc__\n pass",
"def get_threshold(self):\n confs = self.confidence[\"conf\"]\n\n return compute_minimum_kernel_density(confs)",
"def threshold(self) -> float:\n return pulumi.get(self, \"threshold\")",
"def threshol... | [
"0.73241156",
"0.66150147",
"0.66146654",
"0.6598506",
"0.6598506",
"0.65935475",
"0.64329726",
"0.6304388",
"0.630252",
"0.630252",
"0.630252",
"0.630252",
"0.630252",
"0.6246413",
"0.62270814",
"0.60848033",
"0.6081257",
"0.6074666",
"0.60721767",
"0.607076",
"0.6017999",
... | 0.6652094 | 1 |
Gets the job_id of this JobStep. Job id. | def job_id(self):
return self._job_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_id(self) -> JobId:\r\n return self._job_id",
"def job_id(self):\n return self._properties.get(\"jobReference\", {}).get(\"jobId\")",
"def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")",
"def id(self):\n return self.job_proto.id",
"def get_job_... | [
"0.8739483",
"0.8523845",
"0.81206083",
"0.78795564",
"0.78115475",
"0.76450133",
"0.76224107",
"0.7509963",
"0.7344271",
"0.72903085",
"0.7149698",
"0.7098242",
"0.69462925",
"0.69262326",
"0.6850177",
"0.68230236",
"0.6782792",
"0.67015374",
"0.66165316",
"0.66089547",
"0.6... | 0.8536458 | 1 |
Sets the job_id of this JobStep. Job id. | def job_id(self, job_id):
self._job_id = job_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_id(self, job_id: JobId):\r\n self._job_id = job_id",
"def setJobId(self, jobid):\n self._ShREEKConfig.setJobId(jobid)",
"def job_flow_id(self, job_flow_id):\n\n self._job_flow_id = job_flow_id",
"def job_id(self) -> JobId:\r\n return self._job_id",
"def job_id(self):\n ... | [
"0.838606",
"0.793644",
"0.7301092",
"0.6904316",
"0.67028964",
"0.6677732",
"0.6489816",
"0.6479959",
"0.63705176",
"0.63311017",
"0.63311017",
"0.6264543",
"0.6085973",
"0.60832214",
"0.60643417",
"0.6011225",
"0.5938848",
"0.59232664",
"0.5908727",
"0.5838017",
"0.5806139"... | 0.8376385 | 3 |
Gets the status of this JobStep. Job status | def status(self):
return self._status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return self.job_proto.status",
"def get_status(self):\n\t\treturn call_sdk_function('PrlJob_GetStatus', self.handle)",
"def status(self) -> pulumi.Output['outputs.JobStatus']:\n return pulumi.get(self, \"status\")",
"def get_status(self):\n url = \"data_request?id=job... | [
"0.8316874",
"0.8170203",
"0.8025292",
"0.79033196",
"0.77905196",
"0.7761273",
"0.76482093",
"0.75814277",
"0.7544778",
"0.7498731",
"0.74954873",
"0.74954873",
"0.74954873",
"0.7478736",
"0.74375486",
"0.7414185",
"0.73739785",
"0.7349007",
"0.7327923",
"0.732722",
"0.73016... | 0.721824 | 46 |
Sets the status of this JobStep. Job status | def status(self, status):
self._status = status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_status(self, job_status):\n\n self._job_status = job_status",
"def set_status(self, status):\n if not status == self._status:\n self._status = status\n self.winstance.send_event('State changed to ' + self._status)\n\n self.completed = not self.parent_node.is... | [
"0.8083068",
"0.7632967",
"0.7617502",
"0.7600165",
"0.7600165",
"0.7600165",
"0.7581615",
"0.75197697",
"0.7490496",
"0.7433905",
"0.7426344",
"0.73512405",
"0.7310624",
"0.7310624",
"0.7310624",
"0.7310624",
"0.7310624",
"0.7310624",
"0.7310624",
"0.72511667",
"0.7241483",
... | 0.7279861 | 35 |
Gets the start_time of this JobStep. Job start time | def start_time(self):
return self._start_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def start_time(self):\n return self._meta['start_time']",
"def start_time(self) -> float:\n return self._start_time",
"def start_time(self) -> s... | [
"0.8239348",
"0.81051844",
"0.8025276",
"0.79232687",
"0.79232687",
"0.79140836",
"0.78559947",
"0.78320044",
"0.7822141",
"0.7794889",
"0.7794382",
"0.7755178",
"0.7753571",
"0.7684196",
"0.7665442",
"0.764536",
"0.7613548",
"0.7613548",
"0.76091045",
"0.75810516",
"0.756753... | 0.80146784 | 8 |
Sets the start_time of this JobStep. Job start time | def start_time(self, start_time):
self._start_time = start_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self, start_time):\n self._start_time = start_time",
"def start_time(self, start_time):\n self._start_time = start_time",
"def start_time(self, value):\n self._start_time = value",
"def start_time(self, start_time: str):\n if start_time is None:\n raise V... | [
"0.800744",
"0.800744",
"0.7877681",
"0.7791287",
"0.72461337",
"0.71487594",
"0.7097873",
"0.7074666",
"0.7056443",
"0.6930376",
"0.6875255",
"0.6835338",
"0.68181187",
"0.6797789",
"0.6780192",
"0.67735445",
"0.6685911",
"0.6636852",
"0.6590866",
"0.65608406",
"0.6491959",
... | 0.8038201 | 2 |
Gets the end_time of this JobStep. Job end time | def end_time(self):
return self._end_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEndTime(self):\n assert self.isFinished(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.endTime",
"def end_time(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"end_time\")",
"def get_end_time(self):\n return str(self._end_time)",
"def end... | [
"0.8149161",
"0.80751115",
"0.8060317",
"0.80183303",
"0.7996291",
"0.791651",
"0.7892639",
"0.782973",
"0.7769445",
"0.7769445",
"0.7762642",
"0.7697924",
"0.76386136",
"0.76367384",
"0.760764",
"0.7557092",
"0.7533783",
"0.7502275",
"0.7399947",
"0.73737746",
"0.7349557",
... | 0.8192687 | 4 |
Sets the end_time of this JobStep. Job end time | def end_time(self, end_time):
self._end_time = end_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n if end_time is None:\n raise ValueError(\"Invalid value for `end_time`, must not be `None`\") # noqa: E501\n\n self._... | [
"0.8313205",
"0.8313205",
"0.7994362",
"0.7882683",
"0.7675299",
"0.73589575",
"0.7137444",
"0.70736295",
"0.7053522",
"0.6961066",
"0.68741757",
"0.68741757",
"0.68741757",
"0.6804102",
"0.6804102",
"0.6804102",
"0.66712534",
"0.66684854",
"0.6590161",
"0.6589788",
"0.657984... | 0.8353086 | 1 |
Gets the last_updated of this JobStep. Job last update | def last_updated(self):
return self._last_updated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update(self): # TOFIX model the job and return an object instead of dictionary\n return self._data.get('summary_fields', {}).get('last_update')",
"def last_update(self):\n return self._last_update",
"def last_update(self):\n return self._last_update",
"def get_last_updated_at(s... | [
"0.8183137",
"0.7840172",
"0.7840172",
"0.783752",
"0.7603161",
"0.7572164",
"0.7572094",
"0.7515263",
"0.74975705",
"0.74975705",
"0.74624413",
"0.7429383",
"0.7405211",
"0.7268615",
"0.72672033",
"0.7181654",
"0.7164558",
"0.70912486",
"0.7084401",
"0.7059295",
"0.7057088",... | 0.8000778 | 1 |
The homepage of the site. | def home():
nodes = Node.query.order_by(Node.id.desc()).all()
home_nodes = filter(lambda o: o.on_home, nodes)
home_node_ids = map(lambda o: o.id, home_nodes)
if len(home_node_ids):
topics = Topic.query.filter(
Topic.node_id.in_(home_node_ids)
).order_by(Topic.id.desc()).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home_page(self) -> str:\n return self._home_page",
"def home_page(wagtail_site):\n retu... | [
"0.8124127",
"0.80293924",
"0.7967868",
"0.7966219",
"0.7922115",
"0.79003996",
"0.78570896",
"0.77452177",
"0.77452177",
"0.77390474",
"0.7731706",
"0.76914954",
"0.7645051",
"0.7645051",
"0.7645051",
"0.7645051",
"0.7645051",
"0.7645051",
"0.7645051",
"0.7645051",
"0.764505... | 0.0 | -1 |
Readable string representation of `self`. | def __str__(self):
try:
delim = ', ' if len(self) < 8 else ',\n '
s = delim.join('%s: %s' % (repr(k), repr(self[k])) for k in self.peys())
return '{' + s + '}'
except Exception:
return dict.__repr__(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return repr(self)",
"def to_string(self):\r\n return self.__str__()",
"def __repr__(self) -> str:\n return str(self)",
"def toString(self) -> str:\n raise NotImplementedError",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self... | [
"0.83114696",
"0.8292121",
"0.82882386",
"0.82616407",
"0.8244035",
"0.8244035",
"0.8244035",
"0.8244035",
"0.821326",
"0.8200118",
"0.81930935",
"0.81930935",
"0.81930935",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.8... | 0.0 | -1 |
Copy `self` to new `defaultpdict`. Performs a shallow copy. | def copy(self):
return pdict(dict.copy(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return defaultdict.copy(self)",
"def __copy__(self):\n d = dict()\n d.update(self.items())\n return d",
"def copy(self):\n return self.from_dict(self.to_dict(True))",
"def copy(self) -> AF:\n if self._base == OrderedDict:\n kopied = dict(self... | [
"0.7542605",
"0.68186146",
"0.66173065",
"0.6564276",
"0.6545082",
"0.64851284",
"0.63520837",
"0.6250059",
"0.6176557",
"0.6133245",
"0.61035717",
"0.60887486",
"0.60491294",
"0.6006585",
"0.5981306",
"0.5939388",
"0.5853791",
"0.5844727",
"0.58345854",
"0.582743",
"0.579979... | 0.65639484 | 4 |
Equivalent to `self.values()`, but returns a `plist` with values sorted as in `self.peys()`. | def palues(self):
return self[self.peys()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peys(self):\n return plist(sorted(self.keys()))",
"def peys(self):\n return plist(sorted(self.keys()))",
"def values(self):\r\n return [self[k] for k in self]",
"def values(self):\n values = sorted(self._values.items(), key=lambda x: x[1])\n return [hospital[0] for hospital in ... | [
"0.79597735",
"0.79597735",
"0.71234006",
"0.70655423",
"0.706269",
"0.7051806",
"0.70002043",
"0.69407237",
"0.69407237",
"0.6894646",
"0.6894646",
"0.6894646",
"0.689399",
"0.68448603",
"0.68314767",
"0.6816188",
"0.67682517",
"0.67644554",
"0.67434835",
"0.67404735",
"0.66... | 0.657761 | 22 |
Readable string representation of `self`. | def __str__(self):
try:
delim = ', ' if len(self) < 8 else ',\n '
s = delim.join('%s: %s' % (repr(k), repr(self[k])) for k in self.peys())
return '{' + s + '}'
except Exception:
return defaultdict.__repr__(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return repr(self)",
"def to_string(self):\r\n return self.__str__()",
"def __repr__(self) -> str:\n return str(self)",
"def toString(self) -> str:\n raise NotImplementedError",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self... | [
"0.83114696",
"0.8292121",
"0.82882386",
"0.82616407",
"0.8244035",
"0.8244035",
"0.8244035",
"0.8244035",
"0.821326",
"0.8200118",
"0.81930935",
"0.81930935",
"0.81930935",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.81345874",
"0.8... | 0.0 | -1 |
Copy `self` to new `defaultpdict`. Performs a shallow copy. | def copy(self):
return defaultdict.copy(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __copy__(self):\n d = dict()\n d.update(self.items())\n return d",
"def copy(self):\n return self.from_dict(self.to_dict(True))",
"def copy(self) -> AF:\n if self._base == OrderedDict:\n kopied = dict(self)\n else:\n kopied = self._base.copy(s... | [
"0.68186146",
"0.66173065",
"0.6564276",
"0.65639484",
"0.6545082",
"0.64851284",
"0.63520837",
"0.6250059",
"0.6176557",
"0.6133245",
"0.61035717",
"0.60887486",
"0.60491294",
"0.6006585",
"0.5981306",
"0.5939388",
"0.5853791",
"0.5844727",
"0.58345854",
"0.582743",
"0.57997... | 0.7542605 | 0 |
Equivalent to `self.values()`, but returns a `plist` with values sorted as in `self.peys()`. | def palues(self):
return self[self.peys()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peys(self):\n return plist(sorted(self.keys()))",
"def peys(self):\n return plist(sorted(self.keys()))",
"def values(self):\r\n return [self[k] for k in self]",
"def values(self):\n values = sorted(self._values.items(), key=lambda x: x[1])\n return [hospital[0] for hospital in ... | [
"0.79597735",
"0.79597735",
"0.71234006",
"0.70655423",
"0.706269",
"0.7051806",
"0.70002043",
"0.69407237",
"0.69407237",
"0.6894646",
"0.6894646",
"0.6894646",
"0.689399",
"0.68448603",
"0.68314767",
"0.6816188",
"0.67682517",
"0.67644554",
"0.67434835",
"0.67404735",
"0.66... | 0.657761 | 21 |
Returns a plist of the attribute for self, or for each element. If `name` exists as an attribute of plist, that attribute is returned. Otherwise, removes trailing underscores from `name` (apart from those normally part of a `____` name), and uses the count of underscores to indicate how deep into the plist `name` shoul... | def __getattribute__(self, name):
if name == '__root__' or name == '__pepth__':
return list.__getattribute__(self, name)
if not name.endswith('___') and name.startswith('__') and name.endswith('__'):
raise AttributeError('plist objects cannot call reserved members of their elements: \'%s\'' % name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getattr__(self, name):\n try:\n return self[self.argpos(name)]\n except:\n pass\n return list.__getattr__(self, name)",
"def pget(self, name):\n getter = attrgetter(name)\n attr = getter(self.pobj)\n return attr",
"def pget(self, name):\n ... | [
"0.63174444",
"0.6231133",
"0.6231133",
"0.57938987",
"0.5572759",
"0.54181546",
"0.5396055",
"0.539521",
"0.5385513",
"0.53586507",
"0.53575283",
"0.5349079",
"0.5340387",
"0.5331747",
"0.52708656",
"0.5270286",
"0.5269715",
"0.5269715",
"0.5255768",
"0.5215129",
"0.52048194... | 0.7544654 | 0 |
Shortcutting recursive equality function. `pequal` always returns `True` or `False` rather than a plist. This is a convenience method for cases when the filtering that happens with `==` is undesirable or inconvenient. | def pequal(self, other):
if not isinstance(other, plist):
return False
if len(self) != len(other):
return False
try:
for x, y in zip(self, other):
if not x.pequal(y):
return False
except Exception:
for x, y in zip(self, other):
if x != y:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn(p, q):\n if not p or not q: return p is q\n return fn(p.left, q.left) and p.val == q.val and fn(p.right, q.right)",
"def recursiveEquals(obj1, obj2, **kwargs):\n if isIndexable(obj1) != isIndexable(obj2):\n return False\n if isIndexable(obj1):\n for entry1, entry2... | [
"0.58015805",
"0.564723",
"0.56340337",
"0.54607373",
"0.54142535",
"0.5302412",
"0.52755797",
"0.52111626",
"0.5200879",
"0.5129753",
"0.5119052",
"0.50940335",
"0.5082175",
"0.50793976",
"0.50654596",
"0.5063259",
"0.5043805",
"0.50341266",
"0.5012354",
"0.49956408",
"0.498... | 0.6546886 | 0 |
Apply an arbitrary function to elements of self, forwarding arguments. Any arguments passed to `apply` that are `plist`s and have the same length as `self` will be passed oneatatime to `func` with each element of `self`. Otherwise, arguments are passed in unmodified. | def apply(self, func, *args, **kwargs):
paslist = kwargs.pop('paslist', False)
psplat = kwargs.pop('psplat', False)
psplit = kwargs.pop('psplit', 0)
args = [_ensure_len(len(self), a, strict=True) for a in args]
kwargs = {
k: _ensure_len(len(self), v, strict=True) for k, v in kwargs.items()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyToEach(L,f):\n for i in range(len(L)):\n L[i] = f(L[i])",
"def apply(L, f):\n\n result = []\n for i in L:\n result.append(f(i))\n\n return result",
"def apply(self, func, *args):\n pass",
"def apply(self, func, *args, **kwargs):\n\n def call_queue_closure(data... | [
"0.6420734",
"0.6355629",
"0.60198027",
"0.5946255",
"0.5882708",
"0.5852926",
"0.5843246",
"0.5768392",
"0.5747043",
"0.56804395",
"0.5676942",
"0.5625637",
"0.5543421",
"0.55425316",
"0.5535302",
"0.5531861",
"0.5475225",
"0.543404",
"0.54329526",
"0.542957",
"0.5417477",
... | 0.6608235 | 0 |
Inverts the last grouping operation applied and returns a new plist. `ungroup` undoes the last `groupby` operation by default. It removes groupings in the inverse order that they are applied in `groupby` always adds new groups at the inner most layer, so `ungroup` removes groups from the innermost layer. It does not un... | def ungroup(self, r=1, s=None):
s = _successor(r) if s is None else s
if s.v == 0:
return self
new_items = []
try:
cs = s
new_xs = []
for x in self:
cs = _successor(s.v)
new_xs.append(x.ungroup(cs.v, cs))
# Assumes that all children have the same depth.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ungroup(*args, absolute: bool=True, parent: AnyStr=\"\", relative: bool=True, world:\n bool=True, **kwargs)->None:\n pass",
"def test_ungrouping(self):\n s = self.create(ComponentItem, UML.Component)\n uc1 = self.create(UseCaseItem, UML.UseCase)\n uc2 = self.create(UseCaseI... | [
"0.5968751",
"0.5776374",
"0.5712923",
"0.5690751",
"0.5687425",
"0.56799436",
"0.56474537",
"0.56235385",
"0.5623434",
"0.53782946",
"0.5372763",
"0.5302331",
"0.5250676",
"0.5243161",
"0.5195398",
"0.51327693",
"0.505796",
"0.50475025",
"0.49866682",
"0.49820888",
"0.497904... | 0.6206306 | 0 |
If this request connected to the database, close the connection. | def close_db(e=None):
db = g.pop("db", None)
if db is not None:
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n if self.cursor is None and self.database is None:\n # if we don't have an open connection, do nothing\n return\n self.cursor.close()\n self.database.close()",
"def close_connection(self):\r\n if self.conn:\r\n self.conn.cl... | [
"0.79103714",
"0.78451157",
"0.7778762",
"0.7770313",
"0.7714347",
"0.7696842",
"0.76478976",
"0.76394325",
"0.761385",
"0.7609483",
"0.7603633",
"0.75899976",
"0.75852585",
"0.7565864",
"0.7536206",
"0.7524617",
"0.7524617",
"0.75230664",
"0.7520874",
"0.7514028",
"0.7511803... | 0.0 | -1 |
Tests dockerprettyps.version() method, basically making sure it doesnt crash. | def test_version(self):
assert dockerprettyps.__version__
assert dockerprettyps.version() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_version(self):\n v = version('/no/such/executable')\n self.assertEqual(v, '0.0.1.dev0')\n v = version('false')\n self.assertEqual(v, '0.0.1.dev0')\n v = version('echo')\n self.assertEqual(v, 'describe .devrev-list --count HEAD')",
"def ping_docker():\n with D... | [
"0.7149337",
"0.70962316",
"0.70439327",
"0.6899592",
"0.68097425",
"0.6753289",
"0.66722536",
"0.66200966",
"0.6526292",
"0.65248454",
"0.6508087",
"0.64968944",
"0.6449883",
"0.6396855",
"0.63947856",
"0.63805497",
"0.63452977",
"0.6311648",
"0.6309181",
"0.6296869",
"0.629... | 0.8485717 | 0 |
Tests the dockerprettyps._get_num_running_containers() method to make sure it can actually count. | def test__get_num_running_containers(self):
assert dockerprettyps._get_num_running_containers(test_ps_data.ps_containers) == 5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_container_count(dockerc):\n # stopped parameter allows non-running containers in results\n assert (\n len(dockerc.containers(stopped=True)) == 2\n ), \"Wrong number of containers were started.\"",
"def get_num_of_containers(self):\n Container.num_of_cntnrs = len(Container.containe... | [
"0.8033018",
"0.6912724",
"0.6749806",
"0.6722437",
"0.66926104",
"0.65796274",
"0.642283",
"0.6329359",
"0.6244365",
"0.6112657",
"0.6016417",
"0.6005051",
"0.5996384",
"0.5993552",
"0.5918097",
"0.5892177",
"0.588009",
"0.5830661",
"0.57912666",
"0.5755255",
"0.5679043",
... | 0.9081711 | 0 |
Tests the dockerprettyps.order_containers() method to make sure we order containers as you would expect. | def test_order_containers(self):
ordered = dockerprettyps.order_containers(test_ps_data.ps_containers, CliArgs())
position_first_date = ordered[0]["status_date"]
position_last_date = ordered[len(ordered) - 1]["status_date"]
assert position_first_date > position_last_date
# args ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testGetAllContainers(self):\n containers_list = self.explorer_object.GetAllContainers()\n containers_list = sorted(containers_list, key=lambda ci: ci.name)\n self.assertEqual(5, len(containers_list))\n\n container_obj = containers_list[0]\n\n self.assertEqual('/festive_perlman', container_obj.na... | [
"0.6293717",
"0.6210594",
"0.6000049",
"0.5986206",
"0.59723",
"0.5972184",
"0.595384",
"0.59471065",
"0.59252757",
"0.59248024",
"0.58981466",
"0.5860038",
"0.58491564",
"0.5844594",
"0.58198017",
"0.5738766",
"0.57079595",
"0.5699391",
"0.56783605",
"0.56594443",
"0.5601745... | 0.8390919 | 0 |
Calculate the mass of this sequence for the given type of polymer. This calculation assumes that the terminal phosphates have been replaced with alcohol groups, which is the case for most oligos. | def mass(self, polymer='rna'):
sequence = self.seq.upper()
a = sequence.count('A')
c = sequence.count('C')
g = sequence.count('G')
t = u = sequence.count('T') + sequence.count('U')
if polymer == 'rna':
return (a * 329.2) + (u * 306.2) + (c * 305.2) + (g * 34... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Mass(self):\n mpa = self.MassPerLength()\n if mpa == 0.0:\n return 0.\n L = self.Length()\n mass = L * mpa\n\n #try:\n #mass = (self.Rho() * self.Area() + self.Nsm()) * L\n #except TypeError:\n #msg = 'TypeError on eid=%s pid=%s:\\n' % ... | [
"0.64565843",
"0.61502635",
"0.60431147",
"0.5990719",
"0.59732556",
"0.59676933",
"0.5909393",
"0.586811",
"0.586524",
"0.5859254",
"0.583001",
"0.5828596",
"0.5826803",
"0.5799746",
"0.5728697",
"0.5712462",
"0.5708672",
"0.5708452",
"0.569555",
"0.56710994",
"0.565783",
... | 0.748403 | 0 |
This test case checks if customer list endpoint is working as expected | def test_customer_list(self):
self.url = reverse("customer-list")
response = self.client.get(self.url, **self.auth_headers)
self.assertEqual(200, response.status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_customer_list(self):\n customer = self._create_customers(\"Alex\")\n customer.create()\n customer = self._create_customers(\"Sally\")\n customer.create()\n customer = self._create_customers(\"John\")\n customer.create()\n resp = self.app.get(\"/customer... | [
"0.80502814",
"0.7686127",
"0.75626653",
"0.7386518",
"0.7272298",
"0.72501284",
"0.7241528",
"0.7181797",
"0.71332276",
"0.70820934",
"0.70686656",
"0.70355594",
"0.70023394",
"0.69914925",
"0.69609475",
"0.69494915",
"0.6902651",
"0.68581015",
"0.6846121",
"0.6742281",
"0.6... | 0.8493691 | 0 |
This test case checks if product list endpoint is working as expected | def test_product_list(self):
self.url = reverse("product-list")
response = self.client.get(self.url, **self.auth_headers)
self.assertEqual(200, response.status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_product(self):\n url = reverse('products:list')\n response = self.client.get(url)\n self.assertEqual(len(response.data), 1)\n self.assertEqual(response.data[0]['name'], 'Eggs')",
"def test_get_product_list(self):\n self._create_products(5)\n resp = self.app... | [
"0.8259441",
"0.82072127",
"0.8147758",
"0.80223316",
"0.78329587",
"0.7807896",
"0.7676123",
"0.7630408",
"0.75743455",
"0.7537442",
"0.74397385",
"0.742801",
"0.7392035",
"0.733865",
"0.7272505",
"0.7255285",
"0.7223355",
"0.7200746",
"0.7159603",
"0.7118726",
"0.71184963",... | 0.8541009 | 0 |
This test case checks if invoice delete endpoint is working as expected | def test_invoice_delete(self):
# first we create a customer
id = self._create_model("customer", self.customer_data, ["name", "email", "phone"])
if id:
# then we can create the invoice
data = self.invoice_data
data["customer_id"] = id
id_inv = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_verification_document_delete(self):\n pass",
"def test_invoice_item_delete(self):\n # first we create a customer\n id = self._create_model(\"customer\", self.customer_data, [\"name\", \"email\", \"phone\"])\n if id:\n # then we create a invoice\n ... | [
"0.7930001",
"0.761745",
"0.74346024",
"0.73182666",
"0.7282228",
"0.72772145",
"0.71399635",
"0.71246004",
"0.7094469",
"0.7091018",
"0.7082405",
"0.7077564",
"0.704859",
"0.70344377",
"0.7024142",
"0.701393",
"0.7011146",
"0.7002315",
"0.69988954",
"0.69829243",
"0.69787633... | 0.7868483 | 1 |
This test case checks if shoppingcart list endpoint is working as expected | def test_shoppingcart_list(self):
self.url = reverse("shoppingcart-list")
response = self.client.get(self.url, **self.auth_headers)
self.assertEqual(200, response.status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_product_list(self):\n self.url = reverse(\"product-list\")\n response = self.client.get(self.url, **self.auth_headers)\n self.assertEqual(200, response.status_code)",
"def test_list_product(self):\n url = reverse('products:list')\n response = self.client.get(url)\n ... | [
"0.7984509",
"0.7677288",
"0.76292086",
"0.7495589",
"0.74494886",
"0.73511857",
"0.734951",
"0.73186827",
"0.7304247",
"0.71723944",
"0.7159816",
"0.71527386",
"0.70988137",
"0.706697",
"0.70528084",
"0.7041629",
"0.7026308",
"0.7010915",
"0.70054966",
"0.69952875",
"0.69820... | 0.8625183 | 0 |
This test case checks if shoppingcart delete endpoint is working as expected | def test_shoppingcart_delete(self):
# first we create a customer
id = self._create_model("customer", self.customer_data, ["name", "email", "phone"])
if id:
# then we create a product
id_prod = self._create_model("product", self.product_data, ["name", "description", "image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_product(self):\n self._require_login(self.user1)\n response = self.client.delete('/api/1.0/products/1/')\n self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)\n\n response = self.client.get('/api/1.0/products/1/')\n self.assertEqual(response.status_... | [
"0.81172144",
"0.78111386",
"0.7802037",
"0.7782709",
"0.77466905",
"0.7617912",
"0.7560487",
"0.75270694",
"0.75186956",
"0.7506979",
"0.7468386",
"0.7455199",
"0.7375344",
"0.7342295",
"0.72926867",
"0.7266838",
"0.7266107",
"0.7251463",
"0.72255546",
"0.72164476",
"0.71832... | 0.7801334 | 3 |
This test case checks if auth token method fails when wrong password is informed | def test_auth_token_invalid_password(self):
self.url = "/auth"
wrong_pass_user = { **self.auth_user }
wrong_pass_user["password"] = "1234567"
response = self.client.post(self.url, wrong_pass_user)
# for wrong password must not be status code 200!
self.assertNotEqual(200, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wrong_password_to_get_token(self):\n data = {\n 'username': self.user.username,\n 'password': 'senhaerrada',\n }\n response = self.client.post(self.jwt_url, data)\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)",
"def test_invalid_p... | [
"0.8227835",
"0.79326606",
"0.7892342",
"0.78514105",
"0.7778356",
"0.7713597",
"0.76406467",
"0.7636879",
"0.75820315",
"0.75729924",
"0.75463086",
"0.7543433",
"0.7541227",
"0.7540565",
"0.7532115",
"0.7517752",
"0.75050044",
"0.74813133",
"0.74292606",
"0.7422858",
"0.7405... | 0.84496117 | 0 |
Return a python UTClocalized datetime object corresponding to the humanreadable date/time x | def human_to_utc_datetime(x):
return parsedatetime.Calendar().parseDT(datetimeString=x,
sourceTime=datetime.utcnow(),
tzinfo=timezone("UTC"))[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yt_datetime(yt_date_time):\n time_obj = time.strptime(yt_date_time, \"%Y-%m-%dT%H:%M:%S.%fZ\")\n locale_date = time.strftime(\"%x\", time_obj)\n # strip first two digits of four digit year\n short_date = re.sub(r\"(\\d\\d\\D\\d\\d\\D)20(\\d\\d)$\", r\"\\1\\2\", locale_date)\n return time_obj, sh... | [
"0.62545353",
"0.6012103",
"0.5961267",
"0.5939904",
"0.5903021",
"0.58391815",
"0.5816687",
"0.58151555",
"0.579812",
"0.57829636",
"0.57612646",
"0.5749229",
"0.57482547",
"0.57310295",
"0.57201904",
"0.5698841",
"0.5696634",
"0.5696634",
"0.5696634",
"0.56962955",
"0.56924... | 0.7382466 | 0 |
Convert a UTC datetime object d to (float) seconds in the UTC since the UTC unix epoch. If you pass a timezonenaive datetime object, it will be treated as UTC. | def utc_timestamp(d):
if isinstance(d, pd.tslib.Timestamp):
# Pandas datetime timestamp whatever thing
if d.tz != pytz.utc:
d = d.tz_localize('UTC')
else:
# Normal datetime object
if d.tzinfo != pytz.utc:
d = pytz.utc.localize(d)
# Yes, you have to wri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestampfromutc(utc):\n return (utc - datetime(1970, 1, 1)).total_seconds()",
"def datetime_to_epoch_microseconds(obj: \"datetime\") -> float:\n td = datetime_to_epoch_timedelta(obj)\n return (td.days * 86400 + td.seconds) * 10**6 + td.microseconds",
"def datetime_to_utc(timestamp):\n\n ep... | [
"0.6837628",
"0.6464512",
"0.64066815",
"0.6399166",
"0.62029475",
"0.6188801",
"0.6173396",
"0.6133113",
"0.60490805",
"0.6015359",
"0.59106994",
"0.59069854",
"0.59069854",
"0.5889281",
"0.58860755",
"0.5851429",
"0.58497155",
"0.58377516",
"0.5833151",
"0.5806487",
"0.5806... | 0.6793083 | 1 |
Numpy implementation of the Frechet Distance. The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is d^2 = ||mu_1 mu_2||^2 + Tr(C_1 + C_2 2sqrt(C_1C_2)). Stable version by Dougal J. Sutherland. | def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
mu1 = np.atleast_1d(mu1)
mu2 = np.atleast_1d(mu2)
sigma1 = np.atleast_2d(sigma1)
sigma2 = np.atleast_2d(sigma2)
assert mu1.shape == mu2.shape, \
'Training and test mean vectors have different lengths'
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\r\n\r\n mu1 = np.atleast_1d(mu1)\r\n mu2 = np.atleast_1d(mu2)\r\n\r\n sigma1 = np.atleast_2d(sigma1)\r\n sigma2 = np.atleast_2d(sigma2)\r\n\r\n assert mu1.shape == mu2.shape, \\\r\n 'Training and test mean vectors have differ... | [
"0.7605189",
"0.7597506",
"0.7582491",
"0.7578684",
"0.7578684",
"0.7578684",
"0.7463135",
"0.70037794",
"0.66963065",
"0.6651121",
"0.6602123",
"0.6414605",
"0.63799983",
"0.6248208",
"0.6147206",
"0.6145018",
"0.6077862",
"0.59808385",
"0.5976269",
"0.59436053",
"0.5907032"... | 0.76070756 | 0 |
Computes F_beta scores for the given precision/recall values. The F_beta scores for all precision/recall pairs will be computed and returned. | def _prd_to_f_beta(precision, recall, beta=1, epsilon=1e-10):
if not ((precision >= 0).all() and (precision <= 1).all()):
raise ValueError('All values in precision must be in [0, 1].')
if not ((recall >= 0).all() and (recall <= 1).all()):
raise ValueError('All values in recall must be in [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prd_to_max_f_beta_pair(precision, recall, beta=8):\r\n\r\n if not ((precision >= 0).all() and (precision <= 1).all()):\r\n raise ValueError('All values in precision must be in [0, 1].')\r\n if not ((recall >= 0).all() and (recall <= 1).all()):\r\n raise ValueError('All values in recall must... | [
"0.7535236",
"0.72023135",
"0.7075482",
"0.70551103",
"0.7050789",
"0.7004212",
"0.7004212",
"0.7004212",
"0.7004212",
"0.6962243",
"0.66733974",
"0.65951174",
"0.6537947",
"0.6423393",
"0.6395791",
"0.6384665",
"0.6354124",
"0.62269217",
"0.6202877",
"0.6188019",
"0.61743444... | 0.7602386 | 0 |
Computes max. F_beta and max. F_{1/beta} for precision/recall pairs. Computes the maximum F_beta and maximum F_{1/beta} score over all pairs of precision/recall values. This is useful to compress a PRD plot into a single pair of values which correlate with precision and recall. | def prd_to_max_f_beta_pair(precision, recall, beta=8):
if not ((precision >= 0).all() and (precision <= 1).all()):
raise ValueError('All values in precision must be in [0, 1].')
if not ((recall >= 0).all() and (recall <= 1).all()):
raise ValueError('All values in recall must be in [0, 1].'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prd_to_f_beta(precision, recall, beta=1, epsilon=1e-10):\r\n\r\n if not ((precision >= 0).all() and (precision <= 1).all()):\r\n raise ValueError('All values in precision must be in [0, 1].')\r\n if not ((recall >= 0).all() and (recall <= 1).all()):\r\n raise ValueError('All values in reca... | [
"0.67206347",
"0.64627796",
"0.64183646",
"0.64183646",
"0.64183646",
"0.64183646",
"0.6409427",
"0.63597304",
"0.6120082",
"0.60892403",
"0.60862684",
"0.6033136",
"0.5974693",
"0.5950837",
"0.59195167",
"0.5891899",
"0.58911616",
"0.5889496",
"0.5856341",
"0.5804546",
"0.57... | 0.8511812 | 0 |
The wavelength range given in a rangelist format. | def wavelength(self):
return self.getparam("WAVELENGTH") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength_range(fits_list):\r\n mins = []\r\n maxes = []\r\n for fname in fits_list:\r\n spec = np.genfromtxt(fname.replace('fits', 'txt'), names='wave, flux', \r\n dtype='f4, f4')\r\n mins.append(spec['wave'].min())\r\n maxes.append(spe... | [
"0.7484182",
"0.65813166",
"0.64921093",
"0.6252834",
"0.611912",
"0.59935695",
"0.59935695",
"0.5971458",
"0.593575",
"0.58884573",
"0.5860837",
"0.58581907",
"0.5856777",
"0.58417875",
"0.5821548",
"0.5804961",
"0.5790087",
"0.5767925",
"0.574179",
"0.5740731",
"0.5733895",... | 0.5576675 | 40 |
Implementation of the gelu activation function. | def gelu(x):
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out",
"def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out",
"def gelu(x):\n return f_... | [
"0.8188278",
"0.8188278",
"0.78067553",
"0.7555482",
"0.752499",
"0.7476213",
"0.7370755",
"0.72336054",
"0.72119874",
"0.7206583",
"0.7196593",
"0.7191645",
"0.7171082",
"0.71561706",
"0.6966983",
"0.69553304",
"0.6948997",
"0.6794286",
"0.6787408",
"0.67737466",
"0.67737466... | 0.6968394 | 20 |
Construct a layernorm module in the TF style (epsilon inside the square root). | def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y",
"def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ... | [
"0.627885",
"0.601719",
"0.5792404",
"0.574078",
"0.5538754",
"0.55197877",
"0.54237455",
"0.5412939",
"0.5390364",
"0.5367866",
"0.53520614",
"0.52869666",
"0.52580315",
"0.5233752",
"0.522994",
"0.52256304",
"0.5221431",
"0.5220602",
"0.5194599",
"0.5194599",
"0.5193647",
... | 0.0 | -1 |
Instantiate a PreTrainedBertModel from a pretrained model file or a pytorch state dict. Download and cache the pretrained model file if needed. | def from_pretrained(cls,
pretrained_model_name,
state_dict=None,
cache_dir=None,
*inputs,
**kwargs):
resolved_archive_file = pretrained_model_name
# redirect to the cache, if necessary... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_pretrained(cls, model_path):\n # Load config\n config = BertConfig.from_pretrained(model_path)\n configtc = ConfigTC.from_pretrained(model_path)\n\n # Load tokenizer\n tokenizer = BertTokenizer.from_pretrained(model_path,\n ... | [
"0.79304767",
"0.77294385",
"0.7559873",
"0.73967123",
"0.7317343",
"0.71714187",
"0.7129508",
"0.71135783",
"0.70923924",
"0.7071852",
"0.7061337",
"0.7037342",
"0.6949903",
"0.69248354",
"0.68908644",
"0.6852022",
"0.68399644",
"0.6816372",
"0.68029517",
"0.67053866",
"0.66... | 0.772396 | 2 |
Show the triangulation in 3D. | def show(self):
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
pos = self.cluster.get_positions()
from itertools import combinations
for tri in self.mesh.simplices:
for comb in combinat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize_in_3d(self,**kwargs):\n fig = plt.figure(figsize=(7,7))\n ax = fig.add_subplot(111, projection='3d')\n\n points = np.vstack([\n c.to_matrix() for c in self.contours if c.inclusion\n ])\n points[:,:2] = points[:,:2] * self.scan.pixel_spacing\n\n # ... | [
"0.7156076",
"0.700892",
"0.6999586",
"0.6680343",
"0.6348479",
"0.6287975",
"0.6266835",
"0.62315696",
"0.62180585",
"0.6126254",
"0.6076344",
"0.60029984",
"0.59908736",
"0.5957211",
"0.5950931",
"0.5919466",
"0.59175503",
"0.5911478",
"0.58930904",
"0.5873781",
"0.5839536"... | 0.7246295 | 0 |
Convert an order array into string representation. | def order2string(order):
nparray = np.array(order)
num_x = np.sum(nparray==0)
num_y = np.sum(nparray==1)
num_z = np.sum(nparray==2)
string_repr = "$"
if num_x == 0 and num_y == 0 and num_z == 0:
return "constant"
if num_x > 0:
string_repr +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transfer_2d_array_to_str(array):\n str_list = []\n for r in array:\n str_list.append(\",\".join([str(e) for e in r]))\n return \" \".join(str_list)",
"def array_to_concatenated_string(array):\r\n return \",\".join(str(x) for x in array)",
"def array_to_concatenated_string(array):\n return \",\"... | [
"0.6583365",
"0.6565802",
"0.6501806",
"0.64961743",
"0.6348317",
"0.61609733",
"0.614599",
"0.61391604",
"0.609589",
"0.5998052",
"0.5974029",
"0.59508413",
"0.5946128",
"0.5944707",
"0.5937489",
"0.5909077",
"0.58887106",
"0.5882096",
"0.586899",
"0.58632267",
"0.585158",
... | 0.7147623 | 0 |
Generates a CSV file. | def to_csv(self, path=None, sep=',', data_format=DataFormat.RAW, csv_dialect='excel'):
if path is None:
file_handle = StringIO()
self._write_csv(file_handle, csv_dialect, sep, data_format)
return file_handle.getvalue()
# Path provided
with open(path, 'w') as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_csv_file(self):\r\n # Create a new csv-file\r\n with open(self.fname, 'w') as f:\r\n writer = csv.writer(f, dialect='excel')\r\n writer.writerow(['set_time',\r\n 'read_time_P_ac',\r\n 'read_time_P_bat',\r\n ... | [
"0.7561205",
"0.7506874",
"0.75046366",
"0.73715645",
"0.7318737",
"0.7298044",
"0.72940594",
"0.7154364",
"0.71252227",
"0.7030122",
"0.69042474",
"0.68794453",
"0.68767935",
"0.687406",
"0.68696976",
"0.68560696",
"0.6848768",
"0.68411165",
"0.6824233",
"0.6816523",
"0.6746... | 0.0 | -1 |
Test if argument is an ISBN10 or ISBN13 number. | def is_isbn(val):
if is_isbn10(val) or is_isbn13(val):
if val[0:3] in ["978", "979"] or not is_ean13(val):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isISBN(code, isbn13=True):\n\n return isISBN13(code) if isbn13 else isISBN10(code)",
"def isISBN(code):\n if not (\n isinstance(code, str) and # code must be a string\n len(code) == 10 and # code must contain 10 characters\n code[:9].isdigit() # first nine character... | [
"0.7944061",
"0.7897165",
"0.7528847",
"0.7327012",
"0.7262843",
"0.7069712",
"0.6962106",
"0.6928892",
"0.6879331",
"0.6809497",
"0.67764956",
"0.65987927",
"0.6579219",
"0.6567378",
"0.6531365",
"0.64987296",
"0.649548",
"0.6406885",
"0.63869363",
"0.6374634",
"0.6251733",
... | 0.7802005 | 2 |
Test if argument is a DOI. | def is_doi(val):
return doi_regexp.match(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_doi(self, doi, whitespace=False):\n\n result_doi = find_doi_in_string(doi, whitespace=False)\n if result_doi is None:\n raise BadDOI('Supplied DOI \"%s\" fails doi check' % doi)\n return doi",
"def citationContainsDOI(citation):\n if citation.startswith(\"doi:\"):\n ... | [
"0.6697938",
"0.63650364",
"0.63491505",
"0.6209361",
"0.6101104",
"0.60582155",
"0.5834252",
"0.5745865",
"0.5571599",
"0.5463229",
"0.53791934",
"0.53161854",
"0.5200198",
"0.51229596",
"0.5083277",
"0.50685817",
"0.50545317",
"0.5043928",
"0.5033247",
"0.5016071",
"0.50048... | 0.6586589 | 1 |
Test if argument is an ARK. | def is_ark(val):
res = urlparse(val)
return ark_suffix_regexp.match(val) or (
res.scheme == "http"
and res.netloc != ""
and
# Note res.path includes leading slash, hence [1:] to use same reexp
ark_suffix_regexp.match(res.path[1:])
and res.params == ""
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_an_oak(name):\n if 'quercus' in name.lower():\n return True\n else:\n return False",
"def is_an_oak(name):\n return name.lower().startswith(\"quercus\") # use startswith() to catch bugs in spelling/spacing",
"def iskeyword(self, arg: str):\n if arg.upper() in self._keyword... | [
"0.551665",
"0.5490144",
"0.5296185",
"0.52135944",
"0.5164861",
"0.48651707",
"0.4777571",
"0.47697455",
"0.4756843",
"0.47497472",
"0.4739374",
"0.47353587",
"0.4698331",
"0.46937034",
"0.46443418",
"0.46443418",
"0.4634771",
"0.45984417",
"0.45981815",
"0.4580799",
"0.4570... | 0.6138223 | 0 |
Test if argument is a URL. | def is_url(val):
res = urlparse(val)
return bool(res.scheme and res.netloc and res.params == "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_url_arg(str):\n return (True if URL_REGEX.match(str[1:-1] if is_quoted(str) else str)\n else False)",
"def _is_url(string):\n return \"http\" in string",
"def __isUrl(self, url):\n if type(url)==str:\n return url.startswith('http://') or url.startswith('https://')\n ... | [
"0.81043345",
"0.79426426",
"0.7746484",
"0.75996464",
"0.75619435",
"0.7502829",
"0.7497656",
"0.74870545",
"0.7462537",
"0.74251693",
"0.73987496",
"0.73879266",
"0.727624",
"0.72629887",
"0.7253427",
"0.71626127",
"0.71579736",
"0.71425796",
"0.7141382",
"0.7131699",
"0.71... | 0.76955706 | 3 |
Test if argument is an URN. | def is_urn(val):
res = urlparse(val)
return bool(res.scheme == "urn" and res.netloc == "" and res.path != "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_urn(self):\n\n # Should work with string\n self.TEI.urn = \"urn:cts:latinLit:tg.wk.v\"\n self.assertEqual(isinstance(self.TEI.urn, MyCapytain.common.reference.URN), True)\n self.assertEqual(str(self.TEI.urn), \"urn:cts:latinLit:tg.wk.v\")\n\n # Test for URN\n self... | [
"0.59081894",
"0.58783495",
"0.587041",
"0.5753857",
"0.57054055",
"0.5642451",
"0.56025267",
"0.5493029",
"0.5412301",
"0.5405049",
"0.54023534",
"0.53733027",
"0.5343053",
"0.5336499",
"0.52712905",
"0.52413034",
"0.52333754",
"0.5231815",
"0.5220637",
"0.5206345",
"0.52018... | 0.6983984 | 0 |
Test if argument is a RefSeq accession. | def is_refseq(val):
return refseq_regexp.match(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ISREF(value):\n return isinstance(value, Record)",
"def isReference(node):\n return bool(isinstance(node, nodes.Referential)\n and node.get(DuAttrRefid, None))",
"def isRef(self, doc, attr):\n if doc is None: doc__o = None\n else: doc__o = doc._o\n if attr is... | [
"0.6509864",
"0.63953906",
"0.6305542",
"0.62859845",
"0.6152765",
"0.6111242",
"0.60601616",
"0.59552044",
"0.59510106",
"0.5950776",
"0.59364086",
"0.59278804",
"0.5866566",
"0.582268",
"0.5822454",
"0.5780818",
"0.5756706",
"0.5749786",
"0.57459974",
"0.5680306",
"0.561543... | 0.6606532 | 0 |
Test if argument is a Gene Expression Omnibus (GEO) accession. | def is_geo(val):
return geo_regexp.match(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_by_accession_geo_platform_accession_get(self):\n pass",
"def species_has_geo(species_output_dict: dict) -> bool:\n if species_output_dict['paths']['geo'] or species_output_dict['paths']['composite']:\n return True\n return False",
"def isGeospatial(path):\n try:\n ... | [
"0.5637762",
"0.5543603",
"0.54590017",
"0.5399217",
"0.5358293",
"0.5311532",
"0.5311532",
"0.5311532",
"0.5311532",
"0.5311532",
"0.5311532",
"0.5311532",
"0.5311532",
"0.52442276",
"0.52363676",
"0.52266115",
"0.52266115",
"0.52266115",
"0.52266115",
"0.52266115",
"0.52266... | 0.58395725 | 0 |
Test if argument is a Software Heritage identifier. | def is_swh(val):
return swh_regexp.match(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_electron(argument):\n\n if not isinstance(argument, str):\n return False\n\n if argument in ['e', 'e-'] or argument.lower() == 'electron':\n return True\n else:\n return False",
"def validate_identifier(identifier: str) -> bool:\n if identifier[:2] == 'NR':\n ... | [
"0.57010096",
"0.54893917",
"0.535891",
"0.53471017",
"0.5346539",
"0.53411704",
"0.52579844",
"0.5213684",
"0.52001804",
"0.5157544",
"0.51433647",
"0.50951535",
"0.5077289",
"0.50338584",
"0.5012765",
"0.499291",
"0.48872253",
"0.48770648",
"0.48502898",
"0.48502898",
"0.48... | 0.5169796 | 9 |
Normalize a HAL identifier. | def normalize_hal(val):
val = val.replace(" ", "").lower().replace("hal:", "")
return val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_identifier(prefix: str, identifier: str) -> str:\n # A \"banana\" is an embedded prefix that isn't actually part of the identifier.\n # Usually this corresponds to the prefix itself, with some specific stylization\n # such as in the case of FBbt. The banana does NOT include a colon \":\" at ... | [
"0.692716",
"0.6554384",
"0.6535422",
"0.6183972",
"0.61417544",
"0.606231",
"0.60587126",
"0.6023169",
"0.59606725",
"0.594408",
"0.59429526",
"0.5905636",
"0.59021854",
"0.5882181",
"0.58495605",
"0.58435214",
"0.5830242",
"0.5807954",
"0.57992196",
"0.5794124",
"0.5792707"... | 0.63783514 | 3 |
Load instance masks for the given image. Different datasets use different ways to store masks. This function converts the different mask format to one format in the form of a bitmap [height, width, instances] | def load_mask(self, image_id):
image_info = self.image_info[image_id]
if image_info["source"] != "self_annotation":
super(CarsAndVehiclesDataset, self).load_mask(image_id)
instance_masks = []
class_ids = []
annotations = self.image_info[image_id]["annotations"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_mask(self, image_id):\n info = self.image_info[image_id]\n # Get mask directory from image path\n mask_dir = os.path.join(os.path.dirname(os.path.dirname(info['path'])), \"masks\")\n\n # Read mask files from .png image\n mask = []\n # for f in next(os.walk(mask_di... | [
"0.7570777",
"0.7548225",
"0.7457762",
"0.7442869",
"0.74217874",
"0.74065465",
"0.7381475",
"0.73286283",
"0.72843236",
"0.7256916",
"0.7256568",
"0.7223681",
"0.71646166",
"0.71167123",
"0.7038806",
"0.69826496",
"0.690173",
"0.6898403",
"0.6890698",
"0.681828",
"0.6798098"... | 0.7184202 | 12 |
Return name of image in finetuning dataset | def image_reference(self, image_id):
info = self.image_info[image_id]
if info["source"] == "self_annotation":
return os.path.basename(info["path"])
else:
super(CarsAndVehiclesDataset, self).image_reference(image_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"image_name\")",
"def getImageName(self):\r\n return self.imageName",
"def image_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"image_name\")",
"def image_name(self) -> Optional[pulum... | [
"0.7139996",
"0.6954901",
"0.6835825",
"0.6835825",
"0.67498386",
"0.6624625",
"0.6521503",
"0.6497491",
"0.6477025",
"0.6414426",
"0.64042526",
"0.63653284",
"0.6335849",
"0.6319465",
"0.62786007",
"0.6206027",
"0.6203037",
"0.61427754",
"0.61399007",
"0.61322504",
"0.612821... | 0.63374835 | 12 |
Return a value for display; if longer than max length, use ellipsis. | def trim_display_field(self, value, max_length):
if not value:
return ''
if len(value) > max_length:
return value[:max_length - 3] + '...'
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_maxed(arg, maxlen, ellipsis_str=\"..\"):\n s = str(arg)\n if maxlen <= 0 or len(s) <= maxlen:\n return s\n else:\n return \"%s%s\" % (s[:maxlen], ellipsis_str)",
"def ellipsis(value, arg):\n try:\n length = int(arg)\n except ValueError: # invalid literal for int()\n ... | [
"0.7163105",
"0.70909506",
"0.6905948",
"0.68300545",
"0.668445",
"0.6510158",
"0.64593697",
"0.6446969",
"0.64297235",
"0.63705087",
"0.63540596",
"0.63339406",
"0.6299629",
"0.6255431",
"0.6210943",
"0.619666",
"0.61898035",
"0.6186657",
"0.61091006",
"0.60827714",
"0.60667... | 0.79287076 | 0 |
Return True if equal to other. | def __eq__(self, other):
return (self.server + self.scriptpath
== other.server + other.scriptpath) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return equal(self, other)",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\r\n if other is not None:\r\n ... | [
"0.8685058",
"0.8446434",
"0.83770347",
"0.83770347",
"0.8315943",
"0.82753986",
"0.82709265",
"0.82709265",
"0.8270272",
"0.8259561",
"0.82518375",
"0.82386124",
"0.8228682",
"0.8228682",
"0.82265055",
"0.8100341",
"0.8100341",
"0.8089629",
"0.8026016",
"0.7975539",
"0.79749... | 0.0 | -1 |
Turns a datetime.timedelta object into a nice string repr. 'display' can be 'minimal', 'short' or 'long' (default). Taken from bitbucket.org/schinckel/djangotimedeltafield. 'sql' and 'iso8601' support have been removed. | def timedelta_nice_repr(timedelta, display='long', sep=', '):
if not isinstance(timedelta, datetime.timedelta):
raise TypeError('First argument must be a timedelta.')
result = []
weeks = int(timedelta.days / 7)
days = timedelta.days % 7
hours = int(timedelta.seconds / 3600)
minutes = int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_timedelta(timedeltaobj):\n # stolen from https://stackoverflow.com/a/46928226/8207\n if not timedeltaobj:\n return '---'\n secs = timedeltaobj.total_seconds()\n timetot = \"\"\n if secs > 86400: # 60sec * 60min * 24hrs\n days = secs // 86400\n timetot += \"{} days\... | [
"0.71496564",
"0.7044022",
"0.6891926",
"0.6830929",
"0.68135464",
"0.66988087",
"0.66420764",
"0.6626302",
"0.6591315",
"0.65571016",
"0.6553135",
"0.65256655",
"0.65235984",
"0.65043384",
"0.64192814",
"0.6261579",
"0.6238386",
"0.6184191",
"0.6129391",
"0.61017275",
"0.606... | 0.8007574 | 0 |
Gets the raw data directory and analysis output directory paths. | def getDataDirectory(initialDirectory='~'):
root = Tkinter.Tk()
root.withdraw()
rawDataDir = askdirectory(parent=root,
initialdir=initialDirectory,
title='Raw Data Directory')
outDir = askdirectory(parent=root,
initia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_directories(self):\n\n return [simulation.outdir for simulation in self.simulations]",
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def get_data_dir(self):\n return self.data_dir",
... | [
"0.73710614",
"0.7028728",
"0.68394667",
"0.67923087",
"0.6754634",
"0.67183036",
"0.6712482",
"0.66815287",
"0.66682655",
"0.6666011",
"0.6631061",
"0.6631061",
"0.65995175",
"0.65336835",
"0.65216607",
"0.64886713",
"0.6480781",
"0.64593226",
"0.64531463",
"0.6425878",
"0.6... | 0.6642305 | 10 |
get_quantiles function DESCRIPTION This function returns, in the default case, the parameter median and the error% credibility around it. This assumes you give a nonordered distribution of parameters. OUTPUTS Median of the parameter,upper credibility bound, lower credibility bound | def get_quantiles(dist,alpha = 0.68, method = 'median'):
ordered_dist = dist[np.argsort(dist)]
param = 0.0
# Define the number of samples from posterior
nsamples = len(dist)
nsamples_at_each_side = int(nsamples*(alpha/2.)+1)
if(method == 'median'):
med_idx = 0
if(nsamples%2 == 0.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quantiles(dist,alpha = 0.68, method = 'median'):\n ordered_dist = dist[np.argsort(dist)]\n param = 0.0\n # Define the number of samples from posterior\n nsamples = len(dist)\n nsamples_at_each_side = int(nsamples*(alpha/2.)+1)\n if(method == 'median'):\n med_idx = 0\n if(nsamp... | [
"0.6774421",
"0.6774421",
"0.67476827",
"0.6726235",
"0.65486544",
"0.6531441",
"0.6495061",
"0.64926726",
"0.64856195",
"0.6448822",
"0.64385265",
"0.6410735",
"0.6410735",
"0.6365457",
"0.6334751",
"0.6319719",
"0.6303177",
"0.6256157",
"0.6207847",
"0.61957234",
"0.6191429... | 0.6859889 | 0 |
The lowercase name of this entitlement | def name(self) -> str:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return utils.force_name_case(self._name)",
"def get_name(self):\n return self.normalize_name(self.name)",
"def display_name(self) -> str:\n return pulumi.get(self, \"display_name\")",
"def display_name(self) -> str:\n return pulumi.get(self, \"display_name\")",
... | [
"0.76288146",
"0.7087461",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.69799024",
"0.6973416",
"0.6964221",
"0.69409657",
"0.69402575",
"0.69122845",
"0.6897027",
... | 0.0 | -1 |
The human readable title of this entitlement | def title(self) -> str:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_title(self):\n return \"{id}@{hn}\".format(id=self.model.identity, hn=self.model.hostname)",
"def dc_title(self):\n return u\"{0} ({1}): {2} {3}\".format(\n self.label, self.in_assessment[0].timepoint,\n self.subjects[0].code_in_study,\n \"...\" if len(self.... | [
"0.7920312",
"0.7635332",
"0.7536137",
"0.7536137",
"0.7536137",
"0.75174755",
"0.7506154",
"0.7498701",
"0.74319047",
"0.7414031",
"0.7411283",
"0.73814404",
"0.7354441",
"0.73471665",
"0.73471665",
"0.73471665",
"0.73471665",
"0.73471665",
"0.73471665",
"0.73471665",
"0.734... | 0.0 | -1 |
The current status of application of this entitlement | def application_status(self) -> 'Tuple[status.ApplicationStatus, str]':
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n if self.app_id:\n return self.yarn_api.apps_info(self.app_id)\n else:\n raise KnitException(\"Cannot get status, app not started\")",
"def getStatus(self):\n pid = self._getPid()\n if pid:\n if q.system.process.isPidAlive(pid):\n ... | [
"0.8095366",
"0.75786763",
"0.7441602",
"0.7417636",
"0.7416803",
"0.73544073",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
"0.7346117",
... | 0.732969 | 32 |
Simple view to say hello. It is used to check the authentication system. | def hello_page(request):
text = "Welcome to test_project"
if not request.user.is_anonymous:
text = "Welcome '%s' to test_project" % request.user.username
return HttpResponse(text, content_type='text/plain') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def welcome(request):\n return render(request, 'code_challenge/welcome.html', {})",
"def index():\n if auth.user:\n message=\"Welcome: \"\n user=auth.user\n else:\n message=\"Please use login for testing...\"\n user=None\n return dict(message=message, user=user)",
"def h... | [
"0.72723675",
"0.7122611",
"0.70628446",
"0.7016877",
"0.70082897",
"0.7001555",
"0.7001555",
"0.7001555",
"0.7001555",
"0.7001555",
"0.6992886",
"0.6987479",
"0.6980131",
"0.69239765",
"0.690142",
"0.68931895",
"0.68519014",
"0.68233806",
"0.6798988",
"0.6798988",
"0.6798988... | 0.7476538 | 0 |
Pretty JSON dump of an object. | def pprint(obj):
return json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': ')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_dumps(self, obj: object) -> str:\n return json.dumps(obj, sort_keys=self.beautify, indent=4)",
"def print_json(obj):\n print(json.dumps(obj, indent=2))",
"def pprint(self,obj):\n return(json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': ')))",
"def dumps(obj):\n return... | [
"0.79998887",
"0.7930918",
"0.79296386",
"0.78797597",
"0.7752486",
"0.7712631",
"0.7646695",
"0.7569254",
"0.75250614",
"0.74820435",
"0.74561304",
"0.741061",
"0.7307335",
"0.72820616",
"0.7219065",
"0.72057736",
"0.70947427",
"0.70880896",
"0.7081247",
"0.706571",
"0.70638... | 0.7916694 | 3 |
Return a dictionary containing parameters for calculating and plotting histograms using OpenCV. This function defines default parameter values, then updates them based on user input to the function, and finally it does error checking to identify incomplete or erroneous input parameters from the user. | def get_hist_params(hist_params, plot_params=None):
# Default values for all parameters, except 'images', which MUST be provided by user
params = {
'hist': {
'images': None,
'channels': [0],
'mask': None,
'histSize': [256],
'ranges': [0, 256]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getParameters():\r\n\r\n #dictionnary of all parameters\r\n parameters = {}\r\n\r\n #defalt values\r\n parameters['numChannels'] = [20, 'int'] # number of channels\r\n parameters['loFreq'] = [200, 'int'] # lower bound on frequencies\r\n parameters['hiFreq'] = [5000, 'int']... | [
"0.60502636",
"0.60293156",
"0.5922743",
"0.5814743",
"0.57524025",
"0.5712205",
"0.5708078",
"0.56962985",
"0.56828135",
"0.56604904",
"0.5615502",
"0.56109774",
"0.55878407",
"0.55858666",
"0.55724436",
"0.5561694",
"0.5534408",
"0.55330324",
"0.55330044",
"0.55303997",
"0.... | 0.6696807 | 0 |
Indicates the time duration. | def Duration(self):
return self._get_attribute('duration') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n pass",
"def duration(self):\n pass",
"def get_duration(self):\n return self.duration",
"def duration(self) -> str:\n return pulumi.get(self, \"duration\")",
"def duration(self):\n if hasattr(self, 'completed_on') and hasattr(self, 'started_on'):\n ... | [
"0.8785014",
"0.8785014",
"0.83520776",
"0.83333886",
"0.8295772",
"0.82817554",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82631147",
"0.82554936",
"0.8241747",
"0.82343966",
"0.82238364",
"0.82203895",
"0.8137399",
"... | 0.8144142 | 19 |
FUNCTION BY BRAM MAASAKKERS (C) Convert modified Julian date 2010 to UTC This function is vectorsafe. | def ModifiedJulianDatetoUTC(mjd):
import calendar
import time
global t
global gmt
global t2010
t2010 = calendar.timegm((2010, 1, 1, 0, 0, 0)) # seconds in epoch 1970 corresponding to 1 Jan 2010
# Vectorize inputs
if isinstance(mjd, (np.ndarray,list)): # if input is a vecto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UTCtoModifiedJulianDate(year, month, day, hour, minute, second, millisecond=0):\n\n t2000 = calendar.timegm((2010, 1, 1, 0, 0, 0)) # seconds in epoch 1970 corresponding to 1 Jan 2000\n if isinstance(year, np.ndarray): # if input is vectors\n is_scalar = False\n if isinstance(millisecond,int... | [
"0.6762956",
"0.6741666",
"0.63337785",
"0.6095582",
"0.6036631",
"0.60297364",
"0.60021496",
"0.5889073",
"0.58472294",
"0.583415",
"0.5807126",
"0.5807126",
"0.5767923",
"0.5766352",
"0.56795406",
"0.5673284",
"0.5650913",
"0.56342715",
"0.5567716",
"0.5559314",
"0.5524096"... | 0.7631223 | 0 |
For each row, generate nonzero values only on certain columns, according to the given row_density. | def simulate_sparse(n_rows, n_columns, row_density=0.001):
# X = sparse.lil_matrix((n_rows, n_columns))
X = []
counter = 0
for row in range(n_rows):
counter += 1
if (counter % 1000) == 0:
print(counter)
# X[row] = sparse.random(1, n_columns, density=row_density)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_sparse_cols(self,max_density,remove_lowest=True):\n if max_density >= 1:\n max_nnz = int(max_density)\n else:\n max_nnz = int(max_density*self.shape[0])\n for j in range(self.shape[1]):\n col = self.fast_get_col(j)\n excess = col.nnz - max... | [
"0.6217102",
"0.5685919",
"0.56833285",
"0.5667079",
"0.5579868",
"0.5473517",
"0.54138404",
"0.5394363",
"0.5258356",
"0.520967",
"0.5171684",
"0.50182855",
"0.50060517",
"0.4979442",
"0.49730307",
"0.49443743",
"0.4910218",
"0.48955983",
"0.48876232",
"0.48558837",
"0.48556... | 0.53677124 | 8 |
Parse env files and return environment as dict | def load_env(env_files):
env = {}
for env_file in env_files:
with open(env_file) as f:
for line in f:
if line and line[0] != "#":
try:
index = line.index("=")
env[line[:index].strip()] = line[index + 1 :].str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_env_file_form_dict(env='base'):\r\n cur_path = os.path.abspath(os.path.dirname(__file__))\r\n file_path = os.path.join(cur_path, r\"./config/{}.env\".format(env))\r\n\r\n with open(file_path, 'r') as fh:\r\n logger.debug(\"Env file fetched is {}.env\".format(env))\r\n vars_dict = d... | [
"0.81259906",
"0.78529465",
"0.78251356",
"0.7499753",
"0.73537415",
"0.7352287",
"0.73432535",
"0.7139271",
"0.7114771",
"0.71045035",
"0.7077837",
"0.69392633",
"0.68763953",
"0.67472917",
"0.6729596",
"0.67118275",
"0.6708183",
"0.65748364",
"0.654289",
"0.6517783",
"0.649... | 0.7983697 | 1 |
Getter method for age, mapped from YANG variable /bgp_state/route/evpn/mac/age (string) | def _get_age(self):
return self.__age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_age(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"age\", rest_name=\"age\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mg... | [
"0.6753093",
"0.6496655",
"0.647525",
"0.64583385",
"0.64583385",
"0.64583385",
"0.6430087",
"0.6364848",
"0.63574916",
"0.6336141",
"0.6234846",
"0.6234846",
"0.6232056",
"0.6161758",
"0.6097657",
"0.6055476",
"0.6034399",
"0.6033314",
"0.5976762",
"0.59352875",
"0.5887038",... | 0.59283024 | 20 |
Setter method for age, mapped from YANG variable /bgp_state/route/evpn/mac/age (string) | def _set_age(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="age", rest_name="age", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-bgp-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age(self, age):\n\n self._age = age",
"def age(self, age):\n\n self._age = age",
"def set_age(self, age):\n self.__age = age",
"def setAge(self, age):\n self._age = age",
"def set_age(self, newage):\n self.age = newage",
"def set_age(self, age):\n self.age = ... | [
"0.7036505",
"0.7036505",
"0.68646985",
"0.6815267",
"0.67133063",
"0.65636075",
"0.635404",
"0.62248224",
"0.61444616",
"0.61340046",
"0.6092977",
"0.60702056",
"0.6052108",
"0.6052108",
"0.6052108",
"0.60426",
"0.6042144",
"0.5983758",
"0.59786844",
"0.59405553",
"0.5857568... | 0.7421616 | 0 |
Setter method for vrf_label_direction, mapped from YANG variable /bgp_state/route/evpn/mac/vrf_label_direction (direction) | def _set_vrf_label_direction(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'out': {'value': 1}, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_vrf_label_direction(self):\n return self.__vrf_label_direction",
"def _set_vrf_label(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=TypedListType(allowed_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..429... | [
"0.71491265",
"0.69000334",
"0.5820561",
"0.5470106",
"0.5409429",
"0.5107125",
"0.49156675",
"0.48694208",
"0.48601305",
"0.4859372",
"0.4823032",
"0.4822805",
"0.47982126",
"0.4709727",
"0.4689025",
"0.46794134",
"0.4651903",
"0.457328",
"0.45715228",
"0.4547638",
"0.449802... | 0.8761302 | 0 |
Getter method for origin, mapped from YANG variable /bgp_state/route/evpn/mac/origin (string) | def _get_origin(self):
return self.__origin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_origin(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"origin\", rest_name=\"origin\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:broca... | [
"0.67809063",
"0.64610875",
"0.6195969",
"0.6195969",
"0.6195969",
"0.6195969",
"0.60798603",
"0.6026223",
"0.602039",
"0.59246904",
"0.58778614",
"0.58176297",
"0.58176297",
"0.58176297",
"0.58074725",
"0.57673407",
"0.5746841",
"0.5712355",
"0.57095814",
"0.5664013",
"0.566... | 0.62135416 | 2 |
Setter method for origin, mapped from YANG variable /bgp_state/route/evpn/mac/origin (string) | def _set_origin(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="origin", rest_name="origin", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:bro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_origin_path(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"origin-path\", rest_name=\"origin-path\", parent=self... | [
"0.62915164",
"0.6196142",
"0.6180601",
"0.6153488",
"0.6038057",
"0.60127616",
"0.59221435",
"0.59221435",
"0.59221435",
"0.59221435",
"0.5850876",
"0.5842697",
"0.5718782",
"0.5687987",
"0.567677",
"0.5676598",
"0.5646778",
"0.5638219",
"0.5638219",
"0.5638219",
"0.5608571"... | 0.74020004 | 0 |
Getter method for weight, mapped from YANG variable /bgp_state/route/evpn/mac/weight (int32) | def _get_weight(self):
return self.__weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weight(self):\r\n weight = self.weight\r\n if weight is None:\r\n weight = 1\r\n return weight",
"def _set_weight(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restr... | [
"0.6963839",
"0.6935708",
"0.6858111",
"0.67769074",
"0.67682916",
"0.67353386",
"0.6732368",
"0.6646479",
"0.6646479",
"0.6514983",
"0.6514983",
"0.6514983",
"0.64845407",
"0.64473855",
"0.6342232",
"0.632854",
"0.62845385",
"0.6284414",
"0.6284414",
"0.6272666",
"0.6265297"... | 0.6327417 | 22 |
Setter method for weight, mapped from YANG variable /bgp_state/route/evpn/mac/weight (int32) | def _set_weight(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name="weight", rest_name="weight", parent=self, path_helper=self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_weight(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"weight\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"weight must be of a type comp... | [
"0.71726805",
"0.7082878",
"0.697639",
"0.697639",
"0.697639",
"0.6914376",
"0.6914376",
"0.6914376",
"0.691156",
"0.691156",
"0.691156",
"0.6534363",
"0.6486958",
"0.64137894",
"0.63589156",
"0.63272667",
"0.6323824",
"0.62676126",
"0.6230552",
"0.61869454",
"0.6075714",
"... | 0.7638469 | 0 |
Getter method for cluster_list, mapped from YANG variable /bgp_state/route/evpn/mac/cluster_list (string) | def _get_cluster_list(self):
return self.__cluster_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_cluster_list(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"cluster-list\", rest_name=\"cluster-list\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, na... | [
"0.77951854",
"0.6343224",
"0.62321323",
"0.61340284",
"0.59836704",
"0.5950824",
"0.5934728",
"0.5931723",
"0.58923936",
"0.5879487",
"0.5868273",
"0.58626604",
"0.5849913",
"0.58319014",
"0.5787438",
"0.57422954",
"0.5722017",
"0.564251",
"0.5625094",
"0.5562291",
"0.556020... | 0.61925083 | 3 |
Setter method for cluster_list, mapped from YANG variable /bgp_state/route/evpn/mac/cluster_list (string) | def _set_cluster_list(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="cluster-list", rest_name="cluster-list", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hierarchical_clustering(cluster_list, num_clusters):\n\n total_clusters = len(cluster_list)\n\n while total_clusters > num_clusters:\n cluster_list.sort(key = lambda cluster: cluster.horiz_center())\n closest_pair = fast_closest_pair(cluster_list)\n cluster_1 = cluster_list[closest_p... | [
"0.6023487",
"0.59937114",
"0.596938",
"0.59548527",
"0.5865115",
"0.5859679",
"0.57799405",
"0.5715012",
"0.57057154",
"0.5608196",
"0.55940557",
"0.5581816",
"0.5576507",
"0.5569632",
"0.55453795",
"0.5493312",
"0.5402022",
"0.52811086",
"0.520082",
"0.51686764",
"0.5156321... | 0.8407126 | 0 |
Getter method for adj_rib_out_count, mapped from YANG variable /bgp_state/route/evpn/mac/adj_rib_out_count (int32) | def _get_adj_rib_out_count(self):
return self.__adj_rib_out_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_adj_rib_out_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name=\"adj-rib-out-count\", rest_name=\"adj-... | [
"0.7862464",
"0.51296204",
"0.5125045",
"0.4641357",
"0.4568725",
"0.4521173",
"0.45088953",
"0.44995075",
"0.44795972",
"0.44731736",
"0.44529915",
"0.43635255",
"0.43295127",
"0.43059728",
"0.4298486",
"0.42945945",
"0.42776772",
"0.42676097",
"0.4265784",
"0.42637745",
"0.... | 0.74996334 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.