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 |
|---|---|---|---|---|---|---|---|---|---|
cd9c9796e964c2119e89ae775c50e6e636710e99a54fc5a4cf8ed529e9a5089c | def fit(X, estimator, beta=0.05, N=None, start=1, step=1, tol=1e-05, max_iter=20, debug=False):
'Run the StARS algorithm to select the regularization parameter for the given estimator.\n\n Parameters:\n - X (np.array): Array containing n observations of p\n variables. Columns are the observations o... | Run the StARS algorithm to select the regularization parameter for the given estimator.
Parameters:
- X (np.array): Array containing n observations of p
variables. Columns are the observations of a single variable
- estimator (function): Wrapper function for your estimator, as
described below.
- beta... | stars/stars.py | fit | juangamella/stars | 2 | python | def fit(X, estimator, beta=0.05, N=None, start=1, step=1, tol=1e-05, max_iter=20, debug=False):
'Run the StARS algorithm to select the regularization parameter for the given estimator.\n\n Parameters:\n - X (np.array): Array containing n observations of p\n variables. Columns are the observations o... | def fit(X, estimator, beta=0.05, N=None, start=1, step=1, tol=1e-05, max_iter=20, debug=False):
'Run the StARS algorithm to select the regularization parameter for the given estimator.\n\n Parameters:\n - X (np.array): Array containing n observations of p\n variables. Columns are the observations o... |
3c79e9e6183e35de43b847ac926a05ee3c83efce2226cf3e31257440e3ca6ebf | def subsample(X, N):
'Given n observations of p variables X, return N subsamples.\n\n Parameters:\n - X (np.array): Observations. Columns correspond to variables.\n - N (int): Number of subsamples. Must be a divisor of n.\n\n Returns:\n - Subsamples (np.array): Array containing the subsampled d... | Given n observations of p variables X, return N subsamples.
Parameters:
- X (np.array): Observations. Columns correspond to variables.
- N (int): Number of subsamples. Must be a divisor of n.
Returns:
- Subsamples (np.array): Array containing the subsampled data,
of dimension Nxnxp. | stars/stars.py | subsample | juangamella/stars | 2 | python | def subsample(X, N):
'Given n observations of p variables X, return N subsamples.\n\n Parameters:\n - X (np.array): Observations. Columns correspond to variables.\n - N (int): Number of subsamples. Must be a divisor of n.\n\n Returns:\n - Subsamples (np.array): Array containing the subsampled d... | def subsample(X, N):
'Given n observations of p variables X, return N subsamples.\n\n Parameters:\n - X (np.array): Observations. Columns correspond to variables.\n - N (int): Number of subsamples. Must be a divisor of n.\n\n Returns:\n - Subsamples (np.array): Array containing the subsampled d... |
8976a20485049a54d54e708d6d5a58bc88baa9006c02b96687a7a9d6a8e94302 | def estimate_instability(subsamples, estimator, lmbda, return_estimates=False):
'Estimate the instability using a set of subsamples, as in\n (https://arxiv.org/pdf/1006.3316.pdf, page 6)\n\n Parameters:\n - subsamples (np.array): the subsample array\n - estimator (function): the estimator to be used... | Estimate the instability using a set of subsamples, as in
(https://arxiv.org/pdf/1006.3316.pdf, page 6)
Parameters:
- subsamples (np.array): the subsample array
- estimator (function): the estimator to be used. See
documentation for stars.fit for more info.
- lmbda (float): the regularization parameter at wh... | stars/stars.py | estimate_instability | juangamella/stars | 2 | python | def estimate_instability(subsamples, estimator, lmbda, return_estimates=False):
'Estimate the instability using a set of subsamples, as in\n (https://arxiv.org/pdf/1006.3316.pdf, page 6)\n\n Parameters:\n - subsamples (np.array): the subsample array\n - estimator (function): the estimator to be used... | def estimate_instability(subsamples, estimator, lmbda, return_estimates=False):
'Estimate the instability using a set of subsamples, as in\n (https://arxiv.org/pdf/1006.3316.pdf, page 6)\n\n Parameters:\n - subsamples (np.array): the subsample array\n - estimator (function): the estimator to be used... |
c1af6bed8082862968056c03cbd93146127ac485c84d1f09dbce565eddcad072 | def find_supremum(fun, thresh, start, step, max_iter, tol=1e-05, debug=False):
'Given a function fun:X -> R and a (float) threshold thresh,\n approximate the supremum \\sup_x \\{fun(x) \\leq thresh\\}. Adapted\n version of the bisection method.\n\n Parameters:\n\n - fun (function): f:X->R. The functio... | Given a function fun:X -> R and a (float) threshold thresh,
approximate the supremum \sup_x \{fun(x) \leq thresh\}. Adapted
version of the bisection method.
Parameters:
- fun (function): f:X->R. The function for which we perform the search
- thresh (float): The given threshold
- start (value in X): Initial valu... | stars/stars.py | find_supremum | juangamella/stars | 2 | python | def find_supremum(fun, thresh, start, step, max_iter, tol=1e-05, debug=False):
'Given a function fun:X -> R and a (float) threshold thresh,\n approximate the supremum \\sup_x \\{fun(x) \\leq thresh\\}. Adapted\n version of the bisection method.\n\n Parameters:\n\n - fun (function): f:X->R. The functio... | def find_supremum(fun, thresh, start, step, max_iter, tol=1e-05, debug=False):
'Given a function fun:X -> R and a (float) threshold thresh,\n approximate the supremum \\sup_x \\{fun(x) \\leq thresh\\}. Adapted\n version of the bisection method.\n\n Parameters:\n\n - fun (function): f:X->R. The functio... |
4a1c48e9f28ce78867fc6f16fa72408d7d429f0d56af0c29f63351020cd510b3 | def comb(n, k):
'Return the number of ways to choose k items from n items without\n repetition and without order.\n\n '
return (math.factorial(n) / (math.factorial(k) * math.factorial((n - k)))) | Return the number of ways to choose k items from n items without
repetition and without order. | stars/stars.py | comb | juangamella/stars | 2 | python | def comb(n, k):
'Return the number of ways to choose k items from n items without\n repetition and without order.\n\n '
return (math.factorial(n) / (math.factorial(k) * math.factorial((n - k)))) | def comb(n, k):
'Return the number of ways to choose k items from n items without\n repetition and without order.\n\n '
return (math.factorial(n) / (math.factorial(k) * math.factorial((n - k))))<|docstring|>Return the number of ways to choose k items from n items without
repetition and without order.<|end... |
9a4ac5fc923ce3e5d8de2014ca0ac532ae469b7e0436aff3220f6b15a2b6c6ee | def neighbourhood_graph(p, max_nonzero=2, rho=0.245):
'Generate a "neighborhood graph" o p variables as described in page\n 10 of the paper (https://arxiv.org/pdf/1006.3316.pdf). Return its\n precision matrix.\n\n '
Y = np.random.uniform(size=(p, 2))
prob = np.zeros((p, p))
precision = np.zeros... | Generate a "neighborhood graph" o p variables as described in page
10 of the paper (https://arxiv.org/pdf/1006.3316.pdf). Return its
precision matrix. | stars/stars.py | neighbourhood_graph | juangamella/stars | 2 | python | def neighbourhood_graph(p, max_nonzero=2, rho=0.245):
'Generate a "neighborhood graph" o p variables as described in page\n 10 of the paper (https://arxiv.org/pdf/1006.3316.pdf). Return its\n precision matrix.\n\n '
Y = np.random.uniform(size=(p, 2))
prob = np.zeros((p, p))
precision = np.zeros... | def neighbourhood_graph(p, max_nonzero=2, rho=0.245):
'Generate a "neighborhood graph" o p variables as described in page\n 10 of the paper (https://arxiv.org/pdf/1006.3316.pdf). Return its\n precision matrix.\n\n '
Y = np.random.uniform(size=(p, 2))
prob = np.zeros((p, p))
precision = np.zeros... |
fd65ad7797e12fa60df34bc0a838f560e347e80dc02e5326ad079604819d09cc | def automatic_moving_average(ticker_symbol, denominator_1=275, denominator_2=110, denominator_3=55, denominator_4=5.5):
'\n DOCSTRING\n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
count = dataframe_a['ty... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | automatic_moving_average | bbueno25/sentiment_analysis_and_investing | 0 | python | def automatic_moving_average(ticker_symbol, denominator_1=275, denominator_2=110, denominator_3=55, denominator_4=5.5):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
count = dataframe_a['type'].valu... | def automatic_moving_average(ticker_symbol, denominator_1=275, denominator_2=110, denominator_3=55, denominator_4=5.5):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
count = dataframe_a['type'].valu... |
ce9b5f13ba68f42563635beb5e849c1daf80fab08b31c4a6bf6a90d4052b24a5 | def back_test(dataset, close_index, change_index):
'\n DOCSTRING\n '
stock_holdings = 0
initial_capital = (dataset['close'][0] * 8)
current_capital = initial_capital
current_valuation = current_capital
name = dataset['type'][0]
performance_list = []
date_list = []
percent_chang... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | back_test | bbueno25/sentiment_analysis_and_investing | 0 | python | def back_test(dataset, close_index, change_index):
'\n \n '
stock_holdings = 0
initial_capital = (dataset['close'][0] * 8)
current_capital = initial_capital
current_valuation = current_capital
name = dataset['type'][0]
performance_list = []
date_list = []
percent_change_list = ... | def back_test(dataset, close_index, change_index):
'\n \n '
stock_holdings = 0
initial_capital = (dataset['close'][0] * 8)
current_capital = initial_capital
current_valuation = current_capital
name = dataset['type'][0]
performance_list = []
date_list = []
percent_change_list = ... |
961a558229616aed8a855994f124a1d1dd77fb2b2ba8bac77fd6db8f60182419 | def calculate_position(moving_average_1, moving_average_2, moving_average_3, moving_average_4):
'\n DOCSTRING\n '
if (moving_average_4 > moving_average_1 > moving_average_2 > moving_average_3):
return 1
elif (moving_average_1 > moving_average_4 > moving_average_2 > moving_average_3):
r... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | calculate_position | bbueno25/sentiment_analysis_and_investing | 0 | python | def calculate_position(moving_average_1, moving_average_2, moving_average_3, moving_average_4):
'\n \n '
if (moving_average_4 > moving_average_1 > moving_average_2 > moving_average_3):
return 1
elif (moving_average_1 > moving_average_4 > moving_average_2 > moving_average_3):
return 2
... | def calculate_position(moving_average_1, moving_average_2, moving_average_3, moving_average_4):
'\n \n '
if (moving_average_4 > moving_average_1 > moving_average_2 > moving_average_3):
return 1
elif (moving_average_1 > moving_average_4 > moving_average_2 > moving_average_3):
return 2
... |
e2593b550355c18697b597a970fe11586be2c1a68cf3c7b07cde0bd7891cbdd9 | def introduction():
'\n DOCSTRING\n '
sp500 = pandas_datareader.data.get_data_yahoo('%5EGSPC', start=datetime.datetime(2000, 10, 1), end=datetime.datetime(2012, 1, 1))
sp500.to_csv('sp500_ohlc.csv')
dataframe_a = pandas.read_csv('sp500_ohlc.csv', index_col='Date', parse_dates=True)
dataframe_a... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | introduction | bbueno25/sentiment_analysis_and_investing | 0 | python | def introduction():
'\n \n '
sp500 = pandas_datareader.data.get_data_yahoo('%5EGSPC', start=datetime.datetime(2000, 10, 1), end=datetime.datetime(2012, 1, 1))
sp500.to_csv('sp500_ohlc.csv')
dataframe_a = pandas.read_csv('sp500_ohlc.csv', index_col='Date', parse_dates=True)
dataframe_a['high_mi... | def introduction():
'\n \n '
sp500 = pandas_datareader.data.get_data_yahoo('%5EGSPC', start=datetime.datetime(2000, 10, 1), end=datetime.datetime(2012, 1, 1))
sp500.to_csv('sp500_ohlc.csv')
dataframe_a = pandas.read_csv('sp500_ohlc.csv', index_col='Date', parse_dates=True)
dataframe_a['high_mi... |
6cf2f15321f2e161c1e77319ac31b80bd7c7d3edefc4099cf961f670aa1e57fc | def modify_dataset():
'\n DOCSTRING\n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a['time'] = pandas.to_datetime(dataframe_a['time'], unit='s')
dataframe_a = dataframe_a.set_index('time')
dataframe_a.to_csv('data/stocks_sentdex_1-6-2016_full.csv') | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | modify_dataset | bbueno25/sentiment_analysis_and_investing | 0 | python | def modify_dataset():
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a['time'] = pandas.to_datetime(dataframe_a['time'], unit='s')
dataframe_a = dataframe_a.set_index('time')
dataframe_a.to_csv('data/stocks_sentdex_1-6-2016_full.csv') | def modify_dataset():
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a['time'] = pandas.to_datetime(dataframe_a['time'], unit='s')
dataframe_a = dataframe_a.set_index('time')
dataframe_a.to_csv('data/stocks_sentdex_1-6-2016_full.csv')<|docstring|>DOCSTRING... |
ef61b7c52b03cf66beacd9aee15149223364310e7776fd9e0f52116e4355bd22 | def outlier_fixing(ticker_symbol):
'\n DOCSTRING\n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
axis_1 = pyplot.subplot(2, 1, 1)
dataframe_a['close'].plot(label='Price')
pyplot.legend()
datafr... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | outlier_fixing | bbueno25/sentiment_analysis_and_investing | 0 | python | def outlier_fixing(ticker_symbol):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
axis_1 = pyplot.subplot(2, 1, 1)
dataframe_a['close'].plot(label='Price')
pyplot.legend()
dataframe_a['st... | def outlier_fixing(ticker_symbol):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv')
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
axis_1 = pyplot.subplot(2, 1, 1)
dataframe_a['close'].plot(label='Price')
pyplot.legend()
dataframe_a['st... |
520a016d5c31346072bcacb2b7d7b614f707bbc4d1a7e9553df8e62e23ed07f7 | def results():
'\n DOCSTRING\n '
dataframe_a = pandas.read_csv('performance_data_sp500ish.csv', index_col='time', parse_dates=True)
dataframe_a.sort_index(inplace=True)
dataframe_a['expanding_mean'] = pandas.expanding_mean(dataframe_a['percent_change'], 0)
dataframe_a['expanding_mean'].plot(la... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | results | bbueno25/sentiment_analysis_and_investing | 0 | python | def results():
'\n \n '
dataframe_a = pandas.read_csv('performance_data_sp500ish.csv', index_col='time', parse_dates=True)
dataframe_a.sort_index(inplace=True)
dataframe_a['expanding_mean'] = pandas.expanding_mean(dataframe_a['percent_change'], 0)
dataframe_a['expanding_mean'].plot(label='Perf... | def results():
'\n \n '
dataframe_a = pandas.read_csv('performance_data_sp500ish.csv', index_col='time', parse_dates=True)
dataframe_a.sort_index(inplace=True)
dataframe_a['expanding_mean'] = pandas.expanding_mean(dataframe_a['percent_change'], 0)
dataframe_a['expanding_mean'].plot(label='Perf... |
d7ab7c7a687f4c392cd8b0823026581f9ee5d659a00423dfabff1c093a8e6df9 | def single_stock(ticker_symbol):
'\n DOCSTRING\n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv', index_col='time', parse_dates=True)
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
moving_average_500 = dataframe_a['value'].rolling(500).mean()
axis_1 =... | DOCSTRING | sentiment_analysis_and_investing/src/sentiment_analysis_and_investing.py | single_stock | bbueno25/sentiment_analysis_and_investing | 0 | python | def single_stock(ticker_symbol):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv', index_col='time', parse_dates=True)
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
moving_average_500 = dataframe_a['value'].rolling(500).mean()
axis_1 = pyplot.s... | def single_stock(ticker_symbol):
'\n \n '
dataframe_a = pandas.read_csv('data/stocks_sentdex_1-6-2016.csv', index_col='time', parse_dates=True)
dataframe_a = dataframe_a[(dataframe_a.type == ticker_symbol.lower())]
moving_average_500 = dataframe_a['value'].rolling(500).mean()
axis_1 = pyplot.s... |
32ae03fc22d627d12d73fa7e179fbee315e9b3777eebf545ef864c8387226b80 | def _make_argparse_table(class_):
'\n Build the reStructuredText table containing the args and descriptions.\n '
readme = []
parser = ParlaiParser(False, False)
class_.add_cmdline_args(parser, partial_opt=None)
for ag in parser._action_groups:
actions = []
for action in ag._gro... | Build the reStructuredText table containing the args and descriptions. | docs/source/generate_mutator_list.py | _make_argparse_table | justinbuzzni/ParlAI | 9,228 | python | def _make_argparse_table(class_):
'\n \n '
readme = []
parser = ParlaiParser(False, False)
class_.add_cmdline_args(parser, partial_opt=None)
for ag in parser._action_groups:
actions = []
for action in ag._group_actions:
if (hasattr(action, 'hidden') and action.hidde... | def _make_argparse_table(class_):
'\n \n '
readme = []
parser = ParlaiParser(False, False)
class_.add_cmdline_args(parser, partial_opt=None)
for ag in parser._action_groups:
actions = []
for action in ag._group_actions:
if (hasattr(action, 'hidden') and action.hidde... |
4968f5ea3b468d49e68fe2ac851a1077ce0804acb62291117c95506951bab872 | def subsequent_mask(size, device='cpu', dtype=torch.uint8):
'Create mask for subsequent steps (1, size, size)\n\n :param int size: size of mask\n :param str device: "cpu" or "cuda" or torch.Tensor.device\n :param torch.dtype dtype: result dtype\n :rtype: torch.Tensor\n >>> subsequent_mask(3)\n [[1... | Create mask for subsequent steps (1, size, size)
:param int size: size of mask
:param str device: "cpu" or "cuda" or torch.Tensor.device
:param torch.dtype dtype: result dtype
:rtype: torch.Tensor
>>> subsequent_mask(3)
[[1, 0, 0],
[1, 1, 0],
[1, 1, 1]] | espnet/nets/pytorch_backend/e2e_asr_transformer.py | subsequent_mask | akreal/end-to-end-slu-espnet | 0 | python | def subsequent_mask(size, device='cpu', dtype=torch.uint8):
'Create mask for subsequent steps (1, size, size)\n\n :param int size: size of mask\n :param str device: "cpu" or "cuda" or torch.Tensor.device\n :param torch.dtype dtype: result dtype\n :rtype: torch.Tensor\n >>> subsequent_mask(3)\n [[1... | def subsequent_mask(size, device='cpu', dtype=torch.uint8):
'Create mask for subsequent steps (1, size, size)\n\n :param int size: size of mask\n :param str device: "cpu" or "cuda" or torch.Tensor.device\n :param torch.dtype dtype: result dtype\n :rtype: torch.Tensor\n >>> subsequent_mask(3)\n [[1... |
b21ae76226ba481a54c2a13756200238f42e1eed4b594840344c7fa53e8a3717 | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward\n\n :param torch.Tensor xs_pad: batch of padded source sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of source sequences (B)\n :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)\n :return... | E2E forward
:param torch.Tensor xs_pad: batch of padded source sequences (B, Tmax, idim)
:param torch.Tensor ilens: batch of lengths of source sequences (B)
:param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)
:return: ctc loass value
:rtype: torch.Tensor
:return: attention loss value
:rtype: torch.T... | espnet/nets/pytorch_backend/e2e_asr_transformer.py | forward | akreal/end-to-end-slu-espnet | 0 | python | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward\n\n :param torch.Tensor xs_pad: batch of padded source sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of source sequences (B)\n :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)\n :return... | def forward(self, xs_pad, ilens, ys_pad):
'E2E forward\n\n :param torch.Tensor xs_pad: batch of padded source sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of source sequences (B)\n :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)\n :return... |
f31d9dd0f3c6e80c5c177bc3cacaa732cfadbe6c8407604f7b1e6c220deeae62 | def recognize(self, feat, recog_args, char_list=None, rnnlm=None, use_jit=False):
'recognize feat\n\n :param ndnarray x: input acouctic feature (B, T, D) or (T, D)\n :param namespace recog_args: argment namespace contraining options\n :param list char_list: list of characters\n :param to... | recognize feat
:param ndnarray x: input acouctic feature (B, T, D) or (T, D)
:param namespace recog_args: argment namespace contraining options
:param list char_list: list of characters
:param torch.nn.Module rnnlm: language model module
:return: N-best decoding results
:rtype: list
TODO(karita): do not recompute pre... | espnet/nets/pytorch_backend/e2e_asr_transformer.py | recognize | akreal/end-to-end-slu-espnet | 0 | python | def recognize(self, feat, recog_args, char_list=None, rnnlm=None, use_jit=False):
'recognize feat\n\n :param ndnarray x: input acouctic feature (B, T, D) or (T, D)\n :param namespace recog_args: argment namespace contraining options\n :param list char_list: list of characters\n :param to... | def recognize(self, feat, recog_args, char_list=None, rnnlm=None, use_jit=False):
'recognize feat\n\n :param ndnarray x: input acouctic feature (B, T, D) or (T, D)\n :param namespace recog_args: argment namespace contraining options\n :param list char_list: list of characters\n :param to... |
91cd261796353e6a0fb5c381ba42c92682a8519ba864c3e719b160ded5f14aab | def calculate_all_attentions(self, xs_pad, ilens, ys_pad):
'E2E attention calculation\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded character id s... | E2E attention calculation
:param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)
:param torch.Tensor ilens: batch of lengths of input sequences (B)
:param torch.Tensor ys_pad: batch of padded character id sequence tensor (B, Lmax)
:return: attention weights with the following shape,
1) multi-h... | espnet/nets/pytorch_backend/e2e_asr_transformer.py | calculate_all_attentions | akreal/end-to-end-slu-espnet | 0 | python | def calculate_all_attentions(self, xs_pad, ilens, ys_pad):
'E2E attention calculation\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded character id s... | def calculate_all_attentions(self, xs_pad, ilens, ys_pad):
'E2E attention calculation\n\n :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)\n :param torch.Tensor ilens: batch of lengths of input sequences (B)\n :param torch.Tensor ys_pad: batch of padded character id s... |
a8c9b243d14a4c704f4ed2a71e98681a543cc6821107519eceb674b4f2eb01d0 | def _addMethod(self, effect, verb, resource, conditions):
'Adds a method to the internal lists of allowed or denied methods. Each object in\n the internal list contains a resource ARN and a condition statement. The condition\n statement can be null.'
if ((verb != '*') and (not hasattr(HttpVerb, ve... | Adds a method to the internal lists of allowed or denied methods. Each object in
the internal list contains a resource ARN and a condition statement. The condition
statement can be null. | serverless/auth/authorizer.py | _addMethod | pagreene/minerva-cloud | 1 | python | def _addMethod(self, effect, verb, resource, conditions):
'Adds a method to the internal lists of allowed or denied methods. Each object in\n the internal list contains a resource ARN and a condition statement. The condition\n statement can be null.'
if ((verb != '*') and (not hasattr(HttpVerb, ve... | def _addMethod(self, effect, verb, resource, conditions):
'Adds a method to the internal lists of allowed or denied methods. Each object in\n the internal list contains a resource ARN and a condition statement. The condition\n statement can be null.'
if ((verb != '*') and (not hasattr(HttpVerb, ve... |
a42d07b60a540893bb02e38e08ccae911d1c704a0c138d582419bb0f5dd2a060 | def _getEmptyStatement(self, effect):
'Returns an empty statement object prepopulated with the correct action and the\n desired effect.'
statement = {'Action': 'execute-api:Invoke', 'Effect': (effect[:1].upper() + effect[1:].lower()), 'Resource': []}
return statement | Returns an empty statement object prepopulated with the correct action and the
desired effect. | serverless/auth/authorizer.py | _getEmptyStatement | pagreene/minerva-cloud | 1 | python | def _getEmptyStatement(self, effect):
'Returns an empty statement object prepopulated with the correct action and the\n desired effect.'
statement = {'Action': 'execute-api:Invoke', 'Effect': (effect[:1].upper() + effect[1:].lower()), 'Resource': []}
return statement | def _getEmptyStatement(self, effect):
'Returns an empty statement object prepopulated with the correct action and the\n desired effect.'
statement = {'Action': 'execute-api:Invoke', 'Effect': (effect[:1].upper() + effect[1:].lower()), 'Resource': []}
return statement<|docstring|>Returns an empty stat... |
57919eeb601d38456d1ae5fe49d01fa099e67b98d4e0d132c5fe0777a569f5cf | def _getStatementForEffect(self, effect, methods):
'This function loops over an array of objects containing a resourceArn and\n conditions statement and generates the array of statements for the policy.'
statements = []
if (len(methods) > 0):
statement = self._getEmptyStatement(effect)
... | This function loops over an array of objects containing a resourceArn and
conditions statement and generates the array of statements for the policy. | serverless/auth/authorizer.py | _getStatementForEffect | pagreene/minerva-cloud | 1 | python | def _getStatementForEffect(self, effect, methods):
'This function loops over an array of objects containing a resourceArn and\n conditions statement and generates the array of statements for the policy.'
statements = []
if (len(methods) > 0):
statement = self._getEmptyStatement(effect)
... | def _getStatementForEffect(self, effect, methods):
'This function loops over an array of objects containing a resourceArn and\n conditions statement and generates the array of statements for the policy.'
statements = []
if (len(methods) > 0):
statement = self._getEmptyStatement(effect)
... |
715817ff13088ababb23e625fa0aa10a0a3d9190b24852d205ccd567d718e75a | def allowAllMethods(self):
"Adds a '*' allow to the policy to authorize access to all methods of an API"
self._addMethod('Allow', HttpVerb.ALL, '*', []) | Adds a '*' allow to the policy to authorize access to all methods of an API | serverless/auth/authorizer.py | allowAllMethods | pagreene/minerva-cloud | 1 | python | def allowAllMethods(self):
self._addMethod('Allow', HttpVerb.ALL, '*', []) | def allowAllMethods(self):
self._addMethod('Allow', HttpVerb.ALL, '*', [])<|docstring|>Adds a '*' allow to the policy to authorize access to all methods of an API<|endoftext|> |
e687565667756fc575e3396f233d5f13fcee2bcd705903f621df3086f1ec0882 | def denyAllMethods(self):
"Adds a '*' allow to the policy to deny access to all methods of an API"
self._addMethod('Deny', HttpVerb.ALL, '*', []) | Adds a '*' allow to the policy to deny access to all methods of an API | serverless/auth/authorizer.py | denyAllMethods | pagreene/minerva-cloud | 1 | python | def denyAllMethods(self):
self._addMethod('Deny', HttpVerb.ALL, '*', []) | def denyAllMethods(self):
self._addMethod('Deny', HttpVerb.ALL, '*', [])<|docstring|>Adds a '*' allow to the policy to deny access to all methods of an API<|endoftext|> |
b1cb6d759bc1e23728788703ad530e6f5827d8ace17029e8def28a234dbddbc9 | def allowMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods for the policy'
self._addMethod('Allow', verb, resource, []) | Adds an API Gateway method (Http verb + Resource path) to the list of allowed
methods for the policy | serverless/auth/authorizer.py | allowMethod | pagreene/minerva-cloud | 1 | python | def allowMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods for the policy'
self._addMethod('Allow', verb, resource, []) | def allowMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods for the policy'
self._addMethod('Allow', verb, resource, [])<|docstring|>Adds an API Gateway method (Http verb + Resource path) to the list of allowed
methods for the policy<|en... |
1e1aa57bde30c5ed7e0b9bd6c24c57f1e6fb63546527a51368b6979cf8995be4 | def denyMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods for the policy'
self._addMethod('Deny', verb, resource, []) | Adds an API Gateway method (Http verb + Resource path) to the list of denied
methods for the policy | serverless/auth/authorizer.py | denyMethod | pagreene/minerva-cloud | 1 | python | def denyMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods for the policy'
self._addMethod('Deny', verb, resource, []) | def denyMethod(self, verb, resource):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods for the policy'
self._addMethod('Deny', verb, resource, [])<|docstring|>Adds an API Gateway method (Http verb + Resource path) to the list of denied
methods for the policy<|endoft... |
3d9dd9f908fae997f9de4a25b4ca19ede326eca18cc1d2e65591e7d027588964 | def allowMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_p... | Adds an API Gateway method (Http verb + Resource path) to the list of allowed
methods and includes a condition for the policy statement. More on AWS policy
conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition | serverless/auth/authorizer.py | allowMethodWithConditions | pagreene/minerva-cloud | 1 | python | def allowMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_p... | def allowMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of allowed\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_p... |
500bd9a8218e5725b3fde17df801905973873b52b7b01795a9e47fbfdd26a241 | def denyMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_pol... | Adds an API Gateway method (Http verb + Resource path) to the list of denied
methods and includes a condition for the policy statement. More on AWS policy
conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition | serverless/auth/authorizer.py | denyMethodWithConditions | pagreene/minerva-cloud | 1 | python | def denyMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_pol... | def denyMethodWithConditions(self, verb, resource, conditions):
'Adds an API Gateway method (Http verb + Resource path) to the list of denied\n methods and includes a condition for the policy statement. More on AWS policy\n conditions here: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_pol... |
d884349f9f2d18b15ad39edb7c1b87ef67e06bc6ed0bd0b1ffbaef09f0f921a5 | def build(self):
'Generates the policy document based on the internal lists of allowed and denied\n conditions. This will generate a policy with two main statements for the effect:\n one statement for Allow and one statement for Deny.\n Methods that includes conditions will have their own state... | Generates the policy document based on the internal lists of allowed and denied
conditions. This will generate a policy with two main statements for the effect:
one statement for Allow and one statement for Deny.
Methods that includes conditions will have their own statement in the policy. | serverless/auth/authorizer.py | build | pagreene/minerva-cloud | 1 | python | def build(self):
'Generates the policy document based on the internal lists of allowed and denied\n conditions. This will generate a policy with two main statements for the effect:\n one statement for Allow and one statement for Deny.\n Methods that includes conditions will have their own state... | def build(self):
'Generates the policy document based on the internal lists of allowed and denied\n conditions. This will generate a policy with two main statements for the effect:\n one statement for Allow and one statement for Deny.\n Methods that includes conditions will have their own state... |
ff1b965257ba8d2acd0b751ad84ac5b1c8e1538439b40fb218829e809d981b48 | def getPixelsForInterp(img):
'\n Calculates a mask of pixels neighboring invalid values -\n to use for interpolation.\n '
invalid_mask = (np.isnan(img) + (img == 0))
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
dilated_mask = cv2.dilate(invalid_mask.astype('uint8'), kernel, ... | Calculates a mask of pixels neighboring invalid values -
to use for interpolation. | scripts_test/viz3D_Ncams_documente.py | getPixelsForInterp | vbelissen/packnet-sfm | 0 | python | def getPixelsForInterp(img):
'\n Calculates a mask of pixels neighboring invalid values -\n to use for interpolation.\n '
invalid_mask = (np.isnan(img) + (img == 0))
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
dilated_mask = cv2.dilate(invalid_mask.astype('uint8'), kernel, ... | def getPixelsForInterp(img):
'\n Calculates a mask of pixels neighboring invalid values -\n to use for interpolation.\n '
invalid_mask = (np.isnan(img) + (img == 0))
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
dilated_mask = cv2.dilate(invalid_mask.astype('uint8'), kernel, ... |
245278001d914b7a8d88e6fca3002f629b1189a0b6f11f9cbc7c8cccbe79d005 | def get_base_folder(image_file):
'The base folder'
return '/'.join(image_file.split('/')[:(- 6)]) | The base folder | scripts_test/viz3D_Ncams_documente.py | get_base_folder | vbelissen/packnet-sfm | 0 | python | def get_base_folder(image_file):
return '/'.join(image_file.split('/')[:(- 6)]) | def get_base_folder(image_file):
return '/'.join(image_file.split('/')[:(- 6)])<|docstring|>The base folder<|endoftext|> |
3325e6b226221130455fd1e8bb1517069f0daeb033e32c0d09a794c5e84a9439 | def get_camera_name(image_file):
"Returns 'cam_i', i between 0 and 4"
return image_file.split('/')[(- 2)] | Returns 'cam_i', i between 0 and 4 | scripts_test/viz3D_Ncams_documente.py | get_camera_name | vbelissen/packnet-sfm | 0 | python | def get_camera_name(image_file):
return image_file.split('/')[(- 2)] | def get_camera_name(image_file):
return image_file.split('/')[(- 2)]<|docstring|>Returns 'cam_i', i between 0 and 4<|endoftext|> |
d3c2d5ab3c6b6833b15fdf231cb3e093899964c0e31d079147952474f593e6ba | def get_sequence_name(image_file):
"Returns a sequence name like '20180227_185324'."
return image_file.split('/')[(- 3)] | Returns a sequence name like '20180227_185324'. | scripts_test/viz3D_Ncams_documente.py | get_sequence_name | vbelissen/packnet-sfm | 0 | python | def get_sequence_name(image_file):
return image_file.split('/')[(- 3)] | def get_sequence_name(image_file):
return image_file.split('/')[(- 3)]<|docstring|>Returns a sequence name like '20180227_185324'.<|endoftext|> |
52b062b4550f39cf94e2ae65fcb75975b858383d027f1618b974c84a85ff8c35 | def get_split_type(image_file):
"Returns 'train', 'test' or 'test_sync'."
return image_file.split('/')[(- 4)] | Returns 'train', 'test' or 'test_sync'. | scripts_test/viz3D_Ncams_documente.py | get_split_type | vbelissen/packnet-sfm | 0 | python | def get_split_type(image_file):
return image_file.split('/')[(- 4)] | def get_split_type(image_file):
return image_file.split('/')[(- 4)]<|docstring|>Returns 'train', 'test' or 'test_sync'.<|endoftext|> |
64ff2a9e3082e4e5a9606c2b27089a8835f701b1b10f86222cfb522b12b67bdd | def get_path_to_ego_mask(image_file):
'Get the current folder from image_file.'
return os.path.join(get_base_folder(image_file), 'semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), (((get_sequence_name(image_file) + '_') + get_camera_name(image_file)) + '.npy')) | Get the current folder from image_file. | scripts_test/viz3D_Ncams_documente.py | get_path_to_ego_mask | vbelissen/packnet-sfm | 0 | python | def get_path_to_ego_mask(image_file):
return os.path.join(get_base_folder(image_file), 'semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), (((get_sequence_name(image_file) + '_') + get_camera_name(image_file)) + '.npy')) | def get_path_to_ego_mask(image_file):
return os.path.join(get_base_folder(image_file), 'semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), (((get_sequence_name(image_file) + '_') + get_camera_name(image_file)) + '.npy'))<|docstring|>Get the current folder from image_file.<|e... |
5e986fae3b3d17aaf45cf1a7d7563d85458dc4336ecd0f513c4928c252641737 | def get_intrinsics_fisheye(image_file, calib_data):
'Get intrinsics from the calib_data dictionary.'
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
poly_coeffs = np.array([float(intr['c1']), float(intr['c2']), float(intr['c3']), ... | Get intrinsics from the calib_data dictionary. | scripts_test/viz3D_Ncams_documente.py | get_intrinsics_fisheye | vbelissen/packnet-sfm | 0 | python | def get_intrinsics_fisheye(image_file, calib_data):
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
poly_coeffs = np.array([float(intr['c1']), float(intr['c2']), float(intr['c3']), float(intr['c4'])], dtype='float32')
princip... | def get_intrinsics_fisheye(image_file, calib_data):
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
poly_coeffs = np.array([float(intr['c1']), float(intr['c2']), float(intr['c3']), float(intr['c4'])], dtype='float32')
princip... |
3eaa031c364d345437715d8256825c3766722c916f8e3a9a684285fd26310072 | def get_intrinsics_distorted(image_file, calib_data):
'Get intrinsics from the calib_data dictionary.'
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
cx = float(base_intr['cx_px'])
cy = float(base_intr['cy_px'])
img_heigh... | Get intrinsics from the calib_data dictionary. | scripts_test/viz3D_Ncams_documente.py | get_intrinsics_distorted | vbelissen/packnet-sfm | 0 | python | def get_intrinsics_distorted(image_file, calib_data):
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
cx = float(base_intr['cx_px'])
cy = float(base_intr['cy_px'])
img_height_px = float(base_intr['img_height_px'])
img... | def get_intrinsics_distorted(image_file, calib_data):
cam = get_camera_name(image_file)
base_intr = calib_data[cam]['base_intrinsics']
intr = calib_data[cam]['intrinsics']
cx = float(base_intr['cx_px'])
cy = float(base_intr['cy_px'])
img_height_px = float(base_intr['img_height_px'])
img... |
c27e100c9b4a80579686afba3ff13ad2be1b52bc1e7478d615373042cc2c6bb6 | def get_depth_file(image_file):
'Get the corresponding depth file from an image file.'
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'depth_maps', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera_name(image_file)... | Get the corresponding depth file from an image file. | scripts_test/viz3D_Ncams_documente.py | get_depth_file | vbelissen/packnet-sfm | 0 | python | def get_depth_file(image_file):
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'depth_maps', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera_name(image_file).replace('cam', 'velodyne'), (base.replace('cam', 'vel... | def get_depth_file(image_file):
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'depth_maps', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera_name(image_file).replace('cam', 'velodyne'), (base.replace('cam', 'vel... |
9b98f967fc3558defcb1097f25d5e5759b81ba40cd1be58c366290c6276b10d3 | def get_full_mask_file(image_file):
'Get the corresponding full mask file from an image file.'
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'full_semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera... | Get the corresponding full mask file from an image file. | scripts_test/viz3D_Ncams_documente.py | get_full_mask_file | vbelissen/packnet-sfm | 0 | python | def get_full_mask_file(image_file):
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'full_semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera_name(image_file), (base + '.npy')) | def get_full_mask_file(image_file):
(base, ext) = os.path.splitext(os.path.basename(image_file))
return os.path.join(get_base_folder(image_file), 'full_semantic_masks', 'fisheye', get_split_type(image_file), get_sequence_name(image_file), get_camera_name(image_file), (base + '.npy'))<|docstring|>Get the co... |
935cca5b8d2fd23dbfa5a82a4c9d98347e4ceeb8c50430a982606f5db4cb3a4a | def get_extrinsics_pose_matrix_fisheye(image_file, calib_data):
'Get intrinsics from the calib_data dictionary.'
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
t = np.array([float(extr['pos_x_m']), float(extr['pos_y_m']), float(extr['pos_z_m'])])
x_rad = ((np.pi / 180.0) * fl... | Get intrinsics from the calib_data dictionary. | scripts_test/viz3D_Ncams_documente.py | get_extrinsics_pose_matrix_fisheye | vbelissen/packnet-sfm | 0 | python | def get_extrinsics_pose_matrix_fisheye(image_file, calib_data):
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
t = np.array([float(extr['pos_x_m']), float(extr['pos_y_m']), float(extr['pos_z_m'])])
x_rad = ((np.pi / 180.0) * float(extr['rot_x_deg']))
z1_rad = ((np.pi / 1... | def get_extrinsics_pose_matrix_fisheye(image_file, calib_data):
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
t = np.array([float(extr['pos_x_m']), float(extr['pos_y_m']), float(extr['pos_z_m'])])
x_rad = ((np.pi / 180.0) * float(extr['rot_x_deg']))
z1_rad = ((np.pi / 1... |
b29acf04b694da3f135b6bfb839da2710fcdec5c8c36b73daf2a02afd5d80c38 | def get_extrinsics_pose_matrix_distorted(image_file, calib_data):
'Get intrinsics from the calib_data dictionary.'
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
T_other_convention = np.array([float(extr['t_x_m']), float(extr['t_y_m']), float(extr['t_z_m'])])
R = np.array(ext... | Get intrinsics from the calib_data dictionary. | scripts_test/viz3D_Ncams_documente.py | get_extrinsics_pose_matrix_distorted | vbelissen/packnet-sfm | 0 | python | def get_extrinsics_pose_matrix_distorted(image_file, calib_data):
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
T_other_convention = np.array([float(extr['t_x_m']), float(extr['t_y_m']), float(extr['t_z_m'])])
R = np.array(extr['R'])
pose_matrix = transform_from_rot_tra... | def get_extrinsics_pose_matrix_distorted(image_file, calib_data):
cam = get_camera_name(image_file)
extr = calib_data[cam]['extrinsics']
T_other_convention = np.array([float(extr['t_x_m']), float(extr['t_y_m']), float(extr['t_z_m'])])
R = np.array(extr['R'])
pose_matrix = transform_from_rot_tra... |
90b470d3751456ad9a3952b113d99c52c61001b11cb11cc64961889f5c0bb141 | @torch.no_grad()
def infer_plot_and_save_3D_pcl(input_files, output_folder, model_wrappers, image_shape, stop):
'\n Process a single input file to produce and save visualization\n\n Parameters\n ----------\n input_file : list (number of cameras) of lists (number of files) of str\n Image file\n ... | Process a single input file to produce and save visualization
Parameters
----------
input_file : list (number of cameras) of lists (number of files) of str
Image file
output_file : str
Output file, or folder where the output will be saved
model_wrapper : nn.Module
Model wrapper used for inference
image_sha... | scripts_test/viz3D_Ncams_documente.py | infer_plot_and_save_3D_pcl | vbelissen/packnet-sfm | 0 | python | @torch.no_grad()
def infer_plot_and_save_3D_pcl(input_files, output_folder, model_wrappers, image_shape, stop):
'\n Process a single input file to produce and save visualization\n\n Parameters\n ----------\n input_file : list (number of cameras) of lists (number of files) of str\n Image file\n ... | @torch.no_grad()
def infer_plot_and_save_3D_pcl(input_files, output_folder, model_wrappers, image_shape, stop):
'\n Process a single input file to produce and save visualization\n\n Parameters\n ----------\n input_file : list (number of cameras) of lists (number of files) of str\n Image file\n ... |
683a2425a7ec6544a0f3427e7e8cabfc1b90f23369ee16c4c366636fe7ccdb54 | def _toner_used_by_printer(printer, cutoff=0.05, since=date(2017, 8, 20)):
"Returns toner changes for a printer since a given date.\n\n Toner numbers can be significantly noisy, including significant diffs\n whenever toner gets taken out and put back in whenever there is jam. Because\n of this it's hard to... | Returns toner changes for a printer since a given date.
Toner numbers can be significantly noisy, including significant diffs
whenever toner gets taken out and put back in whenever there is jam. Because
of this it's hard to determine if a new toner is inserted into a printer to
reduce this noise we only count diffs th... | ocfweb/stats/printing.py | _toner_used_by_printer | ivyn/ocfweb | 0 | python | def _toner_used_by_printer(printer, cutoff=0.05, since=date(2017, 8, 20)):
"Returns toner changes for a printer since a given date.\n\n Toner numbers can be significantly noisy, including significant diffs\n whenever toner gets taken out and put back in whenever there is jam. Because\n of this it's hard to... | def _toner_used_by_printer(printer, cutoff=0.05, since=date(2017, 8, 20)):
"Returns toner changes for a printer since a given date.\n\n Toner numbers can be significantly noisy, including significant diffs\n whenever toner gets taken out and put back in whenever there is jam. Because\n of this it's hard to... |
c38caf32085947a25fbbb2cc382afbb2cdfd6e64ae8fa724437883ff6b8eda31 | def _create_test(func, name, docs, mod, *args, **kwargs):
' Custom factory function support '
async def _my_test(dut):
(await func(dut, *args, **kwargs))
_my_test.__name__ = name
_my_test.__qualname__ = name
_my_test.__doc__ = docs
_my_test.__module__ = mod.__name__
return testcase(... | Custom factory function support | hardware/testbenches/node/nx_node_decoder/testbench/testbench.py | _create_test | Intuity/nexus | 6 | python | def _create_test(func, name, docs, mod, *args, **kwargs):
' '
async def _my_test(dut):
(await func(dut, *args, **kwargs))
_my_test.__name__ = name
_my_test.__qualname__ = name
_my_test.__doc__ = docs
_my_test.__module__ = mod.__name__
return testcase()(_my_test) | def _create_test(func, name, docs, mod, *args, **kwargs):
' '
async def _my_test(dut):
(await func(dut, *args, **kwargs))
_my_test.__name__ = name
_my_test.__qualname__ = name
_my_test.__doc__ = docs
_my_test.__module__ = mod.__name__
return testcase()(_my_test)<|docstring|>Custom ... |
d9c1125d171b24a31d08616bd8c52a33149c2051e991ac7829f7fa02fc51025f | def __init__(self, dut):
' Initialise the testbench.\n\n Args:\n dut: Pointer to the DUT\n '
super().__init__(dut)
self.msg = StreamInitiator(self, self.clk, self.rst, StreamIO(self.dut, 'msg', IORole.RESPONDER))
self.ram = MemoryMonitor(self, self.clk, self.rst, MemoryIO(self.d... | Initialise the testbench.
Args:
dut: Pointer to the DUT | hardware/testbenches/node/nx_node_decoder/testbench/testbench.py | __init__ | Intuity/nexus | 6 | python | def __init__(self, dut):
' Initialise the testbench.\n\n Args:\n dut: Pointer to the DUT\n '
super().__init__(dut)
self.msg = StreamInitiator(self, self.clk, self.rst, StreamIO(self.dut, 'msg', IORole.RESPONDER))
self.ram = MemoryMonitor(self, self.clk, self.rst, MemoryIO(self.d... | def __init__(self, dut):
' Initialise the testbench.\n\n Args:\n dut: Pointer to the DUT\n '
super().__init__(dut)
self.msg = StreamInitiator(self, self.clk, self.rst, StreamIO(self.dut, 'msg', IORole.RESPONDER))
self.ram = MemoryMonitor(self, self.clk, self.rst, MemoryIO(self.d... |
092e48c4039ac2b5efdb3a62401a2b4ff614ee0ee888ea8659757b1a0e7325c0 | async def initialise(self):
" Initialise the DUT's I/O "
(await super().initialise())
self.msg.intf.initialise(IORole.INITIATOR)
self.ram.intf.initialise(IORole.RESPONDER)
self.sig.intf.initialise(IORole.RESPONDER) | Initialise the DUT's I/O | hardware/testbenches/node/nx_node_decoder/testbench/testbench.py | initialise | Intuity/nexus | 6 | python | async def initialise(self):
" "
(await super().initialise())
self.msg.intf.initialise(IORole.INITIATOR)
self.ram.intf.initialise(IORole.RESPONDER)
self.sig.intf.initialise(IORole.RESPONDER) | async def initialise(self):
" "
(await super().initialise())
self.msg.intf.initialise(IORole.INITIATOR)
self.ram.intf.initialise(IORole.RESPONDER)
self.sig.intf.initialise(IORole.RESPONDER)<|docstring|>Initialise the DUT's I/O<|endoftext|> |
dab99555f330cd18a2f9a0507041fb179bcf2f9d2b94aee1e1978157fb3330c2 | def linkcode_resolve(domain, info):
'in case linkcode is working but linkcode_ws is not\n '
return linkcode_ws_resolve(domain, info)[1] | in case linkcode is working but linkcode_ws is not | conf.py | linkcode_resolve | wavestate/wavestate-doc | 0 | python | def linkcode_resolve(domain, info):
'\n '
return linkcode_ws_resolve(domain, info)[1] | def linkcode_resolve(domain, info):
'\n '
return linkcode_ws_resolve(domain, info)[1]<|docstring|>in case linkcode is working but linkcode_ws is not<|endoftext|> |
77d77eed065dbcc629781bc0af5f09169900a2351a0016e5d8bb267e1cce54cd | def autodoc_process_docstring(app, what, name, obj, options, lines):
'Detects pytests and augments their documentation to include links to their output files\n '
tdir = os.path.join(app.srcdir, 'test_results')
if (what == 'module'):
return
if (what != 'function'):
return
try:
... | Detects pytests and augments their documentation to include links to their output files | conf.py | autodoc_process_docstring | wavestate/wavestate-doc | 0 | python | def autodoc_process_docstring(app, what, name, obj, options, lines):
'\n '
tdir = os.path.join(app.srcdir, 'test_results')
if (what == 'module'):
return
if (what != 'function'):
return
try:
ofile = obj.__code__.co_filename
except AttributeError:
return
if (... | def autodoc_process_docstring(app, what, name, obj, options, lines):
'\n '
tdir = os.path.join(app.srcdir, 'test_results')
if (what == 'module'):
return
if (what != 'function'):
return
try:
ofile = obj.__code__.co_filename
except AttributeError:
return
if (... |
87f788a820665839d3e9944b0a9b53b634f03fb604745c4614e0ff8e41e019ef | def send_packet(recvd_pkt, src_ip, dst_ip, count):
' Send modified packets'
pkt_cnt = 0
p_out = []
for p in recvd_pkt:
pkt_cnt += 1
new_pkt = p.payload
new_pkt[IP].dst = dst_ip
new_pkt[IP].src = src_ip
del new_pkt[IP].chksum
p_out.append(new_pkt)
i... | Send modified packets | Chapter08/8_6_replay_traffic.py | send_packet | shiyeh/py-network-cookbook | 125 | python | def send_packet(recvd_pkt, src_ip, dst_ip, count):
' '
pkt_cnt = 0
p_out = []
for p in recvd_pkt:
pkt_cnt += 1
new_pkt = p.payload
new_pkt[IP].dst = dst_ip
new_pkt[IP].src = src_ip
del new_pkt[IP].chksum
p_out.append(new_pkt)
if ((pkt_cnt % count) ... | def send_packet(recvd_pkt, src_ip, dst_ip, count):
' '
pkt_cnt = 0
p_out = []
for p in recvd_pkt:
pkt_cnt += 1
new_pkt = p.payload
new_pkt[IP].dst = dst_ip
new_pkt[IP].src = src_ip
del new_pkt[IP].chksum
p_out.append(new_pkt)
if ((pkt_cnt % count) ... |
77eb3b4c3a4d9bc2cd7ab34b62f87f83b631f931d4db7f06d0bb1864129b3364 | def preprocess_text(self):
'\n Basic cleaning of the received text. Removes white spaces, and sets the letters to lowercase.\n Args:\n Returns:\n '
self.text_received = self.text_received.replace(' ', '').lower() | Basic cleaning of the received text. Removes white spaces, and sets the letters to lowercase.
Args:
Returns: | send.py | preprocess_text | mirayyuce/SMS_Responder | 0 | python | def preprocess_text(self):
'\n Basic cleaning of the received text. Removes white spaces, and sets the letters to lowercase.\n Args:\n Returns:\n '
self.text_received = self.text_received.replace(' ', ).lower() | def preprocess_text(self):
'\n Basic cleaning of the received text. Removes white spaces, and sets the letters to lowercase.\n Args:\n Returns:\n '
self.text_received = self.text_received.replace(' ', ).lower()<|docstring|>Basic cleaning of the received text. Removes whit... |
139727534848aaa43e1f3b72218b1af1dcad05ab722d2862d95127e1642c827e | def create_message_text(self):
'\n Inspects the received text to prepare the answer\n Args:\n Returns: \n Returns the matching answer from configs.word_dict. If mathcing not found it returns a fixed message.\n '
if (self.text_received in configs.word_dict):... | Inspects the received text to prepare the answer
Args:
Returns:
Returns the matching answer from configs.word_dict. If mathcing not found it returns a fixed message. | send.py | create_message_text | mirayyuce/SMS_Responder | 0 | python | def create_message_text(self):
'\n Inspects the received text to prepare the answer\n Args:\n Returns: \n Returns the matching answer from configs.word_dict. If mathcing not found it returns a fixed message.\n '
if (self.text_received in configs.word_dict):... | def create_message_text(self):
'\n Inspects the received text to prepare the answer\n Args:\n Returns: \n Returns the matching answer from configs.word_dict. If mathcing not found it returns a fixed message.\n '
if (self.text_received in configs.word_dict):... |
cf05caf154a68691316c32a35c794d66a67ac9f3239959a92ab3ddb42dff46f4 | def send_message(self):
'\n Cleans the received text, prepares the message text and sends the message.\n Args:\n Returns: \n '
self.preprocess_text()
message_text = self.create_message_text()
telnyx.Message.create(from_=configs.source_number, to=self.destination_n... | Cleans the received text, prepares the message text and sends the message.
Args:
Returns: | send.py | send_message | mirayyuce/SMS_Responder | 0 | python | def send_message(self):
'\n Cleans the received text, prepares the message text and sends the message.\n Args:\n Returns: \n '
self.preprocess_text()
message_text = self.create_message_text()
telnyx.Message.create(from_=configs.source_number, to=self.destination_n... | def send_message(self):
'\n Cleans the received text, prepares the message text and sends the message.\n Args:\n Returns: \n '
self.preprocess_text()
message_text = self.create_message_text()
telnyx.Message.create(from_=configs.source_number, to=self.destination_n... |
80964143e4e703c106defdd39c1664f59e11a3f9113fad2888517d385d00c6ab | def test_command_line_interface():
'Test the CLI.'
runner = CliRunner()
runner.invoke(cli.command_build) | Test the CLI. | tests/test_jupyterbook_to_zendesk.py | test_command_line_interface | dabble-of-devops-bioanalyze/jupyterbook_to_zendesk | 0 | python | def test_command_line_interface():
runner = CliRunner()
runner.invoke(cli.command_build) | def test_command_line_interface():
runner = CliRunner()
runner.invoke(cli.command_build)<|docstring|>Test the CLI.<|endoftext|> |
ee9379779f07755e991d5c5d559be474ada4bba19a6ea8325296324f6965ca5d | def _write_value(self, key, value, where, node_name=''):
' Implement adding a new entry in the cache.\n\n Parameters\n ----------\n key : str\n Name/key of the new entry.\n\n value : np.ndarray\n Data mapped to the provided key to store in the cache.\n '
... | Implement adding a new entry in the cache.
Parameters
----------
key : str
Name/key of the new entry.
value : np.ndarray
Data mapped to the provided key to store in the cache. | app_common/apptools/cache/single_array_hdf_cache.py | _write_value | KBIbiopharma/app_common | 2 | python | def _write_value(self, key, value, where, node_name=):
' Implement adding a new entry in the cache.\n\n Parameters\n ----------\n key : str\n Name/key of the new entry.\n\n value : np.ndarray\n Data mapped to the provided key to store in the cache.\n '
h5... | def _write_value(self, key, value, where, node_name=):
' Implement adding a new entry in the cache.\n\n Parameters\n ----------\n key : str\n Name/key of the new entry.\n\n value : np.ndarray\n Data mapped to the provided key to store in the cache.\n '
h5... |
b21a18882368ada25750600c48508757cc0adf0d564209457bfe2b16dc650f86 | def _get_file_handle(self, key, make_file=True):
' Return HDF5 open file handle (mode="a").\n '
(_, filepath) = self._prepare_filepath(key, make_dir=make_file)
if (filepath in self.open_files):
return self.open_files[filepath]
if ((not isfile(filepath)) and (not make_file)):
msg =... | Return HDF5 open file handle (mode="a"). | app_common/apptools/cache/single_array_hdf_cache.py | _get_file_handle | KBIbiopharma/app_common | 2 | python | def _get_file_handle(self, key, make_file=True):
' \n '
(_, filepath) = self._prepare_filepath(key, make_dir=make_file)
if (filepath in self.open_files):
return self.open_files[filepath]
if ((not isfile(filepath)) and (not make_file)):
msg = 'File does not exist for key: {}. You c... | def _get_file_handle(self, key, make_file=True):
' \n '
(_, filepath) = self._prepare_filepath(key, make_dir=make_file)
if (filepath in self.open_files):
return self.open_files[filepath]
if ((not isfile(filepath)) and (not make_file)):
msg = 'File does not exist for key: {}. You c... |
dea23f0194d76e6328a422a2a94d8e41228cb5ca3280040f225706247fea0ce8 | def _prepare_node_path(self, key):
' Prepare target node for key setting.\n '
try:
node_path = self.key_to_file_node_converter(key)
except Exception as e:
msg = 'Failed to parse the file path from the key {}. Check the key name and the cache converters. Error was {}'
msg = msg... | Prepare target node for key setting. | app_common/apptools/cache/single_array_hdf_cache.py | _prepare_node_path | KBIbiopharma/app_common | 2 | python | def _prepare_node_path(self, key):
' \n '
try:
node_path = self.key_to_file_node_converter(key)
except Exception as e:
msg = 'Failed to parse the file path from the key {}. Check the key name and the cache converters. Error was {}'
msg = msg.format(key, e)
logger.excep... | def _prepare_node_path(self, key):
' \n '
try:
node_path = self.key_to_file_node_converter(key)
except Exception as e:
msg = 'Failed to parse the file path from the key {}. Check the key name and the cache converters. Error was {}'
msg = msg.format(key, e)
logger.excep... |
17a607e035d1ca311dd39fa0e12ac7e870fd96428c0b72edc9aff80146abf6e5 | def _do_delete(self, keys=None):
" Delete all or some HDF5 file nodes in the cache's url.\n "
if keys:
to_remove = set(keys)
for key in to_remove:
node = self.key_to_file_node_converter(key)
h5file = self._get_file_handle(key)
h5file.remove_node(node)
... | Delete all or some HDF5 file nodes in the cache's url. | app_common/apptools/cache/single_array_hdf_cache.py | _do_delete | KBIbiopharma/app_common | 2 | python | def _do_delete(self, keys=None):
" \n "
if keys:
to_remove = set(keys)
for key in to_remove:
node = self.key_to_file_node_converter(key)
h5file = self._get_file_handle(key)
h5file.remove_node(node)
else:
self._do_delete_all() | def _do_delete(self, keys=None):
" \n "
if keys:
to_remove = set(keys)
for key in to_remove:
node = self.key_to_file_node_converter(key)
h5file = self._get_file_handle(key)
h5file.remove_node(node)
else:
self._do_delete_all()<|docstring|>Del... |
9433da4cb16e83b756fa9f157df67646c90dab72ea279c61e918f132670a6e17 | def _do_delete(self, keys=None):
" Delete all or some HDF5 file nodes in the cache's url.\n "
super(HDF5SingleArrayCache, self)._do_delete(keys=keys)
if keys:
self._data_container = self._data_container.drop(keys) | Delete all or some HDF5 file nodes in the cache's url. | app_common/apptools/cache/single_array_hdf_cache.py | _do_delete | KBIbiopharma/app_common | 2 | python | def _do_delete(self, keys=None):
" \n "
super(HDF5SingleArrayCache, self)._do_delete(keys=keys)
if keys:
self._data_container = self._data_container.drop(keys) | def _do_delete(self, keys=None):
" \n "
super(HDF5SingleArrayCache, self)._do_delete(keys=keys)
if keys:
self._data_container = self._data_container.drop(keys)<|docstring|>Delete all or some HDF5 file nodes in the cache's url.<|endoftext|> |
ee59092b8858905d3e179eba269a10c8808e5551717b91202e047692c9825f07 | def preprocess_paper_1(item: Tuple[(str, Paper)]) -> Tuple[(str, Paper)]:
'\n helper function to perform most of the preprocessing of a paper\n\n Parameters\n ----------\n item: Tuple[str, Paper]\n tuple of paper id and Paper object\n\n Returns\n -------\n Tuple[str, Paper]: tuple of pap... | helper function to perform most of the preprocessing of a paper
Parameters
----------
item: Tuple[str, Paper]
tuple of paper id and Paper object
Returns
-------
Tuple[str, Paper]: tuple of paper id and preprocessed Paper object | s2and/data.py | preprocess_paper_1 | atypon/S2AND | 39 | python | def preprocess_paper_1(item: Tuple[(str, Paper)]) -> Tuple[(str, Paper)]:
'\n helper function to perform most of the preprocessing of a paper\n\n Parameters\n ----------\n item: Tuple[str, Paper]\n tuple of paper id and Paper object\n\n Returns\n -------\n Tuple[str, Paper]: tuple of pap... | def preprocess_paper_1(item: Tuple[(str, Paper)]) -> Tuple[(str, Paper)]:
'\n helper function to perform most of the preprocessing of a paper\n\n Parameters\n ----------\n item: Tuple[str, Paper]\n tuple of paper id and Paper object\n\n Returns\n -------\n Tuple[str, Paper]: tuple of pap... |
defda79e8e320256bcdbeffa658b191a3d40b4a5e7366761435ade12da9e08fd | def preprocess_paper_2(item: Tuple[(str, Paper, List[MiniPaper])]) -> Tuple[(str, Paper)]:
'\n helper function to perform preprocessing of the reference details for a paper.\n Note: this happens after the main paper preprocessing has occurred.\n\n Parameters\n ----------\n item: Tuple[str, Paper, Lis... | helper function to perform preprocessing of the reference details for a paper.
Note: this happens after the main paper preprocessing has occurred.
Parameters
----------
item: Tuple[str, Paper, List[MiniPaper]]
tuple of paper id, Paper object, and list of MiniPaper objects for the references
Returns
-------
Tuple[... | s2and/data.py | preprocess_paper_2 | atypon/S2AND | 39 | python | def preprocess_paper_2(item: Tuple[(str, Paper, List[MiniPaper])]) -> Tuple[(str, Paper)]:
'\n helper function to perform preprocessing of the reference details for a paper.\n Note: this happens after the main paper preprocessing has occurred.\n\n Parameters\n ----------\n item: Tuple[str, Paper, Lis... | def preprocess_paper_2(item: Tuple[(str, Paper, List[MiniPaper])]) -> Tuple[(str, Paper)]:
'\n helper function to perform preprocessing of the reference details for a paper.\n Note: this happens after the main paper preprocessing has occurred.\n\n Parameters\n ----------\n item: Tuple[str, Paper, Lis... |
f2c546a4ae4bbf39737d26c5872b112717895ef2a526785303a71b23514e2f38 | def preprocess_papers_parallel(papers_dict: Dict, n_jobs: int, preprocess: bool) -> Dict:
'\n helper function to preprocess papers\n\n Parameters\n ----------\n papers_dict: Dict\n the papers dictionary\n n_jobs: int\n how many cpus to use\n preprocess: bool\n whether to do al... | helper function to preprocess papers
Parameters
----------
papers_dict: Dict
the papers dictionary
n_jobs: int
how many cpus to use
preprocess: bool
whether to do all of the preprocessing, or just a small piece of it
Returns
-------
Dict: the preprocessed papers dictionary | s2and/data.py | preprocess_papers_parallel | atypon/S2AND | 39 | python | def preprocess_papers_parallel(papers_dict: Dict, n_jobs: int, preprocess: bool) -> Dict:
'\n helper function to preprocess papers\n\n Parameters\n ----------\n papers_dict: Dict\n the papers dictionary\n n_jobs: int\n how many cpus to use\n preprocess: bool\n whether to do al... | def preprocess_papers_parallel(papers_dict: Dict, n_jobs: int, preprocess: bool) -> Dict:
'\n helper function to preprocess papers\n\n Parameters\n ----------\n papers_dict: Dict\n the papers dictionary\n n_jobs: int\n how many cpus to use\n preprocess: bool\n whether to do al... |
fa084cadc021c0f901ec307c88140bc9e3e4bda9597fc1f88b3d79bc38181cea | @staticmethod
def get_full_name_for_features(signature: Signature, include_last: bool=True, include_suffix: bool=True) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature: Signature\n the signature to create the full name for\n ... | Creates the full name from the name parts.
Parameters
----------
signature: Signature
the signature to create the full name for
include_last: bool
whether to include the last name
include_suffix: bool
whether to include the suffix
Returns
-------
string: the full name | s2and/data.py | get_full_name_for_features | atypon/S2AND | 39 | python | @staticmethod
def get_full_name_for_features(signature: Signature, include_last: bool=True, include_suffix: bool=True) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature: Signature\n the signature to create the full name for\n ... | @staticmethod
def get_full_name_for_features(signature: Signature, include_last: bool=True, include_suffix: bool=True) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature: Signature\n the signature to create the full name for\n ... |
b90bc4f137af640d68a2fef171afad2213827c78b1ed6d7130d53225f0e499c0 | def preprocess_signatures(self, load_name_counts: bool):
'\n Preprocess the signatures, doing lots of normalization and feature creation\n\n Parameters\n ----------\n load_name_counts: bool\n whether name counts were loaded (mostly just here so we can not load them when runnin... | Preprocess the signatures, doing lots of normalization and feature creation
Parameters
----------
load_name_counts: bool
whether name counts were loaded (mostly just here so we can not load them when running tests)
Returns
-------
nothing, modifies self.signatures | s2and/data.py | preprocess_signatures | atypon/S2AND | 39 | python | def preprocess_signatures(self, load_name_counts: bool):
'\n Preprocess the signatures, doing lots of normalization and feature creation\n\n Parameters\n ----------\n load_name_counts: bool\n whether name counts were loaded (mostly just here so we can not load them when runnin... | def preprocess_signatures(self, load_name_counts: bool):
'\n Preprocess the signatures, doing lots of normalization and feature creation\n\n Parameters\n ----------\n load_name_counts: bool\n whether name counts were loaded (mostly just here so we can not load them when runnin... |
4b1ef29607ad473e14b626f07f2f7c19220cf831b412a37655d7e5fac12dad9b | @staticmethod
def maybe_load_json(path_or_json: Optional[Union[(str, Union[(List, Dict)])]]) -> Any:
'\n Either loads a dictionary from a json file or passes through the object\n\n Parameters\n ----------\n path_or_json: string or Dict\n the file path or the object\n\n ... | Either loads a dictionary from a json file or passes through the object
Parameters
----------
path_or_json: string or Dict
the file path or the object
Returns
-------
either the loaded json, or the passed in object | s2and/data.py | maybe_load_json | atypon/S2AND | 39 | python | @staticmethod
def maybe_load_json(path_or_json: Optional[Union[(str, Union[(List, Dict)])]]) -> Any:
'\n Either loads a dictionary from a json file or passes through the object\n\n Parameters\n ----------\n path_or_json: string or Dict\n the file path or the object\n\n ... | @staticmethod
def maybe_load_json(path_or_json: Optional[Union[(str, Union[(List, Dict)])]]) -> Any:
'\n Either loads a dictionary from a json file or passes through the object\n\n Parameters\n ----------\n path_or_json: string or Dict\n the file path or the object\n\n ... |
b7bc10122bcbb4f5ceda65f0a799df6e4c5c6a3e7b7aa06c7c733be41d5d4f1e | @staticmethod
def maybe_load_list(path_or_list: Optional[Union[(str, list, Set)]]) -> Optional[Union[(list, Set)]]:
'\n Either loads a list from a text file or passes through the object\n\n Parameters\n ----------\n path_or_list: string or list\n the file path or the object\n\... | Either loads a list from a text file or passes through the object
Parameters
----------
path_or_list: string or list
the file path or the object
Returns
-------
either the loaded list, or the passed in object | s2and/data.py | maybe_load_list | atypon/S2AND | 39 | python | @staticmethod
def maybe_load_list(path_or_list: Optional[Union[(str, list, Set)]]) -> Optional[Union[(list, Set)]]:
'\n Either loads a list from a text file or passes through the object\n\n Parameters\n ----------\n path_or_list: string or list\n the file path or the object\n\... | @staticmethod
def maybe_load_list(path_or_list: Optional[Union[(str, list, Set)]]) -> Optional[Union[(list, Set)]]:
'\n Either loads a list from a text file or passes through the object\n\n Parameters\n ----------\n path_or_list: string or list\n the file path or the object\n\... |
2e37fb9fa51964466948b557633ac46394dde2fe31ff73d7eafb55f2d55acc18 | @staticmethod
def maybe_load_dataframe(path_or_dataframe: Optional[Union[(str, pd.DataFrame)]]) -> Optional[pd.DataFrame]:
'\n Either loads a dataframe from a csv file or passes through the object\n\n Parameters\n ----------\n path_or_dataframe: string or dataframe\n the file ... | Either loads a dataframe from a csv file or passes through the object
Parameters
----------
path_or_dataframe: string or dataframe
the file path or the object
Returns
-------
either the loaded dataframe, or the passed in object | s2and/data.py | maybe_load_dataframe | atypon/S2AND | 39 | python | @staticmethod
def maybe_load_dataframe(path_or_dataframe: Optional[Union[(str, pd.DataFrame)]]) -> Optional[pd.DataFrame]:
'\n Either loads a dataframe from a csv file or passes through the object\n\n Parameters\n ----------\n path_or_dataframe: string or dataframe\n the file ... | @staticmethod
def maybe_load_dataframe(path_or_dataframe: Optional[Union[(str, pd.DataFrame)]]) -> Optional[pd.DataFrame]:
'\n Either loads a dataframe from a csv file or passes through the object\n\n Parameters\n ----------\n path_or_dataframe: string or dataframe\n the file ... |
d9bac521768fdd5129b3c2b69ef11396f05a56f97681d6ede3ff133071f5cc33 | @staticmethod
def maybe_load_specter(path_or_pickle: Optional[Union[(str, Dict)]]) -> Optional[Dict]:
'\n Either loads a dictionary from a pickle file or passes through the object\n\n Parameters\n ----------\n path_or_pickle: string or dictionary\n the file path or the object\... | Either loads a dictionary from a pickle file or passes through the object
Parameters
----------
path_or_pickle: string or dictionary
the file path or the object
Returns
-------
either the loaded json, or the passed in object | s2and/data.py | maybe_load_specter | atypon/S2AND | 39 | python | @staticmethod
def maybe_load_specter(path_or_pickle: Optional[Union[(str, Dict)]]) -> Optional[Dict]:
'\n Either loads a dictionary from a pickle file or passes through the object\n\n Parameters\n ----------\n path_or_pickle: string or dictionary\n the file path or the object\... | @staticmethod
def maybe_load_specter(path_or_pickle: Optional[Union[(str, Dict)]]) -> Optional[Dict]:
'\n Either loads a dictionary from a pickle file or passes through the object\n\n Parameters\n ----------\n path_or_pickle: string or dictionary\n the file path or the object\... |
ed9b9058500954b8ca27954b4a12a148a10e51c1c713fbe0216d82e976124fb0 | def get_original_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided with the dataset\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block = {}
for (signature_id, signature) in self.signat... | Gets the block dict based on the blocks provided with the dataset
Returns
-------
Dict: mapping from block id to list of signatures in the block | s2and/data.py | get_original_blocks | atypon/S2AND | 39 | python | def get_original_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided with the dataset\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block = {}
for (signature_id, signature) in self.signat... | def get_original_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided with the dataset\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block = {}
for (signature_id, signature) in self.signat... |
adb501c08ca64358c42da28f775976bab0734291fe16adffea3712a66f559e02 | def get_s2_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided by Semantic Scholar data\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block: Dict[(str, List[str])] = {}
for (signature_id,... | Gets the block dict based on the blocks provided by Semantic Scholar data
Returns
-------
Dict: mapping from block id to list of signatures in the block | s2and/data.py | get_s2_blocks | atypon/S2AND | 39 | python | def get_s2_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided by Semantic Scholar data\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block: Dict[(str, List[str])] = {}
for (signature_id,... | def get_s2_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict based on the blocks provided by Semantic Scholar data\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
block: Dict[(str, List[str])] = {}
for (signature_id,... |
f370287ab4b4ee70ab3f2c658533cf8c76aff0356ed0def6d7d27a45ba5884a7 | def get_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
if (self.block_type == 's2'):
return self.get_s2_blocks()
elif (self.block_type == 'original'):
... | Gets the block dict
Returns
-------
Dict: mapping from block id to list of signatures in the block | s2and/data.py | get_blocks | atypon/S2AND | 39 | python | def get_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
if (self.block_type == 's2'):
return self.get_s2_blocks()
elif (self.block_type == 'original'):
... | def get_blocks(self) -> Dict[(str, List[str])]:
'\n Gets the block dict\n\n Returns\n -------\n Dict: mapping from block id to list of signatures in the block\n '
if (self.block_type == 's2'):
return self.get_s2_blocks()
elif (self.block_type == 'original'):
... |
10305d75d352e529353963230c8d5904d089d8dbb3df8fe59f09af4e325c7ad0 | def get_constraint(self, signature_id_1: str, signature_id_2: str, low_value: Union[(float, int)]=0, high_value: Union[(float, int)]=LARGE_DISTANCE, dont_merge_cluster_seeds: bool=True, incremental_dont_use_cluster_seeds: bool=False) -> Optional[float]:
'Applies cluster_seeds and generates the default\n cons... | Applies cluster_seeds and generates the default
constraints which are:
First we apply the passed-in cluster_seeds, then:
(1) if not a.prefix(b) or b.prefix(a) and (a, b) not in self.name_tuples:
distance(a, b) = high_value
(2) if len(a_middle) > 0 and len(b_middle) > 0 and
intersection(a_middle_chars, b_midd... | s2and/data.py | get_constraint | atypon/S2AND | 39 | python | def get_constraint(self, signature_id_1: str, signature_id_2: str, low_value: Union[(float, int)]=0, high_value: Union[(float, int)]=LARGE_DISTANCE, dont_merge_cluster_seeds: bool=True, incremental_dont_use_cluster_seeds: bool=False) -> Optional[float]:
'Applies cluster_seeds and generates the default\n cons... | def get_constraint(self, signature_id_1: str, signature_id_2: str, low_value: Union[(float, int)]=0, high_value: Union[(float, int)]=LARGE_DISTANCE, dont_merge_cluster_seeds: bool=True, incremental_dont_use_cluster_seeds: bool=False) -> Optional[float]:
'Applies cluster_seeds and generates the default\n cons... |
b42d3892dc561b7324ac64f0bb03495e3b458d9b2e9ae4697ec5034c167f8f5e | def get_signatures_to_block(self) -> Dict[(str, str)]:
'\n Creates a dictionary mapping signature id to block key\n\n Returns\n -------\n Dict: the signature to block dictionary\n '
signatures_to_block: Dict[(str, str)] = {}
block_dict = self.get_blocks()
for (block_ke... | Creates a dictionary mapping signature id to block key
Returns
-------
Dict: the signature to block dictionary | s2and/data.py | get_signatures_to_block | atypon/S2AND | 39 | python | def get_signatures_to_block(self) -> Dict[(str, str)]:
'\n Creates a dictionary mapping signature id to block key\n\n Returns\n -------\n Dict: the signature to block dictionary\n '
signatures_to_block: Dict[(str, str)] = {}
block_dict = self.get_blocks()
for (block_ke... | def get_signatures_to_block(self) -> Dict[(str, str)]:
'\n Creates a dictionary mapping signature id to block key\n\n Returns\n -------\n Dict: the signature to block dictionary\n '
signatures_to_block: Dict[(str, str)] = {}
block_dict = self.get_blocks()
for (block_ke... |
042046e0aacfc0ed65122b2d08c335ec76decd9ea6ba902c7799fb2d52eef000 | def split_blocks_helper(self, blocks_dict: Dict[(str, List[str])]) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks\n\n Parameters\n ----------\n blocks_dict: Dict\n the full block dictiona... | Splits the block dict into train/val/test blocks
Parameters
----------
blocks_dict: Dict
the full block dictionary
Returns
-------
train/val/test block dictionaries | s2and/data.py | split_blocks_helper | atypon/S2AND | 39 | python | def split_blocks_helper(self, blocks_dict: Dict[(str, List[str])]) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks\n\n Parameters\n ----------\n blocks_dict: Dict\n the full block dictiona... | def split_blocks_helper(self, blocks_dict: Dict[(str, List[str])]) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks\n\n Parameters\n ----------\n blocks_dict: Dict\n the full block dictiona... |
dc290ec6854ca81f45cd6e65f2f739284d4a04d42a0980d90ce068faf3438d17 | def group_signature_helper(self, signature_list: List[str]) -> Dict[(str, List[str])]:
'\n creates a block dict containing a specific input signature list\n\n Parameters\n ----------\n signature_list: List\n the list of signatures to include\n\n Returns\n -------... | creates a block dict containing a specific input signature list
Parameters
----------
signature_list: List
the list of signatures to include
Returns
-------
Dict: the block dict for the input signatures | s2and/data.py | group_signature_helper | atypon/S2AND | 39 | python | def group_signature_helper(self, signature_list: List[str]) -> Dict[(str, List[str])]:
'\n creates a block dict containing a specific input signature list\n\n Parameters\n ----------\n signature_list: List\n the list of signatures to include\n\n Returns\n -------... | def group_signature_helper(self, signature_list: List[str]) -> Dict[(str, List[str])]:
'\n creates a block dict containing a specific input signature list\n\n Parameters\n ----------\n signature_list: List\n the list of signatures to include\n\n Returns\n -------... |
3c5e76c04baa698015840112ecd6949b6dca48898146d8e69c35724e6cac02f7 | def split_cluster_signatures(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on split type requested.\n Options for splitting are `signatures`, `blocks`, and `time`\n\n Returns\n -------\... | Splits the block dict into train/val/test blocks based on split type requested.
Options for splitting are `signatures`, `blocks`, and `time`
Returns
-------
train/val/test block dictionaries | s2and/data.py | split_cluster_signatures | atypon/S2AND | 39 | python | def split_cluster_signatures(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on split type requested.\n Options for splitting are `signatures`, `blocks`, and `time`\n\n Returns\n -------\... | def split_cluster_signatures(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on split type requested.\n Options for splitting are `signatures`, `blocks`, and `time`\n\n Returns\n -------\... |
6edb00fe8f1ec9909acb375c775ac432ba9d895fcf8fa823188ba625f290a80a | def split_cluster_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed block\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... | Splits the block dict into train/val/test blocks based on a fixed block
based split
Returns
-------
train/val/test block dictionaries | s2and/data.py | split_cluster_signatures_fixed | atypon/S2AND | 39 | python | def split_cluster_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed block\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... | def split_cluster_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed block\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... |
bafdf8486fefe5aafa8f5a2e1c8bb25a11d44fbfb1c1890fd76da7517c57c296 | def split_data_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed signature\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... | Splits the block dict into train/val/test blocks based on a fixed signature
based split
Returns
-------
train/val/test block dictionaries | s2and/data.py | split_data_signatures_fixed | atypon/S2AND | 39 | python | def split_data_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed signature\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... | def split_data_signatures_fixed(self) -> Tuple[(Dict[(str, List[str])], Dict[(str, List[str])], Dict[(str, List[str])])]:
'\n Splits the block dict into train/val/test blocks based on a fixed signature\n based split\n\n Returns\n -------\n train/val/test block dictionaries\n ... |
f9a1783bf2d1e8ab4161bee7d513704e9b4ee5836a76a63649ff55b33c690b3e | def split_pairs(self, train_signatures: Dict[(str, List[str])], val_signatures: Dict[(str, List[str])], test_signatures: Dict[(str, List[str])]) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pa... | creates pairs for the pairwise classification task
Parameters
----------
train_signatures: Dict
the train block dict
val_signatures: Dict
the val block dict
test_signatures: Dict
the test block dict
Returns
-------
train/val/test pairs, where each pair is (signature_id_1, signature_id_2, label) | s2and/data.py | split_pairs | atypon/S2AND | 39 | python | def split_pairs(self, train_signatures: Dict[(str, List[str])], val_signatures: Dict[(str, List[str])], test_signatures: Dict[(str, List[str])]) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pa... | def split_pairs(self, train_signatures: Dict[(str, List[str])], val_signatures: Dict[(str, List[str])], test_signatures: Dict[(str, List[str])]) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pa... |
969934fdf26bbb3fd715ec4536a2d756f172dc9a8338e15570a70da375811dbe | def construct_cluster_to_signatures(self, block_dict: Dict[(str, List[str])]) -> Dict[(str, List[str])]:
'\n creates a dictionary mapping cluster to signatures\n\n Parameters\n ----------\n block_dict: Dict\n the block dict to construct cluster to signatures for\n\n Ret... | creates a dictionary mapping cluster to signatures
Parameters
----------
block_dict: Dict
the block dict to construct cluster to signatures for
Returns
-------
Dict: the dictionary mapping cluster to signatures | s2and/data.py | construct_cluster_to_signatures | atypon/S2AND | 39 | python | def construct_cluster_to_signatures(self, block_dict: Dict[(str, List[str])]) -> Dict[(str, List[str])]:
'\n creates a dictionary mapping cluster to signatures\n\n Parameters\n ----------\n block_dict: Dict\n the block dict to construct cluster to signatures for\n\n Ret... | def construct_cluster_to_signatures(self, block_dict: Dict[(str, List[str])]) -> Dict[(str, List[str])]:
'\n creates a dictionary mapping cluster to signatures\n\n Parameters\n ----------\n block_dict: Dict\n the block dict to construct cluster to signatures for\n\n Ret... |
67a99d3fb6ca94e6a2de4cf8d6a4419a40f83ae388e0a59981252cdbdbcb821d | def fixed_pairs(self) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pairs for the pairwise classification task from a fixed train/val/test split\n\n Returns\n -------\n tra... | creates pairs for the pairwise classification task from a fixed train/val/test split
Returns
-------
train/val/test pairs, where each pair is (signature_id_1, signature_id_2, label) | s2and/data.py | fixed_pairs | atypon/S2AND | 39 | python | def fixed_pairs(self) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pairs for the pairwise classification task from a fixed train/val/test split\n\n Returns\n -------\n tra... | def fixed_pairs(self) -> Tuple[(List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]], List[Tuple[(str, str, Union[(int, float)])]])]:
'\n creates pairs for the pairwise classification task from a fixed train/val/test split\n\n Returns\n -------\n tra... |
2f063b05400a21ff25fd73408f8de8a6b96b83ff4aade661c45ec2e462240e05 | def all_pairs(self) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n creates all pairs within blocks, probably used for inference\n\n Returns\n -------\n all pairs, where each pair is (signature_id_1, signature_id_2, label)\n '
all_pairs_output = self.pair_sampling(0, [], ... | creates all pairs within blocks, probably used for inference
Returns
-------
all pairs, where each pair is (signature_id_1, signature_id_2, label) | s2and/data.py | all_pairs | atypon/S2AND | 39 | python | def all_pairs(self) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n creates all pairs within blocks, probably used for inference\n\n Returns\n -------\n all pairs, where each pair is (signature_id_1, signature_id_2, label)\n '
all_pairs_output = self.pair_sampling(0, [], ... | def all_pairs(self) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n creates all pairs within blocks, probably used for inference\n\n Returns\n -------\n all pairs, where each pair is (signature_id_1, signature_id_2, label)\n '
all_pairs_output = self.pair_sampling(0, [], ... |
89fbe7a0a81e26a8807d9439dfbb8f917a92dd07cd9c08392e7bb9e049fbf3ff | def get_full_name(self, signature_id: str) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature_id: str\n the signature id to create the full name for\n\n Returns\n -------\n string: the full name\n '
fi... | Creates the full name from the name parts.
Parameters
----------
signature_id: str
the signature id to create the full name for
Returns
-------
string: the full name | s2and/data.py | get_full_name | atypon/S2AND | 39 | python | def get_full_name(self, signature_id: str) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature_id: str\n the signature id to create the full name for\n\n Returns\n -------\n string: the full name\n '
fi... | def get_full_name(self, signature_id: str) -> str:
'\n Creates the full name from the name parts.\n\n Parameters\n ----------\n signature_id: str\n the signature id to create the full name for\n\n Returns\n -------\n string: the full name\n '
fi... |
e19ce6bebdeb0de816c523dcd695bbc4fb98f9f17894377bf4a0e8f1893c50ba | def pair_sampling(self, sample_size: int, signature_ids: List[str], blocks: Dict[(str, List[str])], all_pairs: bool=False) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n Enumerates all pairs exhaustively, and samples pairs according to the four different strategies.\n\n Parameters\n -----... | Enumerates all pairs exhaustively, and samples pairs according to the four different strategies.
Parameters
----------
sample_size: integer
The desired sample size
signature_ids: list
List of signature ids from which pairs can be sampled from.
List must be provided if blocking is not used
blocks: dict
... | s2and/data.py | pair_sampling | atypon/S2AND | 39 | python | def pair_sampling(self, sample_size: int, signature_ids: List[str], blocks: Dict[(str, List[str])], all_pairs: bool=False) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n Enumerates all pairs exhaustively, and samples pairs according to the four different strategies.\n\n Parameters\n -----... | def pair_sampling(self, sample_size: int, signature_ids: List[str], blocks: Dict[(str, List[str])], all_pairs: bool=False) -> List[Tuple[(str, str, Union[(int, float)])]]:
'\n Enumerates all pairs exhaustively, and samples pairs according to the four different strategies.\n\n Parameters\n -----... |
b7396a0c2c091ed5d567bdba3e8283c0adae1d41fc9bc5f438254ea33e132526 | def load(pglot, user_config):
' setup the http server '
global SERVER, _THREAD
config = DEFAULT_CONFIG
config.update(user_config)
set_config(config)
SERVER = tornado.web.Application([], {})
SERVER.listen(PORT)
_THREAD = threading.Thread(target=run_server)
_THREAD.daemon = True
_T... | setup the http server | polyglot/element_manager/http/__init__.py | load | UniversalDevicesInc/Polyglot | 27 | python | def load(pglot, user_config):
' '
global SERVER, _THREAD
config = DEFAULT_CONFIG
config.update(user_config)
set_config(config)
SERVER = tornado.web.Application([], {})
SERVER.listen(PORT)
_THREAD = threading.Thread(target=run_server)
_THREAD.daemon = True
_THREAD.start()
_LO... | def load(pglot, user_config):
' '
global SERVER, _THREAD
config = DEFAULT_CONFIG
config.update(user_config)
set_config(config)
SERVER = tornado.web.Application([], {})
SERVER.listen(PORT)
_THREAD = threading.Thread(target=run_server)
_THREAD.daemon = True
_THREAD.start()
_LO... |
a791ef5ec9df8e4058506ea7098e066d6363d0192ec271b6303fff3f4476b96b | def unload():
' stops the http server '
ioloop = tornado.ioloop.IOLoop.instance()
ioloop.add_callback((lambda x: x.stop()), ioloop)
_LOGGER.info('Unloaded HTTP element') | stops the http server | polyglot/element_manager/http/__init__.py | unload | UniversalDevicesInc/Polyglot | 27 | python | def unload():
' '
ioloop = tornado.ioloop.IOLoop.instance()
ioloop.add_callback((lambda x: x.stop()), ioloop)
_LOGGER.info('Unloaded HTTP element') | def unload():
' '
ioloop = tornado.ioloop.IOLoop.instance()
ioloop.add_callback((lambda x: x.stop()), ioloop)
_LOGGER.info('Unloaded HTTP element')<|docstring|>stops the http server<|endoftext|> |
c8401384a7ad62f290781697687419be1ff7f541a76b6f41cc1f8090802c38a4 | def get_config():
" Returns the element's configuration. "
return {'password': AUTH_PASS, 'username': AUTH_USER, 'port': PORT} | Returns the element's configuration. | polyglot/element_manager/http/__init__.py | get_config | UniversalDevicesInc/Polyglot | 27 | python | def get_config():
" "
return {'password': AUTH_PASS, 'username': AUTH_USER, 'port': PORT} | def get_config():
" "
return {'password': AUTH_PASS, 'username': AUTH_USER, 'port': PORT}<|docstring|>Returns the element's configuration.<|endoftext|> |
1f3ee7c6554ca294fc7a340bb88a4353ea6eb86f5f08830d47c0928496606f08 | def set_config(config):
' Updates the current configuration. '
global AUTH_USER, AUTH_PASS, PORT
PORT = config['port']
AUTH_USER = config['username']
AUTH_PASS = config['password'] | Updates the current configuration. | polyglot/element_manager/http/__init__.py | set_config | UniversalDevicesInc/Polyglot | 27 | python | def set_config(config):
' '
global AUTH_USER, AUTH_PASS, PORT
PORT = config['port']
AUTH_USER = config['username']
AUTH_PASS = config['password'] | def set_config(config):
' '
global AUTH_USER, AUTH_PASS, PORT
PORT = config['port']
AUTH_USER = config['username']
AUTH_PASS = config['password']<|docstring|>Updates the current configuration.<|endoftext|> |
a951bb3bebe0b14aa148f1e994e69ff06f39db3b7b7a5f0829b73369cfa84ae2 | def register(handlers=None, subdomain=None, parent_dir=None, urls=None):
"\n Register additional handlers to the server.\n\n :param handlers: List of handler classes to register.\n :param subdomain: The desired subdomain\n :param parent_dir: The directory under which all the handlers should be\n ... | Register additional handlers to the server.
:param handlers: List of handler classes to register.
:param subdomain: The desired subdomain
:param parent_dir: The directory under which all the handlers should be
placed
:param urls: List of lists like [['path', Handler]].
Overwrites handle... | polyglot/element_manager/http/__init__.py | register | UniversalDevicesInc/Polyglot | 27 | python | def register(handlers=None, subdomain=None, parent_dir=None, urls=None):
"\n Register additional handlers to the server.\n\n :param handlers: List of handler classes to register.\n :param subdomain: The desired subdomain\n :param parent_dir: The directory under which all the handlers should be\n ... | def register(handlers=None, subdomain=None, parent_dir=None, urls=None):
"\n Register additional handlers to the server.\n\n :param handlers: List of handler classes to register.\n :param subdomain: The desired subdomain\n :param parent_dir: The directory under which all the handlers should be\n ... |
eed7e3b02bea346b82e9bd52bef769208b83f473bdb58eeddef386874e4849c2 | def run_server():
' run the tornado web server '
tornado.ioloop.IOLoop.instance().start() | run the tornado web server | polyglot/element_manager/http/__init__.py | run_server | UniversalDevicesInc/Polyglot | 27 | python | def run_server():
' '
tornado.ioloop.IOLoop.instance().start() | def run_server():
' '
tornado.ioloop.IOLoop.instance().start()<|docstring|>run the tornado web server<|endoftext|> |
b1018b52897e3a838a2140edb3755b4902512849c87c536f77b1edfd1b1b2896 | def authenticate(username, password):
'\n Authenticate the credentials.\n\n :param username: Supplied username\n :param password: Supplied password\n '
if (AUTH_USER is None):
return True
return ((username == AUTH_USER) and (password == AUTH_PASS)) | Authenticate the credentials.
:param username: Supplied username
:param password: Supplied password | polyglot/element_manager/http/__init__.py | authenticate | UniversalDevicesInc/Polyglot | 27 | python | def authenticate(username, password):
'\n Authenticate the credentials.\n\n :param username: Supplied username\n :param password: Supplied password\n '
if (AUTH_USER is None):
return True
return ((username == AUTH_USER) and (password == AUTH_PASS)) | def authenticate(username, password):
'\n Authenticate the credentials.\n\n :param username: Supplied username\n :param password: Supplied password\n '
if (AUTH_USER is None):
return True
return ((username == AUTH_USER) and (password == AUTH_PASS))<|docstring|>Authenticate the credential... |
636d4001cacd7ed0db4c325f5d265ad28f5f81df170e081cf16f2e6fb677862c | def add_handler_callback(server, subdmn, hndls):
' add handler to server '
server.add_handlers(subdmn, hndls) | add handler to server | polyglot/element_manager/http/__init__.py | add_handler_callback | UniversalDevicesInc/Polyglot | 27 | python | def add_handler_callback(server, subdmn, hndls):
' '
server.add_handlers(subdmn, hndls) | def add_handler_callback(server, subdmn, hndls):
' '
server.add_handlers(subdmn, hndls)<|docstring|>add handler to server<|endoftext|> |
1554df4cc35aa2b65b08f25a9ed3e5ede3fc7d63d0e48916fac23a20687cafc2 | def get(self):
' Get handler '
self.write('Polyglot is Running')
self.finish() | Get handler | polyglot/element_manager/http/__init__.py | get | UniversalDevicesInc/Polyglot | 27 | python | def get(self):
' '
self.write('Polyglot is Running')
self.finish() | def get(self):
' '
self.write('Polyglot is Running')
self.finish()<|docstring|>Get handler<|endoftext|> |
18223755c4da3352ce211709f4087ec170b00a893e983a1e777a17ecc98c99ee | def data_received(self, chunk):
' Overwriting abstract method. '
pass | Overwriting abstract method. | polyglot/element_manager/http/__init__.py | data_received | UniversalDevicesInc/Polyglot | 27 | python | def data_received(self, chunk):
' '
pass | def data_received(self, chunk):
' '
pass<|docstring|>Overwriting abstract method.<|endoftext|> |
18223755c4da3352ce211709f4087ec170b00a893e983a1e777a17ecc98c99ee | def data_received(self, chunk):
' Overwriting abstract method. '
pass | Overwriting abstract method. | polyglot/element_manager/http/__init__.py | data_received | UniversalDevicesInc/Polyglot | 27 | python | def data_received(self, chunk):
' '
pass | def data_received(self, chunk):
' '
pass<|docstring|>Overwriting abstract method.<|endoftext|> |
ec5807a0fc926c227b4096a70a7624eccac79a92cd5a83339511bc0d78f2165c | def doc_url(handler):
" reads the url regexp from the handler's docstring. "
docs = handler.__doc__
pieces = docs.strip().split('\n\n')[0].split('\n')
return ''.join([piece.strip() for piece in pieces]) | reads the url regexp from the handler's docstring. | polyglot/element_manager/http/__init__.py | doc_url | UniversalDevicesInc/Polyglot | 27 | python | def doc_url(handler):
" "
docs = handler.__doc__
pieces = docs.strip().split('\n\n')[0].split('\n')
return .join([piece.strip() for piece in pieces]) | def doc_url(handler):
" "
docs = handler.__doc__
pieces = docs.strip().split('\n\n')[0].split('\n')
return .join([piece.strip() for piece in pieces])<|docstring|>reads the url regexp from the handler's docstring.<|endoftext|> |
a51677dbf94e1fb6e013fe7b9c617ba27d233998790ee4006ec733d6e6462e22 | def forward(self, data_dict):
'\n Args:\n data_dict:\n points: (N, 3 + C_in)\n gt_boxes: optional, (N, 7) [x, y, z, dx, dy, dz, heading]\n gt_names: optional, (N), string\n ...\n\n Returns:\n '
if self.train:
for... | Args:
data_dict:
points: (N, 3 + C_in)
gt_boxes: optional, (N, 7) [x, y, z, dx, dy, dz, heading]
gt_names: optional, (N), string
...
Returns: | opencood/data_utils/augmentor/data_augmentor.py | forward | Weizhe-Chen/OpenCOOD | 0 | python | def forward(self, data_dict):
'\n Args:\n data_dict:\n points: (N, 3 + C_in)\n gt_boxes: optional, (N, 7) [x, y, z, dx, dy, dz, heading]\n gt_names: optional, (N), string\n ...\n\n Returns:\n '
if self.train:
for... | def forward(self, data_dict):
'\n Args:\n data_dict:\n points: (N, 3 + C_in)\n gt_boxes: optional, (N, 7) [x, y, z, dx, dy, dz, heading]\n gt_names: optional, (N), string\n ...\n\n Returns:\n '
if self.train:
for... |
e1cd7423a282b7c0b3d9773ada8439049904c20b4d33c0023aad6731d9afced2 | def fatal(msg):
'fatal error: print message and exit'
print('FATAL: {}'.format(msg))
sys.exit(1) | fatal error: print message and exit | pgspell.py | fatal | asylumcs/pgspell | 0 | python | def fatal(msg):
print('FATAL: {}'.format(msg))
sys.exit(1) | def fatal(msg):
print('FATAL: {}'.format(msg))
sys.exit(1)<|docstring|>fatal error: print message and exit<|endoftext|> |
bea5f08290f486dfed7a3e57ddbf03c71f64ef78db754f973551176a22ea1b67 | def aggregate(b):
'aggregation\n load the aggregation file\n combine this data set\n '
hdata = {}
t1 = open('aggregate.txt', 'r', encoding='UTF-8').read()
a = t1.split('\n')
for t in a:
if (t != ''):
c = t.split(',')
hdata[c[0]] = int(c[1])
for word in b:... | aggregation
load the aggregation file
combine this data set | pgspell.py | aggregate | asylumcs/pgspell | 0 | python | def aggregate(b):
'aggregation\n load the aggregation file\n combine this data set\n '
hdata = {}
t1 = open('aggregate.txt', 'r', encoding='UTF-8').read()
a = t1.split('\n')
for t in a:
if (t != ):
c = t.split(',')
hdata[c[0]] = int(c[1])
for word in b:
... | def aggregate(b):
'aggregation\n load the aggregation file\n combine this data set\n '
hdata = {}
t1 = open('aggregate.txt', 'r', encoding='UTF-8').read()
a = t1.split('\n')
for t in a:
if (t != ):
c = t.split(',')
hdata[c[0]] = int(c[1])
for word in b:
... |
87f2999f964bb699d611c88e2ef3fff490244cf0b8bac52e1b217df813c2e08e | def loadFile(fn):
'\n load specified file\n source file can be UTF-8 or ISO-8859-1\n '
if (not os.path.isfile(fn)):
fatal('file {} not found'.format(fn))
try:
wbuf = open(fn, 'r', encoding='UTF-8').read()
wbs = wbuf.split('\n')
t31 = ':'.join(('{0:x}'.format(ord(c)) ... | load specified file
source file can be UTF-8 or ISO-8859-1 | pgspell.py | loadFile | asylumcs/pgspell | 0 | python | def loadFile(fn):
'\n load specified file\n source file can be UTF-8 or ISO-8859-1\n '
if (not os.path.isfile(fn)):
fatal('file {} not found'.format(fn))
try:
wbuf = open(fn, 'r', encoding='UTF-8').read()
wbs = wbuf.split('\n')
t31 = ':'.join(('{0:x}'.format(ord(c)) ... | def loadFile(fn):
'\n load specified file\n source file can be UTF-8 or ISO-8859-1\n '
if (not os.path.isfile(fn)):
fatal('file {} not found'.format(fn))
try:
wbuf = open(fn, 'r', encoding='UTF-8').read()
wbs = wbuf.split('\n')
t31 = ':'.join(('{0:x}'.format(ord(c)) ... |
516562e665556bd74a23b1e12028b936c6e6bc9eb3154219b62dc284d48b3fd3 | def loadFromFile(fn):
'load word file, protect internal punctuation, return as a list'
t32 = loadFile(fn)
for (i, _) in enumerate(t32):
t32[i] = re.sub('--', '≣≣', t32[i])
t32[i] = re.sub("[’']", 'ᒽ', t32[i])
t32[i] = re.sub('([\\p{L}\\-])‘([\\p{L}\\-])', '\\1ᒻ\\2', t32[i])
t... | load word file, protect internal punctuation, return as a list | pgspell.py | loadFromFile | asylumcs/pgspell | 0 | python | def loadFromFile(fn):
t32 = loadFile(fn)
for (i, _) in enumerate(t32):
t32[i] = re.sub('--', '≣≣', t32[i])
t32[i] = re.sub("[’']", 'ᒽ', t32[i])
t32[i] = re.sub('([\\p{L}\\-])‘([\\p{L}\\-])', '\\1ᒻ\\2', t32[i])
t32[i] = re.sub('([\\p{L}\\-])‘]([\\p{L}\\-])', '\\1ᒻ\\2', t32[i]... | def loadFromFile(fn):
t32 = loadFile(fn)
for (i, _) in enumerate(t32):
t32[i] = re.sub('--', '≣≣', t32[i])
t32[i] = re.sub("[’']", 'ᒽ', t32[i])
t32[i] = re.sub('([\\p{L}\\-])‘([\\p{L}\\-])', '\\1ᒻ\\2', t32[i])
t32[i] = re.sub('([\\p{L}\\-])‘]([\\p{L}\\-])', '\\1ᒻ\\2', t32[i]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.