body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
07abdaaac9bc820128716e92b7d86418c967fbc247feb2d85e9ee2e50334af53 | @staticmethod
def count_orders(orders):
'Return count of orders.'
return len(orders) | Return count of orders. | shopify_alexa.py | count_orders | johntelforduk/shopify-alexa-skill | 0 | python | @staticmethod
def count_orders(orders):
return len(orders) | @staticmethod
def count_orders(orders):
return len(orders)<|docstring|>Return count of orders.<|endoftext|> |
04477885aa8e59e6ca9ebec63e40f911181a46943768be28f99db4b2c9838322 | def gross_sales(self, target_date: str) -> float:
'Return the gross amount of sales in the shop currency on parm day.\n Sales are returned as both an integer and a formatted string.'
total = 0.0
orders = self.orders_on_date(target_date)
for each_order in orders:
total += float(each_ord... | Return the gross amount of sales in the shop currency on parm day.
Sales are returned as both an integer and a formatted string. | shopify_alexa.py | gross_sales | johntelforduk/shopify-alexa-skill | 0 | python | def gross_sales(self, target_date: str) -> float:
'Return the gross amount of sales in the shop currency on parm day.\n Sales are returned as both an integer and a formatted string.'
total = 0.0
orders = self.orders_on_date(target_date)
for each_order in orders:
total += float(each_ord... | def gross_sales(self, target_date: str) -> float:
'Return the gross amount of sales in the shop currency on parm day.\n Sales are returned as both an integer and a formatted string.'
total = 0.0
orders = self.orders_on_date(target_date)
for each_order in orders:
total += float(each_ord... |
30c9ed48353a84b8a96c89861118cc550864f31c94263caa46df3d700d5ba366 | def date_as_str(self, delta_days: int) -> str:
'Return a date relative to today as a string in yyyy-mm-dd format.'
utc_now = datetime.now(pytz.utc)
local_now = utc_now.astimezone(pytz.timezone(self.server_timezone))
debug('Skill.date_as_str : utc_now = {} local_now = {}'.format(utc_now, local_now))
... | Return a date relative to today as a string in yyyy-mm-dd format. | shopify_alexa.py | date_as_str | johntelforduk/shopify-alexa-skill | 0 | python | def date_as_str(self, delta_days: int) -> str:
utc_now = datetime.now(pytz.utc)
local_now = utc_now.astimezone(pytz.timezone(self.server_timezone))
debug('Skill.date_as_str : utc_now = {} local_now = {}'.format(utc_now, local_now))
required_date = (local_now + timedelta(days=delta_days))
retu... | def date_as_str(self, delta_days: int) -> str:
utc_now = datetime.now(pytz.utc)
local_now = utc_now.astimezone(pytz.timezone(self.server_timezone))
debug('Skill.date_as_str : utc_now = {} local_now = {}'.format(utc_now, local_now))
required_date = (local_now + timedelta(days=delta_days))
retu... |
23fbd499ce0e5613a562f55358a8dcbe4d61edf5572b434707e1ab2274091df6 | def today_str(self) -> str:
"Return today's date as a string in format yyyy-mm-dd."
return self.date_as_str(delta_days=0) | Return today's date as a string in format yyyy-mm-dd. | shopify_alexa.py | today_str | johntelforduk/shopify-alexa-skill | 0 | python | def today_str(self) -> str:
return self.date_as_str(delta_days=0) | def today_str(self) -> str:
return self.date_as_str(delta_days=0)<|docstring|>Return today's date as a string in format yyyy-mm-dd.<|endoftext|> |
c069993b1c2c476e8b61dcbdde0397b0b3cafdb3164ccb7a4f50f27dafe88921 | def yesterday_str(self) -> str:
"Return yesterday's date as a string in format yyyy-mm-dd."
return self.date_as_str(delta_days=(- 1)) | Return yesterday's date as a string in format yyyy-mm-dd. | shopify_alexa.py | yesterday_str | johntelforduk/shopify-alexa-skill | 0 | python | def yesterday_str(self) -> str:
return self.date_as_str(delta_days=(- 1)) | def yesterday_str(self) -> str:
return self.date_as_str(delta_days=(- 1))<|docstring|>Return yesterday's date as a string in format yyyy-mm-dd.<|endoftext|> |
fcda8c925cf74a2c874ec61de646be0660f0a0e791576e82ccc9a5484be9c92d | def formatted_money(self, money: float) -> (int, str):
'Return parm real as a tuple (integer amount of the money, string of money).\n The string includes the currency symbol.'
total_as_str = '{:,.2f}'.format(round(money, 2))
sales_str = self.shop.money_format.replace('{{amount}}', total_as_str)
... | Return parm real as a tuple (integer amount of the money, string of money).
The string includes the currency symbol. | shopify_alexa.py | formatted_money | johntelforduk/shopify-alexa-skill | 0 | python | def formatted_money(self, money: float) -> (int, str):
'Return parm real as a tuple (integer amount of the money, string of money).\n The string includes the currency symbol.'
total_as_str = '{:,.2f}'.format(round(money, 2))
sales_str = self.shop.money_format.replace('{{amount}}', total_as_str)
... | def formatted_money(self, money: float) -> (int, str):
'Return parm real as a tuple (integer amount of the money, string of money).\n The string includes the currency symbol.'
total_as_str = '{:,.2f}'.format(round(money, 2))
sales_str = self.shop.money_format.replace('{{amount}}', total_as_str)
... |
28694aaa3e3f98e6b00b06597cb22af42bdc09edbb430df59b11dd1703998029 | def number_orders_today(self) -> str:
'Return a string saying how many orders there have been today so far.'
orders = self.shop.orders_on_date(self.today_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You have had no orders yet today.'
elif (num_orders == 1)... | Return a string saying how many orders there have been today so far. | shopify_alexa.py | number_orders_today | johntelforduk/shopify-alexa-skill | 0 | python | def number_orders_today(self) -> str:
orders = self.shop.orders_on_date(self.today_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You have had no orders yet today.'
elif (num_orders == 1):
return 'You have had 1 order so far today.'
else:
... | def number_orders_today(self) -> str:
orders = self.shop.orders_on_date(self.today_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You have had no orders yet today.'
elif (num_orders == 1):
return 'You have had 1 order so far today.'
else:
... |
ee7aed67735405947ada704f3198425f0c7215c321fb9d5e7ccfb246c9b89fbf | def number_orders_yesterday(self) -> str:
'Return a string saying how many orders there were yesterday.'
orders = self.shop.orders_on_date(self.yesterday_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You had no orders yesterday.'
elif (num_orders == 1):
... | Return a string saying how many orders there were yesterday. | shopify_alexa.py | number_orders_yesterday | johntelforduk/shopify-alexa-skill | 0 | python | def number_orders_yesterday(self) -> str:
orders = self.shop.orders_on_date(self.yesterday_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You had no orders yesterday.'
elif (num_orders == 1):
return 'You had 1 order yesterday.'
else:
ret... | def number_orders_yesterday(self) -> str:
orders = self.shop.orders_on_date(self.yesterday_str())
num_orders = self.shop.count_orders(orders)
if (num_orders == 0):
return 'You had no orders yesterday.'
elif (num_orders == 1):
return 'You had 1 order yesterday.'
else:
ret... |
74fe2af2023842d139b656fbbffd4d88999dae36cac9e67637db3a4ea35631ad | def gross_sales_today(self) -> str:
'Return a string saying what the gross sales are today so far.'
sales = self.shop.gross_sales(self.today_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yet today.'
else:
return 'Gross sales so far ... | Return a string saying what the gross sales are today so far. | shopify_alexa.py | gross_sales_today | johntelforduk/shopify-alexa-skill | 0 | python | def gross_sales_today(self) -> str:
sales = self.shop.gross_sales(self.today_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yet today.'
else:
return 'Gross sales so far today are {}'.format(sales_str) | def gross_sales_today(self) -> str:
sales = self.shop.gross_sales(self.today_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yet today.'
else:
return 'Gross sales so far today are {}'.format(sales_str)<|docstring|>Return a string say... |
bc3186550cc23c494f8f9933c70736fc89f811212db718dc79a353ec0a2dc288 | def gross_sales_yesterday(self) -> str:
'Return a string saying what the gross sales were yesterday.'
sales = self.shop.gross_sales(self.yesterday_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yesterday.'
else:
return 'Gross sales y... | Return a string saying what the gross sales were yesterday. | shopify_alexa.py | gross_sales_yesterday | johntelforduk/shopify-alexa-skill | 0 | python | def gross_sales_yesterday(self) -> str:
sales = self.shop.gross_sales(self.yesterday_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yesterday.'
else:
return 'Gross sales yesterday were {}'.format(sales_str) | def gross_sales_yesterday(self) -> str:
sales = self.shop.gross_sales(self.yesterday_str())
(sales_int, sales_str) = self.formatted_money(sales)
if (sales_int == 0):
return 'No sales yesterday.'
else:
return 'Gross sales yesterday were {}'.format(sales_str)<|docstring|>Return a stri... |
a615c70d38e63e8e4b458967582898b9953c4ff792256b64461963642553fb42 | def most_recent_order(self) -> str:
'Return a sting with details of the most recent order.'
if (len(self.shop.orders) == 0):
return 'There are no recent orders.'
else:
order = self.shop.orders[0]
money = float(order['total_price'])
(_, money_str) = self.formatted_money(money)... | Return a sting with details of the most recent order. | shopify_alexa.py | most_recent_order | johntelforduk/shopify-alexa-skill | 0 | python | def most_recent_order(self) -> str:
if (len(self.shop.orders) == 0):
return 'There are no recent orders.'
else:
order = self.shop.orders[0]
money = float(order['total_price'])
(_, money_str) = self.formatted_money(money)
datetime_format1 = '%Y-%m-%d %H:%M:%S'
... | def most_recent_order(self) -> str:
if (len(self.shop.orders) == 0):
return 'There are no recent orders.'
else:
order = self.shop.orders[0]
money = float(order['total_price'])
(_, money_str) = self.formatted_money(money)
datetime_format1 = '%Y-%m-%d %H:%M:%S'
... |
3f22e68a306e5f841d27c333c6e891775838e763d0cc834c3b8529031a53b847 | def taxstring(tid, verbose=False):
'\n\n :param tid: taxonomy ID\n :param verbose: more output\n :return: an array of the taxnomy from kingdom -> species\n '
global taxa
if (tid in taxa):
return taxa[tid]
want = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
... | :param tid: taxonomy ID
:param verbose: more output
:return: an array of the taxnomy from kingdom -> species | ncbi/blast2taxonomy_col.py | taxstring | johned0/EdwardsLab | 30 | python | def taxstring(tid, verbose=False):
'\n\n :param tid: taxonomy ID\n :param verbose: more output\n :return: an array of the taxnomy from kingdom -> species\n '
global taxa
if (tid in taxa):
return taxa[tid]
want = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
... | def taxstring(tid, verbose=False):
'\n\n :param tid: taxonomy ID\n :param verbose: more output\n :return: an array of the taxnomy from kingdom -> species\n '
global taxa
if (tid in taxa):
return taxa[tid]
want = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
... |
b1833bdae9d68340dcd2da66430887adeb2309224a09e4d06fc913a1620729c6 | def parse_blast(bf, taxcol, verbose=False):
'\n\n :param bf: the blast output file\n :param taxcol: the column that contains the taxonomy ID\n :param verbose: more output\n :return:\n '
lastcol = (- 1)
if bf.endswith('.gz'):
f = gzip.open(bf, 'rt')
else:
f = open(bf, 'r')
... | :param bf: the blast output file
:param taxcol: the column that contains the taxonomy ID
:param verbose: more output
:return: | ncbi/blast2taxonomy_col.py | parse_blast | johned0/EdwardsLab | 30 | python | def parse_blast(bf, taxcol, verbose=False):
'\n\n :param bf: the blast output file\n :param taxcol: the column that contains the taxonomy ID\n :param verbose: more output\n :return:\n '
lastcol = (- 1)
if bf.endswith('.gz'):
f = gzip.open(bf, 'rt')
else:
f = open(bf, 'r')
... | def parse_blast(bf, taxcol, verbose=False):
'\n\n :param bf: the blast output file\n :param taxcol: the column that contains the taxonomy ID\n :param verbose: more output\n :return:\n '
lastcol = (- 1)
if bf.endswith('.gz'):
f = gzip.open(bf, 'rt')
else:
f = open(bf, 'r')
... |
3a55da6f6b0b559e2f7870b4fe086a8d3c78efd78369cc035a65d9d363de93db | @weak_script
def ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the structura... | ssim_loss(input, target, max_val, filter_size, k1, k2,
sigma, size_average=None, reduce=None, reduction='mean') -> Tensor
Measures the structural similarity index (SSIM) error.
See :class:`~torch.nn.SSIMLoss` for details. | metrics/my_ssim.py | ssim_loss | veritas9872/fastMRI-kspace | 18 | python | @weak_script
def ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the structura... | @weak_script
def ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the structura... |
38bc87e5154cf0773ad0415cabe8ae22e714b2dc8cf5f9802348b3ba91f0592c | def ms_ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ms_ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the multi-scale s... | ms_ssim_loss(input, target, max_val, filter_size, k1, k2,
sigma, size_average=None, reduce=None, reduction='mean') -> Tensor
Measures the multi-scale structural similarity index (MS-SSIM) error.
See :class:`~torch.nn.MSSSIMLoss` for details. | metrics/my_ssim.py | ms_ssim_loss | veritas9872/fastMRI-kspace | 18 | python | def ms_ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ms_ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the multi-scale s... | def ms_ssim_loss(input, target, max_val, filter_size=11, k1=0.01, k2=0.03, sigma=1.5, size_average=None, reduce=None, reduction='mean'):
"ms_ssim_loss(input, target, max_val, filter_size, k1, k2,\n sigma, size_average=None, reduce=None, reduction='mean') -> Tensor\n Measures the multi-scale s... |
8de0197d1f089d600596c29f44a4c0bd0fb3772f5e6f2e15ba8f793d7e4f2c8d | def dfs_impl(graph, cur_vertex, path_marked, marked, cycles, cur_path):
'\n plain depth first search implementation function.\n\n :param cur_vertex: currently processed vertex\n :param path_marked: list of booleans that defines whether a vertex is\n a part of path that connects current vertex and ve... | plain depth first search implementation function.
:param cur_vertex: currently processed vertex
:param path_marked: list of booleans that defines whether a vertex is
a part of path that connects current vertex and vertex dfs algo started
with
:param marked: visited vertices
:param cycles: cycles detected
:para... | inclusion_analysis/graph.py | dfs_impl | Andrey-Dubas/inclusion_analysis | 0 | python | def dfs_impl(graph, cur_vertex, path_marked, marked, cycles, cur_path):
'\n plain depth first search implementation function.\n\n :param cur_vertex: currently processed vertex\n :param path_marked: list of booleans that defines whether a vertex is\n a part of path that connects current vertex and ve... | def dfs_impl(graph, cur_vertex, path_marked, marked, cycles, cur_path):
'\n plain depth first search implementation function.\n\n :param cur_vertex: currently processed vertex\n :param path_marked: list of booleans that defines whether a vertex is\n a part of path that connects current vertex and ve... |
314bdfccb97ed0ec6a4c819a68699663654f8f51302773a57625835351eeddc4 | def cycle_detect(graph, root_vertex):
'\n cycle detection function\n\n :param graph: processed graph\n :param root_vertex: a vertex to start processing with\n :type graph: graph\n :type root_vertex: root_vertex\n :return: a list of pairs that combine a cycle detected and a\n path to a verte... | cycle detection function
:param graph: processed graph
:param root_vertex: a vertex to start processing with
:type graph: graph
:type root_vertex: root_vertex
:return: a list of pairs that combine a cycle detected and a
path to a vertex cycle starts with
:rtype: list<(list, list)> | inclusion_analysis/graph.py | cycle_detect | Andrey-Dubas/inclusion_analysis | 0 | python | def cycle_detect(graph, root_vertex):
'\n cycle detection function\n\n :param graph: processed graph\n :param root_vertex: a vertex to start processing with\n :type graph: graph\n :type root_vertex: root_vertex\n :return: a list of pairs that combine a cycle detected and a\n path to a verte... | def cycle_detect(graph, root_vertex):
'\n cycle detection function\n\n :param graph: processed graph\n :param root_vertex: a vertex to start processing with\n :type graph: graph\n :type root_vertex: root_vertex\n :return: a list of pairs that combine a cycle detected and a\n path to a verte... |
0868527f38fd025905ed8edf316d8c1bf0b38b77aec6fd1853311ed4267b8d84 | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation (directed edge) between vertices.\n from_vertex -> to_vertex\n\n :param from_vertex: index of vertex that edge goes from\n :param to_vertex: index of vertex that edge goes to\n :type from_vertex: int\n ... | sets a one-direction relation (directed edge) between vertices.
from_vertex -> to_vertex
:param from_vertex: index of vertex that edge goes from
:param to_vertex: index of vertex that edge goes to
:type from_vertex: int
:type to_vertex: int
:return: None | inclusion_analysis/graph.py | connect | Andrey-Dubas/inclusion_analysis | 0 | python | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation (directed edge) between vertices.\n from_vertex -> to_vertex\n\n :param from_vertex: index of vertex that edge goes from\n :param to_vertex: index of vertex that edge goes to\n :type from_vertex: int\n ... | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation (directed edge) between vertices.\n from_vertex -> to_vertex\n\n :param from_vertex: index of vertex that edge goes from\n :param to_vertex: index of vertex that edge goes to\n :type from_vertex: int\n ... |
1accd8d484f40fb1aada7cbf898eda678cbac3bf89d2b0c7d215647ba8320ace | def is_adjacent(self, from_vertex, to_vertex):
' checks if there is an edge between vertices '
return (to_vertex in self.__vertices[from_vertex]) | checks if there is an edge between vertices | inclusion_analysis/graph.py | is_adjacent | Andrey-Dubas/inclusion_analysis | 0 | python | def is_adjacent(self, from_vertex, to_vertex):
' '
return (to_vertex in self.__vertices[from_vertex]) | def is_adjacent(self, from_vertex, to_vertex):
' '
return (to_vertex in self.__vertices[from_vertex])<|docstring|>checks if there is an edge between vertices<|endoftext|> |
a7e6567d1a9f239fe5a17a72b248c38c4db6ccdf21de896e8e25e8807d0ff2db | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :rtype: list<int>\n '
if isinstance(from_vertex, int):
return self.__vertices[from_vertex] | get all vertices that are connected directly to the particular one
:param from_vertex: particular vertex
:rtype: list<int> | inclusion_analysis/graph.py | get_connected | Andrey-Dubas/inclusion_analysis | 0 | python | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :rtype: list<int>\n '
if isinstance(from_vertex, int):
return self.__vertices[from_vertex] | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :rtype: list<int>\n '
if isinstance(from_vertex, int):
return self.__vertices[from_vertex]<|docstring|>get all vertices tha... |
a34c7628865308fe1aa5608701682e5bb2a38473abf9cc68f533305bf9ebf536 | def add_vertex(self, index):
'\n add a informational vertex to the graph with\n :param data: an information contained by vertex\n :return: None\n '
self.__vertices[index] = [] | add a informational vertex to the graph with
:param data: an information contained by vertex
:return: None | inclusion_analysis/graph.py | add_vertex | Andrey-Dubas/inclusion_analysis | 0 | python | def add_vertex(self, index):
'\n add a informational vertex to the graph with\n :param data: an information contained by vertex\n :return: None\n '
self.__vertices[index] = [] | def add_vertex(self, index):
'\n add a informational vertex to the graph with\n :param data: an information contained by vertex\n :return: None\n '
self.__vertices[index] = []<|docstring|>add a informational vertex to the graph with
:param data: an information contained by vertex
:re... |
b02e32717891099f25e9b600e62520b0b286b9fb11d31588ec972b03640a4c7f | def has_vertex(self, index):
"\n checks if graph contains a vertex with particular information\n :param name: an info we're looking for\n :return: Boolean\n "
return self.__vertices.has_key(index) | checks if graph contains a vertex with particular information
:param name: an info we're looking for
:return: Boolean | inclusion_analysis/graph.py | has_vertex | Andrey-Dubas/inclusion_analysis | 0 | python | def has_vertex(self, index):
"\n checks if graph contains a vertex with particular information\n :param name: an info we're looking for\n :return: Boolean\n "
return self.__vertices.has_key(index) | def has_vertex(self, index):
"\n checks if graph contains a vertex with particular information\n :param name: an info we're looking for\n :return: Boolean\n "
return self.__vertices.has_key(index)<|docstring|>checks if graph contains a vertex with particular information
:param name: ... |
7115927f32fe33fd87aa3d8c658a7d65195e134ba804d68c4d0662c2337305d9 | def __init__(self):
'\n __graph is a graph of indexes, each index represents file\n __name_to_index if a dict which key is filename and its value is index\n __index_name if a dict which key is index and its value is filename\n '
self.__graph = Graph()
self.__name_to_index = {}
... | __graph is a graph of indexes, each index represents file
__name_to_index if a dict which key is filename and its value is index
__index_name if a dict which key is index and its value is filename | inclusion_analysis/graph.py | __init__ | Andrey-Dubas/inclusion_analysis | 0 | python | def __init__(self):
'\n __graph is a graph of indexes, each index represents file\n __name_to_index if a dict which key is filename and its value is index\n __index_name if a dict which key is index and its value is filename\n '
self.__graph = Graph()
self.__name_to_index = {}
... | def __init__(self):
'\n __graph is a graph of indexes, each index represents file\n __name_to_index if a dict which key is filename and its value is index\n __index_name if a dict which key is index and its value is filename\n '
self.__graph = Graph()
self.__name_to_index = {}
... |
dc2f91b923e0b5108e88a3bb5ef8d07d596bb664ff85345af3f056e23cf2ab42 | def get_name_by_index(self, index):
' returns filename by its index '
return self.__index_name[index] | returns filename by its index | inclusion_analysis/graph.py | get_name_by_index | Andrey-Dubas/inclusion_analysis | 0 | python | def get_name_by_index(self, index):
' '
return self.__index_name[index] | def get_name_by_index(self, index):
' '
return self.__index_name[index]<|docstring|>returns filename by its index<|endoftext|> |
3e68c3640786392f9b8d7905dcfc0b0f891d5453345f5c733bd3f0daea3960e0 | def get_index_by_name(self, name):
" returns file's index by its name "
return self.__name_to_index[name] | returns file's index by its name | inclusion_analysis/graph.py | get_index_by_name | Andrey-Dubas/inclusion_analysis | 0 | python | def get_index_by_name(self, name):
" "
return self.__name_to_index[name] | def get_index_by_name(self, name):
" "
return self.__name_to_index[name]<|docstring|>returns file's index by its name<|endoftext|> |
e939fa09a72ce46e72b04bfbbbbb4e1b57fadf352c837b926eb54eefd621dcd8 | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation between vertices. from_vertex -> to_vertex\n\n :param from_vertex: filename that contains inclusion\n :param to_vertex: included filename\n :type from_vertex: str\n :type to_vertex: str\n :return: ... | sets a one-direction relation between vertices. from_vertex -> to_vertex
:param from_vertex: filename that contains inclusion
:param to_vertex: included filename
:type from_vertex: str
:type to_vertex: str
:return: None | inclusion_analysis/graph.py | connect | Andrey-Dubas/inclusion_analysis | 0 | python | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation between vertices. from_vertex -> to_vertex\n\n :param from_vertex: filename that contains inclusion\n :param to_vertex: included filename\n :type from_vertex: str\n :type to_vertex: str\n :return: ... | def connect(self, from_vertex, to_vertex):
'\n sets a one-direction relation between vertices. from_vertex -> to_vertex\n\n :param from_vertex: filename that contains inclusion\n :param to_vertex: included filename\n :type from_vertex: str\n :type to_vertex: str\n :return: ... |
2a71183de3d9407f54bac87a1d3766aa2c1081c302d325228b121656bcd52a34 | def is_adjacent(self, from_vertex, to_vertex):
' returns whether to_vertex is adjacent to from_vertex '
from_vertex = self.get_index_by_name(from_vertex)
to_vertex = self.get_index_by_name(to_vertex)
return self.__graph.is_adjacent(from_vertex, to_vertex) | returns whether to_vertex is adjacent to from_vertex | inclusion_analysis/graph.py | is_adjacent | Andrey-Dubas/inclusion_analysis | 0 | python | def is_adjacent(self, from_vertex, to_vertex):
' '
from_vertex = self.get_index_by_name(from_vertex)
to_vertex = self.get_index_by_name(to_vertex)
return self.__graph.is_adjacent(from_vertex, to_vertex) | def is_adjacent(self, from_vertex, to_vertex):
' '
from_vertex = self.get_index_by_name(from_vertex)
to_vertex = self.get_index_by_name(to_vertex)
return self.__graph.is_adjacent(from_vertex, to_vertex)<|docstring|>returns whether to_vertex is adjacent to from_vertex<|endoftext|> |
143d015101d453951827a4ba41f49799cfe7cc02639b149aab6de2db1bb060c8 | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :type from_vertex: str\n :returns: all adjacent vertices\n :rtype: list <int>\n '
if isinstance(from_vertex, int):
... | get all vertices that are connected directly to the particular one
:param from_vertex: particular vertex
:type from_vertex: str
:returns: all adjacent vertices
:rtype: list <int> | inclusion_analysis/graph.py | get_connected | Andrey-Dubas/inclusion_analysis | 0 | python | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :type from_vertex: str\n :returns: all adjacent vertices\n :rtype: list <int>\n '
if isinstance(from_vertex, int):
... | def get_connected(self, from_vertex):
'\n get all vertices that are connected directly to the particular one\n\n :param from_vertex: particular vertex\n :type from_vertex: str\n :returns: all adjacent vertices\n :rtype: list <int>\n '
if isinstance(from_vertex, int):
... |
1a23b53f207f675723d206bf1d3be317a2c113e2d7270a831942695281300cb0 | def add_vertex(self, data):
'\n add a informational vertex to the graph with\n\n :param data: an information contained by vertex\n :type data: str\n :rtype: None\n '
self.__name_to_index[data] = len(self)
self.__index_name[len(self)] = data
self.__graph.add_vertex(len(... | add a informational vertex to the graph with
:param data: an information contained by vertex
:type data: str
:rtype: None | inclusion_analysis/graph.py | add_vertex | Andrey-Dubas/inclusion_analysis | 0 | python | def add_vertex(self, data):
'\n add a informational vertex to the graph with\n\n :param data: an information contained by vertex\n :type data: str\n :rtype: None\n '
self.__name_to_index[data] = len(self)
self.__index_name[len(self)] = data
self.__graph.add_vertex(len(... | def add_vertex(self, data):
'\n add a informational vertex to the graph with\n\n :param data: an information contained by vertex\n :type data: str\n :rtype: None\n '
self.__name_to_index[data] = len(self)
self.__index_name[len(self)] = data
self.__graph.add_vertex(len(... |
2368e075e902fa9750a792f88690daf31221c3c850e3dc2bd76d9ca7be61f66d | def has_vertex(self, name):
'\n checks if graph contains a vertex with particular information\n\n :param name: an info we are looking for\n :rtype name: str\n :return: if the graph contains particular filename\n :rtype: Boolean\n '
return self.__vertices.has_key(name) | checks if graph contains a vertex with particular information
:param name: an info we are looking for
:rtype name: str
:return: if the graph contains particular filename
:rtype: Boolean | inclusion_analysis/graph.py | has_vertex | Andrey-Dubas/inclusion_analysis | 0 | python | def has_vertex(self, name):
'\n checks if graph contains a vertex with particular information\n\n :param name: an info we are looking for\n :rtype name: str\n :return: if the graph contains particular filename\n :rtype: Boolean\n '
return self.__vertices.has_key(name) | def has_vertex(self, name):
'\n checks if graph contains a vertex with particular information\n\n :param name: an info we are looking for\n :rtype name: str\n :return: if the graph contains particular filename\n :rtype: Boolean\n '
return self.__vertices.has_key(name)<|... |
7f904aeed0c6fda6915f17809842bdd984a954ffc93191b35620a14d304e1801 | def cycle_detect(self, root_vertex):
'\n detects all cycles of the graph\n\n :param root_vertex: the vertex it start graph traverse\n :rtype root_vertex: str\n :return: a list of pairs that combine a cycle detected and a path to a vertex cycle starts with\n '
root_vertex = sel... | detects all cycles of the graph
:param root_vertex: the vertex it start graph traverse
:rtype root_vertex: str
:return: a list of pairs that combine a cycle detected and a path to a vertex cycle starts with | inclusion_analysis/graph.py | cycle_detect | Andrey-Dubas/inclusion_analysis | 0 | python | def cycle_detect(self, root_vertex):
'\n detects all cycles of the graph\n\n :param root_vertex: the vertex it start graph traverse\n :rtype root_vertex: str\n :return: a list of pairs that combine a cycle detected and a path to a vertex cycle starts with\n '
root_vertex = sel... | def cycle_detect(self, root_vertex):
'\n detects all cycles of the graph\n\n :param root_vertex: the vertex it start graph traverse\n :rtype root_vertex: str\n :return: a list of pairs that combine a cycle detected and a path to a vertex cycle starts with\n '
root_vertex = sel... |
9f410f30ed668655fffa2e60fe421c39b5b56c214a253a0f055c7c197fdd2364 | @staticmethod
def checkOptions(options):
'\n :return: True if dependent options changed, otherwise False.\n '
dependentChanges = MeshType_3d_heartventricles2.checkOptions(options)
options['Number of elements around LV free wall'] = 5
options['Number of elements around ventricular septum']... | :return: True if dependent options changed, otherwise False. | src/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase2.py | checkOptions | keeran97/scaffoldmaker | 1 | python | @staticmethod
def checkOptions(options):
'\n \n '
dependentChanges = MeshType_3d_heartventricles2.checkOptions(options)
options['Number of elements around LV free wall'] = 5
options['Number of elements around ventricular septum'] = 7
options['Number of elements around atria'] = 8
o... | @staticmethod
def checkOptions(options):
'\n \n '
dependentChanges = MeshType_3d_heartventricles2.checkOptions(options)
options['Number of elements around LV free wall'] = 5
options['Number of elements around ventricular septum'] = 7
options['Number of elements around atria'] = 8
o... |
a904880d7b7302c2940b704e7873110addc9a410e92b6d57a2794322284f9dc4 | @classmethod
def generateBaseMesh(cls, region, options):
'\n Generate the base tricubic Hermite mesh.\n :param region: Zinc region to define model in. Must be empty.\n :param options: Dict containing options. See getDefaultOptions().\n :return: list of AnnotationGroup\n '
elem... | Generate the base tricubic Hermite mesh.
:param region: Zinc region to define model in. Must be empty.
:param options: Dict containing options. See getDefaultOptions().
:return: list of AnnotationGroup | src/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase2.py | generateBaseMesh | keeran97/scaffoldmaker | 1 | python | @classmethod
def generateBaseMesh(cls, region, options):
'\n Generate the base tricubic Hermite mesh.\n :param region: Zinc region to define model in. Must be empty.\n :param options: Dict containing options. See getDefaultOptions().\n :return: list of AnnotationGroup\n '
elem... | @classmethod
def generateBaseMesh(cls, region, options):
'\n Generate the base tricubic Hermite mesh.\n :param region: Zinc region to define model in. Must be empty.\n :param options: Dict containing options. See getDefaultOptions().\n :return: list of AnnotationGroup\n '
elem... |
b18354ca7a193c698cedf67e0bdf305af0b03bb16de776a2a890be4c87acb391 | @classmethod
def refineMesh(cls, meshrefinement, options):
'\n Refine source mesh into separate region, with change of basis.\n :param meshrefinement: MeshRefinement, which knows source and target region.\n :param options: Dict containing options. See getDefaultOptions().\n '
assert ... | Refine source mesh into separate region, with change of basis.
:param meshrefinement: MeshRefinement, which knows source and target region.
:param options: Dict containing options. See getDefaultOptions(). | src/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase2.py | refineMesh | keeran97/scaffoldmaker | 1 | python | @classmethod
def refineMesh(cls, meshrefinement, options):
'\n Refine source mesh into separate region, with change of basis.\n :param meshrefinement: MeshRefinement, which knows source and target region.\n :param options: Dict containing options. See getDefaultOptions().\n '
assert ... | @classmethod
def refineMesh(cls, meshrefinement, options):
'\n Refine source mesh into separate region, with change of basis.\n :param meshrefinement: MeshRefinement, which knows source and target region.\n :param options: Dict containing options. See getDefaultOptions().\n '
assert ... |
86b5422cc0253487cd0c453c65dd3be1280de7b8971eb641c3a5d561933b4d75 | def verify(self, options, secret_data):
' Check connection\n '
azure_vm_connector = self.locator.get_connector('AzureVMConnector')
r = azure_vm_connector.verify(options, secret_data)
return r | Check connection | src/spaceone/inventory/manager/collector_manager.py | verify | jihyungSong/plugin-azure-vm-inven-collector | 0 | python | def verify(self, options, secret_data):
' \n '
azure_vm_connector = self.locator.get_connector('AzureVMConnector')
r = azure_vm_connector.verify(options, secret_data)
return r | def verify(self, options, secret_data):
' \n '
azure_vm_connector = self.locator.get_connector('AzureVMConnector')
r = azure_vm_connector.verify(options, secret_data)
return r<|docstring|>Check connection<|endoftext|> |
e65593327b704915b135357729d70e3b323d5bb29c2032b335e421575c524b77 | def list_resources(self, params):
' Get list of resources\n Args:\n params:\n - resource_group\n - vms\n\n Returns: list of resources\n '
start_time = time.time()
total_resources = []
try:
(resources, error_resources) = self.list_all_... | Get list of resources
Args:
params:
- resource_group
- vms
Returns: list of resources | src/spaceone/inventory/manager/collector_manager.py | list_resources | jihyungSong/plugin-azure-vm-inven-collector | 0 | python | def list_resources(self, params):
' Get list of resources\n Args:\n params:\n - resource_group\n - vms\n\n Returns: list of resources\n '
start_time = time.time()
total_resources = []
try:
(resources, error_resources) = self.list_all_... | def list_resources(self, params):
' Get list of resources\n Args:\n params:\n - resource_group\n - vms\n\n Returns: list of resources\n '
start_time = time.time()
total_resources = []
try:
(resources, error_resources) = self.list_all_... |
49fb2008dc5853532fbb8bc503948702870c88be84c227212daf75f5af69472a | def denseUnet121(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
i... | Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | networks/dense_decoders.py | denseUnet121 | marcelampc/aerial_mtl | 58 | python | def denseUnet121(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
i... | def denseUnet121(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
i... |
41f0cf74cfab50699387589daeffec591a70be840a984e51e2cffcdce0bf4cda | def D3net_shared_weights(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ... | Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | networks/dense_decoders.py | D3net_shared_weights | marcelampc/aerial_mtl | 58 | python | def D3net_shared_weights(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ... | def D3net_shared_weights(pretrained=False, d_block_type='basic', init_method='normal', version=1, **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ... |
65e0acef04f3a880aceb3625c10776cb8ab50a36f836646a38108bb0e3b8c5a8 | def denseUnet169(pretrained=False, d_block_type='basic', init_method='normal', **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
d_block = ge... | Densenet-121 model from
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | networks/dense_decoders.py | denseUnet169 | marcelampc/aerial_mtl | 58 | python | def denseUnet169(pretrained=False, d_block_type='basic', init_method='normal', **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
d_block = ge... | def denseUnet169(pretrained=False, d_block_type='basic', init_method='normal', **kwargs):
'Densenet-121 model from\n `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
d_block = ge... |
074071667e1821e5d077bd0db2f63b34402c0d65c8d9911baab8209179d51d30 | def add_data_available_callback(self, cb):
'Warning: callback is called back in another thread!'
if (not self._callbacks):
self._enable_listener()
ref = (max(self._callbacks) if self._callbacks else 0)
self._callbacks[ref] = cb
return ref | Warning: callback is called back in another thread! | dds/__init__.py | add_data_available_callback | urielka/pydds-rti-xml | 0 | python | def add_data_available_callback(self, cb):
if (not self._callbacks):
self._enable_listener()
ref = (max(self._callbacks) if self._callbacks else 0)
self._callbacks[ref] = cb
return ref | def add_data_available_callback(self, cb):
if (not self._callbacks):
self._enable_listener()
ref = (max(self._callbacks) if self._callbacks else 0)
self._callbacks[ref] = cb
return ref<|docstring|>Warning: callback is called back in another thread!<|endoftext|> |
39b9dac585b1e03bdde69662df250ff86d28a575c4bfbff15dbd5e9fa3bbbd98 | def _receive(self, instanceState: DDS_InstanceStateKindEnum, take=True):
"'takeFlag' controls whether read samples stay in the DDS cache (i.e. use DDS Read API) or removed (i.e. use DDS Take API) "
data_seq = DDSType.DynamicDataSeq()
DDSFunc.DynamicDataSeq_initialize(data_seq)
info_seq = DDSType.SampleI... | 'takeFlag' controls whether read samples stay in the DDS cache (i.e. use DDS Read API) or removed (i.e. use DDS Take API) | dds/__init__.py | _receive | urielka/pydds-rti-xml | 0 | python | def _receive(self, instanceState: DDS_InstanceStateKindEnum, take=True):
" "
data_seq = DDSType.DynamicDataSeq()
DDSFunc.DynamicDataSeq_initialize(data_seq)
info_seq = DDSType.SampleInfoSeq()
DDSFunc.SampleInfoSeq_initialize(info_seq)
try:
if take:
self._dyn_narrowed_reader.t... | def _receive(self, instanceState: DDS_InstanceStateKindEnum, take=True):
" "
data_seq = DDSType.DynamicDataSeq()
DDSFunc.DynamicDataSeq_initialize(data_seq)
info_seq = DDSType.SampleInfoSeq()
DDSFunc.SampleInfoSeq_initialize(info_seq)
try:
if take:
self._dyn_narrowed_reader.t... |
324eba17e02956308ee64949ee798af552cb0c4da3989b553e0e3ed46626e4ba | def lookup_datawriter_by_name(self, datawriter_full_name):
'Retrieves the DDS DataWriter according to its full name (e.g. MyPublisher::HelloWorldWriter'
res = Writer(self, cstring(datawriter_full_name))
return res | Retrieves the DDS DataWriter according to its full name (e.g. MyPublisher::HelloWorldWriter | dds/__init__.py | lookup_datawriter_by_name | urielka/pydds-rti-xml | 0 | python | def lookup_datawriter_by_name(self, datawriter_full_name):
res = Writer(self, cstring(datawriter_full_name))
return res | def lookup_datawriter_by_name(self, datawriter_full_name):
res = Writer(self, cstring(datawriter_full_name))
return res<|docstring|>Retrieves the DDS DataWriter according to its full name (e.g. MyPublisher::HelloWorldWriter<|endoftext|> |
ece60077c7e155911cdc94b7028434896d585d9f8eee1a19c89650d51aedb722 | def lookup_datareader_by_name(self, datareader_full_name):
'Retrieves the DDS DataReader according to its full name (e.g. MySubscriber::HelloWorldReader'
res = Reader(self, cstring(datareader_full_name))
return res | Retrieves the DDS DataReader according to its full name (e.g. MySubscriber::HelloWorldReader | dds/__init__.py | lookup_datareader_by_name | urielka/pydds-rti-xml | 0 | python | def lookup_datareader_by_name(self, datareader_full_name):
res = Reader(self, cstring(datareader_full_name))
return res | def lookup_datareader_by_name(self, datareader_full_name):
res = Reader(self, cstring(datareader_full_name))
return res<|docstring|>Retrieves the DDS DataReader according to its full name (e.g. MySubscriber::HelloWorldReader<|endoftext|> |
67486c9401fb07b33683a45897ede99d4ffec605c5068507e6680fd9786b32bb | def test_r():
'\n This is basically just the using_R notebook.\n '
r = R(r_file)
r.display_source_ipython()
model = r.model('myModel')
distance = r.distance('myDistance')
sum_stat = r.summary_statistics('mySummaryStatistics')
prior = pyabc.Distribution(meanX=pyabc.RV('uniform', 0, 10),... | This is basically just the using_R notebook. | test/test_external.py | test_r | Pat-Laub/pyABC | 0 | python | def test_r():
'\n \n '
r = R(r_file)
r.display_source_ipython()
model = r.model('myModel')
distance = r.distance('myDistance')
sum_stat = r.summary_statistics('mySummaryStatistics')
prior = pyabc.Distribution(meanX=pyabc.RV('uniform', 0, 10), meanY=pyabc.RV('uniform', 0, 10))
sampl... | def test_r():
'\n \n '
r = R(r_file)
r.display_source_ipython()
model = r.model('myModel')
distance = r.distance('myDistance')
sum_stat = r.summary_statistics('mySummaryStatistics')
prior = pyabc.Distribution(meanX=pyabc.RV('uniform', 0, 10), meanY=pyabc.RV('uniform', 0, 10))
sampl... |
129f4eb25cf042b43cd9894f947a3511f32ce4f9159cf1a7c7090492f8cbaf70 | def __init__(self, filename, *args, **kwargs):
'\n Initialize an instance of GatkReport\n :param filename: path to a GATKReport file\n :param args: args\n :param kwargs: kwargs\n '
self.tables = dict()
self.update(dict(*args, **kwargs))
self.filename = filename
sel... | Initialize an instance of GatkReport
:param filename: path to a GATKReport file
:param args: args
:param kwargs: kwargs | gsalib.py | __init__ | myourshaw/gsalib | 0 | python | def __init__(self, filename, *args, **kwargs):
'\n Initialize an instance of GatkReport\n :param filename: path to a GATKReport file\n :param args: args\n :param kwargs: kwargs\n '
self.tables = dict()
self.update(dict(*args, **kwargs))
self.filename = filename
sel... | def __init__(self, filename, *args, **kwargs):
'\n Initialize an instance of GatkReport\n :param filename: path to a GATKReport file\n :param args: args\n :param kwargs: kwargs\n '
self.tables = dict()
self.update(dict(*args, **kwargs))
self.filename = filename
sel... |
afa9324aa0518a96b1c84b7f0d9d384ae47093765d32878ce6cf93858d35354e | def __setitem__(self, dataframe):
'\n Add a Dataframe to the report.\n :param dataframe: the dataframe to be added\n :return: None\n '
try:
table_name = [dataframe.name]
except AttributeError:
table_name = dataframe.name = 'table'
self._used_names[table_name] ... | Add a Dataframe to the report.
:param dataframe: the dataframe to be added
:return: None | gsalib.py | __setitem__ | myourshaw/gsalib | 0 | python | def __setitem__(self, dataframe):
'\n Add a Dataframe to the report.\n :param dataframe: the dataframe to be added\n :return: None\n '
try:
table_name = [dataframe.name]
except AttributeError:
table_name = dataframe.name = 'table'
self._used_names[table_name] ... | def __setitem__(self, dataframe):
'\n Add a Dataframe to the report.\n :param dataframe: the dataframe to be added\n :return: None\n '
try:
table_name = [dataframe.name]
except AttributeError:
table_name = dataframe.name = 'table'
self._used_names[table_name] ... |
04e88ce073793e0c7490ff2ec358220ea0abda9edc1308c4238336fac58d035c | def _get_report_id(self, report_line):
'\n Get the version of the GATK report. Fo versions >=1 also get the number of tables.\n :param report_line: report definition line\n :return: ReportId (version, n_tables,)\n '
m = self._report_rx.match(report_line)
if (m is not None):
... | Get the version of the GATK report. Fo versions >=1 also get the number of tables.
:param report_line: report definition line
:return: ReportId (version, n_tables,) | gsalib.py | _get_report_id | myourshaw/gsalib | 0 | python | def _get_report_id(self, report_line):
'\n Get the version of the GATK report. Fo versions >=1 also get the number of tables.\n :param report_line: report definition line\n :return: ReportId (version, n_tables,)\n '
m = self._report_rx.match(report_line)
if (m is not None):
... | def _get_report_id(self, report_line):
'\n Get the version of the GATK report. Fo versions >=1 also get the number of tables.\n :param report_line: report definition line\n :return: ReportId (version, n_tables,)\n '
m = self._report_rx.match(report_line)
if (m is not None):
... |
f2c19e5e241a0f420ed3b70a9cb8a1a952408c081f3f1dfb4a215e728a096ccd | def _get_table_format(self, table_format_line):
'\n Get the format of a v1.x GATK table.\n :param table_format_line: table format definition line\n :return: TableFormat (n_cols, n_rows, col_formats,)\n '
m = self._table_format_rx.match(table_format_line)
if (m is not None):
... | Get the format of a v1.x GATK table.
:param table_format_line: table format definition line
:return: TableFormat (n_cols, n_rows, col_formats,) | gsalib.py | _get_table_format | myourshaw/gsalib | 0 | python | def _get_table_format(self, table_format_line):
'\n Get the format of a v1.x GATK table.\n :param table_format_line: table format definition line\n :return: TableFormat (n_cols, n_rows, col_formats,)\n '
m = self._table_format_rx.match(table_format_line)
if (m is not None):
... | def _get_table_format(self, table_format_line):
'\n Get the format of a v1.x GATK table.\n :param table_format_line: table format definition line\n :return: TableFormat (n_cols, n_rows, col_formats,)\n '
m = self._table_format_rx.match(table_format_line)
if (m is not None):
... |
59ed305241f9ba0e1806496553d8cb44506ddffae168ab33a2b7d5154217bb46 | def _get_table_v0_id(self, table_id_line):
'\n Get the name a v0.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._report_v0_rx.match(table_id_line)
if (m is not None):
return self._TableId(m.g... | Get the name a v0.x GATK table.
:param table_id_line: table id definition line
:return: TableId (table_name, table_description,) | gsalib.py | _get_table_v0_id | myourshaw/gsalib | 0 | python | def _get_table_v0_id(self, table_id_line):
'\n Get the name a v0.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._report_v0_rx.match(table_id_line)
if (m is not None):
return self._TableId(m.g... | def _get_table_v0_id(self, table_id_line):
'\n Get the name a v0.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._report_v0_rx.match(table_id_line)
if (m is not None):
return self._TableId(m.g... |
1d01fdf9a69db210647e419c2a1ed1b33722d0205e60583270f31714da327a63 | def _get_table_id(self, table_id_line):
'\n Get the name and description of a v1.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._table_id_rx.match(table_id_line)
if (m is not None):
return se... | Get the name and description of a v1.x GATK table.
:param table_id_line: table id definition line
:return: TableId (table_name, table_description,) | gsalib.py | _get_table_id | myourshaw/gsalib | 0 | python | def _get_table_id(self, table_id_line):
'\n Get the name and description of a v1.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._table_id_rx.match(table_id_line)
if (m is not None):
return se... | def _get_table_id(self, table_id_line):
'\n Get the name and description of a v1.x GATK table.\n :param table_id_line: table id definition line\n :return: TableId (table_name, table_description,)\n '
m = self._table_id_rx.match(table_id_line)
if (m is not None):
return se... |
6bc72d8f38e5df98f172c93bf68bf98c31cda7d13330071d3d37d4e927bbb0b3 | def _read_gatkreportv0(self, lines):
'\n Reads a v0.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_id = None
table_data = []
for line in lines:
if ((line.strip() == '') or (line.strip().... | Reads a v0.x GATK report into a GATKReport object
:param lines: list of lines from report file
:return: None | gsalib.py | _read_gatkreportv0 | myourshaw/gsalib | 0 | python | def _read_gatkreportv0(self, lines):
'\n Reads a v0.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_id = None
table_data = []
for line in lines:
if ((line.strip() == ) or (line.strip().st... | def _read_gatkreportv0(self, lines):
'\n Reads a v0.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_id = None
table_data = []
for line in lines:
if ((line.strip() == ) or (line.strip().st... |
5bf9162a1a3dac9ca061106d911c50663b38ca2659c6257152e301fb05d9d35c | def _read_gatkreportv1(self, lines):
'\n Reads a v1.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_format = None
table_id = None
table_data = []
for line in lines:
if ((line.strip() ... | Reads a v1.x GATK report into a GATKReport object
:param lines: list of lines from report file
:return: None | gsalib.py | _read_gatkreportv1 | myourshaw/gsalib | 0 | python | def _read_gatkreportv1(self, lines):
'\n Reads a v1.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_format = None
table_id = None
table_data = []
for line in lines:
if ((line.strip() ... | def _read_gatkreportv1(self, lines):
'\n Reads a v1.x GATK report into a GATKReport object\n :param lines: list of lines from report file\n :return: None\n '
n_tables = 0
table_format = None
table_id = None
table_data = []
for line in lines:
if ((line.strip() ... |
dccc74c2621802fc9c92630a774bf93cabddf05e3e44b5f5defdc51d56eb8493 | def on_save(self, *args):
'Events called when the "OK" dialog box button is clicked.'
self.dismiss() | Events called when the "OK" dialog box button is clicked. | modified_picker/picker.py | on_save | ShareASmile/car-locator | 21 | python | def on_save(self, *args):
self.dismiss() | def on_save(self, *args):
self.dismiss()<|docstring|>Events called when the "OK" dialog box button is clicked.<|endoftext|> |
0486ca9d7dc67b383755fd3d372c0f4d5555885e4bc76dce0619c1819e5e0847 | def on_cancel(self, *args):
'Events called when the "CANCEL" dialog box button is clicked.'
self.dismiss() | Events called when the "CANCEL" dialog box button is clicked. | modified_picker/picker.py | on_cancel | ShareASmile/car-locator | 21 | python | def on_cancel(self, *args):
self.dismiss() | def on_cancel(self, *args):
self.dismiss()<|docstring|>Events called when the "CANCEL" dialog box button is clicked.<|endoftext|> |
179895fe82b7e75916f309b1c8ba9f2807ead29c4796fb6061e2a6732140d7ac | def isnumeric(self, value):
'\n We are forced to create a custom method because if we set the ``int``\n value for the ``input_filter`` parameter of the text field, then the\n ``-`` character is still available for keyboard input. Apparently, this\n is a Kivy bug.\n '
try:
... | We are forced to create a custom method because if we set the ``int``
value for the ``input_filter`` parameter of the text field, then the
``-`` character is still available for keyboard input. Apparently, this
is a Kivy bug. | modified_picker/picker.py | isnumeric | ShareASmile/car-locator | 21 | python | def isnumeric(self, value):
'\n We are forced to create a custom method because if we set the ``int``\n value for the ``input_filter`` parameter of the text field, then the\n ``-`` character is still available for keyboard input. Apparently, this\n is a Kivy bug.\n '
try:
... | def isnumeric(self, value):
'\n We are forced to create a custom method because if we set the ``int``\n value for the ``input_filter`` parameter of the text field, then the\n ``-`` character is still available for keyboard input. Apparently, this\n is a Kivy bug.\n '
try:
... |
d68c8c0443cff085338e6bef03a3a6334e78d3768dad9e4091eec8b9489fe578 | def do_backspace(self, *args):
'Prevent deleting text from the middle of a line of a text field.'
self._backspace = True
self.text = self.text[:(- 1)]
self._date = self.text
self._backspace = False | Prevent deleting text from the middle of a line of a text field. | modified_picker/picker.py | do_backspace | ShareASmile/car-locator | 21 | python | def do_backspace(self, *args):
self._backspace = True
self.text = self.text[:(- 1)]
self._date = self.text
self._backspace = False | def do_backspace(self, *args):
self._backspace = True
self.text = self.text[:(- 1)]
self._date = self.text
self._backspace = False<|docstring|>Prevent deleting text from the middle of a line of a text field.<|endoftext|> |
7b0b4f2a344a8f455f9ed7722f80a7dc10da89ceb3b29a47f28157b496b25511 | def input_filter(self, value, boolean):
'Date validity check in dd/mm/yyyy format.'
cursor = self.cursor[0]
if (len(self.text) == 10):
return
if self.isnumeric(value):
self._date += value
value = int(value)
if (cursor == 0):
if (self.owner.sel_month == 2):
... | Date validity check in dd/mm/yyyy format. | modified_picker/picker.py | input_filter | ShareASmile/car-locator | 21 | python | def input_filter(self, value, boolean):
cursor = self.cursor[0]
if (len(self.text) == 10):
return
if self.isnumeric(value):
self._date += value
value = int(value)
if (cursor == 0):
if (self.owner.sel_month == 2):
valid_value = 2
el... | def input_filter(self, value, boolean):
cursor = self.cursor[0]
if (len(self.text) == 10):
return
if self.isnumeric(value):
self._date += value
value = int(value)
if (cursor == 0):
if (self.owner.sel_month == 2):
valid_value = 2
el... |
b5c15794eab34953fbdbf875d5b126dbe552ba069b4b029830ee3400ddfe718d | def _get_list_date(self):
'\n Returns a list as `[dd, mm, yyyy]` from a text fied for entering a date.\n '
return [d for d in self.text.split('/') if d] | Returns a list as `[dd, mm, yyyy]` from a text fied for entering a date. | modified_picker/picker.py | _get_list_date | ShareASmile/car-locator | 21 | python | def _get_list_date(self):
'\n \n '
return [d for d in self.text.split('/') if d] | def _get_list_date(self):
'\n \n '
return [d for d in self.text.split('/') if d]<|docstring|>Returns a list as `[dd, mm, yyyy]` from a text fied for entering a date.<|endoftext|> |
49474ea566c519db578326d23f60c6bba7ef3dc8c53c754d8d50dd441c4ef7c5 | def update_text_full_date(self, list_date):
'\n Updates the title of the week, month and number day name\n in an open date input dialog.\n '
if ((len(list_date) == 1) and (len(list_date[0]) == 2)):
self.ids.label_full_date.text = self.set_text_full_date(self.sel_year, self.sel_month... | Updates the title of the week, month and number day name
in an open date input dialog. | modified_picker/picker.py | update_text_full_date | ShareASmile/car-locator | 21 | python | def update_text_full_date(self, list_date):
'\n Updates the title of the week, month and number day name\n in an open date input dialog.\n '
if ((len(list_date) == 1) and (len(list_date[0]) == 2)):
self.ids.label_full_date.text = self.set_text_full_date(self.sel_year, self.sel_month... | def update_text_full_date(self, list_date):
'\n Updates the title of the week, month and number day name\n in an open date input dialog.\n '
if ((len(list_date) == 1) and (len(list_date[0]) == 2)):
self.ids.label_full_date.text = self.set_text_full_date(self.sel_year, self.sel_month... |
19ae8fe4567b7c6edba1bbf4b9a3e27cbb44dafd1b6b3de3fc949a381785fce8 | def get_field(self):
'Creates and returns a text field object used to enter dates.'
field = DatePickerEnterDataField(owner=self)
field.color_mode = 'custom'
field.line_color_focus = (self.theme_cls.primary_color if (not self.input_field_text_color) else self.input_field_text_color)
field.current_hin... | Creates and returns a text field object used to enter dates. | modified_picker/picker.py | get_field | ShareASmile/car-locator | 21 | python | def get_field(self):
field = DatePickerEnterDataField(owner=self)
field.color_mode = 'custom'
field.line_color_focus = (self.theme_cls.primary_color if (not self.input_field_text_color) else self.input_field_text_color)
field.current_hint_text_color = field.line_color_focus
field._current_hint_... | def get_field(self):
field = DatePickerEnterDataField(owner=self)
field.color_mode = 'custom'
field.line_color_focus = (self.theme_cls.primary_color if (not self.input_field_text_color) else self.input_field_text_color)
field.current_hint_text_color = field.line_color_focus
field._current_hint_... |
a31f9327a225b2ba2e5a2be167c154b9e71471e2902a4bfe26eb9bf46724ddbd | def set_text_full_date(self, year, month, day, orientation):
'\n Returns a string of type "Tue, Feb 2" or "Tue,\nFeb 2" for a date\n choose and a string like "Feb 15 - Mar 23" or "Feb 15,\nMar 23" for\n a date range.\n '
if (12 < int(month) < 0):
raise ValueError(f'''set_text... | Returns a string of type "Tue, Feb 2" or "Tue,
Feb 2" for a date
choose and a string like "Feb 15 - Mar 23" or "Feb 15,
Mar 23" for
a date range. | modified_picker/picker.py | set_text_full_date | ShareASmile/car-locator | 21 | python | def set_text_full_date(self, year, month, day, orientation):
'\n Returns a string of type "Tue, Feb 2" or "Tue,\nFeb 2" for a date\n choose and a string like "Feb 15 - Mar 23" or "Feb 15,\nMar 23" for\n a date range.\n '
if (12 < int(month) < 0):
raise ValueError(f'set_text_f... | def set_text_full_date(self, year, month, day, orientation):
'\n Returns a string of type "Tue, Feb 2" or "Tue,\nFeb 2" for a date\n choose and a string like "Feb 15 - Mar 23" or "Feb 15,\nMar 23" for\n a date range.\n '
if (12 < int(month) < 0):
raise ValueError(f'set_text_f... |
321db849309a79d0a053e7a3f0de762aca726fb49c84744687b853ca978db1db | def change_month(self, operation):
'\n Called when "chevron-left" and "chevron-right" buttons are pressed.\n Switches the calendar to the previous/next month.\n '
operation = (1 if (operation == 'next') else (- 1))
month = (12 if ((self.month + operation) == 0) else (1 if ((self.month +... | Called when "chevron-left" and "chevron-right" buttons are pressed.
Switches the calendar to the previous/next month. | modified_picker/picker.py | change_month | ShareASmile/car-locator | 21 | python | def change_month(self, operation):
'\n Called when "chevron-left" and "chevron-right" buttons are pressed.\n Switches the calendar to the previous/next month.\n '
operation = (1 if (operation == 'next') else (- 1))
month = (12 if ((self.month + operation) == 0) else (1 if ((self.month +... | def change_month(self, operation):
'\n Called when "chevron-left" and "chevron-right" buttons are pressed.\n Switches the calendar to the previous/next month.\n '
operation = (1 if (operation == 'next') else (- 1))
month = (12 if ((self.month + operation) == 0) else (1 if ((self.month +... |
80785c48a0c3bde9807826e9f8e53b8c0f417f43eac217a292a15c0860018561 | def on_text(self, *args):
'\n Texts should be center aligned. now we are setting the padding of text\n to somehow make them aligned.\n '
if (not self.c):
self.c = Clock.schedule_once(self._set_padding, 0) | Texts should be center aligned. now we are setting the padding of text
to somehow make them aligned. | modified_picker/picker.py | on_text | ShareASmile/car-locator | 21 | python | def on_text(self, *args):
'\n Texts should be center aligned. now we are setting the padding of text\n to somehow make them aligned.\n '
if (not self.c):
self.c = Clock.schedule_once(self._set_padding, 0) | def on_text(self, *args):
'\n Texts should be center aligned. now we are setting the padding of text\n to somehow make them aligned.\n '
if (not self.c):
self.c = Clock.schedule_once(self._set_padding, 0)<|docstring|>Texts should be center aligned. now we are setting the padding of ... |
f4d2d2e96a9493cd96c125c38e644acda9b87f9304621feddff5060bd824ffae | def _update_labels(self, animate=True, *args):
'\n This method builds the selector based on current mode which currently\n can be hour or minute.\n '
if (self.mode == 'hour'):
param = (1, 12)
self.degree_spacing = 30
self.start_from = 60
elif (self.mode == 'minut... | This method builds the selector based on current mode which currently
can be hour or minute. | modified_picker/picker.py | _update_labels | ShareASmile/car-locator | 21 | python | def _update_labels(self, animate=True, *args):
'\n This method builds the selector based on current mode which currently\n can be hour or minute.\n '
if (self.mode == 'hour'):
param = (1, 12)
self.degree_spacing = 30
self.start_from = 60
elif (self.mode == 'minut... | def _update_labels(self, animate=True, *args):
'\n This method builds the selector based on current mode which currently\n can be hour or minute.\n '
if (self.mode == 'hour'):
param = (1, 12)
self.degree_spacing = 30
self.start_from = 60
elif (self.mode == 'minut... |
f26dfca3de22b29e5ecfffdaff43a679ecca43e0fbac46667e0125df49a63f5f | def _add_items(self, start, end, step=1):
"\n Adds all number in range `[start, end + 1]` to the circular layout with\n the specified step. Step means that all widgets will be added to layout\n but sets the opacity for skipped widgets to `0` because we are using\n the label's text as a r... | Adds all number in range `[start, end + 1]` to the circular layout with
the specified step. Step means that all widgets will be added to layout
but sets the opacity for skipped widgets to `0` because we are using
the label's text as a reference to the selected number so we have to
add these to layout. | modified_picker/picker.py | _add_items | ShareASmile/car-locator | 21 | python | def _add_items(self, start, end, step=1):
"\n Adds all number in range `[start, end + 1]` to the circular layout with\n the specified step. Step means that all widgets will be added to layout\n but sets the opacity for skipped widgets to `0` because we are using\n the label's text as a r... | def _add_items(self, start, end, step=1):
"\n Adds all number in range `[start, end + 1]` to the circular layout with\n the specified step. Step means that all widgets will be added to layout\n but sets the opacity for skipped widgets to `0` because we are using\n the label's text as a r... |
081d5be0ab7c3334a27a097ab32bc3a173ca24a0145fa84a4948e0ed0d7f5069 | def _get_centers(self, *args):
'\n Returns a list of all center. we use this for positioning the selector\n indicator.\n '
self._centers_pos = []
for child in self.children:
self._centers_pos.append(child.center) | Returns a list of all center. we use this for positioning the selector
indicator. | modified_picker/picker.py | _get_centers | ShareASmile/car-locator | 21 | python | def _get_centers(self, *args):
'\n Returns a list of all center. we use this for positioning the selector\n indicator.\n '
self._centers_pos = []
for child in self.children:
self._centers_pos.append(child.center) | def _get_centers(self, *args):
'\n Returns a list of all center. we use this for positioning the selector\n indicator.\n '
self._centers_pos = []
for child in self.children:
self._centers_pos.append(child.center)<|docstring|>Returns a list of all center. we use this for position... |
ecc4098b106cc9abe0536563fb8f1c613dbdda09b6105823741026ca716c777c | def _get_closest_widget(self, pos):
'\n Returns the nearest widget to the given position. we use this to create\n the magnetic effect.\n '
distance = [Vector(pos).distance(point) for point in self._centers_pos]
if (not distance):
return False
index = distance.index(min(dista... | Returns the nearest widget to the given position. we use this to create
the magnetic effect. | modified_picker/picker.py | _get_closest_widget | ShareASmile/car-locator | 21 | python | def _get_closest_widget(self, pos):
'\n Returns the nearest widget to the given position. we use this to create\n the magnetic effect.\n '
distance = [Vector(pos).distance(point) for point in self._centers_pos]
if (not distance):
return False
index = distance.index(min(dista... | def _get_closest_widget(self, pos):
'\n Returns the nearest widget to the given position. we use this to create\n the magnetic effect.\n '
distance = [Vector(pos).distance(point) for point in self._centers_pos]
if (not distance):
return False
index = distance.index(min(dista... |
92e9795b9781eef257adcf475d00088eee93155e878ac16655e205f1252fd1de | def set_selector(self, selected):
"\n Sets the selector's position towards the given text.\n "
widget = None
for wid in self.children:
wid.text_color = self.text_color
if (wid.text == selected):
widget = wid
if (not widget):
return False
self.selecto... | Sets the selector's position towards the given text. | modified_picker/picker.py | set_selector | ShareASmile/car-locator | 21 | python | def set_selector(self, selected):
"\n \n "
widget = None
for wid in self.children:
wid.text_color = self.text_color
if (wid.text == selected):
widget = wid
if (not widget):
return False
self.selector_pos = widget.center
widget.text_color = [1, 1,... | def set_selector(self, selected):
"\n \n "
widget = None
for wid in self.children:
wid.text_color = self.text_color
if (wid.text == selected):
widget = wid
if (not widget):
return False
self.selector_pos = widget.center
widget.text_color = [1, 1,... |
f2e36d314ab3569de066f354152a8e791bd2b8e61cb78d5e0c6bb25e47cd2aca | def set_time(self, time_obj):
'\n Manually set time dialog with the specified time.\n '
hour = time_obj.hour
minute = time_obj.minute
if (hour > 12):
hour -= 12
mode = 'pm'
else:
mode = 'am'
hour = str(hour)
minute = str(minute)
self._set_time_input(... | Manually set time dialog with the specified time. | modified_picker/picker.py | set_time | ShareASmile/car-locator | 21 | python | def set_time(self, time_obj):
'\n \n '
hour = time_obj.hour
minute = time_obj.minute
if (hour > 12):
hour -= 12
mode = 'pm'
else:
mode = 'am'
hour = str(hour)
minute = str(minute)
self._set_time_input(hour, minute)
self._set_dial_time(hour, minut... | def set_time(self, time_obj):
'\n \n '
hour = time_obj.hour
minute = time_obj.minute
if (hour > 12):
hour -= 12
mode = 'pm'
else:
mode = 'am'
hour = str(hour)
minute = str(minute)
self._set_time_input(hour, minute)
self._set_dial_time(hour, minut... |
1b63d0c5589578011c2c8851f7102a14fe3ca8ca93b7956e36cabc522d4641a1 | def get_state(self):
'\n Returns the current state of TimePicker.\n Can be one of `portrait`, `landscape` or `input`.\n '
return self._state | Returns the current state of TimePicker.
Can be one of `portrait`, `landscape` or `input`. | modified_picker/picker.py | get_state | ShareASmile/car-locator | 21 | python | def get_state(self):
'\n Returns the current state of TimePicker.\n Can be one of `portrait`, `landscape` or `input`.\n '
return self._state | def get_state(self):
'\n Returns the current state of TimePicker.\n Can be one of `portrait`, `landscape` or `input`.\n '
return self._state<|docstring|>Returns the current state of TimePicker.
Can be one of `portrait`, `landscape` or `input`.<|endoftext|> |
ac181a61f8f8749b28b9121e87dc31a97a1acbefbfcb42d2021c8f7359ed68e0 | def load_data(train_path, val_path, test_path):
'\n Load data from csvs into a dictionary for the different splits.\n Args:\n train_path (str): path to csv with training data\n val_path (str): path to csv with validation data\n test_path (str): path to csv with test data\n Returns:\n da... | Load data from csvs into a dictionary for the different splits.
Args:
train_path (str): path to csv with training data
val_path (str): path to csv with validation data
test_path (str): path to csv with test data
Returns:
data (dict): dictionary of the form {split: sub_dic} for each
split, where sub_dic cont... | scripts/cp3d/sklearn/run.py | load_data | jkaraguesian/NeuralForceField | 0 | python | def load_data(train_path, val_path, test_path):
'\n Load data from csvs into a dictionary for the different splits.\n Args:\n train_path (str): path to csv with training data\n val_path (str): path to csv with validation data\n test_path (str): path to csv with test data\n Returns:\n da... | def load_data(train_path, val_path, test_path):
'\n Load data from csvs into a dictionary for the different splits.\n Args:\n train_path (str): path to csv with training data\n val_path (str): path to csv with validation data\n test_path (str): path to csv with test data\n Returns:\n da... |
18d8963c8022a3e91c5850b7fa591d34e12e4036823e7bc05696aab7ab4aae87 | def make_mol_rep(data, splits, props, fp_type, fp_kwargs):
"\n Make representations for each molecule through Morgan fingerprints,\n and combine all the labels into an array.\n Args:\n data (dict): dictionary with data for each split\n splits (list[str]): name of the splits to use (e.g. train, va... | Make representations for each molecule through Morgan fingerprints,
and combine all the labels into an array.
Args:
data (dict): dictionary with data for each split
splits (list[str]): name of the splits to use (e.g. train, val, test)
props (list[str]): properties you'll want to predict with the model.
fp_type ... | scripts/cp3d/sklearn/run.py | make_mol_rep | jkaraguesian/NeuralForceField | 0 | python | def make_mol_rep(data, splits, props, fp_type, fp_kwargs):
"\n Make representations for each molecule through Morgan fingerprints,\n and combine all the labels into an array.\n Args:\n data (dict): dictionary with data for each split\n splits (list[str]): name of the splits to use (e.g. train, va... | def make_mol_rep(data, splits, props, fp_type, fp_kwargs):
"\n Make representations for each molecule through Morgan fingerprints,\n and combine all the labels into an array.\n Args:\n data (dict): dictionary with data for each split\n splits (list[str]): name of the splits to use (e.g. train, va... |
c82e73bf6947e578447c30d629ecd76269d1d38553f2c0a7e2f76dec483edcd1 | def get_hyperparams(model_type, classifier, custom_hyps=None, fp_type='morgan'):
"\n Get hyperparameters and ranges to be optimized for a\n given model type.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n custom_hyps (di... | Get hyperparameters and ranges to be optimized for a
given model type.
Args:
model_type (str): name of model (e.g. random_forest)
classifier (bool): whether or not it's a classifier
custom_hyps (dict): Dictionary of the form {hyperparam: new_vals}
for each hyperparameter, where `new_vals` is the range you w... | scripts/cp3d/sklearn/run.py | get_hyperparams | jkaraguesian/NeuralForceField | 0 | python | def get_hyperparams(model_type, classifier, custom_hyps=None, fp_type='morgan'):
"\n Get hyperparameters and ranges to be optimized for a\n given model type.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n custom_hyps (di... | def get_hyperparams(model_type, classifier, custom_hyps=None, fp_type='morgan'):
"\n Get hyperparameters and ranges to be optimized for a\n given model type.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n custom_hyps (di... |
abc39c03f1eb98fbdbc05d6e1df45dfec25063ea9cc35917fe725f0f48f035d8 | def make_space(model_type, classifier, fp_type='morgan'):
"\n Make `hyperopt` space of hyperparameters.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n fp_type (str, optional): type of fingerprint to use\n Returns:\n ... | Make `hyperopt` space of hyperparameters.
Args:
model_type (str): name of model (e.g. random_forest)
classifier (bool): whether or not it's a classifier
fp_type (str, optional): type of fingerprint to use
Returns:
space (dict): hyperopt` space of hyperparameters | scripts/cp3d/sklearn/run.py | make_space | jkaraguesian/NeuralForceField | 0 | python | def make_space(model_type, classifier, fp_type='morgan'):
"\n Make `hyperopt` space of hyperparameters.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n fp_type (str, optional): type of fingerprint to use\n Returns:\n ... | def make_space(model_type, classifier, fp_type='morgan'):
"\n Make `hyperopt` space of hyperparameters.\n Args:\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or not it's a classifier\n fp_type (str, optional): type of fingerprint to use\n Returns:\n ... |
7225d54376f19f89aa6a93c0811f8f36a5fd1508627b1d00016461bcac571cf4 | def make_sample_data(max_specs, data, props, seed):
"\n Get a sample of the data for hyperopt.\n Args:\n max_specs (int, optional): maximum number of species to use in hyperopt\n data (dict): dictionary with data for each split\n props (list[str]): properties you'll want to predict with the mod... | Get a sample of the data for hyperopt.
Args:
max_specs (int, optional): maximum number of species to use in hyperopt
data (dict): dictionary with data for each split
props (list[str]): properties you'll want to predict with the model.
seed (int, optional): seed to use if we take a subsample of the data
Returns:... | scripts/cp3d/sklearn/run.py | make_sample_data | jkaraguesian/NeuralForceField | 0 | python | def make_sample_data(max_specs, data, props, seed):
"\n Get a sample of the data for hyperopt.\n Args:\n max_specs (int, optional): maximum number of species to use in hyperopt\n data (dict): dictionary with data for each split\n props (list[str]): properties you'll want to predict with the mod... | def make_sample_data(max_specs, data, props, seed):
"\n Get a sample of the data for hyperopt.\n Args:\n max_specs (int, optional): maximum number of species to use in hyperopt\n data (dict): dictionary with data for each split\n props (list[str]): properties you'll want to predict with the mod... |
6daf15b3793efcc30d89241f3ef699835659653cd119bda0529190548c42a3c7 | def get_splits(space, data, props, max_specs=None, seed=None, fp_type='morgan'):
"\n Get representations and values of the data given a certain\n set of Morgan hyperparameters.\n Args:\n space (dict): hyperopt` space of hyperparameters\n data (dict): dictionary with data for each split\n pro... | Get representations and values of the data given a certain
set of Morgan hyperparameters.
Args:
space (dict): hyperopt` space of hyperparameters
data (dict): dictionary with data for each split
props (list[str]): properties you'll want to predict with the model.
max_specs (int, optional): maximum number of spec... | scripts/cp3d/sklearn/run.py | get_splits | jkaraguesian/NeuralForceField | 0 | python | def get_splits(space, data, props, max_specs=None, seed=None, fp_type='morgan'):
"\n Get representations and values of the data given a certain\n set of Morgan hyperparameters.\n Args:\n space (dict): hyperopt` space of hyperparameters\n data (dict): dictionary with data for each split\n pro... | def get_splits(space, data, props, max_specs=None, seed=None, fp_type='morgan'):
"\n Get representations and values of the data given a certain\n set of Morgan hyperparameters.\n Args:\n space (dict): hyperopt` space of hyperparameters\n data (dict): dictionary with data for each split\n pro... |
156b60ae28cbe8d9e0a9f76a3548f8a45e3cccb58f78fcd6bba66ee7f6303fd3 | def balance_weights(y_train):
'\n Make balanced weights. This can apply to a classification\n model being fit by a classifier or by a regressor.\n Args:\n y_train (np.array): training labels\n Returns:\n sample_weight (np.array): weights for each \n item.\n '
pos_idx = (y_train =... | Make balanced weights. This can apply to a classification
model being fit by a classifier or by a regressor.
Args:
y_train (np.array): training labels
Returns:
sample_weight (np.array): weights for each
item. | scripts/cp3d/sklearn/run.py | balance_weights | jkaraguesian/NeuralForceField | 0 | python | def balance_weights(y_train):
'\n Make balanced weights. This can apply to a classification\n model being fit by a classifier or by a regressor.\n Args:\n y_train (np.array): training labels\n Returns:\n sample_weight (np.array): weights for each \n item.\n '
pos_idx = (y_train =... | def balance_weights(y_train):
'\n Make balanced weights. This can apply to a classification\n model being fit by a classifier or by a regressor.\n Args:\n y_train (np.array): training labels\n Returns:\n sample_weight (np.array): weights for each \n item.\n '
pos_idx = (y_train =... |
241131676c26d50acea34016c3671d52599c2aecfe6b950b73143d835329f63a | def run_sklearn(space, seed, model_type, classifier, x_train, y_train, x_test, y_test):
"\n Train an sklearn model.\n Args:\n space (dict): hyperopt` space of hyperparameters\n seed (int): random seed\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or no... | Train an sklearn model.
Args:
space (dict): hyperopt` space of hyperparameters
seed (int): random seed
model_type (str): name of model (e.g. random_forest)
classifier (bool): whether or not it's a classifier
x_train (np.array): input in training set
y_train (np.array): output in training set
x_test (np.ar... | scripts/cp3d/sklearn/run.py | run_sklearn | jkaraguesian/NeuralForceField | 0 | python | def run_sklearn(space, seed, model_type, classifier, x_train, y_train, x_test, y_test):
"\n Train an sklearn model.\n Args:\n space (dict): hyperopt` space of hyperparameters\n seed (int): random seed\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or no... | def run_sklearn(space, seed, model_type, classifier, x_train, y_train, x_test, y_test):
"\n Train an sklearn model.\n Args:\n space (dict): hyperopt` space of hyperparameters\n seed (int): random seed\n model_type (str): name of model (e.g. random_forest)\n classifier (bool): whether or no... |
dc2a284acbc243a7306d09de989e3e296b8877649b513f2d36432e95e8f5cd90 | def get_metrics(pred, real, score_metrics, props):
'\n Get scores on various metrics.\n Args:\n pred (np.array): predicted values\n real (np.array): real values\n score_metrics (list[str]): metrics to use\n props (list[str]): properties being predicted.\n Returns:\n metric_scores (... | Get scores on various metrics.
Args:
pred (np.array): predicted values
real (np.array): real values
score_metrics (list[str]): metrics to use
props (list[str]): properties being predicted.
Returns:
metric_scores (dict): dictionary of the form
{prop: sub_dic} for each property, where sub_dic
has the fo... | scripts/cp3d/sklearn/run.py | get_metrics | jkaraguesian/NeuralForceField | 0 | python | def get_metrics(pred, real, score_metrics, props):
'\n Get scores on various metrics.\n Args:\n pred (np.array): predicted values\n real (np.array): real values\n score_metrics (list[str]): metrics to use\n props (list[str]): properties being predicted.\n Returns:\n metric_scores (... | def get_metrics(pred, real, score_metrics, props):
'\n Get scores on various metrics.\n Args:\n pred (np.array): predicted values\n real (np.array): real values\n score_metrics (list[str]): metrics to use\n props (list[str]): properties being predicted.\n Returns:\n metric_scores (... |
7d6e462b7ea3691a97e968c319a6ea585e6d3395dbf4c0cfbaa36395008b87a9 | def update_saved_scores(score_path, space, metrics):
'\n Update saved hyperparameter scores with new results.\n Args:\n score_path (str): path to JSON file with scores\n space (dict): hyperopt` space of hyperparameters\n metrics (dict): scores on various metrics.\n Returns:\n None\n ... | Update saved hyperparameter scores with new results.
Args:
score_path (str): path to JSON file with scores
space (dict): hyperopt` space of hyperparameters
metrics (dict): scores on various metrics.
Returns:
None | scripts/cp3d/sklearn/run.py | update_saved_scores | jkaraguesian/NeuralForceField | 0 | python | def update_saved_scores(score_path, space, metrics):
'\n Update saved hyperparameter scores with new results.\n Args:\n score_path (str): path to JSON file with scores\n space (dict): hyperopt` space of hyperparameters\n metrics (dict): scores on various metrics.\n Returns:\n None\n ... | def update_saved_scores(score_path, space, metrics):
'\n Update saved hyperparameter scores with new results.\n Args:\n score_path (str): path to JSON file with scores\n space (dict): hyperopt` space of hyperparameters\n metrics (dict): scores on various metrics.\n Returns:\n None\n ... |
82f68e7593f20c01ef089e6056fb86627aae2ca1d88b53952b2cf9736c0dedc1 | def make_objective(data, metric_name, seed, classifier, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Make objective function for `hyperopt`.\n Args:\n data (dict): dictionary with data for each split\n metric_name (str): metric to optimize\n seed (int): ra... | Make objective function for `hyperopt`.
Args:
data (dict): dictionary with data for each split
metric_name (str): metric to optimize
seed (int): random seed
classifier (bool): whether the model is a classifier
hyper_score_path (str): path to JSON file to save hyperparameter
scores.
model_type (str): nam... | scripts/cp3d/sklearn/run.py | make_objective | jkaraguesian/NeuralForceField | 0 | python | def make_objective(data, metric_name, seed, classifier, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Make objective function for `hyperopt`.\n Args:\n data (dict): dictionary with data for each split\n metric_name (str): metric to optimize\n seed (int): ra... | def make_objective(data, metric_name, seed, classifier, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Make objective function for `hyperopt`.\n Args:\n data (dict): dictionary with data for each split\n metric_name (str): metric to optimize\n seed (int): ra... |
9ee4e61acefa133034794f17a5b703c299f0f3c47512eec54b929391e2a2ecfa | def translate_best_params(best_params, model_type, classifier, fp_type='morgan'):
'\n Translate the hyperparameters outputted by hyperopt.\n Args:\n best_params (dict): parameters outputted by hyperopt\n model_type (str): name of model type to be trained.\n classifier (bool): whether the model ... | Translate the hyperparameters outputted by hyperopt.
Args:
best_params (dict): parameters outputted by hyperopt
model_type (str): name of model type to be trained.
classifier (bool): whether the model is a classifier
fp_type (str, optional): type of fingerprint to use
Returns:
translate_params (dict): transla... | scripts/cp3d/sklearn/run.py | translate_best_params | jkaraguesian/NeuralForceField | 0 | python | def translate_best_params(best_params, model_type, classifier, fp_type='morgan'):
'\n Translate the hyperparameters outputted by hyperopt.\n Args:\n best_params (dict): parameters outputted by hyperopt\n model_type (str): name of model type to be trained.\n classifier (bool): whether the model ... | def translate_best_params(best_params, model_type, classifier, fp_type='morgan'):
'\n Translate the hyperparameters outputted by hyperopt.\n Args:\n best_params (dict): parameters outputted by hyperopt\n model_type (str): name of model type to be trained.\n classifier (bool): whether the model ... |
ef7d517ec4f2d8b7acca824e3e3e23944d0a6140a3173faca4d4fde54d0391bd | def get_preds(pred_fn, score_metrics, xy_dic, props):
'\n Get predictions and scores from a model.\n Args:\n pred_fn (callable): trained model\n score_metrics (list[str]): metrics to evaluate\n xy_dic (dict): dictionary of inputs and outputs for\n each split\n props (list[str]): pro... | Get predictions and scores from a model.
Args:
pred_fn (callable): trained model
score_metrics (list[str]): metrics to evaluate
xy_dic (dict): dictionary of inputs and outputs for
each split
props (list[str]): properties to predict
Returns:
results (dict): dictionary of the form {prop: sub_dic}
for ea... | scripts/cp3d/sklearn/run.py | get_preds | jkaraguesian/NeuralForceField | 0 | python | def get_preds(pred_fn, score_metrics, xy_dic, props):
'\n Get predictions and scores from a model.\n Args:\n pred_fn (callable): trained model\n score_metrics (list[str]): metrics to evaluate\n xy_dic (dict): dictionary of inputs and outputs for\n each split\n props (list[str]): pro... | def get_preds(pred_fn, score_metrics, xy_dic, props):
'\n Get predictions and scores from a model.\n Args:\n pred_fn (callable): trained model\n score_metrics (list[str]): metrics to evaluate\n xy_dic (dict): dictionary of inputs and outputs for\n each split\n props (list[str]): pro... |
efc2c53da2f5a8c9dff274bdd9714faca2d0f2a47611e62e8e3e93284c537b5b | def save_preds(ensemble_preds, ensemble_scores, pred_save_path, score_save_path, pred_fns):
'\n Save predictions and models.\n Args:\n ensemble_preds (dict): predictions\n ensemble_scores (dict): scores\n pred_save_path (str): path to JSON file in which to save\n predictions.\n scor... | Save predictions and models.
Args:
ensemble_preds (dict): predictions
ensemble_scores (dict): scores
pred_save_path (str): path to JSON file in which to save
predictions.
score_save_path (str): path to JSON file in which to save
scores.
pred_fns (dict): Dictionary of fitted models for each seed
Retur... | scripts/cp3d/sklearn/run.py | save_preds | jkaraguesian/NeuralForceField | 0 | python | def save_preds(ensemble_preds, ensemble_scores, pred_save_path, score_save_path, pred_fns):
'\n Save predictions and models.\n Args:\n ensemble_preds (dict): predictions\n ensemble_scores (dict): scores\n pred_save_path (str): path to JSON file in which to save\n predictions.\n scor... | def save_preds(ensemble_preds, ensemble_scores, pred_save_path, score_save_path, pred_fns):
'\n Save predictions and models.\n Args:\n ensemble_preds (dict): predictions\n ensemble_scores (dict): scores\n pred_save_path (str): path to JSON file in which to save\n predictions.\n scor... |
d71ac2f0072aa63e6ac641537ba1875a30211cda1e5fb3054381f82101f3e98d | def get_or_load_hypers(hyper_save_path, rerun_hyper, data, hyper_metric, seed, classifier, num_samples, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Optimize hyperparameters or load hyperparameters if\n they've already been otpimized.\n Args:\n hyper_save_path (s... | Optimize hyperparameters or load hyperparameters if
they've already been otpimized.
Args:
hyper_save_path (str): path to best hyperparameters
rerun_hyper (bool): rerun the hyperparameter optimization
even if `hyper_save_path` exists.
data (dict): dictionary with data for each split
hyper_metric (str): metri... | scripts/cp3d/sklearn/run.py | get_or_load_hypers | jkaraguesian/NeuralForceField | 0 | python | def get_or_load_hypers(hyper_save_path, rerun_hyper, data, hyper_metric, seed, classifier, num_samples, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Optimize hyperparameters or load hyperparameters if\n they've already been otpimized.\n Args:\n hyper_save_path (s... | def get_or_load_hypers(hyper_save_path, rerun_hyper, data, hyper_metric, seed, classifier, num_samples, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type='morgan'):
"\n Optimize hyperparameters or load hyperparameters if\n they've already been otpimized.\n Args:\n hyper_save_path (s... |
c119f0338cc1eca69687b684a666c1d3793cf81d9926cc5c0bc75a59f2a30a87 | def get_ensemble_preds(test_folds, translate_params, data, classifier, score_metrics, model_type, props, fp_type='morgan'):
"\n Get ensemble-averaged predictions from a model.\n Args:\n test_folds (int): number of different models to train\n and evaluate on the test set\n translate_params (di... | Get ensemble-averaged predictions from a model.
Args:
test_folds (int): number of different models to train
and evaluate on the test set
translate_params (dict): best hyperparameters
data (dict): dictionary with data for each split
classifier (bool): whether the model is a classifier
score_metrics (list[s... | scripts/cp3d/sklearn/run.py | get_ensemble_preds | jkaraguesian/NeuralForceField | 0 | python | def get_ensemble_preds(test_folds, translate_params, data, classifier, score_metrics, model_type, props, fp_type='morgan'):
"\n Get ensemble-averaged predictions from a model.\n Args:\n test_folds (int): number of different models to train\n and evaluate on the test set\n translate_params (di... | def get_ensemble_preds(test_folds, translate_params, data, classifier, score_metrics, model_type, props, fp_type='morgan'):
"\n Get ensemble-averaged predictions from a model.\n Args:\n test_folds (int): number of different models to train\n and evaluate on the test set\n translate_params (di... |
6a2328a305b8b0de48c5152429ab09c90e64ee6883df604a44a403ea663caf96 | def hyper_and_train(train_path, val_path, test_path, pred_save_path, score_save_path, num_samples, hyper_metric, seed, score_metrics, hyper_save_path, rerun_hyper, classifier, test_folds, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type, **kwargs):
"\n Run hyperparameter optimization and trai... | Run hyperparameter optimization and train an ensemble of models.
Args:
train_path (str): path to csv with training data
val_path (str): path to csv with validation data
test_path (str): path to csv with test data
pred_save_path (str): path to JSON file in which to save
predictions.
score_save_path (str): ... | scripts/cp3d/sklearn/run.py | hyper_and_train | jkaraguesian/NeuralForceField | 0 | python | def hyper_and_train(train_path, val_path, test_path, pred_save_path, score_save_path, num_samples, hyper_metric, seed, score_metrics, hyper_save_path, rerun_hyper, classifier, test_folds, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type, **kwargs):
"\n Run hyperparameter optimization and trai... | def hyper_and_train(train_path, val_path, test_path, pred_save_path, score_save_path, num_samples, hyper_metric, seed, score_metrics, hyper_save_path, rerun_hyper, classifier, test_folds, hyper_score_path, model_type, props, max_specs, custom_hyps, fp_type, **kwargs):
"\n Run hyperparameter optimization and trai... |
1c57fa41d0ba515ab1c106c889ecf9e2babcc620a167ed7b13b891f5b36ec854 | def firstUniqChar(s):
'\n :type s: str\n :rtype: int\n '
mapping = {}
for x in s:
if (x not in mapping):
mapping[x] = 1
else:
mapping[x] += 1
for i in range(len(s)):
x = s[i]
if (mapping[x] == 1):
return i
return (- 1) | :type s: str
:rtype: int | Amazon/FirstUniqueCharacter.py | firstUniqChar | roeiherz/CodingInterviews | 0 | python | def firstUniqChar(s):
'\n :type s: str\n :rtype: int\n '
mapping = {}
for x in s:
if (x not in mapping):
mapping[x] = 1
else:
mapping[x] += 1
for i in range(len(s)):
x = s[i]
if (mapping[x] == 1):
return i
return (- 1) | def firstUniqChar(s):
'\n :type s: str\n :rtype: int\n '
mapping = {}
for x in s:
if (x not in mapping):
mapping[x] = 1
else:
mapping[x] += 1
for i in range(len(s)):
x = s[i]
if (mapping[x] == 1):
return i
return (- 1)<|doc... |
b5cb8072a8d34ec62fbb6d7c601421bc26e6b3502cdb93c2b75769a04150bb09 | def parse_name(name, from_i, to_i, mapping=None):
'Source: https://audeering.github.io/audformat/emodb-example.html'
key = name[from_i:to_i]
return (mapping[key] if mapping else key) | Source: https://audeering.github.io/audformat/emodb-example.html | tensorflow_datasets/aesdd/aesdd.py | parse_name | Neclow/SERAB | 10 | python | def parse_name(name, from_i, to_i, mapping=None):
key = name[from_i:to_i]
return (mapping[key] if mapping else key) | def parse_name(name, from_i, to_i, mapping=None):
key = name[from_i:to_i]
return (mapping[key] if mapping else key)<|docstring|>Source: https://audeering.github.io/audformat/emodb-example.html<|endoftext|> |
6fbc0beaecb972fbc4575a52ceae1b1c40ef4432593915e3b95ee54d03f2a4f3 | def _compute_split_boundaries(split_probs, n_items):
"Computes boundary indices for each of the splits in split_probs.\n Args:\n split_probs: List of (split_name, prob), e.g. [('train', 0.6), ('dev', 0.2),\n ('test', 0.2)]\n n_items: Number of items we want to split.\n Returns:\n The ite... | Computes boundary indices for each of the splits in split_probs.
Args:
split_probs: List of (split_name, prob), e.g. [('train', 0.6), ('dev', 0.2),
('test', 0.2)]
n_items: Number of items we want to split.
Returns:
The item indices of boundaries between different splits. For the above
example and n_items=10... | tensorflow_datasets/aesdd/aesdd.py | _compute_split_boundaries | Neclow/SERAB | 10 | python | def _compute_split_boundaries(split_probs, n_items):
"Computes boundary indices for each of the splits in split_probs.\n Args:\n split_probs: List of (split_name, prob), e.g. [('train', 0.6), ('dev', 0.2),\n ('test', 0.2)]\n n_items: Number of items we want to split.\n Returns:\n The ite... | def _compute_split_boundaries(split_probs, n_items):
"Computes boundary indices for each of the splits in split_probs.\n Args:\n split_probs: List of (split_name, prob), e.g. [('train', 0.6), ('dev', 0.2),\n ('test', 0.2)]\n n_items: Number of items we want to split.\n Returns:\n The ite... |
41f7db59d75db22c8a4b6f153a5692b878609250e6ce8c295a64988331df2cbc | def _get_inter_splits_by_group(items_and_groups, split_probs, split_number):
"Split items to train/dev/test, so all items in group go into same split.\n Each group contains all the samples from the same speaker ID. The samples are\n splitted so that all each speaker belongs to exactly one split.\n Args:\n ... | Split items to train/dev/test, so all items in group go into same split.
Each group contains all the samples from the same speaker ID. The samples are
splitted so that all each speaker belongs to exactly one split.
Args:
items_and_groups: Sequence of (item_id, group_id) pairs.
split_probs: List of (split_name, prob... | tensorflow_datasets/aesdd/aesdd.py | _get_inter_splits_by_group | Neclow/SERAB | 10 | python | def _get_inter_splits_by_group(items_and_groups, split_probs, split_number):
"Split items to train/dev/test, so all items in group go into same split.\n Each group contains all the samples from the same speaker ID. The samples are\n splitted so that all each speaker belongs to exactly one split.\n Args:\n ... | def _get_inter_splits_by_group(items_and_groups, split_probs, split_number):
"Split items to train/dev/test, so all items in group go into same split.\n Each group contains all the samples from the same speaker ID. The samples are\n splitted so that all each speaker belongs to exactly one split.\n Args:\n ... |
0919d45dd14f7dadccd4533ad9830233fa1739871cd978a2411cca4431cb7d75 | def _info(self) -> tfds.core.DatasetInfo:
'Returns the dataset metadata.'
return tfds.core.DatasetInfo(builder=self, description=_DESCRIPTION, features=tfds.features.FeaturesDict({'audio': tfds.features.Audio(file_format='wav', sample_rate=_SAMPLE_RATE), 'label': tfds.features.ClassLabel(names=_LABEL_MAP.values... | Returns the dataset metadata. | tensorflow_datasets/aesdd/aesdd.py | _info | Neclow/SERAB | 10 | python | def _info(self) -> tfds.core.DatasetInfo:
return tfds.core.DatasetInfo(builder=self, description=_DESCRIPTION, features=tfds.features.FeaturesDict({'audio': tfds.features.Audio(file_format='wav', sample_rate=_SAMPLE_RATE), 'label': tfds.features.ClassLabel(names=_LABEL_MAP.values()), 'speaker_id': tf.string}),... | def _info(self) -> tfds.core.DatasetInfo:
return tfds.core.DatasetInfo(builder=self, description=_DESCRIPTION, features=tfds.features.FeaturesDict({'audio': tfds.features.Audio(file_format='wav', sample_rate=_SAMPLE_RATE), 'label': tfds.features.ClassLabel(names=_LABEL_MAP.values()), 'speaker_id': tf.string}),... |
4c664c4b03d6208c8ddb78ee6609c3fa1d923b243cbb80820ee31f1288a2e933 | def _split_generators(self, dl_manager: tfds.download.DownloadManager):
'Returns SplitGenerators.'
zip_path = os.path.join(dl_manager.manual_dir, 'Acted Emotional Speech Dynamic Database.zip')
if (not tf.io.gfile.exists(zip_path)):
raise AssertionError('AESDD requires manual download of the data. Pl... | Returns SplitGenerators. | tensorflow_datasets/aesdd/aesdd.py | _split_generators | Neclow/SERAB | 10 | python | def _split_generators(self, dl_manager: tfds.download.DownloadManager):
zip_path = os.path.join(dl_manager.manual_dir, 'Acted Emotional Speech Dynamic Database.zip')
if (not tf.io.gfile.exists(zip_path)):
raise AssertionError('AESDD requires manual download of the data. Please download the audio da... | def _split_generators(self, dl_manager: tfds.download.DownloadManager):
zip_path = os.path.join(dl_manager.manual_dir, 'Acted Emotional Speech Dynamic Database.zip')
if (not tf.io.gfile.exists(zip_path)):
raise AssertionError('AESDD requires manual download of the data. Please download the audio da... |
0675f33c16b41a62faa9bcd382a1ee4dd46f495ec92cac0511a991c2989061c9 | def _generate_examples(self, file_names):
'Yields examples.'
for fname in file_names:
wavname = os.path.basename(fname)
speaker_id = parse_speaker_id(wavname)
label = parse_name(wavname, from_i=0, to_i=1, mapping=_LABEL_MAP)
example = {'audio': fname, 'label': label, 'speaker_id'... | Yields examples. | tensorflow_datasets/aesdd/aesdd.py | _generate_examples | Neclow/SERAB | 10 | python | def _generate_examples(self, file_names):
for fname in file_names:
wavname = os.path.basename(fname)
speaker_id = parse_speaker_id(wavname)
label = parse_name(wavname, from_i=0, to_i=1, mapping=_LABEL_MAP)
example = {'audio': fname, 'label': label, 'speaker_id': speaker_id}
... | def _generate_examples(self, file_names):
for fname in file_names:
wavname = os.path.basename(fname)
speaker_id = parse_speaker_id(wavname)
label = parse_name(wavname, from_i=0, to_i=1, mapping=_LABEL_MAP)
example = {'audio': fname, 'label': label, 'speaker_id': speaker_id}
... |
f21d718b2a0a439f72edd3fcf9dfb6dd196fcc043f518a6fa5b09d72f18c54d2 | def get(self, request, *args, **kwargs):
'\n Render media list\n\n :param request: The current request\n :type request: ~django.http.HttpResponse\n\n :param args: The supplied arguments\n :type args: list\n\n :param kwargs: The supplied keyword arguments\n :type kwar... | Render media list
:param request: The current request
:type request: ~django.http.HttpResponse
:param args: The supplied arguments
:type args: list
:param kwargs: The supplied keyword arguments
:type kwargs: dict
:return: The rendered template response
:rtype: ~django.template.response.TemplateResponse | src/cms/views/media/media_list_view.py | get | mckinly/cms-django | 0 | python | def get(self, request, *args, **kwargs):
'\n Render media list\n\n :param request: The current request\n :type request: ~django.http.HttpResponse\n\n :param args: The supplied arguments\n :type args: list\n\n :param kwargs: The supplied keyword arguments\n :type kwar... | def get(self, request, *args, **kwargs):
'\n Render media list\n\n :param request: The current request\n :type request: ~django.http.HttpResponse\n\n :param args: The supplied arguments\n :type args: list\n\n :param kwargs: The supplied keyword arguments\n :type kwar... |
dc7899e02060ccd7ada54a510e1c30233ce3c66c040e51faf36ee00ca05b9840 | def get_tweets_from_screen_name(screen_name, credentials):
"\n Get the last 3240 tweets (maximum allowed by the API) from an user\n with given screen name.\n Adapted from https://gist.github.com/yanofsky/5436496\n\n Parameters:\n screen_name: str, the screen_name of the user (ex: @random_user bec... | Get the last 3240 tweets (maximum allowed by the API) from an user
with given screen name.
Adapted from https://gist.github.com/yanofsky/5436496
Parameters:
screen_name: str, the screen_name of the user (ex: @random_user becomes
'random_user')
credentials: dic, contain the credentials for... | utils.py | get_tweets_from_screen_name | delpapa/TweetGen | 0 | python | def get_tweets_from_screen_name(screen_name, credentials):
"\n Get the last 3240 tweets (maximum allowed by the API) from an user\n with given screen name.\n Adapted from https://gist.github.com/yanofsky/5436496\n\n Parameters:\n screen_name: str, the screen_name of the user (ex: @random_user bec... | def get_tweets_from_screen_name(screen_name, credentials):
"\n Get the last 3240 tweets (maximum allowed by the API) from an user\n with given screen name.\n Adapted from https://gist.github.com/yanofsky/5436496\n\n Parameters:\n screen_name: str, the screen_name of the user (ex: @random_user bec... |
4548e41171696ae5b9bbf678737cab157fbc2fdcd51c5bbed9c90bb9e8419b71 | def still_has_cards(self):
'\n Returs True if player still has cards left\n '
return (len(self.hand.cards) != 0) | Returs True if player still has cards left | oop_project.py | still_has_cards | profmcdan/War_Game | 0 | python | def still_has_cards(self):
'\n \n '
return (len(self.hand.cards) != 0) | def still_has_cards(self):
'\n \n '
return (len(self.hand.cards) != 0)<|docstring|>Returs True if player still has cards left<|endoftext|> |
cac00557fdf60ed2db4eed8621dd54186a58bfcfc98567278d01c48d7a1d432f | def load(self, device: str):
'\n Load user-selected task-specific model\n\n Args:\n device (str): device information\n\n Returns:\n object: User-selected task-specific model\n\n '
if ('brainbert' in self.config.n_model):
from pororo.models.brainbert impo... | Load user-selected task-specific model
Args:
device (str): device information
Returns:
object: User-selected task-specific model | pororo/tasks/zero_shot_classification.py | load | jayten42/pororo | 1,137 | python | def load(self, device: str):
'\n Load user-selected task-specific model\n\n Args:\n device (str): device information\n\n Returns:\n object: User-selected task-specific model\n\n '
if ('brainbert' in self.config.n_model):
from pororo.models.brainbert impo... | def load(self, device: str):
'\n Load user-selected task-specific model\n\n Args:\n device (str): device information\n\n Returns:\n object: User-selected task-specific model\n\n '
if ('brainbert' in self.config.n_model):
from pororo.models.brainbert impo... |
560b3e00b83da4fec99dbec8e7d47666a77e0ddd90e95303f7a70a9d5ad59e26 | def predict(self, sent: str, labels: List[str], **kwargs) -> Dict[(str, float)]:
'\n Conduct zero-shot classification\n\n Args:\n sent (str): sentence to be classified\n labels (List[str]): candidate labels\n\n Returns:\n List[Tuple(str, float)]: confidence scor... | Conduct zero-shot classification
Args:
sent (str): sentence to be classified
labels (List[str]): candidate labels
Returns:
List[Tuple(str, float)]: confidence scores corresponding to each input label | pororo/tasks/zero_shot_classification.py | predict | jayten42/pororo | 1,137 | python | def predict(self, sent: str, labels: List[str], **kwargs) -> Dict[(str, float)]:
'\n Conduct zero-shot classification\n\n Args:\n sent (str): sentence to be classified\n labels (List[str]): candidate labels\n\n Returns:\n List[Tuple(str, float)]: confidence scor... | def predict(self, sent: str, labels: List[str], **kwargs) -> Dict[(str, float)]:
'\n Conduct zero-shot classification\n\n Args:\n sent (str): sentence to be classified\n labels (List[str]): candidate labels\n\n Returns:\n List[Tuple(str, float)]: confidence scor... |
6f386169b8b7abaef604a260539360af625a66c7d777fc3f8e720670660efcad | def pretty_print_POST(req):
'\n At this point it is completely built and ready\n to be fired; it is "prepared".\n\n However pay attention at the formatting used in\n this function because it is programmed to be pretty\n printed and may differ from the actual request.\n\n https://stackoverflow.com/... | At this point it is completely built and ready
to be fired; it is "prepared".
However pay attention at the formatting used in
this function because it is programmed to be pretty
printed and may differ from the actual request.
https://stackoverflow.com/a/23816211 | collaborator_api/client.py | pretty_print_POST | OpenUpSA/collaborator-api-client | 0 | python | def pretty_print_POST(req):
'\n At this point it is completely built and ready\n to be fired; it is "prepared".\n\n However pay attention at the formatting used in\n this function because it is programmed to be pretty\n printed and may differ from the actual request.\n\n https://stackoverflow.com/... | def pretty_print_POST(req):
'\n At this point it is completely built and ready\n to be fired; it is "prepared".\n\n However pay attention at the formatting used in\n this function because it is programmed to be pretty\n printed and may differ from the actual request.\n\n https://stackoverflow.com/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.