query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Builds the occupancy map centered around a human from the agents around it. | def build_occupancy_map_torch(human: torch.Tensor, other_agents: torch.Tensor, cell_num: int, cell_size: float,
om_channel_size: int) -> torch.Tensor:
other_px = other_agents[:, 0] - human[0]
other_py = other_agents[:, 1] - human[1]
# new x-axis is in the direction of human's veloci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_occupancy_map(human : Human, other_agents : np.array, cell_num : int, cell_size : float, om_channel_size : int) -> np.array:\n other_px = other_agents[:, 0] - human.px\n other_py = other_agents[:, 1] - human.py\n\n # new x-axis is in the direction of human's velocity\n human_velocity_angle = ... | [
"0.74350286",
"0.6325588",
"0.6325558",
"0.6064309",
"0.59039295",
"0.5875931",
"0.5818135",
"0.5811123",
"0.578889",
"0.5700514",
"0.56371635",
"0.5620403",
"0.558473",
"0.5583018",
"0.55252826",
"0.5518686",
"0.54607475",
"0.54467845",
"0.5439471",
"0.5431876",
"0.54031414"... | 0.72045183 | 1 |
Compare the candidate and running configurations. | def compare(self, delay_factor=1):
delay_factor = self.select_delay_factor(delay_factor)
compare_command = "show candidate diff all"
no_changes = '% No configuration changes found.'
self.config_mode()
output = self.send_command(compare_command, delay_factor=delay_factor)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configs_in_comparisons(self):\n return _get_unique_configs_from_comparisons(self.comparisons,\n self.all_comparisons)",
"def check_shared_configs_consistency(lods):\n shared_trainvals = [lods.shared_trainval.get_x(\n x) for x in [1, 10, 32]]... | [
"0.6372602",
"0.6022456",
"0.60222036",
"0.59441084",
"0.5829869",
"0.55581826",
"0.5544143",
"0.5497578",
"0.54621017",
"0.54517233",
"0.54513496",
"0.5365473",
"0.53572685",
"0.53463995",
"0.5341962",
"0.53284043",
"0.5326147",
"0.532248",
"0.53150165",
"0.5304962",
"0.5304... | 0.6831396 | 0 |
Put file using SCP. | def scp_put_file(self, source_file=None, dest_file=None):
try:
scp = SCPConn(ssh_conn=self)
scp.scp_put_file(source_file=source_file, dest_file=dest_file)
except Exception:
raise
finally:
scp.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scp_put_file(self, source_file, dest_file):\n self.scp_client.put(source_file, dest_file)",
"def _put(self, src_fname, dst_fname):\n logging.info('Transferring file %s to %s', src_fname, self._ip_addr)\n sftp_cli = self._get_sftp_client()\n if sftp_cli is None:\n raise Exception('Not sup... | [
"0.82231313",
"0.79387826",
"0.7933855",
"0.7406798",
"0.72622156",
"0.725179",
"0.7135309",
"0.7012995",
"0.7000298",
"0.69634014",
"0.69558436",
"0.6900815",
"0.68965",
"0.68621397",
"0.6835498",
"0.6808286",
"0.68073934",
"0.67861754",
"0.67376965",
"0.6676569",
"0.6659041... | 0.80475897 | 1 |
Telnet login is not supported. | def telnet_login(self, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def telnet_login(\n self, username_pattern=r\"(?:user>)\", alt_prompt_term=r\"#\\s*$\", **kwargs\n ):\n self.TELNET_RETURN = self.RETURN\n return super().telnet_login(\n username_pattern=username_pattern,\n alt_prompt_terminator=alt_prompt_term,\n **kwargs\n... | [
"0.6637468",
"0.65377754",
"0.63938713",
"0.63271314",
"0.62102973",
"0.60322285",
"0.6011146",
"0.5998153",
"0.59635186",
"0.5958893",
"0.59579414",
"0.59579414",
"0.59306",
"0.59089774",
"0.58955765",
"0.58865744",
"0.588107",
"0.58726525",
"0.5837439",
"0.5831086",
"0.5782... | 0.8005908 | 0 |
Find the first leaf node (Page) in the tree. | def first_leaf(tree):
if 'contents' in tree:
x = tree['contents'][0]
return first_leaf(x)
else:
return tree | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(self):\n return self._subtree_first_position(self.root()) if len(self) > 0 else None",
"def _subtree_first_position(self, p):\n \"\"\"will be used by before()\"\"\"\n walk = p\n #recursivly walking to the left child until the left subtree has no child\n while self.lef... | [
"0.65191627",
"0.6458763",
"0.6458683",
"0.64157206",
"0.63865143",
"0.6378463",
"0.6282795",
"0.6199657",
"0.6157939",
"0.60959136",
"0.60481435",
"0.6011175",
"0.59946644",
"0.5983214",
"0.5936053",
"0.5935651",
"0.5934739",
"0.5922006",
"0.5903637",
"0.58765525",
"0.586545... | 0.7199187 | 0 |
Returns a list of nodes in a book's tree. | def get_book_nodes(book_id):
for x in flatten_tree(get_book_tree(book_id)):
yield expand_tree_node(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self): \n return [n for n in self.iternodes()]",
"def list_of_nodes(tree):\n list_ = []\n if tree.left.is_leaf() and tree.right.is_leaf():\n list_.append(tree)\n return list_\n elif tree.left.is_leaf():\n list_.extend(list_of_nodes(tree.right... | [
"0.6915602",
"0.67631805",
"0.67453516",
"0.6729543",
"0.6702058",
"0.6658768",
"0.66550666",
"0.6592894",
"0.6555684",
"0.65281737",
"0.65211135",
"0.6459367",
"0.64355236",
"0.6405265",
"0.64048654",
"0.6398985",
"0.6329184",
"0.6310391",
"0.6310391",
"0.6310391",
"0.629710... | 0.7489497 | 0 |
\ This creates the nginx uri map to be used inside the nginx configuration's `map` block. | def generate_nginx_uri_mappings(book):
tree = get_book_tree(book)
non_preface_tree = [ x for x in tree['contents'] if 'contents' in x ][0]
intro_page = first_leaf(non_preface_tree)
nodes = list(get_book_nodes(book))
book_node = nodes[0]
book_slug = get_book_slug(book)
uri_mappings = [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_nginx_rules(app_names, error):\n for (app_name, static) in create_rules(app_names, error):\n yield 'location /static/%s/ {' % app_name\n yield ' alias %s/;' % static\n yield '}'\n yield ''",
"def _url_map(self):\n return Map([\n Rule('/init', endpoin... | [
"0.62999403",
"0.6260571",
"0.55464685",
"0.5530561",
"0.5496927",
"0.54682213",
"0.54109216",
"0.5395196",
"0.53535575",
"0.52616113",
"0.52504486",
"0.52361107",
"0.52182907",
"0.51305556",
"0.5118739",
"0.51075685",
"0.5090826",
"0.50855726",
"0.5069762",
"0.5063519",
"0.5... | 0.6825814 | 0 |
Generate environments//files/etc/nginx/urimaps/rexuris.map for redirecting books and pages from cnx to rex. ENVIRONMENT Name of cnxdeploy environment, e.g. staging, used for determining the rex domain | def update_rex_redirects(environment):
env_dir = here.resolve().parent / 'environments' / environment
vars_path = env_dir / 'group_vars/all/vars.yml'
if not vars_path.exists():
vars_path = env_dir / 'group_vars/all.yml'
with vars_path.open('r') as f:
all_vars = yaml.load(f)
rex_h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_nginx_uri_mappings(book):\n tree = get_book_tree(book)\n non_preface_tree = [ x for x in tree['contents'] if 'contents' in x ][0]\n intro_page = first_leaf(non_preface_tree)\n\n nodes = list(get_book_nodes(book))\n book_node = nodes[0]\n book_slug = get_book_slug(book)\n\n uri_map... | [
"0.62209606",
"0.529739",
"0.528408",
"0.52728397",
"0.5215243",
"0.51817703",
"0.49942428",
"0.4884451",
"0.48005736",
"0.47819096",
"0.47751287",
"0.47420454",
"0.4705481",
"0.46749395",
"0.46748832",
"0.46557373",
"0.46352983",
"0.46146107",
"0.45388162",
"0.4521718",
"0.4... | 0.7518129 | 0 |
\ Generates a list of URIs for a cnx book. The URIs are several variations of the same page. This includes URIs with and without versions that use both the long and short id as well as the combination of the two. | def generate_cnx_uris(book_id):
nodes = list(get_book_nodes(book_id))
book_node = nodes[0]
short_book_id = book_node['short_id']
for node in nodes[1:]: # skip the book
# Non-versioned URIs
yield f"/contents/{book_id}:{node['id']}/{node['slug']}"
yield f"/contents/{book_id}:{no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_cnx_uris_for_rex_books(rex_host):\n release_json_url = get_rex_release_json_url(rex_host)\n release_data = requests.get(release_json_url).json()\n for book in release_data['books']:\n for uri in generate_cnx_uris(book):\n click.echo(uri)",
"def generate_nginx_uri_mappings(... | [
"0.6851071",
"0.64288586",
"0.5838203",
"0.5558606",
"0.5514035",
"0.5488511",
"0.54792714",
"0.5459655",
"0.54364514",
"0.54224336",
"0.54211515",
"0.5400728",
"0.53900397",
"0.5375567",
"0.5361768",
"0.53611183",
"0.5360493",
"0.53537375",
"0.53490317",
"0.53300387",
"0.532... | 0.78602666 | 0 |
This outputs a list of CNX URIs to stdout. These are URIs that should redirect to REX. The URIs output by this function are intended for testing use. They exercise a number of variations the URI can be represented as. | def generate_cnx_uris_for_rex_books(rex_host):
release_json_url = get_rex_release_json_url(rex_host)
release_data = requests.get(release_json_url).json()
for book in release_data['books']:
for uri in generate_cnx_uris(book):
click.echo(uri) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_printer(self):\n for i in self.output:\n for item, value in i.items():\n if not isinstance(value, list) and \"http://\" not in value:\n print(f\"{item} : {value}\")\n print(20 * '-')",
"def collectLinks(self, output):\n pass",
"def pr... | [
"0.56118196",
"0.5420336",
"0.53316545",
"0.5292817",
"0.52066284",
"0.5178184",
"0.5130157",
"0.51014674",
"0.5088067",
"0.503968",
"0.5030315",
"0.5015393",
"0.50080425",
"0.4967148",
"0.49484277",
"0.49467713",
"0.4922942",
"0.49128616",
"0.4871896",
"0.48574162",
"0.48482... | 0.5837113 | 0 |
Returns geomdl full version as a tuple | def geomdl_version():
return tuple(__version__.split('.')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_info() -> Tuple[Text, Text]:",
"def fl_library_full_version():\n _fl_library_full_version = library.cfuncproto(\n library.load_so_libforms(), \"fl_library_full_version\", \\\n cty.c_long, [cty.POINTER(cty.c_int), cty.POINTER(cty.c_int), \\\n cty.POINTER(cty.c_int), cty.POI... | [
"0.6739573",
"0.64452404",
"0.63275105",
"0.62999374",
"0.62994355",
"0.6212264",
"0.6160296",
"0.59104824",
"0.5772352",
"0.5756329",
"0.575",
"0.5747563",
"0.5747563",
"0.5663172",
"0.55985165",
"0.5582572",
"0.5546787",
"0.5546375",
"0.5546375",
"0.5529147",
"0.54839945",
... | 0.76042444 | 0 |
Set an expression of 't' to rewrite the timestamp. This is passed to awk(1). | def __setRewriteTimestamp(self, expr):
self.rewriteTimestamp = expr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_time(line, old_time, swap_time):\n line = re.sub(str(old_time), str(swap_time), line, 2)\n return line",
"def t(self, t):\n\n self._t = t",
"def record_time(t):\n\n f = open('time.out', 'w')\n f.write(str(t))\n f.close()",
"def time_stamp(self, line):\n time_delta = date... | [
"0.6126832",
"0.5480052",
"0.54123354",
"0.5371296",
"0.5365838",
"0.53444576",
"0.53441143",
"0.53086114",
"0.53040004",
"0.53037524",
"0.5190752",
"0.51862645",
"0.5142356",
"0.5099608",
"0.50891626",
"0.50681454",
"0.5060547",
"0.50424236",
"0.5038873",
"0.50145274",
"0.50... | 0.6661876 | 0 |
Return index and size of largest cluster | def get_largest_cluster(self) -> tuple:
flat_cluster = self.cluster.reshape(-1)
true_clusters = np.extract(flat_cluster > 0, flat_cluster)
counts = np.bincount(true_clusters)
largest = np.argmax(counts)
size = counts[largest]
return largest, size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxCluster(clusters):\n try:\n return clusters[np.argmax(map(len, clusters))]\n except:\n return None",
"def get_cluster_to_split(clusters):\n\treturn max(clusters.items(), key=lambda x: x[1].get_distortion())[1]",
"def getBestCluster():\r\n global bestCluster\r\n return bestClust... | [
"0.69069916",
"0.6875171",
"0.6868148",
"0.67819893",
"0.6517468",
"0.6368921",
"0.635396",
"0.63266695",
"0.63240397",
"0.62888813",
"0.61457545",
"0.6123891",
"0.60936064",
"0.6071748",
"0.6069598",
"0.60232633",
"0.5954868",
"0.5935137",
"0.5917247",
"0.5916565",
"0.587352... | 0.76109576 | 0 |
Plot clusters using matplotlib | def plot_clusters(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotClusters(self):\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n fig.set_size_inches(18.5, 9.5)\n ax.set_title('Identification of Cluster Particles with Voronoi Volumes', fontsize=22)\n ax.set_xlabel('x [m]', fontsize=18)\n ax.set_ylabel('y [m]',... | [
"0.84290314",
"0.80663663",
"0.7972347",
"0.76775306",
"0.7590494",
"0.7541457",
"0.74899715",
"0.7304596",
"0.7285093",
"0.7261141",
"0.7249832",
"0.72489995",
"0.7225073",
"0.71991867",
"0.71842045",
"0.7155068",
"0.71548474",
"0.71289515",
"0.7097984",
"0.7087705",
"0.7079... | 0.8759711 | 0 |
Find minimum p value that produces a crossing Use a simple dichotomy algorithm | def find_p_cross(self):
# initial values
a = 0.
b = 1.
err = 1.
while err > 1e-3:
p = 0.5 * (a + b)
self.compute_clusters(p)
if self.is_crossed():
b = p
else:
a = p
err = abs(a - b)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(p, n):\n # return (p[0] > p[1] and n[0] < n[1]) or (p[0] < p[1] and n[0] > n[1])\n if (p[0] > p[1] and n[0] < n[1]):\n return -1\n elif (p[0] < p[1] and n[0] > n[1]):\n return 1\n\n return 0",
"def find_x(p, c):\n if p == 0:\n x = int(math.sqrt(c)) + 1\n else:\n ... | [
"0.6452149",
"0.6387847",
"0.6203902",
"0.6149419",
"0.60113037",
"0.59263164",
"0.58939683",
"0.58578545",
"0.58379126",
"0.57495475",
"0.5702375",
"0.56880575",
"0.5687613",
"0.5668798",
"0.56283754",
"0.5626022",
"0.5612389",
"0.5611443",
"0.5611218",
"0.56098413",
"0.5602... | 0.7131225 | 0 |
Return a 2d random array | def _get_rand_array(self):
return np.random.random((self.w + 1, self.h + 1, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_rand_array(self):\n return np.random.random((self.w, self.h))",
"def randomArray (self, length, width):\n\t\treturn [[random.random() for \n\t\ti in range(width)] for j in range(length)]",
"def _get_rand_array(self):\n rand_array = np.random.random((self.n, self.n, 2))\n rand_arra... | [
"0.7521032",
"0.74172115",
"0.7088139",
"0.68222886",
"0.67712563",
"0.67414933",
"0.67244625",
"0.6643412",
"0.6593464",
"0.6520585",
"0.65151894",
"0.6507812",
"0.6470644",
"0.6458704",
"0.6458164",
"0.644339",
"0.6436446",
"0.63067937",
"0.62724894",
"0.623708",
"0.6222788... | 0.8002582 | 0 |
Compute the clusters of a percolation sample x of width w and height h, on the square lattice, return a list cluster[i, j] = k where k indicate to which cluster the site (i,j) belongs to. Order the vertices by order[i, j] = i + 1 + (w + 1)j, that is left to right, bottom to top. The variable order record the next unvis... | def compute_clusters(self, p: float):
w = self.w
h = self.h
self.p = p
self.sample = self._get_sample(p)
self.cluster = np.zeros((w + 1, h + 1), dtype=int)
visited = np.full((w + 1, h + 1), False)
k = 0 # cluster index
myvertex = 1
stack = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_clusters(self, p: float):\n w = self.w\n h = self.h\n self.p = p\n self.sample = self._get_sample(p)\n self.cluster = np.zeros((w, h), dtype=int)\n x = self.sample\n visited = np.full((w, h), False)\n k = 0 # cluster index\n myvertex = 1\n... | [
"0.7121861",
"0.6492717",
"0.5898104",
"0.578989",
"0.574878",
"0.562329",
"0.5559004",
"0.54639626",
"0.5450528",
"0.5441684",
"0.54153305",
"0.54139304",
"0.5363096",
"0.5310802",
"0.52949023",
"0.52518904",
"0.5249489",
"0.52432966",
"0.52283585",
"0.521124",
"0.518422",
... | 0.7113222 | 1 |
Return a 2d random array | def _get_rand_array(self):
return np.random.random((self.w, self.h)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_rand_array(self):\n return np.random.random((self.w + 1, self.h + 1, 2))",
"def randomArray (self, length, width):\n\t\treturn [[random.random() for \n\t\ti in range(width)] for j in range(length)]",
"def _get_rand_array(self):\n rand_array = np.random.random((self.n, self.n, 2))\n ... | [
"0.8003144",
"0.7416416",
"0.708854",
"0.6822432",
"0.6770387",
"0.6740862",
"0.67248",
"0.6644545",
"0.65926653",
"0.6520912",
"0.6515756",
"0.6508255",
"0.646947",
"0.64606714",
"0.6459046",
"0.6444397",
"0.6434885",
"0.63055706",
"0.62734646",
"0.6237022",
"0.62234414",
... | 0.7521095 | 1 |
compute the clusters of a percolation sample x of width w and height h, on the hexagonal lattice, return a list cluster[i,j] = k where k indicates to which cluster the site (i,j) belongs to. order the vertices by order(i,j)=i+1+wj, that is left to right, bottom to top. the variable myvertex record the next unvisited ve... | def compute_clusters(self, p: float):
w = self.w
h = self.h
self.p = p
self.sample = self._get_sample(p)
self.cluster = np.zeros((w, h), dtype=int)
x = self.sample
visited = np.full((w, h), False)
k = 0 # cluster index
myvertex = 1
stack =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_clusters(self, p: float):\n w = self.w\n h = self.h\n self.p = p\n self.sample = self._get_sample(p)\n self.cluster = np.zeros((w + 1, h + 1), dtype=int)\n visited = np.full((w + 1, h + 1), False)\n k = 0 # cluster index\n myvertex = 1\n s... | [
"0.7103432",
"0.60676974",
"0.5613001",
"0.55861783",
"0.55299205",
"0.5457722",
"0.5417837",
"0.5368234",
"0.53043973",
"0.5276851",
"0.5214433",
"0.5210819",
"0.520385",
"0.5202059",
"0.51989365",
"0.51821005",
"0.5177106",
"0.5158719",
"0.51510704",
"0.51385313",
"0.513470... | 0.7281442 | 0 |
plot a single edge | def plot_edge(self, x0, x1, y0, y1):
self.ax.plot([x0, x1], [y0, y1], '-o', color=self.color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_edges(self):\n pass",
"def plot(self):\n return self.graph(edge_labels='words_in_out').plot()",
"def edge(self, viz_edge: VizEdge) -> None:\n self._digraph.edge(viz_edge.start, viz_edge.end)",
"def plot_graph(self) -> None:",
"def plot(self, **kwds):\n c0 = 'blue' # s... | [
"0.71036917",
"0.67802185",
"0.66796315",
"0.65535325",
"0.6506702",
"0.6356567",
"0.63337076",
"0.63289255",
"0.6249659",
"0.6160119",
"0.61482984",
"0.61406755",
"0.6131292",
"0.61138237",
"0.6094382",
"0.6085169",
"0.6072634",
"0.60711074",
"0.6060082",
"0.6026647",
"0.602... | 0.79260814 | 0 |
Plot the probability of crossing as a function of p by running nsim simulations | def percolation_vs_p(w: int, h: int, nsim=40, n_p=50):
p_values = np.linspace(0., 1., n_p) # n_p-value array between 0 and 1
def plot_crossing_probability(ax, Percolation) -> np.ndarray:
"""
Plot crossing probabilities of a percolation of type Percolation
"""
print(f"Computing... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_crossing_probability(ax, Percolation) -> np.ndarray:\n\n print(f\"Computing crossing probabilities for {Percolation.grid_type} \"\n \"percolation\")\n cross_proba = np.zeros_like(p_values)\n for i in progressbar.progressbar(range(nsim)):\n perco = Percolation(w... | [
"0.6802019",
"0.5923673",
"0.5871177",
"0.5721985",
"0.5642161",
"0.5629112",
"0.55962366",
"0.55636334",
"0.55436826",
"0.55369306",
"0.5514733",
"0.55069953",
"0.5496173",
"0.54960525",
"0.549263",
"0.5492127",
"0.5488934",
"0.54596204",
"0.5449949",
"0.5436948",
"0.5415453... | 0.67598367 | 1 |
Plot crossing probabilities of a percolation of type Percolation | def plot_crossing_probability(ax, Percolation) -> np.ndarray:
print(f"Computing crossing probabilities for {Percolation.grid_type} "
"percolation")
cross_proba = np.zeros_like(p_values)
for i in progressbar.progressbar(range(nsim)):
perco = Percolation(w, h)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percolation_vs_p(w: int, h: int, nsim=40, n_p=50):\n p_values = np.linspace(0., 1., n_p) # n_p-value array between 0 and 1\n\n def plot_crossing_probability(ax, Percolation) -> np.ndarray:\n \"\"\"\n Plot crossing probabilities of a percolation of type Percolation\n \"\"\"\n\n ... | [
"0.77114993",
"0.59706366",
"0.5795794",
"0.56556404",
"0.5614111",
"0.5579156",
"0.5553865",
"0.55474484",
"0.5479693",
"0.54778475",
"0.546573",
"0.5461639",
"0.54490477",
"0.5443024",
"0.5409724",
"0.5397981",
"0.53972983",
"0.5377955",
"0.53730726",
"0.53675896",
"0.53643... | 0.7959311 | 0 |
Register a reader, the given callback will be called with the given args when the file is ready to read | def register_reader(self, fileobj, callback: typing.Callable[..., None], *args):
if fileobj.fileno() in self.selector.get_map():
if self.selector.get_key(fileobj).events == selectors.EVENT_WRITE:
# If the item exists and is registered for just WRITE, listen for READ too
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addReader(self, reader):\n if reader in self._readers:\n # Don't add the reader if it's already there\n return\n self._readers[reader] = True\n fd = reader.fileno()\n if fd in self._fds:\n (_, writer) = self._fds[fd]\n self._fds[fd] = (rea... | [
"0.60967344",
"0.5932465",
"0.59265405",
"0.576169",
"0.56432515",
"0.56412745",
"0.55362344",
"0.54501295",
"0.5391382",
"0.53362244",
"0.53111213",
"0.5263184",
"0.52529573",
"0.5249176",
"0.52207243",
"0.5172244",
"0.5168104",
"0.515358",
"0.51005656",
"0.509244",
"0.50802... | 0.75688356 | 0 |
Register a writer, the given callback will be called with the given args when the file is ready to write | def register_writer(self, fileobj, callback: typing.Callable, *args):
if fileobj.fileno() in self.selector.get_map():
if self.selector.get_key(fileobj).events == selectors.EVENT_READ:
# If the item exists and is registered for just READ, listen for WRITE too
self.sele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_write_callback(self, fcn, **kwargs):\n assert(hasattr(fcn, '__call__'))\n self._write_callbacks[fcn] = kwargs",
"def write_file(*args, **kwargs): # real signature unknown\n pass",
"def addWriter(self, writer):\n if writer in self._writers:\n return\n self._writ... | [
"0.6385542",
"0.60983187",
"0.603559",
"0.6000676",
"0.59150916",
"0.5877957",
"0.5794071",
"0.5749085",
"0.56524676",
"0.5454422",
"0.5381786",
"0.5381786",
"0.5361258",
"0.5265381",
"0.5228072",
"0.5215117",
"0.5215035",
"0.51821053",
"0.5163701",
"0.5162245",
"0.5148527",
... | 0.7524809 | 0 |
Disable and remove a reader. Returns whether or not successful | def unregister_reader(self, fileobj):
if fileobj.fileno() in self.selector.get_map(): # If it exists as a WRITER and READER, make it just WRITER
if self.selector.get_key(fileobj) == selectors.EVENT_READ ^ selectors.EVENT_WRITE:
self.selector.modify(fileobj, selectors.EVENT_WRITE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_reader(self):\n self.reader = None\n self.model.reset()",
"def removeReader(self, reader):\n fd = reader.fileno()\n if reader in self._readers:\n del self._readers[reader]\n if self._closed: return\n (_, writer) = self._fds[fd]\n ... | [
"0.6493295",
"0.6435525",
"0.6277885",
"0.6090223",
"0.60334176",
"0.59881437",
"0.59656316",
"0.58657014",
"0.5706895",
"0.57007897",
"0.56752914",
"0.55957294",
"0.5594134",
"0.55760896",
"0.553354",
"0.55119336",
"0.5499903",
"0.5466654",
"0.5430937",
"0.542666",
"0.540236... | 0.67055357 | 0 |
Disable and remove a writer. Returns whether or not successful | def unregister_writer(self, fileobj):
if fileobj.fileno() in self.selector.get_map(): # If it exists as a WRITER and READER, make it just READER
if self.selector.get_key(fileobj) == selectors.EVENT_READ ^ selectors.EVENT_WRITE:
self.selector.modify(fileobj, selectors.EVENT_READ)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeWriter(self, writer):\n fd = writer.fileno()\n if writer in self._writers:\n del self._writers[writer]\n if self._closed: return\n (reader, _) = self._fds[fd]\n if reader:\n # We have a reader so we need to update the IOLoop for\n ... | [
"0.6555368",
"0.6476275",
"0.6183134",
"0.6174837",
"0.60103065",
"0.59795076",
"0.58553976",
"0.58214766",
"0.5697401",
"0.5556968",
"0.5454187",
"0.54371953",
"0.54277617",
"0.54235643",
"0.54123324",
"0.5296894",
"0.5287549",
"0.526886",
"0.52579623",
"0.5254519",
"0.52146... | 0.68908715 | 0 |
Parse any project specific params and add to the given data dict. | def _parse_project_params(self, response_tree, data):
# if self.project == 'TWC':
# data['lithium'] = response_tree.find('lithiumresults').text
if self.project == 'ILAR':
data['ilar_title'] = response_tree.find('ilartitle').text
data['ilar_rank'] = int(response_tree.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_project_values(project, data):\n project.hashtag = data['hashtag']\n if 'name' in data and len(data['name']) > 0:\n project.name = data['name']\n else:\n project.name = project.hashtag.replace('-', ' ')\n if 'summary' in data and len(data['summary']) > 0:\n project.summary ... | [
"0.6846135",
"0.5871499",
"0.584978",
"0.56637955",
"0.55777466",
"0.55064195",
"0.54478496",
"0.54400355",
"0.5344797",
"0.5337187",
"0.5324547",
"0.53097075",
"0.5295819",
"0.5294145",
"0.5281782",
"0.525717",
"0.52566695",
"0.5232131",
"0.5230158",
"0.52282846",
"0.5218172... | 0.7073795 | 0 |
Make requests to the endpoint to open x number of sessions. | def open_new_sessions(self, number_of_sessions=1):
session_ids = []
for x in range(0, number_of_sessions):
init_request = self.make_request()
session_ids.append(init_request['ident'])
print 'Acquired SessionID #%s: %s' % (
x, init_request['ident']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session():\n s = requests.Session()\n retries = Retry(total=5, backoff_factor=0.5)\n s.mount(\"http://\", HTTPAdapter(max_retries=retries))\n return s",
"def retry(num=5):\n s = requests.Session()\n retries = Retry(total=num, backoff_factor=0.1,\n status_forcelist=[500, 5... | [
"0.61514413",
"0.61172545",
"0.60192204",
"0.57969695",
"0.56527877",
"0.56229675",
"0.5600649",
"0.5587406",
"0.5573832",
"0.55700976",
"0.55628836",
"0.5552895",
"0.5519411",
"0.55096984",
"0.54714847",
"0.54601073",
"0.5450661",
"0.5438189",
"0.5433544",
"0.54249877",
"0.5... | 0.73699737 | 0 |
Calculate the power of the input signal, default axis=0 | def signal_power(signal_input, *arg):
signal_T = np.array(signal_input)
energy = np.abs(signal_T) ** 2
if len(arg) < 1:
power = np.mean(energy)
else:
power = np.mean(energy, axis=arg[0])
return power | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal_power_tf(signal_input, *arg):\r\n energy = tf.pow(tf.abs(signal_input), 2)\r\n if len(arg) < 1:\r\n power = tf.reduce_sum(tf.reduce_mean(energy))\r\n else:\r\n power = tf.reduce_sum(tf.reduce_mean(energy, axis=arg[0]))\r\n return power",
"def signedpow... | [
"0.7088364",
"0.6437029",
"0.6308445",
"0.6293088",
"0.62445873",
"0.62339926",
"0.6191243",
"0.6125598",
"0.61203164",
"0.6049411",
"0.6023444",
"0.5974872",
"0.5955626",
"0.59047854",
"0.5895021",
"0.58707654",
"0.5830187",
"0.5814692",
"0.5811119",
"0.5801685",
"0.5798066"... | 0.754145 | 0 |
Calculate the power of the input signal, default axis=0 | def signal_power_tf(signal_input, *arg):
energy = tf.pow(tf.abs(signal_input), 2)
if len(arg) < 1:
power = tf.reduce_sum(tf.reduce_mean(energy))
else:
power = tf.reduce_sum(tf.reduce_mean(energy, axis=arg[0]))
return power | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal_power(signal_input, *arg):\r\n signal_T = np.array(signal_input)\r\n energy = np.abs(signal_T) ** 2\r\n if len(arg) < 1:\r\n power = np.mean(energy)\r\n else:\r\n power = np.mean(energy, axis=arg[0])\r\n return power",
"def signedpower(x: pd.Ser... | [
"0.7541983",
"0.6438472",
"0.63116676",
"0.62950784",
"0.6248387",
"0.6236657",
"0.61926675",
"0.6125883",
"0.61207163",
"0.60522336",
"0.60263586",
"0.5977754",
"0.5957558",
"0.5908114",
"0.58978146",
"0.58725613",
"0.5830364",
"0.58156",
"0.5813348",
"0.5804124",
"0.5800076... | 0.7090031 | 1 |
calculation the accuracy rate (bit error rate) | def count_accuracy_rate(binary_1, binary_2):
binary_1 = np.array(binary_1)
binary_2 = np.array(binary_2)
error_num = np.sum(np.abs(binary_1 - binary_2))
T = np.size(binary_1)
bit_error_rate = error_num / int(np.size(binary_1))
accuracy = 1. - bit_error_rate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(self):\n total_predictions = self.tp + self.fp + self.tn + self.fn;\n return float(self.tp + self.tn) / total_predictions if total_predictions != 0 else 1",
"def accuracy(self):",
"def accuracy(self):\n return (self.table[0, 0] + self.table[1, 1]) / self.N",
"def accuracy(se... | [
"0.74579656",
"0.7440399",
"0.707814",
"0.7039524",
"0.69247633",
"0.685812",
"0.6845187",
"0.679565",
"0.6787519",
"0.6661789",
"0.6644088",
"0.6643556",
"0.66168183",
"0.6597838",
"0.658952",
"0.65866786",
"0.6527206",
"0.64649534",
"0.64612645",
"0.64562607",
"0.64544564",... | 0.7491279 | 0 |
dMap the input signal to the scatter diagram and demodulate the binary data to> [binary_data, complex_data] | def signal_decoder(self, signal_receive):
size = np.shape(signal_receive)
signal_receive1 = np.array(signal_receive).reshape([-1, 1])
# 进行星座映射前,将信号放缩回标准的幅度、
signal_norm = signal_receive1 * self.scatter_power
n = len(signal_receive1) # 接收复信号信号长度
binary_data = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_assemble(self, x,y, r_cut, add_mask=5, pick_choice=False):\n #segmentation components\n obj_masks,center_mask_info, segments_deblend_list = self._seg_image(x, y, r_cut=r_cut)\n data_masks_center, _, xcenter, ycenter, c_index = center_mask_info\n image = self.cut_image(x,y,r_cut)\n... | [
"0.52954143",
"0.5056885",
"0.50563335",
"0.5003429",
"0.5001331",
"0.49707818",
"0.49329987",
"0.49215063",
"0.49080262",
"0.4848212",
"0.48438838",
"0.48330647",
"0.4745483",
"0.47409472",
"0.4738311",
"0.4725683",
"0.47231928",
"0.46915108",
"0.46753392",
"0.4674763",
"0.4... | 0.5685837 | 0 |
Build InputFeature from Dict by randomizing between using docstring or function name for query | def build_input_features_from_dict(sample: Dict[str, Union[str, int, np.ndarray]]) -> InputFeatures:
if random.uniform(0.0, 1.0) < data_params.fraction_using_func_name:
return InputFeatures(
language=data_params.lang_ids[cast(str, sample["language"])],
similarity=cast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _train_input_fn():\n\t\tprint('\\n\\nRunning _train_input_fn\\n\\n')\n\t\tfeatures_placeholder = {\n\t\t\t#'query_unigrams' : tf.placeholder(tf.string, (len(features['query_unigrams']), features['query_unigrams'][0].shape[0])),\n\t\t\t#'doc_unigrams' : tf.placeholder(tf.string, (len(features['doc_unigrams']), ... | [
"0.5823072",
"0.5744938",
"0.56607056",
"0.563978",
"0.56200755",
"0.561077",
"0.56024784",
"0.55640936",
"0.55296516",
"0.55161834",
"0.54386014",
"0.5420825",
"0.54205674",
"0.5418314",
"0.5410511",
"0.5402047",
"0.539954",
"0.5376042",
"0.5373568",
"0.5366252",
"0.53414744... | 0.78513306 | 0 |
get_tokenized_sentences will first split the snippets in sentences | def get_tokenized_sentences(snippets):
sentences = []
id2sentences = []
for snippet in snippets:
snippet_sent = split_single(snippet[1])
id2sentences.extend([snippet[0]] * len(snippet_sent))
sentences.extend(snippet_sent)
return [Sentence(sentence, use_tokenizer=True) for senten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sentences(self):\n return [s for s in self.text.split('\\n')]",
"def get_sentences(text):\n \n return text.split('.')",
"def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]",
"def sentences(self) -> List[str]:\n\t\treturn [self.text[s... | [
"0.74452627",
"0.7368498",
"0.7359173",
"0.7359173",
"0.7260601",
"0.71699095",
"0.71629345",
"0.71425474",
"0.68662435",
"0.6860318",
"0.68540734",
"0.68492407",
"0.6836181",
"0.6830419",
"0.68292785",
"0.6811221",
"0.67965025",
"0.67873204",
"0.6774041",
"0.67729",
"0.67616... | 0.7959182 | 0 |
Returns the url string for the cancel event endpoint | def get_cancel_event_endpoint_url() -> str:
return "/events/cancel" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCancelURL(self):\n if not self.return_to:\n raise NoReturnToError\n\n if self.immediate:\n raise ValueError(\"Cancel is not an appropriate response to \"\n \"immediate mode requests.\")\n\n response = Message(self.message.getOpenIDNamesp... | [
"0.749225",
"0.6748085",
"0.6287431",
"0.6287431",
"0.6046953",
"0.59996486",
"0.5834716",
"0.57902855",
"0.57706034",
"0.57706034",
"0.5758704",
"0.5714185",
"0.5708712",
"0.5701541",
"0.5696543",
"0.56635296",
"0.56635296",
"0.56635296",
"0.56635296",
"0.56635296",
"0.56635... | 0.9059689 | 0 |
Checks if response code is as expected for a valid event cancel | def check_valid_cancel_response(response: HTTPResponse) -> bool:
return response.status_code == 204 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def check_response_code(response, expected_response_code):\n if response.status_code == expected_response_code:\n pas... | [
"0.6611546",
"0.6611546",
"0.6611546",
"0.6611546",
"0.6591385",
"0.65252",
"0.6523028",
"0.64352906",
"0.64181364",
"0.6352458",
"0.62820756",
"0.6211828",
"0.61851794",
"0.6170487",
"0.6154181",
"0.6075779",
"0.6049504",
"0.5993894",
"0.5991343",
"0.5977028",
"0.5977028",
... | 0.73567134 | 0 |
Checks if response code is as expected for an unauthorized event cancel | def check_unauthorized_response(response: HTTPResponse) -> bool:
return response.status_code == 403 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_valid_cancel_response(response: HTTPResponse) -> bool:\n return response.status_code == 204",
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def canCancel(self) -> bool:\n ...",
"def test_status_u... | [
"0.697629",
"0.6449148",
"0.6449148",
"0.6449148",
"0.6449148",
"0.63382643",
"0.6279705",
"0.62749887",
"0.62713015",
"0.6234412",
"0.6217571",
"0.6209937",
"0.62090516",
"0.61564493",
"0.61459863",
"0.6115845",
"0.6081293",
"0.6077542",
"0.6059453",
"0.6039988",
"0.6033075"... | 0.70770985 | 0 |
Checks if response code is as expected for an empty json payload | def check_no_data_response(response: HTTPResponse) -> bool:
return response.status_code == 422 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_response_no_data(response: HTTPResponse) -> bool:\n return response.status_code == 422",
"def _check_response(self, response):\n if response.status_code == requests.codes.ok:\n # Since the ZenHub REST API does not send back 204 when there is\n # no content, we have to ch... | [
"0.7291176",
"0.70699203",
"0.70409155",
"0.68649054",
"0.68453157",
"0.6824498",
"0.67270297",
"0.66770184",
"0.66712445",
"0.6551668",
"0.6538832",
"0.65374166",
"0.6531125",
"0.6509117",
"0.65083885",
"0.6508086",
"0.6472652",
"0.646834",
"0.64596564",
"0.6446508",
"0.6423... | 0.73334736 | 0 |
Checks if response code is as expected for an event id that doesn't correspond to an event in the database | def check_no_event_response(response: HTTPResponse) -> bool:
return response.status_code == 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_nonexisting_event(self):\n response = self.client.get(\"/events/1\")\n self.assertEqual(response.status_code, 404)",
"def check_response_code(response, expected_response_code):\n if response.status_code == expected_response_code:\n pass\n elif response.status_code == RATE_LIMI... | [
"0.6599379",
"0.6492662",
"0.63456744",
"0.6319376",
"0.6222744",
"0.61948943",
"0.61863697",
"0.61497176",
"0.61455697",
"0.613866",
"0.6136502",
"0.6115662",
"0.61052424",
"0.60858893",
"0.6081234",
"0.6043205",
"0.6041284",
"0.6028767",
"0.6016661",
"0.60012096",
"0.597602... | 0.7199231 | 0 |
Checks if a newly acquired event object is the same as the old, except for an enum which is expected to now be cancelled on the new object. | def check_event_update_safe(old_event: event_models.Event,
new_event: event_models.Event) -> bool:
old_event.status = event_models.EventStatusEnum.cancelled
return old_event == new_event | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: Event) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n if not isinstance(other, EventType):\n return True\n\n return self.to_dict() != other.to_dict()",
"def __ne__(self, other):\n if not isinstance(other, SafetyEvent):\n ... | [
"0.6565669",
"0.6425756",
"0.639029",
"0.6358252",
"0.6176304",
"0.61366004",
"0.6131324",
"0.6006748",
"0.59377766",
"0.5923623",
"0.590856",
"0.5895108",
"0.58053184",
"0.57907",
"0.57816315",
"0.577049",
"0.576467",
"0.5757309",
"0.57204205",
"0.57179654",
"0.5697099",
"... | 0.7446278 | 0 |
Checks if the given event is in the database | def event_in_database(event: event_models.Event) -> bool:
id_dict = async_to_sync(event_utils.generate_event_id_dict)(event)
var = event_utils.events_collection().find_one(id_dict)
return bool(var) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def check_scheduled_events_exists(self) -> bool:\n\n mycursor, _ = await the_database()\n await mycursor.execute(\"SHOW TABLE STATUS LIKE 'ScheduledEvents'\")\n exists = await mycursor.fetchone()\n await mycursor.close()\n if exists:\n return True\n else:\... | [
"0.7064578",
"0.68567604",
"0.6432379",
"0.64163643",
"0.6283231",
"0.6229788",
"0.6204965",
"0.61045676",
"0.60995096",
"0.60738385",
"0.60218966",
"0.6003006",
"0.5993567",
"0.59884393",
"0.5987102",
"0.59779865",
"0.5977106",
"0.5975212",
"0.5955525",
"0.59242505",
"0.5921... | 0.8571696 | 0 |
build index from documents stored in the input directory, then output the dictionary file and postings file | def build_index(in_dir, out_dict, out_postings):
print('indexing...')
maxInt = sys.maxsize
while True:
# decrease the maxInt value by factor 10
# as long as the OverflowError occurs.
try:
csv.field_size_limit(maxInt)
break
except OverflowError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index(in_dir, out_dict, out_postings):\n print('indexing...')\n\n stemmer = stem.PorterStemmer()\n\n #Dictionary for saving our tokens and the reference to their postings list\n dictionary = dict()\n #Number of files that will be indexed\n num_files = 1000000\n #1. We have to open th... | [
"0.8008384",
"0.68767405",
"0.6867144",
"0.68415546",
"0.6761826",
"0.6725081",
"0.67161083",
"0.66778785",
"0.6671684",
"0.66640383",
"0.66592205",
"0.6654655",
"0.6637115",
"0.663162",
"0.6586695",
"0.65800345",
"0.6504149",
"0.6436366",
"0.64300215",
"0.63986534",
"0.63928... | 0.8037236 | 0 |
Returns status and percentage of download. | def get_status(self):
return str(self.percentage) + "%", self.downloaded, self.speed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status():\n used = get_space_used()\n avail = get_space_available()\n allowed = config.download.space_to_use\n print \"Space used by downloaded files: %.2f GB of %.2f GB (%.2f%%)\" % \\\n (used/1024.0**3, allowed/1024.0**3, 100.0*used/allowed)\n print \"Space available on file system:... | [
"0.7467775",
"0.71519023",
"0.7092631",
"0.70839685",
"0.7051068",
"0.6987735",
"0.6921654",
"0.6919458",
"0.6909803",
"0.6891368",
"0.68560714",
"0.6806973",
"0.66332144",
"0.6622256",
"0.64624935",
"0.6430908",
"0.64160454",
"0.63825315",
"0.6336113",
"0.63268435",
"0.62491... | 0.8340439 | 0 |
Parse the 'ip addr list dev' command raw output. | def _parse_ip_addr_show(raw_result):
# does link exist?
show_re = (
r'"(?P<dev>\S+)"\s+does not exist'
)
re_result = search(show_re, raw_result)
result = None
if not (re_result):
# match top two lines for serveral 'always there' variables
show_re = (
r'\s*(?P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_interface(enode, dev, shell=None):\n assert dev\n\n cmd = 'ip addr list dev {ldev}'.format(ldev=dev)\n response = enode(cmd, shell=shell)\n\n first_half_dict = _parse_ip_addr_show(response)\n\n d = None\n if (first_half_dict):\n cmd = 'ip -s link list dev {ldev}'.format(ldev=dev)\... | [
"0.6172062",
"0.61358017",
"0.593978",
"0.59342784",
"0.592683",
"0.58983046",
"0.58046657",
"0.5750179",
"0.5660487",
"0.5638853",
"0.5599769",
"0.5519368",
"0.54568243",
"0.54491615",
"0.54011136",
"0.53891057",
"0.53835166",
"0.5345464",
"0.53333026",
"0.5269705",
"0.52582... | 0.6893496 | 0 |
Parse the 'ip s link show dev ' command raw output. | def _parse_ip_stats_link_show(raw_result):
show_re = (
r'.+?RX:.*?\n'
r'\s*(?P<rx_bytes>\d+)\s+(?P<rx_packets>\d+)\s+(?P<rx_errors>\d+)\s+'
r'(?P<rx_dropped>\d+)\s+(?P<rx_overrun>\d+)\s+(?P<rx_mcast>\d+)'
r'.+?TX:.*?\n'
r'\s*(?P<tx_bytes>\d+)\s+(?P<tx_packets>\d+)\s+(?P<tx_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_ip_addr_show(raw_result):\n # does link exist?\n show_re = (\n r'\"(?P<dev>\\S+)\"\\s+does not exist'\n )\n re_result = search(show_re, raw_result)\n result = None\n\n if not (re_result):\n # match top two lines for serveral 'always there' variables\n show_re = (\n... | [
"0.71872616",
"0.6295929",
"0.564603",
"0.5594993",
"0.55892795",
"0.55746603",
"0.5532848",
"0.55254334",
"0.5493736",
"0.5467406",
"0.54668933",
"0.5406345",
"0.5396165",
"0.53332585",
"0.532095",
"0.52996475",
"0.52896196",
"0.5283135",
"0.52831",
"0.5248178",
"0.5243615",... | 0.70613617 | 1 |
Configure a subinterface. All parameters left as ``None`` are ignored and thus no configuration action is taken for that parameter (left "asis"). Sub interfaces can only be configured if the device exists. If you want to enable the sub interface, it will enable the interface as well. | def sub_interface(enode, portlbl, subint, addr=None, up=None, shell=None):
assert portlbl
assert subint
port = enode.ports[portlbl]
if addr is not None:
assert ip_interface(addr)
cmd = 'ip addr add {addr} dev {port}.{subint}'.format(addr=addr,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Configure(self, argin):\n # PROTECTED REGION ID(CspSubElementSubarray.Configure) ENABLED START #\n return self.ConfigureScan(argin)\n # PROTECTED REGION END # // CspSubElementSubarray.Configure",
"def do_configure(\n self,\n sub_array_id: int,\n configuration: ty... | [
"0.6085846",
"0.601727",
"0.58972824",
"0.5697075",
"0.56925994",
"0.565964",
"0.5535238",
"0.5499577",
"0.5494393",
"0.5461625",
"0.54308784",
"0.5396985",
"0.53885734",
"0.5357006",
"0.5353153",
"0.53171164",
"0.5311403",
"0.52295804",
"0.5224994",
"0.5201214",
"0.51980275"... | 0.6611459 | 0 |
Remove an IP address from an interface. All parameters left as ``None`` are ignored and thus no configuration action is taken for that parameter (left "asis"). | def remove_ip(enode, portlbl, addr, shell=None):
assert portlbl
assert ip_interface(addr)
port = enode.ports[portlbl]
cmd = 'ip addr del {addr} dev {port}'.format(addr=addr, port=port)
response = enode(cmd, shell=shell)
assert not response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_ipv4_address(self, net_interface, address):\n self._runner.run('ip addr del %s dev %s' % (address, net_interface))",
"def remove(ip):\n return __apf_cmd(\"-u {}\".format(ip))",
"def remove_interface(ctx, interface_name):\n config_db = ConfigDBConnector()\n config_db.connect()\n\n ... | [
"0.71915936",
"0.67640084",
"0.65481555",
"0.6505961",
"0.63174236",
"0.6311167",
"0.6294774",
"0.62906903",
"0.6232962",
"0.6171024",
"0.61697006",
"0.61626697",
"0.61570746",
"0.6096721",
"0.6088209",
"0.60403955",
"0.5977128",
"0.59673816",
"0.59283024",
"0.5873158",
"0.58... | 0.7132095 | 1 |
Add a new virtual link with the type set to VLAN. Creates a new vlan device {name} on device {port}. Will raise an exception if value is already assigned. | def add_link_type_vlan(enode, portlbl, name, vlan_id, shell=None):
assert name
if name in enode.ports:
raise ValueError('Port {name} already exists'.format(name=name))
assert portlbl
assert vlan_id
port = enode.ports[portlbl]
cmd = 'ip link add link {dev} name {name} type vlan id {vlan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vlan(self, vlan):\n logger.info('adding vlan: %s' % vlan.name)\n data = self._add_common(vlan)\n logger.debug('vlan data: %s' % data)\n self.interface_data[vlan.name] = data\n if vlan.routes:\n self._add_routes(vlan.name, vlan.routes)",
"def add_vlan(self, vl... | [
"0.706955",
"0.682846",
"0.6736001",
"0.6372676",
"0.62433374",
"0.62107116",
"0.61299473",
"0.6065782",
"0.6018979",
"0.59763926",
"0.5913838",
"0.5834151",
"0.571904",
"0.5711874",
"0.56569356",
"0.5631391",
"0.55685043",
"0.5542326",
"0.5530196",
"0.5515172",
"0.549025",
... | 0.7811051 | 0 |
Delete a virtual link. Deletes a vlan device with the name {name}. Will raise an expection if the port is not already present. | def remove_link_type_vlan(enode, name, shell=None):
assert name
if name not in enode.ports:
raise ValueError('Port {name} doesn\'t exists'.format(name=name))
cmd = 'ip link del link dev {name}'.format(name=name)
response = enode(cmd, shell=shell)
assert not response, 'Cannot remove virtual... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,\n nexus_ports, nexus_ssh_port):\n with self.nxos_connect(nexus_host, int(nexus_ssh_port), nexus_user,\n nexus_password) as man:\n self.disable_vlan(man, vlan_id)\n fo... | [
"0.6484663",
"0.6314779",
"0.628301",
"0.6230465",
"0.61447746",
"0.6114118",
"0.61089385",
"0.60771424",
"0.60668516",
"0.59919214",
"0.5953649",
"0.59414446",
"0.5767606",
"0.5736696",
"0.5734514",
"0.57263327",
"0.5721086",
"0.5714259",
"0.5618483",
"0.559609",
"0.55326724... | 0.7438986 | 0 |
Computes the correlation time of system at parameter values beta and D. | def tau_sys(self, beta, D, **trajectory_info):
self._set_beta_D(beta,D)
np.random.seed(42)
t2,Y2=self.GenerateTrajectory(**trajectory_info)
dt = t2[1]-t2[0]
tau=CorrelationTime(Y2[0,:],dt=dt)
self.tau = tau
print('beta='+str(self.beta)+', D='+str(self.D))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(init_par, alpha, delta, obs, sigma_obs, ccoef, N):\n\n\n\t## Initial parameters\n\n\tparallax, v, sigma_v = init_par[:-4], init_par[-4:-1], init_par[-1] \n\tplx_obs, mualpha_obs, mudelta_obs = obs[:, 0], obs[:, 1], obs[:, 2]\n\n\t### Define normal triad and proper motions\n\tp, q, r = normalTriad(alph... | [
"0.6450963",
"0.60753214",
"0.60052633",
"0.59866786",
"0.5806536",
"0.57956445",
"0.5732459",
"0.57285523",
"0.57075334",
"0.5703305",
"0.5692143",
"0.56898487",
"0.5675551",
"0.5638645",
"0.561115",
"0.5575545",
"0.5565605",
"0.5565605",
"0.55422175",
"0.55119026",
"0.54198... | 0.664189 | 0 |
Generates a trajectory of the SDE model. | def draw_trajectory_SDEsys(Oscillatior_Parametrs, q0 = np.array([.1,.1]), T = 10000, dt = 0.1):
N=int(T*1000) # number of time steps
n_samp = np.amax([int(dt/(T/N)),1]) # sampling interval (cannot be smaller than time step)
k,beta,D = Oscillatior_Parametrs['k'],Oscillatior_Parametrs['beta'],Oscillati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_trajectory(self, coeff_S, coeff_D):\n # Create trajectory\n trajectory = Trajectory(self.deltaT, self.dt, self.t_steps)\n coeff = np.array([coeff_S, coeff_D]).T\n p_array = self.helper_p.dot(coeff)\n v_array = self.helper_v.dot(coeff)\n a_array = self.helper_a.dot... | [
"0.6383673",
"0.6316274",
"0.6308561",
"0.6220945",
"0.6167923",
"0.6160945",
"0.61083585",
"0.6058636",
"0.6027574",
"0.600039",
"0.5929237",
"0.58956563",
"0.58761775",
"0.5875327",
"0.57948756",
"0.57933164",
"0.57655734",
"0.5761365",
"0.574805",
"0.5741351",
"0.57386273"... | 0.7075424 | 0 |
Computes the correlation time of time series in y. | def CorrelationTime(y,dt=1):
ac=np.correlate(y,y,'same')
Index_m= int( (len(y)-1) / 2) # index of middle point (lag=0)
Slab=ac[Index_m:] # take the right half
ID_zero= np.argmax(Slab<0)-1 # first crossing with zero
n_corr = np.sum(Slab[:ID_zero])/Slab[0]
tau_corr=n_corr*dt
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cor(x, y):\n scaler = TimeSeriesScalerMeanVariance()\n x_norm = scaler.fit_transform(x)\n y_norm = scaler.fit_transform(y)\n pcc = np.mean(x_norm * y_norm) # Pearson correlation coefficients\n d = np.sqrt(2.0 * (1.0 - pcc + 1e-9)) # correlation-based similarities\n return np.sum(d)",
"def... | [
"0.7457199",
"0.69495153",
"0.6769867",
"0.6657957",
"0.6645585",
"0.66108537",
"0.6582758",
"0.65364456",
"0.6530159",
"0.6481932",
"0.644786",
"0.6440823",
"0.6396841",
"0.6361775",
"0.63409793",
"0.63160515",
"0.6289233",
"0.62501967",
"0.6241746",
"0.6218509",
"0.6111374"... | 0.73033375 | 1 |
Solves f(p)=0 with p in [a,b] using bisection method. The coding is optimized so that f is computed the minimal number of required times. | def bisection(f,a,b,tol=1e-4,Max_trial=14):
pvalues = np.zeros(Max_trial+3)
fvalues = np.zeros(Max_trial+3)
fa,fb = f(a),f(b)
pvalues[0],pvalues[1]=a,b
fvalues[0],fvalues[1]=fa,fb
if fa*fb>0:
print('f(a)*f(b)>0 ---> specified a and b do not work!')
print('spiting out a or b --- ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BisectionMethod(f, a=0, b=1, tol=1e-10):\n\tstart = time()\n\tf_a = f(a)\n\tf_b = f(b)\n\t\n\t# Initialization of errors and iters\n\terrs = []\n\ti = 0\n\n\tif f_a == 0:\n\t\treturn a\n\telif f_b == 0:\n\t\treturn b\n\telif f_a*f_b > 0:\n\t\tprint(\"The function values have the same sign!\")\n\telse:\n\t\terr... | [
"0.77137166",
"0.7380954",
"0.72045314",
"0.6970468",
"0.69083655",
"0.68599665",
"0.67694885",
"0.66439545",
"0.66375536",
"0.6554857",
"0.6536367",
"0.6527826",
"0.651622",
"0.648337",
"0.64377046",
"0.63371414",
"0.6277171",
"0.6276628",
"0.6196315",
"0.61958337",
"0.61872... | 0.7562944 | 1 |
Transform class of x from G to 1, I to 2 and everything else to 0 | def class_uc(x):
if Class(x) == "G" :
return 1
else :
if Class(x) == "I" :
return 2
else :
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify(self, x):\n return np.sign(np.dot(self.w, x))",
"def ig(X, y):\n\n # binarization: from counts to presence/abscence\n binarize(X, threshold=0.0, copy=False)\n\n # una columna por cada clase\n Y = LabelBinarizer().fit_transform(y)\n if Y.shape[1] == 1: # binary problem case\n ... | [
"0.6103739",
"0.5879875",
"0.57993317",
"0.57237995",
"0.563698",
"0.56368214",
"0.5599283",
"0.5585794",
"0.5585794",
"0.5572997",
"0.5564642",
"0.5534197",
"0.55257016",
"0.5515699",
"0.5509411",
"0.5454752",
"0.54500437",
"0.54141766",
"0.54020035",
"0.5388392",
"0.538554"... | 0.6639189 | 0 |
Returns all scale 3 components of p, i.e. all metamers of p | def metamer(p):
return Components(p, Scale=3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale3(a,c):\n return [a[0]*c,a[1]*c,a[2]*c,1.0]",
"def get_scale(self):\r\n try: return self.scale[0], self.scale[1], self.scale[2]\r\n except: return self.scale, self.scale, self.scale",
"def scale3d(p, a=1, b=1, c=1):\n translation_mat = np.matrix([\n [a,0,0,0],\n [0,b,... | [
"0.62360466",
"0.5766099",
"0.5687478",
"0.5615533",
"0.56125265",
"0.5590034",
"0.5577647",
"0.55237645",
"0.55047154",
"0.54779184",
"0.5469857",
"0.53684175",
"0.5364907",
"0.5339221",
"0.5331674",
"0.53255",
"0.5285435",
"0.52743274",
"0.5268442",
"0.5255932",
"0.5205827"... | 0.6996138 | 0 |
Return the number of leafy shoots of category `cat` of a FU Note that bourse counts as 1 small leafy shoot | def nb_leafy_rameau_cat(x, cat):
nb = 0
for y in Sons(x):
if Class(y) == 'I':
if cat == 'small':
nb +=1
try:
if type_uc(Sons(y)[0]) == cat:
nb +=1
except IndexError:
continue
elif type_uc(y) == cat:
nb += 1
return nb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length_rameau_cat(x, cat):\r\n length = 0\r\n for y in Sons(x):\r\n if Class(y) == 'I':\r\n if cat == 'small':\r\n length += length_uc(y)\r\n try:\r\n if type_uc(Sons(y)[0]) == cat:\r\n length += length_uc(Sons(y)[0])\r\n except IndexError:\r\n continue\r\n ... | [
"0.6800462",
"0.65692306",
"0.6439141",
"0.62321204",
"0.5912179",
"0.5876912",
"0.5823472",
"0.56861097",
"0.5664567",
"0.5563709",
"0.5563679",
"0.5529792",
"0.5474058",
"0.53442824",
"0.5328667",
"0.5300091",
"0.52954537",
"0.52947867",
"0.528822",
"0.52762944",
"0.5270911... | 0.74298024 | 0 |
Return the number of fruits on a GU | def fruit_nb(x):
return len([y for y in metamer(x) if Feature(y, 'fruit')]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(item):\n return len(item)",
"def count():",
"def get_marble_count(self):",
"def totalFruit(self, tree):\n s = e = 0\n ans = -1\n baskets = set()\n baskets.add(tree[s])\n while e < len(tree):\n # keep adding fruit into basket.\n if tree[e] in... | [
"0.603463",
"0.5962676",
"0.5943187",
"0.59032106",
"0.587587",
"0.587587",
"0.58737785",
"0.58716047",
"0.5865172",
"0.586076",
"0.58106786",
"0.58106786",
"0.58106786",
"0.58106786",
"0.58006024",
"0.5773184",
"0.5746064",
"0.57419235",
"0.57399184",
"0.5720534",
"0.5689878... | 0.70216835 | 0 |
Return the cumulated length of all leafy shoots of category `cat` of a FU | def length_rameau_cat(x, cat):
length = 0
for y in Sons(x):
if Class(y) == 'I':
if cat == 'small':
length += length_uc(y)
try:
if type_uc(Sons(y)[0]) == cat:
length += length_uc(Sons(y)[0])
except IndexError:
continue
elif type_uc(y) == cat:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nb_leafy_rameau_cat(x, cat):\r\n nb = 0\r\n for y in Sons(x):\r\n if Class(y) == 'I':\r\n if cat == 'small':\r\n nb +=1\r\n try:\r\n if type_uc(Sons(y)[0]) == cat:\r\n nb +=1\r\n except IndexError:\r\n continue\r\n elif type_uc(y) == cat:\r\n nb += 1\r\... | [
"0.60636556",
"0.5749279",
"0.5712689",
"0.560333",
"0.5424308",
"0.5417537",
"0.5381562",
"0.53583723",
"0.5339486",
"0.5333443",
"0.53279895",
"0.5302515",
"0.52835095",
"0.52726984",
"0.5259692",
"0.5225831",
"0.52120453",
"0.5203069",
"0.5171853",
"0.5168547",
"0.5158164"... | 0.69088125 | 0 |
Return the cumulated volume of all leafy shoots of category `cat` of a FU | def vol_rameau_cat(x, cat):
vol = 0
for y in Sons(x):
if Class(y) == 'I':
if cat == 'small':
vol += vol_uc(y)
try:
if type_uc(Sons(y)[0]) == cat:
vol += vol_uc(Sons(y)[0])
except IndexError:
continue
elif type_uc(y) == cat:
vol += vol_uc(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_volume(hull):\n origin = hull[0][0]\n volume = 0.0\n for face in hull:\n logvolume = signed_volume(form_face(face, origin))[1]\n volume += numpy.exp(logvolume)\n # n-dimensional simplex = det / n!\n volume /= scipy.special.factorial(len(origin))\n\n return volume",
"... | [
"0.6061716",
"0.5996998",
"0.5505544",
"0.5394679",
"0.53825706",
"0.531452",
"0.5284611",
"0.5190847",
"0.51737356",
"0.51623875",
"0.51591456",
"0.515566",
"0.51388884",
"0.51060575",
"0.5096787",
"0.5092251",
"0.5049299",
"0.50208956",
"0.5007778",
"0.50058144",
"0.5002256... | 0.624945 | 0 |
Compute a bounding volume for the given `scene`. The `shape` of this volume can be one of these keyword Note that the `pgl.fit` could deliver different shapes by using | def computeBoundingShape(scene, shape='ellipsoid'):
gr= pgl.Group([ sh.geometry for sh in scene ])
tglset = pgl.fit( shape, gr )
#hull = pgl.Shape( tglSet, __Green )
return tglset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingVolume( self, mode ):\n bb = None\n for attrib in self.attributes:\n if attrib.isCoord:\n bv = attrib.boundingVolume( mode )\n if bv and bb:\n bb = boundingvolume.AABoundingBox.union( (bb,bv))\n elif bv:\n ... | [
"0.6002687",
"0.5800201",
"0.5710754",
"0.56306005",
"0.5441446",
"0.5433985",
"0.54107326",
"0.53259814",
"0.53259814",
"0.5253756",
"0.52361286",
"0.51766735",
"0.51478946",
"0.5116203",
"0.5098762",
"0.50981367",
"0.50890654",
"0.50860125",
"0.5046421",
"0.49935907",
"0.49... | 0.7218005 | 0 |
Function to extract the center, radii and rotations of a given ellipse A bounding ellipse is generated as a Translated(Rotated(Scaled(Sphere))) Hence the ellipse center is given by the translation and its radii by the scaling | def ellipseDesc(lps):
unit = 100 #units in QualiTree are in [mm], hence Pgl is in [dm] ?
if isinstance(lps, pgl.Translated):
cx, cy, cz = lps.translation
else:
print"missing Translated from the bounding ellipse as a Translated(Rotated(Scaled(Sphere)))"
ori = lps.geometry
if isinstance(ori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ellipsoid(center, radii, rotation, scales=None, shape=None, minarea=0):\n center = np.array(center)\n radii = np.array(radii)\n rotation = np.array(rotation)\n assert center.shape == (3,)\n assert radii.shape == (3,)\n assert 0 < radii.max(), \"radii should contain at least one positive value... | [
"0.67717135",
"0.64454716",
"0.64443475",
"0.6270962",
"0.6269833",
"0.62664694",
"0.62569326",
"0.622506",
"0.61824405",
"0.61344934",
"0.6134186",
"0.6131986",
"0.6122533",
"0.61142945",
"0.606742",
"0.6014351",
"0.60076195",
"0.59815663",
"0.59571457",
"0.5934738",
"0.5916... | 0.68975204 | 0 |
Renders `data` into serialized XML without the root tag | def render(self, data, accepted_media_type=None, renderer_context=None):
if data is None:
return ''
stream = StringIO()
xml = SimplerXMLGenerator(stream, self.charset)
xml.startDocument()
#xml.startElement("root", {})
self._to_xml(xml, data)
#xml.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self, data):\n return []",
"def display_xml(data: XMLLike) -> str:\n\n xmlstring = etree.tostring(data, encoding='unicode', pretty_print=True)\n return highlight(xmlstring, XmlLexer(), HtmlFormatter(noclasses=True, nobackground=False))",
"def render(self, data):\n logging.info(\"re... | [
"0.6865926",
"0.6676916",
"0.6581637",
"0.65684086",
"0.63993984",
"0.6223833",
"0.6175116",
"0.6162547",
"0.60683304",
"0.5986692",
"0.59786385",
"0.5943022",
"0.5939354",
"0.593482",
"0.5880321",
"0.5830282",
"0.5788277",
"0.578177",
"0.5687456",
"0.56774884",
"0.56621134",... | 0.76185143 | 0 |
The run method is called when the thread starts. It begins by adding a local connection to the database to enable us to lookup user data. Then we create our input queue that all information is passed into so we can prioritise messages. Then we run our main queue loop to process data we recieve in the queue. | def run(self):
message = 'user thread {0} started'.format(self.ident)
logger.queue.put({'type':'notice', 'source':'user', 'message':message})
stack.add('users',self.ident)
# Run our main loop to process messages in the message queue
while self.more:
# Check if there is a packet to process
try:
data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\n self.make_connection()\n self.channel()\n self.declare_queue()\n self.publish_message()\n self.close_connection()",
"def run(self):\n self.initialize()\n\n self.engine = setup_db_connection(driver=\"Fake\")\n self.logger = multiprocessing... | [
"0.67482",
"0.6623152",
"0.65279245",
"0.64640653",
"0.6452481",
"0.63861",
"0.6311445",
"0.6307035",
"0.63028646",
"0.6272854",
"0.62723935",
"0.62576145",
"0.6230662",
"0.61832327",
"0.6179516",
"0.6091784",
"0.60804486",
"0.6077471",
"0.60714966",
"0.60526776",
"0.60311764... | 0.71380746 | 0 |
Create the logs directories under mip_convert_config_dir/log/stream_component/date/ and move logs to them. | def manage_logs(stream, component, mip_convert_config_dir,
cylc_task_cycle_point):
logger = logging.getLogger(__name__)
setup_logger(logger)
logger.info('Managing logs')
# suffix is a variable used in the suite.rc that is a useful shorthand.
suffix = '_'.join([stream, component])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createLogFolders():\n os.chdir(\"ARCHIVES\")\n logFolder = datetime.datetime.now().strftime(\"ARCHIVE_%d_%b_%Y_%H_%M_%S_0\")\n while logFolder in os.listdir():\n split = logFolder.split('_')\n curIndex = int(split[7])\n nextIndex = curIndex + 1\n split[7] = str(nextIndex)\n... | [
"0.7142198",
"0.69973445",
"0.68759114",
"0.67811304",
"0.6395429",
"0.6394472",
"0.638535",
"0.62457335",
"0.6188346",
"0.611065",
"0.60340196",
"0.5988813",
"0.5983094",
"0.5960695",
"0.5948846",
"0.592399",
"0.5917114",
"0.5900699",
"0.5884165",
"0.5877015",
"0.58731735",
... | 0.78791636 | 0 |
Run MIP Convert, or perform dummy_run if specified, and update logs. | def run_mip_convert(stream, dummy_run, timestamp):
mip_convert_log = 'mip_convert.{}.log'.format(timestamp)
mip_convert_cfg = 'mip_convert.{}.cfg'.format(timestamp)
logger = logging.getLogger(__name__)
setup_logger(logger)
logger.info('Running mip_convert')
logger.info('Working directory: {}'.fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_preprocessing(run):\n def _process(run):\n \"\"\" Process a run/flowcell and transfer to analysis server\n :param taca.illumina.Run run: Run to be processed and transferred\n \"\"\"\n logger.info('Checking run {}'.format(run.id))\n t_file = os.path.join(CONFIG['ana... | [
"0.5979962",
"0.5464819",
"0.5402695",
"0.5322873",
"0.5317628",
"0.52965766",
"0.52871436",
"0.5262205",
"0.5225495",
"0.5218592",
"0.51931584",
"0.51817065",
"0.5106672",
"0.50729877",
"0.50657284",
"0.5061157",
"0.5054993",
"0.5054034",
"0.5051439",
"0.5051439",
"0.5041565... | 0.64011115 | 0 |
Identify critical issues logged by MIP Convert and copy them to a central log file so that users can keep an eye on them. | def manage_critical_issues(exit_code, mip_convert_config_dir, timestamp,
fields_to_log=None):
if fields_to_log is None:
fields_to_log = []
logger = logging.getLogger(__name__)
critical_issues_file = os.path.join(mip_convert_config_dir, 'log',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _consolidate_mp_logs(self):\n for i, fn in enumerate(self.logfiles):\n with open(fn) as f:\n logger.info(\"Log from thread {0}:\\n{1}\".format(i, f.read()))\n open(fn, \"w\").write(\"\")",
"def _log_crash_report():\n # For each crash report we find, dump its con... | [
"0.61974126",
"0.59265107",
"0.5479486",
"0.54643214",
"0.54071766",
"0.5354113",
"0.53280216",
"0.53156984",
"0.5268601",
"0.52090245",
"0.51972324",
"0.5165489",
"0.5160985",
"0.5148661",
"0.5148661",
"0.5148661",
"0.5148661",
"0.5148661",
"0.5148661",
"0.5148661",
"0.51486... | 0.69056875 | 0 |
Prune unused images (i.e. dangling images with no tag) and all containers. | def prune():
if not gce_instance_id():
log.warning('Not cleaning up docker on non-gce machines to prevent '
'deleting containers in dev')
return
dkr = docker.from_env()
dkr.api.prune_containers()
dkr.api.prune_images()
check_disk_usage() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup():\n cmd='docker rmi --force $(docker images -a -q)'\n bash_command(\"Deleting all images\", cmd)",
"def clean(all):\n docker_clean(all)",
"def clean(self):\n tags = self.get_tags()\n for tag in tags:\n image_name = self.build_image_name(tag)\n try:\n ... | [
"0.66839886",
"0.6371305",
"0.6359191",
"0.6352857",
"0.62534636",
"0.62261295",
"0.6086414",
"0.59989613",
"0.596821",
"0.59156376",
"0.5866961",
"0.5836334",
"0.5826403",
"0.5813093",
"0.57792795",
"0.5776669",
"0.5666887",
"0.56471634",
"0.5637321",
"0.5602819",
"0.5533891... | 0.77409863 | 0 |
Saves the updated setting Checks email alert | def save_setting(self):
if self.is_checked.get():
if "Email" not in s.alert:
s.updateAlert("Email")
s.updateEmail(self.email_addr_entry.get())
if not self.is_checked.get():
if "Email" in s.alert:
s.deleteAlert("Email")
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_update(self):\n\t\tfor email_account in frappe.get_all(\"Email Account\", filters={\"domain\": self.name}):\n\t\t\ttry:\n\t\t\t\temail_account = frappe.get_doc(\"Email Account\", email_account.name)\n\t\t\t\tfor attr in [\"email_server\", \"use_imap\", \"use_ssl\", \"use_tls\", \"attachment_limit\", \"smtp_... | [
"0.6566364",
"0.6120561",
"0.6112843",
"0.605319",
"0.5978082",
"0.5966335",
"0.5959676",
"0.59425175",
"0.5877219",
"0.5839659",
"0.57857645",
"0.5783967",
"0.5756592",
"0.5728181",
"0.568164",
"0.5585023",
"0.55828524",
"0.5561281",
"0.55489135",
"0.5514387",
"0.551357",
... | 0.7375022 | 0 |
Obtains stock info from appropriate scrapers Threads run this method | def scraper_data(self):
self.lock.acquire()
for item in s.item:
item_name = item.get("item")
item_url = item.get("url")
item_stock, item_cost = self.scraper.ChooseScraper(item_url)
s.updateStatus(item_name, item_url, item_stock, item_cost)
time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrap_ticker(self, ticker: str, stock_list: None):\n logging.info(f'Scrap for Ticker {ticker}')\n print(ticker)\n r = requests.Response()\n\n self.main_dict['Ticker'] = ticker\n if stock_list is not None:\n self.main_dict['Description'] = stock_list[ticker]\n\n ... | [
"0.6621699",
"0.6522943",
"0.6504662",
"0.62345093",
"0.6087702",
"0.6042084",
"0.59272504",
"0.5924634",
"0.5901286",
"0.5900362",
"0.58965886",
"0.5881519",
"0.58801454",
"0.58680236",
"0.58361685",
"0.57625",
"0.57431984",
"0.5709774",
"0.5630213",
"0.56067693",
"0.5592753... | 0.70852846 | 0 |
Updates the items in the GUI with the stock information | def update_stock_info(self, entry, item_name, item_url, item_stock, item_cost):
self.items_list.delete(entry)
self.items_list.insert(
"", "end", values=(item_name, item_url, item_stock, item_cost)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stockButtonClicked(self):\n # Clear text edit box and get the stock symbol from combobox.\n self.central.text3.clear()\n stocksymbol = self.central.combobox.currentText()\n\n URL = 'https://finance.yahoo.com/quote/{0}/profile?p={0}'.format(stocksymbol)\n\n # Safely get the we... | [
"0.68995094",
"0.6629644",
"0.65514445",
"0.64773697",
"0.62755656",
"0.62225133",
"0.62137085",
"0.61793387",
"0.6171211",
"0.6115127",
"0.6113896",
"0.6039025",
"0.6034866",
"0.60253996",
"0.5991553",
"0.5967654",
"0.59623796",
"0.59618515",
"0.5942495",
"0.5935877",
"0.592... | 0.6700298 | 1 |
This function is used in an entry object, to verify that the input is a number. To use it, specify this function as the "validatecommand" option when creating a tkinter entry object. | def __verify_numeric(self, action, value):
if action != "1": # if the action is anything other than inserting:
return True
try:
return value.isnumeric()
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_number(self, text, widget):\n if len(text) > 2:\n return False\n for char in text:\n if not char.isdigit():\n return False\n if text != '' and int(text) == 0:\n return False\n return True",
"def validate_number(input_data):\... | [
"0.67381525",
"0.6544873",
"0.6451688",
"0.6349024",
"0.63471055",
"0.6331389",
"0.6267259",
"0.6267259",
"0.6249672",
"0.62450457",
"0.62344444",
"0.6220084",
"0.6203595",
"0.61967504",
"0.61740226",
"0.6169016",
"0.6165394",
"0.61192846",
"0.61183715",
"0.61111295",
"0.6082... | 0.6596218 | 1 |
Edits the currently selected item. To do this, it creates a popup to gather the new item information. | def edit_item(self):
for item in self.selection():
origin_name = self.set(item)["1"]
origin_url = self.set(item)["2"]
popup = GetItemURLDialogue(self, "Edit Item", origin_name, origin_url)
self.item(item, values=(popup.name, popup.url, self.set(item)["3"]))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_item(self) -> None:\n item = self.get_selected_item(self.tree_cache)\n if item is None:\n return\n\n text, ok = QInputDialog.getText(self, \"Edit data\", \"Data:\", text=item.data().get_value())\n if ok:\n item.setText(text)\n item.data().set_va... | [
"0.70596254",
"0.6997861",
"0.6607622",
"0.6488002",
"0.6458834",
"0.6389157",
"0.6373148",
"0.6365289",
"0.62859267",
"0.6276543",
"0.6250807",
"0.6247635",
"0.62370795",
"0.61288255",
"0.6077622",
"0.60508996",
"0.6041547",
"0.6040688",
"0.5983822",
"0.5972946",
"0.5932272"... | 0.7210286 | 0 |
Adds a new item to the list. It launches a popup to gather the name and url for the item from the user. | def add_item_popup(self):
popup = GetItemURLDialogue(self, "Add Item", "", "")
if not popup.cancelled:
self.add_item(popup.name, popup.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(self, name, url):\n self.insert(\"\", \"end\", values=(name, url, \"\"))\n # Add the item - backend\n s.updateItem({\"item\": name, \"url\": url, \"status\": \"\", \"pstatus\": \"\"})\n\n self.selection_clear()",
"def add_new_item():\n\n lst = item_list()\n return r... | [
"0.733852",
"0.6673442",
"0.6524548",
"0.64480895",
"0.6424925",
"0.6369128",
"0.63386375",
"0.63274497",
"0.6316575",
"0.63072187",
"0.6293732",
"0.6254343",
"0.61626005",
"0.615947",
"0.61554116",
"0.6120298",
"0.6108947",
"0.6108041",
"0.60726154",
"0.6043358",
"0.6027765"... | 0.8136465 | 0 |
Alerts the user that a particular product is back in stock by launching a popup and, if the email setting is active, sending an email. | def alert(self, name, url):
email = ""
if app.is_checked.get():
email = app.email_addr_entry.get()
SendEmail.sendEmail(email, name, url)
# tempWin = tk.Tk() # Temporary, invisible window to use as a popup's root
# # This way the root will always... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_new_products(self):\n \n init() # Initiates colorama\n print(f'\\n{Fore.BLUE + Style.BRIGHT}STARTING WEBSCRAPER!{Style.RESET_ALL} Time: {self.get_current_time()}\\n')\n\n initial_products_prices = self.get_all_products(verbose=False, print_time=False)\n send_email_flag... | [
"0.6203177",
"0.6201374",
"0.61802095",
"0.60202056",
"0.5964982",
"0.5954556",
"0.5920288",
"0.58098614",
"0.5747291",
"0.5714624",
"0.56922466",
"0.56889105",
"0.56790835",
"0.563211",
"0.5623485",
"0.5608038",
"0.55104584",
"0.54982895",
"0.54143083",
"0.5396509",
"0.53690... | 0.73854125 | 0 |
Minimize the application to system tray if the the setting is enabled If the setting is not enabled the application will close Save the state of the settings to the tracker.txt when closing | def on_closing():
if not app.is_minimize_to_system_tray.get():
app.save_setting()
app.destroy()
else:
app.withdraw()
plus_image = os.path.join("data", "plus.gif")
image = Image.open(plus_image)
menus = menu(item("Quit", quit_window), item("Show", show_window, defa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_minimize_to_tray(self):\r\n\t\tself.statusicon = gtk.StatusIcon()\r\n\t\ticon_path = os.path.realpath(\".\" + \"\\\\icon.png\")\r\n\t\tself.statusicon = load_status_icon(icon_path, 128, 128, gtk.STOCK_GOTO_TOP)\r\n\t\tself.statusicon.set_tooltip(\"Claimtracker\")\r\n\t\tself.statusicon.connect(\"activate\"... | [
"0.67197084",
"0.65202695",
"0.63644385",
"0.6257896",
"0.62190324",
"0.62018317",
"0.61887985",
"0.6160866",
"0.614092",
"0.6023134",
"0.60119027",
"0.6007562",
"0.598718",
"0.5877087",
"0.5856366",
"0.58479923",
"0.584332",
"0.58082175",
"0.5776681",
"0.57318664",
"0.570280... | 0.70247614 | 0 |
create a dbc.Card object with title and content | def create_card(cls, card_title, card_content, content_id, css_class="card-text"):
card = dbc.Card(
dbc.CardBody(
[
html.H5(card_title, className="card-title"),
html.P(card_content, className=css_class, id=content_id),
],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createCard(self,id,name):\n card = Card(id,name)\n self.cards[id] = card\n print('Created Card:'+id)",
"def set_card_simple(self, title, content):\n self.response.card.type = 'Simple'\n self.response.card.title = title\n self.response.card.content = content",
"def ... | [
"0.69926614",
"0.6876433",
"0.65182257",
"0.65182257",
"0.64862865",
"0.6362564",
"0.6356984",
"0.63509905",
"0.6286245",
"0.6239128",
"0.6211841",
"0.6206039",
"0.620144",
"0.61875916",
"0.6133676",
"0.61331946",
"0.61211944",
"0.6120123",
"0.6117449",
"0.6107",
"0.60607284"... | 0.8081158 | 0 |
Traverses the basefolder and its subfolders for stat files produced by the changedetection.net framework, and presents these stat files in a number of overview files | def statAggregator(baseFolder):
allStats, overviewStats = getStatsFromSubfolder(baseFolder)
pickle.dump(allStats, open('allStats.p', 'wb'))
pickle.dump(overviewStats, open('overviewStats.p', 'wb'))
allStats = pickle.load(open('allStats.p', 'rb'))
overviewStats = pickle.load(open('overviewStats.p'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test2_basic_info(self):\n\t\tprint \"\\nTEST 2: Extracting basic info from each ontology in %s folder.\\n=================\" % DATA_FOLDER\n\n\t\tfor f in os.listdir(DATA_FOLDER):\n\t\t\tif not f.startswith('.'):\n\t\t\t\tprint \"Loading... >\", f\n\t\t\t\t\n\t\t\t\t# divert output to a file temporarily \n\t\t... | [
"0.60667306",
"0.6008489",
"0.5977371",
"0.5976685",
"0.59453046",
"0.59302753",
"0.588248",
"0.5852355",
"0.5828777",
"0.5827584",
"0.57823205",
"0.5649574",
"0.5647123",
"0.56452376",
"0.563639",
"0.5592892",
"0.5577325",
"0.55665946",
"0.55374277",
"0.55284184",
"0.5519748... | 0.6850961 | 0 |
Writes overview tables of the aggregated statistics in .csvformat. | def writeStatTables(allStats, overviewStats):
# Create all stats
statFileHandlers = {}
statFiles = {}
measures = ['recall', 'specificity', 'FPR', 'FNR', 'PBC', 'precision', 'f-measure']
for measure in measures:
statFileHandlers[measure] = open(measure + '-all.csv', 'w', newline='')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_stats(self):\n with open(self.log_file,'a') as output:\n writer = csv.writer(output)\n n_comps,comp_size = self.connected_component() # Calculate number of connected components (sub-colonies)\n writer.writerow([self.pop_size,\n self.get_average_ag... | [
"0.658212",
"0.64379287",
"0.63192654",
"0.62861633",
"0.6234221",
"0.6192399",
"0.6176169",
"0.61721104",
"0.61708367",
"0.61533993",
"0.6146898",
"0.6120467",
"0.61068803",
"0.6047894",
"0.6026266",
"0.601434",
"0.5996645",
"0.59924006",
"0.59832937",
"0.59652615",
"0.59614... | 0.72709906 | 0 |
Rotate axis labels by anble in degree | def rotate_lables_for_xaxis(self, axes, angle=50, alignment='center') : # 'right'
for label in axes.get_xticklabels() :
label.set_rotation(angle)
label.set_horizontalalignment(alignment) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_ticks(ax, angle):\n ts = ax.xaxis.get_major_ticks()\n for t in ts:\n t.label.set_rotation(angle)",
"def _datex_rotate(self):\n # NOTE: Rotation is done *before* horizontal/vertical alignment,\n # cannot change alignment with set_tick_params. Must apply to text\n # obj... | [
"0.72918075",
"0.7058158",
"0.69465065",
"0.6819661",
"0.64033556",
"0.6271656",
"0.62452817",
"0.6142684",
"0.6117312",
"0.60617924",
"0.5984393",
"0.59606177",
"0.5951896",
"0.5921874",
"0.589313",
"0.58639824",
"0.58336216",
"0.580835",
"0.57818866",
"0.57794183",
"0.57056... | 0.7978649 | 0 |
Filter packs from list which are below the pack size threshold. | def filter_packs(self, packs):
return [
pack for pack in packs
if len(pack) < self.model.pack_size_threshold
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_func_pack(self, packs):\n return [pack for pack in packs if len(pack.wolves) < self.min_pack]",
"def _filter_boxes(boxes, min_size):\n ws = boxes[:, 2] - boxes[:, 0] + 1\n hs = boxes[:, 3] - boxes[:, 1] + 1\n keep = np.where((ws >= min_size) & (hs >= min_size))[0]\n ... | [
"0.7499574",
"0.63235843",
"0.6320264",
"0.6307798",
"0.6307798",
"0.6241925",
"0.61801726",
"0.5940633",
"0.59103423",
"0.58080775",
"0.5756219",
"0.5713874",
"0.57127136",
"0.5697896",
"0.56815964",
"0.5679822",
"0.56571597",
"0.561008",
"0.5539507",
"0.5537312",
"0.5480646... | 0.8420422 | 0 |
Filter the list of packs. | def filter_func_pack(self, packs):
return [pack for pack in packs if len(pack.wolves) < self.min_pack] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_packs(self, packs):\n return [\n pack for pack in packs\n if len(pack) < self.model.pack_size_threshold\n ]",
"def get_filtered_pack(self):\n return self.list_pack",
"def filter(self, filters):",
"def _filter_pkgs(self, pkgs):\n pkgs = [pkg.strip()... | [
"0.77188456",
"0.73507464",
"0.62560284",
"0.5924296",
"0.5895366",
"0.5852901",
"0.57433677",
"0.5706939",
"0.56965977",
"0.56784576",
"0.56051356",
"0.5565651",
"0.55628145",
"0.54909927",
"0.5461588",
"0.54507077",
"0.5392766",
"0.5392108",
"0.5385494",
"0.53753936",
"0.53... | 0.7364086 | 1 |
Filter the list of wolves. | def filter_wolves(self, agents):
return [
agent for agent in agents
if agent.energy < self.model.energy_threshold and not agent.pack
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_waters(self):\n fpred = lambda f: f.is_water()\n return itertools.ifilter(fpred, self.iter_fragments())",
"def filter(self, filters):",
"def filter_func(self, agents):\n return [\n agent for agent in agents\n if agent.energy < self.model.energy_threshold and ... | [
"0.662778",
"0.6306272",
"0.5935287",
"0.5901699",
"0.5810601",
"0.5793218",
"0.5764164",
"0.57175106",
"0.55772",
"0.55761755",
"0.5569863",
"0.5569813",
"0.55566543",
"0.55353147",
"0.54880154",
"0.5439177",
"0.53936195",
"0.53468883",
"0.5327611",
"0.53016603",
"0.52841705... | 0.7068028 | 0 |
Find a wolf in the neighborhood. | def find_wolf_for_pack(self):
agent = self.move_towards_specified_kind(
Wolf, self.model.wolf_territorium, self.filter_wolves
)
if (agent):
logging.debug("Next wolf found is: {}".format(agent))
logging.debug("Pack size is now {}".format(len(self.wolves)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_wj(self, L_wi, U_wi, L_wj, U_wj, L_overlap, U_overlap):\n # these conditions determine whether there is any solution\n exists_feasible_region = (L_wi <= U_wi) and \\\n (L_wj <= U_wj) and \\\n (L_overlap <= U_wi + U_wj) and \\\n ... | [
"0.5961115",
"0.5756821",
"0.57124805",
"0.5697521",
"0.5577704",
"0.5575601",
"0.5570224",
"0.5565936",
"0.5565936",
"0.5565936",
"0.5565936",
"0.5565936",
"0.5565936",
"0.5565936",
"0.5565936",
"0.55591846",
"0.5551218",
"0.5549329",
"0.5523068",
"0.5506629",
"0.55052274",
... | 0.6382744 | 0 |
Find a pack in the neighborhood. | def find_pack_for_pack(self):
pack = self.move_towards_specified_kind(
Pack, self.model.wolf_territorium, self.filter_func_pack
)
if (pack):
logging.debug("Next pack found is: {}".format(pack))
logging.debug("Pack size is now {}".format(len(self.wolves)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_wolf_for_pack(self):\n agent = self.move_towards_specified_kind(\n Wolf, self.model.wolf_territorium, self.filter_wolves\n )\n if (agent):\n logging.debug(\"Next wolf found is: {}\".format(agent))\n logging.debug(\"Pack size is now {}\".format(len(self... | [
"0.58642834",
"0.5719904",
"0.5612561",
"0.5553045",
"0.547902",
"0.5478615",
"0.5478095",
"0.5478095",
"0.5475985",
"0.54351866",
"0.5367491",
"0.5352002",
"0.5350992",
"0.53503907",
"0.53382605",
"0.5332479",
"0.5321356",
"0.52899444",
"0.52623653",
"0.52591085",
"0.5241782... | 0.6976927 | 0 |
Add a pack to this pack and dissolve the other one. | def add_pack_to_pack(self, pack):
logging.debug("Merging packs")
for wolf in pack.wolves:
self.add_wolf_to_pack(wolf)
logging.debug("Pack is now {} wolves".format(len(self.wolves)))
self.model.schedule.remove(pack)
self.model.grid.remove_agent(pack) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_wolf_to_pack(self, wolf):\n logging.debug(\"Adding wolf {} to pack\".format(wolf.unique_id))\n # When a Wolf is part of a pack\n if (not wolf.pack):\n self.model.schedule.remove(wolf)\n self.model.grid.remove_agent(wolf)\n wolf.pack = True\n self.wol... | [
"0.5911773",
"0.55020624",
"0.51406705",
"0.513359",
"0.5037758",
"0.4729559",
"0.47208986",
"0.46786466",
"0.46674705",
"0.46440998",
"0.46430564",
"0.46339893",
"0.4597175",
"0.4590006",
"0.45629215",
"0.45621002",
"0.45598066",
"0.45381516",
"0.45310938",
"0.4517529",
"0.4... | 0.7512161 | 0 |
Add wolf to pack. | def add_wolf_to_pack(self, wolf):
logging.debug("Adding wolf {} to pack".format(wolf.unique_id))
# When a Wolf is part of a pack
if (not wolf.pack):
self.model.schedule.remove(wolf)
self.model.grid.remove_agent(wolf)
wolf.pack = True
self.wolves.append(wol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_wad(self, wad):\n\n self.wads.append(wad)",
"def add_pack_to_pack(self, pack):\n logging.debug(\"Merging packs\")\n for wolf in pack.wolves:\n self.add_wolf_to_pack(wolf)\n logging.debug(\"Pack is now {} wolves\".format(len(self.wolves)))\n self.model.schedul... | [
"0.5279869",
"0.52209187",
"0.5111803",
"0.49970365",
"0.49656025",
"0.496219",
"0.49437404",
"0.4939001",
"0.48862815",
"0.48689324",
"0.48117167",
"0.47810304",
"0.47810304",
"0.47528467",
"0.4749568",
"0.4718925",
"0.47108847",
"0.469926",
"0.46269712",
"0.4626383",
"0.458... | 0.7201018 | 0 |
Remove wolf from this pack. | def remove_from_pack(self, wolf):
logging.debug("Removing Wolf")
logging.debug("Wolf info ID: {}, PACK: {}, POS: {}".format(
wolf.unique_id, wolf.pack, wolf.pos)
)
wolf.pack = False
self.model.schedule.add(wolf)
self.model.grid.place_agent(wolf, self.pos)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip(self):\n result = library.MagickStripImage(self.wand)\n if not result:\n self.raise_exception()",
"def wipe(self) -> None:\n self.mc('rb', '--force', '--dangerous', 'minio')",
"def strip(self):\n types = [type(self.strip),\n type(self.values),\n ... | [
"0.5766765",
"0.5582902",
"0.55202323",
"0.5510025",
"0.5446721",
"0.5374566",
"0.5315423",
"0.5302855",
"0.52620476",
"0.5251639",
"0.5242293",
"0.51999557",
"0.5184455",
"0.5183103",
"0.5180702",
"0.51608586",
"0.5153912",
"0.514978",
"0.51356393",
"0.5125235",
"0.5118049",... | 0.7482923 | 0 |
Chooses elk to eat based on fitted polynomial to the probability curve of elk being killed by wolf based on age | def choose_elk_to_eat(self, elk, number=1):
if len(elk) == 0:
return []
def prob_killedbywolf_byage(age):
param = self.model.elk_wolfkill_params
degree = self.model.polynomial_degree
return max(
0.001, sum([param[i]*age**(degree-i) for i ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elo(old, exp, score, k=10):\n return old + k * (score - exp)",
"def _cost_caught_by_police(self):\n if self.fine_frequency != 0:\n if self.number_of_courses % self.fine_frequency == 0 and self.number_of_courses != 0:\n if self.number_of_courses % self.fine_frequency_paid_b... | [
"0.59541786",
"0.54943967",
"0.5420896",
"0.54067177",
"0.5384416",
"0.53728515",
"0.5372806",
"0.53517735",
"0.5344808",
"0.5254204",
"0.5246802",
"0.5240783",
"0.5231455",
"0.5184606",
"0.5167454",
"0.5147728",
"0.51473135",
"0.5145732",
"0.5132992",
"0.51201665",
"0.510890... | 0.6581845 | 0 |
Pack has eaten. Add kills to wolf, add energy and disband the pack. | def pack_has_eaten(self, elk_to_eat):
# Remove elk
for elk in elk_to_eat:
self.model.grid.remove_agent(elk)
self.model.schedule.remove(elk)
logging.debug('Pack has eated, disbanding pack with size {}'.format(
len(self.wolves))
)
for wolf in sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self):\n logging.debug(\"Wolf pack size {}\".format(len(self.wolves)))\n if (len(self.wolves) < self.min_pack):\n self.find_wolf_for_pack()\n logging.debug(\"Pack size below minimum\")\n else:\n logging.debug(\"Pack up to size. Start searching for Elk.... | [
"0.72325885",
"0.7041433",
"0.6171382",
"0.6159792",
"0.61239666",
"0.5997608",
"0.5989119",
"0.5943309",
"0.58719265",
"0.5867405",
"0.58558273",
"0.582015",
"0.5753596",
"0.5748115",
"0.57319576",
"0.57265645",
"0.5712438",
"0.5692539",
"0.56549174",
"0.5648876",
"0.5624563... | 0.76507896 | 0 |
Test parsing and streaming SearchResponse KNX/IP packet. | def test_search_response(self):
raw = bytes.fromhex(
"06 10 02 02 00 50 08 01 C0 A8 2A 0A 0E 57 36 01"
"02 00 11 00 00 00 11 22 33 44 55 66 E0 00 17 0C"
"01 02 03 04 05 06 47 69 72 61 20 4B 4E 58 2F 49"
"50 2D 52 6F 75 74 65 72 00 00 00 00 00 00 00 00"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_request(self):\n raw = ((0x06, 0x10, 0x02, 0x01, 0x00, 0x0e, 0x08, 0x01,\n 0xe0, 0x00, 0x17, 0x0c, 0x0e, 0x57))\n xknx = XKNX(loop=self.loop)\n knxipframe = KNXIPFrame(xknx)\n knxipframe.from_knx(raw)\n\n self.assertTrue(isinstance(knxipframe.body, ... | [
"0.67152107",
"0.57588136",
"0.57495344",
"0.5713337",
"0.5374161",
"0.5372757",
"0.5369365",
"0.53553665",
"0.5335946",
"0.53332245",
"0.52922785",
"0.52844286",
"0.5277692",
"0.52510244",
"0.5227519",
"0.52199847",
"0.51869494",
"0.51855725",
"0.515875",
"0.51521343",
"0.51... | 0.75380707 | 0 |
Test device_name if no DIBDeviceInformation is present. | def test_unknown_device_name(self):
search_response = SearchResponse()
assert search_response.device_name == "UNKNOWN" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testCheckDeviceName(self):\n device = config.devices[self.driver.desired_capabilities.get(\"deviceName\")][\"name\"]\n print(\"Device : \", device)",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n ... | [
"0.68436",
"0.6676391",
"0.6676391",
"0.65906227",
"0.65906227",
"0.6541282",
"0.64708275",
"0.6308622",
"0.6291499",
"0.6255184",
"0.6225018",
"0.6168583",
"0.6071711",
"0.60398024",
"0.6024621",
"0.59612274",
"0.59126014",
"0.5833782",
"0.58291286",
"0.5824395",
"0.582406",... | 0.6739686 | 1 |
Get the bit score for each hit/domain in a hmmersearch result | def get_model_scores(model_output):
return [hsp.bitscore for query in SearchIO.parse(model_output, "hmmer3-text") \
for hit in query for hsp in hit] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_hits(bh, vc, verbose=False):\n\n hc = {}\n for g in bh:\n hc[g] = {}\n for b in bh[g]:\n hc[g][vc[b]] = hc[g].get(vc[b], 0) + 1\n besthit = None\n bhc = 0\n for h in hc[g]:\n if hc[g][h] > bhc:\n bhc = hc[g][h]\n ... | [
"0.58048856",
"0.5803041",
"0.5781293",
"0.5777022",
"0.5765094",
"0.57200843",
"0.56990397",
"0.56325287",
"0.5586541",
"0.55723137",
"0.5571808",
"0.55708027",
"0.55509686",
"0.5534836",
"0.5514782",
"0.5507723",
"0.5491575",
"0.5489358",
"0.5488816",
"0.54879653",
"0.54867... | 0.69351155 | 0 |
Link to a GitHub user. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. | def ghuser_role(name, rawtext, text, lineno, inliner, options=None, content=None):
if options is None:
options = {}
app = inliner.document.settings.env.app
#info('user link %r' % text)
ref = 'https://www.github.com/' + text
node = nodes.reference(rawtext, text, refuri=ref, **options)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):\r\n app = inliner.document.settings.env.app\r\n #app.info('user link %r' % text)\r\n ref = 'https://www.github.com/' + text\r\n node = nodes.reference(rawtext, text, refuri=ref, **options)\r\n return [node], []",
"def g... | [
"0.6738505",
"0.61809444",
"0.59667224",
"0.5839986",
"0.5543463",
"0.549682",
"0.54410046",
"0.54242647",
"0.5314077",
"0.5314077",
"0.52926105",
"0.5285535",
"0.5243971",
"0.5226282",
"0.52234995",
"0.51820195",
"0.51675993",
"0.5167408",
"0.51506567",
"0.514692",
"0.509189... | 0.655619 | 1 |
ye recommended list bar assasse category va session | def recommended_list(self, request, instance):
if request.user.is_authenticated:
viewed_item = self.filter_by_model(
instance=instance).filter(user=request.user)
elif request.user.is_anonymous:
ip_address = get_client_ip(request)
viewed_item = self.fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCategory():",
"def menu_categories(self, app: object) -> None:\n while True:\n if self.back:\n break\n else:\n self.cmd_categories = app.view_cat()\n rand_cat = random.sample(list(self.cmd_categories), 10)\n print(\"-... | [
"0.6495047",
"0.59907657",
"0.598476",
"0.59513044",
"0.5916058",
"0.56753653",
"0.5662612",
"0.56184113",
"0.5558238",
"0.5502479",
"0.5500625",
"0.54980874",
"0.5482365",
"0.5457043",
"0.54446715",
"0.5410353",
"0.53490674",
"0.53365034",
"0.53147924",
"0.5297652",
"0.52755... | 0.6349757 | 1 |
Reshape a TensorRT output from NCHW to NHWC format (with expected C=255), and then return it in (height,width,3,85) dimensionality after further reshaping. | def _reshape_output(self, output):
output = np.transpose(output, [0, 2, 3, 1])
_, height, width, _ = output.shape
dim1, dim2 = height, width
dim3 = 3
# There are CATEGORY_NUM=80 object categories:
dim4 = (4 + 1 + CATEGORY_NUM)
return np.reshape(output, (dim1, dim2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_nhwc_to_nchw(input_data):\n return np.rollaxis(input_data, -1, -3)",
"def tile_images(images_nhwc: Sequence[np.ndarray]) -> np.ndarray: # pragma: no cover\n img_nhwc = np.asarray(images_nhwc)\n n_images, height, width, n_channels = img_nhwc.shape\n # new_height was named H before\n new_h... | [
"0.66180575",
"0.64627016",
"0.64242035",
"0.6192843",
"0.61564106",
"0.61098236",
"0.60885745",
"0.60472006",
"0.60325956",
"0.6017382",
"0.599883",
"0.59735316",
"0.5948185",
"0.5940901",
"0.59376395",
"0.5885205",
"0.587928",
"0.5854464",
"0.5801186",
"0.5706552",
"0.56588... | 0.6557434 | 1 |
Return the exponential of the input. | def exponential(value):
return math.exp(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp(x):\n raise NotImplementedError",
"def Exp(num):\n return math.exp(float(num))",
"def exponential(self) -> np.ndarray:\n if self.is_real():\n return np.array([1.0, 0.0, 0.0, 0.0])\n t = np.linalg.norm(self.v)\n u = self.v/t\n q_exp = np.array([np.cos(t),... | [
"0.7757153",
"0.76728433",
"0.7368416",
"0.73036104",
"0.7287106",
"0.7242993",
"0.72413695",
"0.7184224",
"0.70461255",
"0.7042846",
"0.6980404",
"0.6927922",
"0.6917829",
"0.6855434",
"0.6816277",
"0.68150693",
"0.68060374",
"0.67723686",
"0.67418283",
"0.67187214",
"0.6701... | 0.8516119 | 0 |
Take in the unfiltered bounding box descriptors and discard each cell whose score is lower than the object threshold set during class initialization. | def _filter_boxes(self, boxes, box_confidences, box_class_probs):
box_scores = box_confidences * box_class_probs
box_classes = np.argmax(box_scores, axis=-1)
box_class_scores = np.max(box_scores, axis=-1)
pos = np.where(box_class_scores >= self.object_threshold)
boxes = boxes[po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxes_filter(dets, bbox_id=1, class_name='None', color=(255, 255, 255), scale=1.0, thresh=0.5, min_size=(2, 2)):\n _objs = []\n inds = np.where(dets[:, -1] >= thresh)[0]\n if len(inds) == 0:\n return _objs\n\n for i in inds:\n bbox = dets[i, :4] / scale\n bbox_confidence = dets... | [
"0.67993003",
"0.67721516",
"0.64291966",
"0.63394976",
"0.62640655",
"0.62451243",
"0.6169222",
"0.6150016",
"0.6099145",
"0.6036444",
"0.6032561",
"0.6012943",
"0.5991367",
"0.59878886",
"0.59526324",
"0.59224176",
"0.5913991",
"0.58820915",
"0.58818364",
"0.5881471",
"0.58... | 0.6818446 | 0 |
Apply the NonMaximum Suppression (NMS) algorithm on the bounding boxes with their confidence scores and return an array with the indexes of the bounding boxes we want to keep (and display later). | def _nms_boxes(self, boxes, box_confidences):
x_coord = boxes[:, 0]
y_coord = boxes[:, 1]
width = boxes[:, 2]
height = boxes[:, 3]
areas = width * height
ordered = box_confidences.argsort()[::-1]
keep = list()
while ordered.size > 0:
# Index ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_max_suppression(self, filtered_boxes, box_classes, box_scores):\n box_predictions = []\n predicted_box_classes = []\n predicted_box_scores = []\n for label in range(len(self.class_names)):\n # for each class\n boxes = []\n class_tmp = []\n ... | [
"0.74188983",
"0.7279355",
"0.72521144",
"0.72321755",
"0.7220489",
"0.7149488",
"0.7127528",
"0.71227485",
"0.71109706",
"0.70798403",
"0.70474976",
"0.70236284",
"0.70221704",
"0.70044285",
"0.6993217",
"0.697691",
"0.69736964",
"0.69503355",
"0.6944182",
"0.6930919",
"0.68... | 0.74669826 | 0 |
Return primary and group where userid is a substitute, or None if nothing can be found. | def get_primary_for(userid): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_substitute_for(userid):",
"def __getitem__(self, userid):\r\n userid = int(userid)\r\n if self.__contains__(userid):\r\n return self.players[userid]\r\n return None",
"def maybe_find_user(user_id):\n try:\n return find(user_id)\n except KeyError:\n re... | [
"0.664141",
"0.5842186",
"0.56693363",
"0.5647178",
"0.54886925",
"0.54278255",
"0.54197043",
"0.54016566",
"0.53320014",
"0.5276366",
"0.520074",
"0.51717883",
"0.515401",
"0.5107618",
"0.50950027",
"0.49973184",
"0.49866486",
"0.497975",
"0.49777916",
"0.49663782",
"0.48790... | 0.67851377 | 0 |
Return group where userid has vote rights, or None if nothing can be found. | def get_voting_group_for(userid): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_groupfinder(userid, request):\r\n user = request.user\r\n if user is not None:\r\n if user.is_admin:\r\n return 'admin'\r\n else:\r\n return 'user'\r\n return None",
"def what_is(self, _id):\n for g in self.groups:\n if _id... | [
"0.59627193",
"0.5610295",
"0.55904126",
"0.5256703",
"0.5202669",
"0.5042593",
"0.5039713",
"0.50154305",
"0.5003878",
"0.4982192",
"0.49538013",
"0.49420515",
"0.49418104",
"0.48961386",
"0.4853452",
"0.48479605",
"0.48274422",
"0.480587",
"0.48018128",
"0.48018128",
"0.478... | 0.74966097 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.