repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
KeithSSmith/switcheo-python
switcheo/authenticated_client.py
AuthenticatedClient.execute_order
def execute_order(self, order_params, private_key): """ This function executes the order created before it and signs the transaction to be submitted to the blockchain. Execution of this function is as follows:: execute_order(order_params=create_order, private_key=kp) The ex...
python
def execute_order(self, order_params, private_key): """ This function executes the order created before it and signs the transaction to be submitted to the blockchain. Execution of this function is as follows:: execute_order(order_params=create_order, private_key=kp) The ex...
[ "def", "execute_order", "(", "self", ",", "order_params", ",", "private_key", ")", ":", "order_id", "=", "order_params", "[", "'id'", "]", "api_params", "=", "self", ".", "sign_execute_order_function", "[", "self", ".", "blockchain", "]", "(", "order_params", ...
This function executes the order created before it and signs the transaction to be submitted to the blockchain. Execution of this function is as follows:: execute_order(order_params=create_order, private_key=kp) The expected return result for this function is the same as the execute_order ...
[ "This", "function", "executes", "the", "order", "created", "before", "it", "and", "signs", "the", "transaction", "to", "be", "submitted", "to", "the", "blockchain", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/authenticated_client.py#L595-L651
KeithSSmith/switcheo-python
switcheo/authenticated_client.py
AuthenticatedClient.withdrawal
def withdrawal(self, asset, amount, private_key): """ This function is a wrapper function around the create and execute withdrawal functions to help make this processes simpler for the end user by combining these requests in 1 step. Execution of this function is as follows:: ...
python
def withdrawal(self, asset, amount, private_key): """ This function is a wrapper function around the create and execute withdrawal functions to help make this processes simpler for the end user by combining these requests in 1 step. Execution of this function is as follows:: ...
[ "def", "withdrawal", "(", "self", ",", "asset", ",", "amount", ",", "private_key", ")", ":", "create_withdrawal", "=", "self", ".", "create_withdrawal", "(", "asset", "=", "asset", ",", "amount", "=", "amount", ",", "private_key", "=", "private_key", ")", ...
This function is a wrapper function around the create and execute withdrawal functions to help make this processes simpler for the end user by combining these requests in 1 step. Execution of this function is as follows:: withdrawal(asset="SWTH", amount=1.1, private_key=kp)) The ex...
[ "This", "function", "is", "a", "wrapper", "function", "around", "the", "create", "and", "execute", "withdrawal", "functions", "to", "help", "make", "this", "processes", "simpler", "for", "the", "end", "user", "by", "combining", "these", "requests", "in", "1", ...
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/authenticated_client.py#L653-L687
KeithSSmith/switcheo-python
switcheo/authenticated_client.py
AuthenticatedClient.create_withdrawal
def create_withdrawal(self, asset, amount, private_key): """ Function to create a withdrawal request by generating a withdrawal ID request from the Switcheo API. Execution of this function is as follows:: create_withdrawal(asset="SWTH", amount=1.1, private_key=kp) The expec...
python
def create_withdrawal(self, asset, amount, private_key): """ Function to create a withdrawal request by generating a withdrawal ID request from the Switcheo API. Execution of this function is as follows:: create_withdrawal(asset="SWTH", amount=1.1, private_key=kp) The expec...
[ "def", "create_withdrawal", "(", "self", ",", "asset", ",", "amount", ",", "private_key", ")", ":", "signable_params", "=", "{", "'blockchain'", ":", "self", ".", "blockchain", ",", "'asset_id'", ":", "asset", ",", "'amount'", ":", "str", "(", "self", ".",...
Function to create a withdrawal request by generating a withdrawal ID request from the Switcheo API. Execution of this function is as follows:: create_withdrawal(asset="SWTH", amount=1.1, private_key=kp) The expected return result for this function is as follows:: { ...
[ "Function", "to", "create", "a", "withdrawal", "request", "by", "generating", "a", "withdrawal", "ID", "request", "from", "the", "Switcheo", "API", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/authenticated_client.py#L689-L718
KeithSSmith/switcheo-python
switcheo/authenticated_client.py
AuthenticatedClient.execute_withdrawal
def execute_withdrawal(self, withdrawal_params, private_key): """ This function is to sign the message generated from the create withdrawal function and submit it to the blockchain for transfer from the smart contract to the owners address. Execution of this function is as follows:: ...
python
def execute_withdrawal(self, withdrawal_params, private_key): """ This function is to sign the message generated from the create withdrawal function and submit it to the blockchain for transfer from the smart contract to the owners address. Execution of this function is as follows:: ...
[ "def", "execute_withdrawal", "(", "self", ",", "withdrawal_params", ",", "private_key", ")", ":", "withdrawal_id", "=", "withdrawal_params", "[", "'id'", "]", "api_params", "=", "self", ".", "sign_execute_withdrawal_function", "[", "self", ".", "blockchain", "]", ...
This function is to sign the message generated from the create withdrawal function and submit it to the blockchain for transfer from the smart contract to the owners address. Execution of this function is as follows:: execute_withdrawal(withdrawal_params=create_withdrawal, private_key=kp) ...
[ "This", "function", "is", "to", "sign", "the", "message", "generated", "from", "the", "create", "withdrawal", "function", "and", "submit", "it", "to", "the", "blockchain", "for", "transfer", "from", "the", "smart", "contract", "to", "the", "owners", "address",...
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/authenticated_client.py#L720-L753
MFreidank/ARSpy
arspy/ars.py
adaptive_rejection_sampling
def adaptive_rejection_sampling(logpdf: callable, a: float, b: float, domain: Tuple[float, float], n_samples: int, random_stream=None): """ Adaptive rejection sampling samples exactly ...
python
def adaptive_rejection_sampling(logpdf: callable, a: float, b: float, domain: Tuple[float, float], n_samples: int, random_stream=None): """ Adaptive rejection sampling samples exactly ...
[ "def", "adaptive_rejection_sampling", "(", "logpdf", ":", "callable", ",", "a", ":", "float", ",", "b", ":", "float", ",", "domain", ":", "Tuple", "[", "float", ",", "float", "]", ",", "n_samples", ":", "int", ",", "random_stream", "=", "None", ")", ":...
Adaptive rejection sampling samples exactly (all samples are i.i.d) and efficiently from any univariate log-concave distribution. The basic idea is to successively determine an envelope of straight-line segments to construct an increasingly accurate approximation of the logarithm. It does not require any normalizat...
[ "Adaptive", "rejection", "sampling", "samples", "exactly", "(", "all", "samples", "are", "i", ".", "i", ".", "d", ")", "and", "efficiently", "from", "any", "univariate", "log", "-", "concave", "distribution", ".", "The", "basic", "idea", "is", "to", "succe...
train
https://github.com/MFreidank/ARSpy/blob/866885071b43e36a529f2fecf584ceef5248d800/arspy/ars.py#L29-L168
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_create_cancellation
def sign_create_cancellation(cancellation_params, key_pair): """ Function to sign the parameters required to create a cancellation request from the Switcheo Exchange. Execution of this function is as follows:: sign_create_cancellation(cancellation_params=signable_params, key_pair=key_pair) The...
python
def sign_create_cancellation(cancellation_params, key_pair): """ Function to sign the parameters required to create a cancellation request from the Switcheo Exchange. Execution of this function is as follows:: sign_create_cancellation(cancellation_params=signable_params, key_pair=key_pair) The...
[ "def", "sign_create_cancellation", "(", "cancellation_params", ",", "key_pair", ")", ":", "encoded_message", "=", "encode_message", "(", "cancellation_params", ")", "create_params", "=", "cancellation_params", ".", "copy", "(", ")", "create_params", "[", "'address'", ...
Function to sign the parameters required to create a cancellation request from the Switcheo Exchange. Execution of this function is as follows:: sign_create_cancellation(cancellation_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows:: { ...
[ "Function", "to", "sign", "the", "parameters", "required", "to", "create", "a", "cancellation", "request", "from", "the", "Switcheo", "Exchange", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L15-L42
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_execute_cancellation
def sign_execute_cancellation(cancellation_params, key_pair): """ Function to sign the parameters required to execute a cancellation request on the Switcheo Exchange. Execution of this function is as follows:: sign_execute_cancellation(cancellation_params=signable_params, key_pair=key_pair) Th...
python
def sign_execute_cancellation(cancellation_params, key_pair): """ Function to sign the parameters required to execute a cancellation request on the Switcheo Exchange. Execution of this function is as follows:: sign_execute_cancellation(cancellation_params=signable_params, key_pair=key_pair) Th...
[ "def", "sign_execute_cancellation", "(", "cancellation_params", ",", "key_pair", ")", ":", "signature", "=", "sign_transaction", "(", "transaction", "=", "cancellation_params", "[", "'transaction'", "]", ",", "private_key_hex", "=", "private_key_to_hex", "(", "key_pair"...
Function to sign the parameters required to execute a cancellation request on the Switcheo Exchange. Execution of this function is as follows:: sign_execute_cancellation(cancellation_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows:: { ...
[ "Function", "to", "sign", "the", "parameters", "required", "to", "execute", "a", "cancellation", "request", "on", "the", "Switcheo", "Exchange", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L45-L66
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_create_deposit
def sign_create_deposit(deposit_params, key_pair): """ Function to create a deposit request by generating a transaction request from the Switcheo API. Execution of this function is as follows:: sign_create_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result fo...
python
def sign_create_deposit(deposit_params, key_pair): """ Function to create a deposit request by generating a transaction request from the Switcheo API. Execution of this function is as follows:: sign_create_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result fo...
[ "def", "sign_create_deposit", "(", "deposit_params", ",", "key_pair", ")", ":", "encoded_message", "=", "encode_message", "(", "deposit_params", ")", "create_params", "=", "deposit_params", ".", "copy", "(", ")", "create_params", "[", "'address'", "]", "=", "neo_g...
Function to create a deposit request by generating a transaction request from the Switcheo API. Execution of this function is as follows:: sign_create_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result for this function is as follows:: { 'blockch...
[ "Function", "to", "create", "a", "deposit", "request", "by", "generating", "a", "transaction", "request", "from", "the", "Switcheo", "API", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L69-L99
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_execute_deposit
def sign_execute_deposit(deposit_params, key_pair): """ Function to execute the deposit request by signing the transaction generated by the create deposit function. Execution of this function is as follows:: sign_execute_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected r...
python
def sign_execute_deposit(deposit_params, key_pair): """ Function to execute the deposit request by signing the transaction generated by the create deposit function. Execution of this function is as follows:: sign_execute_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected r...
[ "def", "sign_execute_deposit", "(", "deposit_params", ",", "key_pair", ")", ":", "signature", "=", "sign_transaction", "(", "transaction", "=", "deposit_params", "[", "'transaction'", "]", ",", "private_key_hex", "=", "private_key_to_hex", "(", "key_pair", "=", "key...
Function to execute the deposit request by signing the transaction generated by the create deposit function. Execution of this function is as follows:: sign_execute_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result for this function is as follows:: { ...
[ "Function", "to", "execute", "the", "deposit", "request", "by", "signing", "the", "transaction", "generated", "by", "the", "create", "deposit", "function", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L102-L123
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_create_order
def sign_create_order(order_params, key_pair): """ Function to sign the create order parameters and send to the Switcheo API. Execution of this function is as follows:: sign_create_order(order_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows...
python
def sign_create_order(order_params, key_pair): """ Function to sign the create order parameters and send to the Switcheo API. Execution of this function is as follows:: sign_create_order(order_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows...
[ "def", "sign_create_order", "(", "order_params", ",", "key_pair", ")", ":", "encoded_message", "=", "encode_message", "(", "order_params", ")", "create_params", "=", "order_params", ".", "copy", "(", ")", "create_params", "[", "'address'", "]", "=", "neo_get_scrip...
Function to sign the create order parameters and send to the Switcheo API. Execution of this function is as follows:: sign_create_order(order_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows:: { 'blockchain': 'neo', ...
[ "Function", "to", "sign", "the", "create", "order", "parameters", "and", "send", "to", "the", "Switcheo", "API", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L126-L160
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_execute_order
def sign_execute_order(order_params, key_pair): """ Function to execute the order request by signing the transaction generated from the create order function. Execution of this function is as follows:: sign_execute_order(order_params=signable_params, key_pair=key_pair) The expected return resu...
python
def sign_execute_order(order_params, key_pair): """ Function to execute the order request by signing the transaction generated from the create order function. Execution of this function is as follows:: sign_execute_order(order_params=signable_params, key_pair=key_pair) The expected return resu...
[ "def", "sign_execute_order", "(", "order_params", ",", "key_pair", ")", ":", "execute_params", "=", "{", "'signatures'", ":", "{", "'fill_groups'", ":", "{", "}", ",", "'fills'", ":", "sign_txn_array", "(", "messages", "=", "order_params", "[", "'fills'", "]",...
Function to execute the order request by signing the transaction generated from the create order function. Execution of this function is as follows:: sign_execute_order(order_params=signable_params, key_pair=key_pair) The expected return result for this function is as follows:: { ...
[ "Function", "to", "execute", "the", "order", "request", "by", "signing", "the", "transaction", "generated", "from", "the", "create", "order", "function", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L163-L197
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_create_withdrawal
def sign_create_withdrawal(withdrawal_params, key_pair): """ Function to create the withdrawal request by signing the parameters necessary for withdrawal. Execution of this function is as follows:: sign_create_withdrawal(withdrawal_params=signable_params, private_key=eth_private_key) The expec...
python
def sign_create_withdrawal(withdrawal_params, key_pair): """ Function to create the withdrawal request by signing the parameters necessary for withdrawal. Execution of this function is as follows:: sign_create_withdrawal(withdrawal_params=signable_params, private_key=eth_private_key) The expec...
[ "def", "sign_create_withdrawal", "(", "withdrawal_params", ",", "key_pair", ")", ":", "encoded_message", "=", "encode_message", "(", "withdrawal_params", ")", "create_params", "=", "withdrawal_params", ".", "copy", "(", ")", "create_params", "[", "'address'", "]", "...
Function to create the withdrawal request by signing the parameters necessary for withdrawal. Execution of this function is as follows:: sign_create_withdrawal(withdrawal_params=signable_params, private_key=eth_private_key) The expected return result for this function is as follows:: { ...
[ "Function", "to", "create", "the", "withdrawal", "request", "by", "signing", "the", "parameters", "necessary", "for", "withdrawal", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L200-L230
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
sign_execute_withdrawal
def sign_execute_withdrawal(withdrawal_params, key_pair): """ Function to execute the withdrawal request by signing the transaction generated from the create withdrawal function. Execution of this function is as follows:: sign_execute_withdrawal(withdrawal_params=signable_params, private_key=eth_pr...
python
def sign_execute_withdrawal(withdrawal_params, key_pair): """ Function to execute the withdrawal request by signing the transaction generated from the create withdrawal function. Execution of this function is as follows:: sign_execute_withdrawal(withdrawal_params=signable_params, private_key=eth_pr...
[ "def", "sign_execute_withdrawal", "(", "withdrawal_params", ",", "key_pair", ")", ":", "withdrawal_id", "=", "withdrawal_params", "[", "'id'", "]", "signable_params", "=", "{", "'id'", ":", "withdrawal_id", ",", "'timestamp'", ":", "get_epoch_milliseconds", "(", ")"...
Function to execute the withdrawal request by signing the transaction generated from the create withdrawal function. Execution of this function is as follows:: sign_execute_withdrawal(withdrawal_params=signable_params, private_key=eth_private_key) The expected return result for this function is as fol...
[ "Function", "to", "execute", "the", "withdrawal", "request", "by", "signing", "the", "transaction", "generated", "from", "the", "create", "withdrawal", "function", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L233-L263
runfalk/spans
spans/settypes.py
MetaRangeSet.register
def register(cls, range_mixin): """ Decorator for registering range set mixins for global use. This works the same as :meth:`~spans.settypes.MetaRangeSet.add` :param range_mixin: A :class:`~spans.types.Range` mixin class to to register a decorated range set m...
python
def register(cls, range_mixin): """ Decorator for registering range set mixins for global use. This works the same as :meth:`~spans.settypes.MetaRangeSet.add` :param range_mixin: A :class:`~spans.types.Range` mixin class to to register a decorated range set m...
[ "def", "register", "(", "cls", ",", "range_mixin", ")", ":", "def", "decorator", "(", "range_set_mixin", ")", ":", "cls", ".", "add", "(", "range_mixin", ",", "range_set_mixin", ")", "return", "range_set_mixin", "return", "decorator" ]
Decorator for registering range set mixins for global use. This works the same as :meth:`~spans.settypes.MetaRangeSet.add` :param range_mixin: A :class:`~spans.types.Range` mixin class to to register a decorated range set mixin class for :return: A decorator to use o...
[ "Decorator", "for", "registering", "range", "set", "mixins", "for", "global", "use", ".", "This", "works", "the", "same", "as", ":", "meth", ":", "~spans", ".", "settypes", ".", "MetaRangeSet", ".", "add" ]
train
https://github.com/runfalk/spans/blob/59ed73407a569c3be86cfdb4b8f438cb8c794540/spans/settypes.py#L60-L73
deshima-dev/decode
decode/models/functions.py
pca
def pca(onarray, offarray, n=10, exchs=None, pc=False, mode='mean'): """Apply Principal Component Analysis (PCA) method to estimate baselines at each time. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. ...
python
def pca(onarray, offarray, n=10, exchs=None, pc=False, mode='mean'): """Apply Principal Component Analysis (PCA) method to estimate baselines at each time. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. ...
[ "def", "pca", "(", "onarray", ",", "offarray", ",", "n", "=", "10", ",", "exchs", "=", "None", ",", "pc", "=", "False", ",", "mode", "=", "'mean'", ")", ":", "logger", "=", "getLogger", "(", "'decode.models.pca'", ")", "logger", ".", "info", "(", "...
Apply Principal Component Analysis (PCA) method to estimate baselines at each time. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. n (int): The number of pricipal components. pc (bool): When True,...
[ "Apply", "Principal", "Component", "Analysis", "(", "PCA", ")", "method", "to", "estimate", "baselines", "at", "each", "time", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/models/functions.py#L21-L95
deshima-dev/decode
decode/models/functions.py
r_division
def r_division(onarray, offarray, rarray, mode='mean'): """Apply R division. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. rarray (decode.array): Decode array of R observations. mode (str): M...
python
def r_division(onarray, offarray, rarray, mode='mean'): """Apply R division. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. rarray (decode.array): Decode array of R observations. mode (str): M...
[ "def", "r_division", "(", "onarray", ",", "offarray", ",", "rarray", ",", "mode", "=", "'mean'", ")", ":", "logger", "=", "getLogger", "(", "'decode.models.r_division'", ")", "logger", ".", "info", "(", "'mode'", ")", "logger", ".", "info", "(", "'{}'", ...
Apply R division. Args: onarray (decode.array): Decode array of on-point observations. offarray (decode.array): Decode array of off-point observations. rarray (decode.array): Decode array of R observations. mode (str): Method for the selection of nominal R value. 'mean':...
[ "Apply", "R", "division", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/models/functions.py#L139-L218
deshima-dev/decode
decode/models/functions.py
gauss_fit
def gauss_fit(map_data, chs=None, mode='deg', amplitude=1, x_mean=0, y_mean=0, x_stddev=None, y_stddev=None, theta=None, cov_matrix=None, noise=0, **kwargs): """make a 2D Gaussian model and fit the observed data with the model. Args: map_data (xarray.Dataarray): Dataarray of cube or single chs. ...
python
def gauss_fit(map_data, chs=None, mode='deg', amplitude=1, x_mean=0, y_mean=0, x_stddev=None, y_stddev=None, theta=None, cov_matrix=None, noise=0, **kwargs): """make a 2D Gaussian model and fit the observed data with the model. Args: map_data (xarray.Dataarray): Dataarray of cube or single chs. ...
[ "def", "gauss_fit", "(", "map_data", ",", "chs", "=", "None", ",", "mode", "=", "'deg'", ",", "amplitude", "=", "1", ",", "x_mean", "=", "0", ",", "y_mean", "=", "0", ",", "x_stddev", "=", "None", ",", "y_stddev", "=", "None", ",", "theta", "=", ...
make a 2D Gaussian model and fit the observed data with the model. Args: map_data (xarray.Dataarray): Dataarray of cube or single chs. chs (list of int): in prep. mode (str): Coordinates for the fitting 'pix' 'deg' amplitude (float or None): Initial amplitude...
[ "make", "a", "2D", "Gaussian", "model", "and", "fit", "the", "observed", "data", "with", "the", "model", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/models/functions.py#L221-L345
facelessuser/pyspelling
pyspelling/filters/url.py
URLFilter.setup
def setup(self): """Setup.""" self.emails = self.config['emails'] self.urls = self.config['urls']
python
def setup(self): """Setup.""" self.emails = self.config['emails'] self.urls = self.config['urls']
[ "def", "setup", "(", "self", ")", ":", "self", ".", "emails", "=", "self", ".", "config", "[", "'emails'", "]", "self", ".", "urls", "=", "self", ".", "config", "[", "'urls'", "]" ]
Setup.
[ "Setup", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/url.py#L49-L53
facelessuser/pyspelling
pyspelling/filters/url.py
URLFilter._filter
def _filter(self, text): """Filter out the URL and email addresses.""" if self.urls: text = RE_LINK.sub('', text) if self.emails: text = RE_MAIL.sub('', text) return text
python
def _filter(self, text): """Filter out the URL and email addresses.""" if self.urls: text = RE_LINK.sub('', text) if self.emails: text = RE_MAIL.sub('', text) return text
[ "def", "_filter", "(", "self", ",", "text", ")", ":", "if", "self", ".", "urls", ":", "text", "=", "RE_LINK", ".", "sub", "(", "''", ",", "text", ")", "if", "self", ".", "emails", ":", "text", "=", "RE_MAIL", ".", "sub", "(", "''", ",", "text",...
Filter out the URL and email addresses.
[ "Filter", "out", "the", "URL", "and", "email", "addresses", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/url.py#L55-L62
JMSwag/dsdev-utils
dsdev_utils/paths.py
get_mac_dot_app_dir
def get_mac_dot_app_dir(directory): """Returns parent directory of mac .app Args: directory (str): Current directory Returns: (str): Parent directory of mac .app """ return os.path.dirname(os.path.dirname(os.path.dirname(directory)))
python
def get_mac_dot_app_dir(directory): """Returns parent directory of mac .app Args: directory (str): Current directory Returns: (str): Parent directory of mac .app """ return os.path.dirname(os.path.dirname(os.path.dirname(directory)))
[ "def", "get_mac_dot_app_dir", "(", "directory", ")", ":", "return", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "directory", ")", ")", ")" ]
Returns parent directory of mac .app Args: directory (str): Current directory Returns: (str): Parent directory of mac .app
[ "Returns", "parent", "directory", "of", "mac", ".", "app" ]
train
https://github.com/JMSwag/dsdev-utils/blob/5adbf9b3fd9fff92d1dd714423b08e26a5038e14/dsdev_utils/paths.py#L36-L47
deshima-dev/decode
decode/utils/misc/functions.py
copy_function
def copy_function(func, name=None): """Copy a function object with different name. Args: func (function): Function to be copied. name (string, optional): Name of the new function. If not spacified, the same name of `func` will be used. Returns: newfunc (function): New f...
python
def copy_function(func, name=None): """Copy a function object with different name. Args: func (function): Function to be copied. name (string, optional): Name of the new function. If not spacified, the same name of `func` will be used. Returns: newfunc (function): New f...
[ "def", "copy_function", "(", "func", ",", "name", "=", "None", ")", ":", "code", "=", "func", ".", "__code__", "newname", "=", "name", "or", "func", ".", "__name__", "newcode", "=", "CodeType", "(", "code", ".", "co_argcount", ",", "code", ".", "co_kwo...
Copy a function object with different name. Args: func (function): Function to be copied. name (string, optional): Name of the new function. If not spacified, the same name of `func` will be used. Returns: newfunc (function): New function with different name.
[ "Copy", "a", "function", "object", "with", "different", "name", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/utils/misc/functions.py#L61-L100
deshima-dev/decode
decode/utils/misc/functions.py
one_thread_per_process
def one_thread_per_process(): """Return a context manager where only one thread is allocated to a process. This function is intended to be used as a with statement like:: >>> with process_per_thread(): ... do_something() # one thread per process Notes: This function only works...
python
def one_thread_per_process(): """Return a context manager where only one thread is allocated to a process. This function is intended to be used as a with statement like:: >>> with process_per_thread(): ... do_something() # one thread per process Notes: This function only works...
[ "def", "one_thread_per_process", "(", ")", ":", "try", ":", "import", "mkl", "is_mkl", "=", "True", "except", "ImportError", ":", "is_mkl", "=", "False", "if", "is_mkl", ":", "n_threads", "=", "mkl", ".", "get_max_threads", "(", ")", "mkl", ".", "set_num_t...
Return a context manager where only one thread is allocated to a process. This function is intended to be used as a with statement like:: >>> with process_per_thread(): ... do_something() # one thread per process Notes: This function only works when MKL (Intel Math Kernel Library)...
[ "Return", "a", "context", "manager", "where", "only", "one", "thread", "is", "allocated", "to", "a", "process", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/utils/misc/functions.py#L104-L134
MFreidank/ARSpy
arspy/hull.py
compute_hulls
def compute_hulls(S, fS, domain): """ (Re-)compute upper and lower hull given the segment points `S` with function values `fS` and the `domain` of the logpdf. Parameters ---------- S : np.ndarray (N, 1) Straight-line segment points accumulated thus far. fS : tuple Value ...
python
def compute_hulls(S, fS, domain): """ (Re-)compute upper and lower hull given the segment points `S` with function values `fS` and the `domain` of the logpdf. Parameters ---------- S : np.ndarray (N, 1) Straight-line segment points accumulated thus far. fS : tuple Value ...
[ "def", "compute_hulls", "(", "S", ",", "fS", ",", "domain", ")", ":", "assert", "(", "len", "(", "S", ")", "==", "len", "(", "fS", ")", ")", "assert", "(", "len", "(", "domain", ")", "==", "2", ")", "lower_hull", "=", "[", "]", "for", "li", "...
(Re-)compute upper and lower hull given the segment points `S` with function values `fS` and the `domain` of the logpdf. Parameters ---------- S : np.ndarray (N, 1) Straight-line segment points accumulated thus far. fS : tuple Value of the `logpdf` under sampling for each ...
[ "(", "Re", "-", ")", "compute", "upper", "and", "lower", "hull", "given", "the", "segment", "points", "S", "with", "function", "values", "fS", "and", "the", "domain", "of", "the", "logpdf", "." ]
train
https://github.com/MFreidank/ARSpy/blob/866885071b43e36a529f2fecf584ceef5248d800/arspy/hull.py#L44-L193
MFreidank/ARSpy
arspy/hull.py
sample_upper_hull
def sample_upper_hull(upper_hull, random_stream): """ Return a single value randomly sampled from the given `upper_hull`. Parameters ---------- upper_hull : List[pyars.hull.HullNode] Upper hull to evaluate. random_stream : numpy.random.RandomState (Seeded) stream of random ...
python
def sample_upper_hull(upper_hull, random_stream): """ Return a single value randomly sampled from the given `upper_hull`. Parameters ---------- upper_hull : List[pyars.hull.HullNode] Upper hull to evaluate. random_stream : numpy.random.RandomState (Seeded) stream of random ...
[ "def", "sample_upper_hull", "(", "upper_hull", ",", "random_stream", ")", ":", "cdf", "=", "cumsum", "(", "[", "node", ".", "pr", "for", "node", "in", "upper_hull", "]", ")", "# randomly choose a line segment", "U", "=", "random_stream", ".", "rand", "(", ")...
Return a single value randomly sampled from the given `upper_hull`. Parameters ---------- upper_hull : List[pyars.hull.HullNode] Upper hull to evaluate. random_stream : numpy.random.RandomState (Seeded) stream of random values to use during sampling. Returns ---------- ...
[ "Return", "a", "single", "value", "randomly", "sampled", "from", "the", "given", "upper_hull", "." ]
train
https://github.com/MFreidank/ARSpy/blob/866885071b43e36a529f2fecf584ceef5248d800/arspy/hull.py#L207-L249
mrcagney/make_gtfs
make_gtfs/validators.py
check_for_required_columns
def check_for_required_columns(problems, table, df): """ Check that the given ProtoFeed table has the required columns. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` means the P...
python
def check_for_required_columns(problems, table, df): """ Check that the given ProtoFeed table has the required columns. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` means the P...
[ "def", "check_for_required_columns", "(", "problems", ",", "table", ",", "df", ")", ":", "r", "=", "cs", ".", "PROTOFEED_REF", "req_columns", "=", "r", ".", "loc", "[", "(", "r", "[", "'table'", "]", "==", "table", ")", "&", "r", "[", "'column_required...
Check that the given ProtoFeed table has the required columns. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` means the ProtoFeed is violated; ``'warning'`` means there is a p...
[ "Check", "that", "the", "given", "ProtoFeed", "table", "has", "the", "required", "columns", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L24-L66
mrcagney/make_gtfs
make_gtfs/validators.py
check_for_invalid_columns
def check_for_invalid_columns(problems, table, df): """ Check for invalid columns in the given ProtoFeed DataFrame. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` mean...
python
def check_for_invalid_columns(problems, table, df): """ Check for invalid columns in the given ProtoFeed DataFrame. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` mean...
[ "def", "check_for_invalid_columns", "(", "problems", ",", "table", ",", "df", ")", ":", "r", "=", "cs", ".", "PROTOFEED_REF", "valid_columns", "=", "r", ".", "loc", "[", "r", "[", "'table'", "]", "==", "table", ",", "'column'", "]", ".", "values", "for...
Check for invalid columns in the given ProtoFeed DataFrame. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` means the ProtoFeed is violated; ``'warning'`` means ther...
[ "Check", "for", "invalid", "columns", "in", "the", "given", "ProtoFeed", "DataFrame", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L68-L110
mrcagney/make_gtfs
make_gtfs/validators.py
check_frequencies
def check_frequencies(pfeed, *, as_df=False, include_warnings=False): """ Check that ``pfeed.frequency`` follows the ProtoFeed spec. Return a list of problems of the form described in :func:`gt.check_table`; the list will be empty if no problems are found. """ table = 'frequencies' probl...
python
def check_frequencies(pfeed, *, as_df=False, include_warnings=False): """ Check that ``pfeed.frequency`` follows the ProtoFeed spec. Return a list of problems of the form described in :func:`gt.check_table`; the list will be empty if no problems are found. """ table = 'frequencies' probl...
[ "def", "check_frequencies", "(", "pfeed", ",", "*", ",", "as_df", "=", "False", ",", "include_warnings", "=", "False", ")", ":", "table", "=", "'frequencies'", "problems", "=", "[", "]", "# Preliminary checks", "if", "pfeed", ".", "frequencies", "is", "None"...
Check that ``pfeed.frequency`` follows the ProtoFeed spec. Return a list of problems of the form described in :func:`gt.check_table`; the list will be empty if no problems are found.
[ "Check", "that", "pfeed", ".", "frequency", "follows", "the", "ProtoFeed", "spec", ".", "Return", "a", "list", "of", "problems", "of", "the", "form", "described", "in", ":", "func", ":", "gt", ".", "check_table", ";", "the", "list", "will", "be", "empty"...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L112-L167
mrcagney/make_gtfs
make_gtfs/validators.py
check_meta
def check_meta(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.meta`` """ table = 'meta' problems = [] # Preliminary checks if pfeed.meta is None: problems.append(['error', 'Missing table', table, []]) else: f = pfeed.m...
python
def check_meta(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.meta`` """ table = 'meta' problems = [] # Preliminary checks if pfeed.meta is None: problems.append(['error', 'Missing table', table, []]) else: f = pfeed.m...
[ "def", "check_meta", "(", "pfeed", ",", "*", ",", "as_df", "=", "False", ",", "include_warnings", "=", "False", ")", ":", "table", "=", "'meta'", "problems", "=", "[", "]", "# Preliminary checks", "if", "pfeed", ".", "meta", "is", "None", ":", "problems"...
Analog of :func:`check_frequencies` for ``pfeed.meta``
[ "Analog", "of", ":", "func", ":", "check_frequencies", "for", "pfeed", ".", "meta" ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L169-L210
mrcagney/make_gtfs
make_gtfs/validators.py
check_service_windows
def check_service_windows(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.service_windows`` """ table = 'service_windows' problems = [] # Preliminary checks if pfeed.service_windows is None: problems.append(['error', 'Missing table...
python
def check_service_windows(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.service_windows`` """ table = 'service_windows' problems = [] # Preliminary checks if pfeed.service_windows is None: problems.append(['error', 'Missing table...
[ "def", "check_service_windows", "(", "pfeed", ",", "*", ",", "as_df", "=", "False", ",", "include_warnings", "=", "False", ")", ":", "table", "=", "'service_windows'", "problems", "=", "[", "]", "# Preliminary checks", "if", "pfeed", ".", "service_windows", "i...
Analog of :func:`check_frequencies` for ``pfeed.service_windows``
[ "Analog", "of", ":", "func", ":", "check_frequencies", "for", "pfeed", ".", "service_windows" ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L212-L245
mrcagney/make_gtfs
make_gtfs/validators.py
check_shapes
def check_shapes(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.shapes`` """ table = 'shapes' problems = [] # Preliminary checks if pfeed.shapes is None: return problems f = pfeed.shapes.copy() problems = check_for_requir...
python
def check_shapes(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.shapes`` """ table = 'shapes' problems = [] # Preliminary checks if pfeed.shapes is None: return problems f = pfeed.shapes.copy() problems = check_for_requir...
[ "def", "check_shapes", "(", "pfeed", ",", "*", ",", "as_df", "=", "False", ",", "include_warnings", "=", "False", ")", ":", "table", "=", "'shapes'", "problems", "=", "[", "]", "# Preliminary checks", "if", "pfeed", ".", "shapes", "is", "None", ":", "ret...
Analog of :func:`check_frequencies` for ``pfeed.shapes``
[ "Analog", "of", ":", "func", ":", "check_frequencies", "for", "pfeed", ".", "shapes" ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L247-L273
mrcagney/make_gtfs
make_gtfs/validators.py
check_stops
def check_stops(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.stops`` """ # Use gtfstk's stop validator if pfeed.stops is not None: stop_times = pd.DataFrame(columns=['stop_id']) feed = gt.Feed(stops=pfeed.stops, stop_times=stop_t...
python
def check_stops(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.stops`` """ # Use gtfstk's stop validator if pfeed.stops is not None: stop_times = pd.DataFrame(columns=['stop_id']) feed = gt.Feed(stops=pfeed.stops, stop_times=stop_t...
[ "def", "check_stops", "(", "pfeed", ",", "*", ",", "as_df", "=", "False", ",", "include_warnings", "=", "False", ")", ":", "# Use gtfstk's stop validator", "if", "pfeed", ".", "stops", "is", "not", "None", ":", "stop_times", "=", "pd", ".", "DataFrame", "(...
Analog of :func:`check_frequencies` for ``pfeed.stops``
[ "Analog", "of", ":", "func", ":", "check_frequencies", "for", "pfeed", ".", "stops" ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L275-L284
mrcagney/make_gtfs
make_gtfs/validators.py
validate
def validate(pfeed, *, as_df=True, include_warnings=True): """ Check whether the given pfeed satisfies the ProtoFeed spec. Parameters ---------- pfeed : ProtoFeed as_df : boolean If ``True``, then return the resulting report as a DataFrame; otherwise return the result as a list ...
python
def validate(pfeed, *, as_df=True, include_warnings=True): """ Check whether the given pfeed satisfies the ProtoFeed spec. Parameters ---------- pfeed : ProtoFeed as_df : boolean If ``True``, then return the resulting report as a DataFrame; otherwise return the result as a list ...
[ "def", "validate", "(", "pfeed", ",", "*", ",", "as_df", "=", "True", ",", "include_warnings", "=", "True", ")", ":", "problems", "=", "[", "]", "# Check for invalid columns and check the required tables", "checkers", "=", "[", "'check_frequencies'", ",", "'check_...
Check whether the given pfeed satisfies the ProtoFeed spec. Parameters ---------- pfeed : ProtoFeed as_df : boolean If ``True``, then return the resulting report as a DataFrame; otherwise return the result as a list include_warnings : boolean If ``True``, then include proble...
[ "Check", "whether", "the", "given", "pfeed", "satisfies", "the", "ProtoFeed", "spec", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/validators.py#L286-L336
deshima-dev/decode
decode/joke/functions.py
youtube
def youtube(keyword=None): """Open youtube. Args: keyword (optional): Search word. """ if keyword is None: web.open('https://www.youtube.com/watch?v=L_mBVT2jBFw') else: web.open(quote('https://www.youtube.com/results?search_query={}'.format(keyword), RESERVED))
python
def youtube(keyword=None): """Open youtube. Args: keyword (optional): Search word. """ if keyword is None: web.open('https://www.youtube.com/watch?v=L_mBVT2jBFw') else: web.open(quote('https://www.youtube.com/results?search_query={}'.format(keyword), RESERVED))
[ "def", "youtube", "(", "keyword", "=", "None", ")", ":", "if", "keyword", "is", "None", ":", "web", ".", "open", "(", "'https://www.youtube.com/watch?v=L_mBVT2jBFw'", ")", "else", ":", "web", ".", "open", "(", "quote", "(", "'https://www.youtube.com/results?sear...
Open youtube. Args: keyword (optional): Search word.
[ "Open", "youtube", "." ]
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/joke/functions.py#L21-L30
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.setup
def setup(self): """Setup.""" self.blocks = self.config['block_comments'] self.lines = self.config['line_comments'] self.group_comments = self.config['group_comments'] self.jsdocs = self.config['jsdocs'] self.decode_escapes = self.config['decode_escapes'] self.st...
python
def setup(self): """Setup.""" self.blocks = self.config['block_comments'] self.lines = self.config['line_comments'] self.group_comments = self.config['group_comments'] self.jsdocs = self.config['jsdocs'] self.decode_escapes = self.config['decode_escapes'] self.st...
[ "def", "setup", "(", "self", ")", ":", "self", ".", "blocks", "=", "self", ".", "config", "[", "'block_comments'", "]", "self", ".", "lines", "=", "self", ".", "config", "[", "'line_comments'", "]", "self", ".", "group_comments", "=", "self", ".", "con...
Setup.
[ "Setup", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L71-L80
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.replace_escapes
def replace_escapes(self, m): """Replace escapes.""" groups = m.groupdict() esc = m.group(0) if groups.get('special'): value = BACK_SLASH_TRANSLATION[esc] elif groups.get('char'): try: if esc.endswith('}'): value = chr(...
python
def replace_escapes(self, m): """Replace escapes.""" groups = m.groupdict() esc = m.group(0) if groups.get('special'): value = BACK_SLASH_TRANSLATION[esc] elif groups.get('char'): try: if esc.endswith('}'): value = chr(...
[ "def", "replace_escapes", "(", "self", ",", "m", ")", ":", "groups", "=", "m", ".", "groupdict", "(", ")", "esc", "=", "m", ".", "group", "(", "0", ")", "if", "groups", ".", "get", "(", "'special'", ")", ":", "value", "=", "BACK_SLASH_TRANSLATION", ...
Replace escapes.
[ "Replace", "escapes", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L82-L108
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.replace_surrogates
def replace_surrogates(self, m): """Replace surrogates.""" high, low = ord(m.group(1)), ord(m.group(2)) return chr((high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000)
python
def replace_surrogates(self, m): """Replace surrogates.""" high, low = ord(m.group(1)), ord(m.group(2)) return chr((high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000)
[ "def", "replace_surrogates", "(", "self", ",", "m", ")", ":", "high", ",", "low", "=", "ord", "(", "m", ".", "group", "(", "1", ")", ")", ",", "ord", "(", "m", ".", "group", "(", "2", ")", ")", "return", "chr", "(", "(", "high", "-", "0xD800"...
Replace surrogates.
[ "Replace", "surrogates", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L110-L114
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.evaluate_strings
def evaluate_strings(self, string, temp=False): """Evaluate strings.""" value = '' if self.strings: if self.decode_escapes: value = RE_SURROGATES.sub( self.replace_surrogates, (RE_TEMP_ESC if temp else RE_ESC).sub(self.replace_...
python
def evaluate_strings(self, string, temp=False): """Evaluate strings.""" value = '' if self.strings: if self.decode_escapes: value = RE_SURROGATES.sub( self.replace_surrogates, (RE_TEMP_ESC if temp else RE_ESC).sub(self.replace_...
[ "def", "evaluate_strings", "(", "self", ",", "string", ",", "temp", "=", "False", ")", ":", "value", "=", "''", "if", "self", ".", "strings", ":", "if", "self", ".", "decode_escapes", ":", "value", "=", "RE_SURROGATES", ".", "sub", "(", "self", ".", ...
Evaluate strings.
[ "Evaluate", "strings", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L116-L130
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.evaluate_block
def evaluate_block(self, comments): """Evaluate block comments.""" if self.jsdocs: m1 = RE_JSDOC.match(comments) if m1: lines = [] for line in m1.group(1).splitlines(True): l = line.lstrip() lines.append(l[1...
python
def evaluate_block(self, comments): """Evaluate block comments.""" if self.jsdocs: m1 = RE_JSDOC.match(comments) if m1: lines = [] for line in m1.group(1).splitlines(True): l = line.lstrip() lines.append(l[1...
[ "def", "evaluate_block", "(", "self", ",", "comments", ")", ":", "if", "self", ".", "jsdocs", ":", "m1", "=", "RE_JSDOC", ".", "match", "(", "comments", ")", "if", "m1", ":", "lines", "=", "[", "]", "for", "line", "in", "m1", ".", "group", "(", "...
Evaluate block comments.
[ "Evaluate", "block", "comments", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L157-L171
facelessuser/pyspelling
pyspelling/filters/javascript.py
JavaScriptFilter.find_content
def find_content(self, text, index=0, backtick=False): """Find content.""" curly_count = 0 last = '\n' self.lines_num = 1 length = len(text) while index < length: start_index = index c = text[index] if c == '{' and backtick: ...
python
def find_content(self, text, index=0, backtick=False): """Find content.""" curly_count = 0 last = '\n' self.lines_num = 1 length = len(text) while index < length: start_index = index c = text[index] if c == '{' and backtick: ...
[ "def", "find_content", "(", "self", ",", "text", ",", "index", "=", "0", ",", "backtick", "=", "False", ")", ":", "curly_count", "=", "0", "last", "=", "'\\n'", "self", ".", "lines_num", "=", "1", "length", "=", "len", "(", "text", ")", "while", "i...
Find content.
[ "Find", "content", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/javascript.py#L196-L262
facelessuser/pyspelling
pyspelling/plugin.py
Plugin.override_config
def override_config(self, options): """Override the default configuration.""" for k, v in options.items(): # Reject names not in the default configuration if k not in self.config: raise KeyError("'{}' is not a valid option for '{}'".format(k, self.__class__.__nam...
python
def override_config(self, options): """Override the default configuration.""" for k, v in options.items(): # Reject names not in the default configuration if k not in self.config: raise KeyError("'{}' is not a valid option for '{}'".format(k, self.__class__.__nam...
[ "def", "override_config", "(", "self", ",", "options", ")", ":", "for", "k", ",", "v", "in", "options", ".", "items", "(", ")", ":", "# Reject names not in the default configuration", "if", "k", "not", "in", "self", ".", "config", ":", "raise", "KeyError", ...
Override the default configuration.
[ "Override", "the", "default", "configuration", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/plugin.py#L33-L41
facelessuser/pyspelling
pyspelling/plugin.py
Plugin.validate_options
def validate_options(self, k, v): """Validate options.""" args = [self.__class__.__name__, k] # Booleans if isinstance(self.config[k], bool) and not isinstance(v, bool): raise ValueError("{}: option '{}' must be a bool type.".format(*args)) # Strings elif isi...
python
def validate_options(self, k, v): """Validate options.""" args = [self.__class__.__name__, k] # Booleans if isinstance(self.config[k], bool) and not isinstance(v, bool): raise ValueError("{}: option '{}' must be a bool type.".format(*args)) # Strings elif isi...
[ "def", "validate_options", "(", "self", ",", "k", ",", "v", ")", ":", "args", "=", "[", "self", ".", "__class__", ".", "__name__", ",", "k", "]", "# Booleans", "if", "isinstance", "(", "self", ".", "config", "[", "k", "]", ",", "bool", ")", "and", ...
Validate options.
[ "Validate", "options", "." ]
train
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/plugin.py#L43-L67
mrcagney/make_gtfs
make_gtfs/main.py
get_duration
def get_duration(timestr1, timestr2, units='s'): """ Return the duration of the time period between the first and second time string in the given units. Allowable units are 's' (seconds), 'min' (minutes), 'h' (hours). Assume ``timestr1 < timestr2``. """ valid_units = ['s', 'min', 'h'] as...
python
def get_duration(timestr1, timestr2, units='s'): """ Return the duration of the time period between the first and second time string in the given units. Allowable units are 's' (seconds), 'min' (minutes), 'h' (hours). Assume ``timestr1 < timestr2``. """ valid_units = ['s', 'min', 'h'] as...
[ "def", "get_duration", "(", "timestr1", ",", "timestr2", ",", "units", "=", "'s'", ")", ":", "valid_units", "=", "[", "'s'", ",", "'min'", ",", "'h'", "]", "assert", "units", "in", "valid_units", ",", "\"Units must be one of {!s}\"", ".", "format", "(", "v...
Return the duration of the time period between the first and second time string in the given units. Allowable units are 's' (seconds), 'min' (minutes), 'h' (hours). Assume ``timestr1 < timestr2``.
[ "Return", "the", "duration", "of", "the", "time", "period", "between", "the", "first", "and", "second", "time", "string", "in", "the", "given", "units", ".", "Allowable", "units", "are", "s", "(", "seconds", ")", "min", "(", "minutes", ")", "h", "(", "...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L10-L30
mrcagney/make_gtfs
make_gtfs/main.py
build_stop_ids
def build_stop_ids(shape_id): """ Create a pair of stop IDs based on the given shape ID. """ return [cs.SEP.join(['stp', shape_id, str(i)]) for i in range(2)]
python
def build_stop_ids(shape_id): """ Create a pair of stop IDs based on the given shape ID. """ return [cs.SEP.join(['stp', shape_id, str(i)]) for i in range(2)]
[ "def", "build_stop_ids", "(", "shape_id", ")", ":", "return", "[", "cs", ".", "SEP", ".", "join", "(", "[", "'stp'", ",", "shape_id", ",", "str", "(", "i", ")", "]", ")", "for", "i", "in", "range", "(", "2", ")", "]" ]
Create a pair of stop IDs based on the given shape ID.
[ "Create", "a", "pair", "of", "stop", "IDs", "based", "on", "the", "given", "shape", "ID", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L32-L36
mrcagney/make_gtfs
make_gtfs/main.py
build_agency
def build_agency(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``agency.txt`` """ return pd.DataFrame({ 'agency_name': pfeed.meta['agency_name'].iat[0], 'agency_url': pfeed.meta['agency_url'].iat[0], 'agency_timezone': pfeed.meta['agency_timezone'].iat[0], }, index...
python
def build_agency(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``agency.txt`` """ return pd.DataFrame({ 'agency_name': pfeed.meta['agency_name'].iat[0], 'agency_url': pfeed.meta['agency_url'].iat[0], 'agency_timezone': pfeed.meta['agency_timezone'].iat[0], }, index...
[ "def", "build_agency", "(", "pfeed", ")", ":", "return", "pd", ".", "DataFrame", "(", "{", "'agency_name'", ":", "pfeed", ".", "meta", "[", "'agency_name'", "]", ".", "iat", "[", "0", "]", ",", "'agency_url'", ":", "pfeed", ".", "meta", "[", "'agency_u...
Given a ProtoFeed, return a DataFrame representing ``agency.txt``
[ "Given", "a", "ProtoFeed", "return", "a", "DataFrame", "representing", "agency", ".", "txt" ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L45-L53
mrcagney/make_gtfs
make_gtfs/main.py
build_calendar_etc
def build_calendar_etc(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``calendar.txt`` and a dictionary of the form <service window ID> -> <service ID>, respectively. """ windows = pfeed.service_windows.copy() # Create a service ID for each distinct days_active field and map...
python
def build_calendar_etc(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``calendar.txt`` and a dictionary of the form <service window ID> -> <service ID>, respectively. """ windows = pfeed.service_windows.copy() # Create a service ID for each distinct days_active field and map...
[ "def", "build_calendar_etc", "(", "pfeed", ")", ":", "windows", "=", "pfeed", ".", "service_windows", ".", "copy", "(", ")", "# Create a service ID for each distinct days_active field and map the", "# service windows to those service IDs", "def", "get_sid", "(", "bitlist", ...
Given a ProtoFeed, return a DataFrame representing ``calendar.txt`` and a dictionary of the form <service window ID> -> <service ID>, respectively.
[ "Given", "a", "ProtoFeed", "return", "a", "DataFrame", "representing", "calendar", ".", "txt", "and", "a", "dictionary", "of", "the", "form", "<service", "window", "ID", ">", "-", ">", "<service", "ID", ">", "respectively", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L55-L90
mrcagney/make_gtfs
make_gtfs/main.py
build_routes
def build_routes(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``routes.txt``. """ f = pfeed.frequencies[['route_short_name', 'route_long_name', 'route_type', 'shape_id']].drop_duplicates().copy() # Create route IDs f['route_id'] = 'r' + f['route_short_name'].map(str) ...
python
def build_routes(pfeed): """ Given a ProtoFeed, return a DataFrame representing ``routes.txt``. """ f = pfeed.frequencies[['route_short_name', 'route_long_name', 'route_type', 'shape_id']].drop_duplicates().copy() # Create route IDs f['route_id'] = 'r' + f['route_short_name'].map(str) ...
[ "def", "build_routes", "(", "pfeed", ")", ":", "f", "=", "pfeed", ".", "frequencies", "[", "[", "'route_short_name'", ",", "'route_long_name'", ",", "'route_type'", ",", "'shape_id'", "]", "]", ".", "drop_duplicates", "(", ")", ".", "copy", "(", ")", "# Cr...
Given a ProtoFeed, return a DataFrame representing ``routes.txt``.
[ "Given", "a", "ProtoFeed", "return", "a", "DataFrame", "representing", "routes", ".", "txt", "." ]
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L92-L104
mrcagney/make_gtfs
make_gtfs/main.py
build_shapes
def build_shapes(pfeed): """ Given a ProtoFeed, return DataFrame representing ``shapes.txt``. Only use shape IDs that occur in both ``pfeed.shapes`` and ``pfeed.frequencies``. Create reversed shapes where routes traverse shapes in both directions. """ rows = [] for shape, geom in pfe...
python
def build_shapes(pfeed): """ Given a ProtoFeed, return DataFrame representing ``shapes.txt``. Only use shape IDs that occur in both ``pfeed.shapes`` and ``pfeed.frequencies``. Create reversed shapes where routes traverse shapes in both directions. """ rows = [] for shape, geom in pfe...
[ "def", "build_shapes", "(", "pfeed", ")", ":", "rows", "=", "[", "]", "for", "shape", ",", "geom", "in", "pfeed", ".", "shapes", "[", "[", "'shape_id'", ",", "'geometry'", "]", "]", ".", "itertuples", "(", "index", "=", "False", ")", ":", "if", "sh...
Given a ProtoFeed, return DataFrame representing ``shapes.txt``. Only use shape IDs that occur in both ``pfeed.shapes`` and ``pfeed.frequencies``. Create reversed shapes where routes traverse shapes in both directions.
[ "Given", "a", "ProtoFeed", "return", "DataFrame", "representing", "shapes", ".", "txt", ".", "Only", "use", "shape", "IDs", "that", "occur", "in", "both", "pfeed", ".", "shapes", "and", "pfeed", ".", "frequencies", ".", "Create", "reversed", "shapes", "where...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L106-L137
mrcagney/make_gtfs
make_gtfs/main.py
build_stops
def build_stops(pfeed, shapes=None): """ Given a ProtoFeed, return a DataFrame representing ``stops.txt``. If ``pfeed.stops`` is not ``None``, then return that. Otherwise, require built shapes output by :func:`build_shapes`, create one stop at the beginning (the first point) of each shape and on...
python
def build_stops(pfeed, shapes=None): """ Given a ProtoFeed, return a DataFrame representing ``stops.txt``. If ``pfeed.stops`` is not ``None``, then return that. Otherwise, require built shapes output by :func:`build_shapes`, create one stop at the beginning (the first point) of each shape and on...
[ "def", "build_stops", "(", "pfeed", ",", "shapes", "=", "None", ")", ":", "if", "pfeed", ".", "stops", "is", "not", "None", ":", "stops", "=", "pfeed", ".", "stops", ".", "copy", "(", ")", "else", ":", "if", "shapes", "is", "None", ":", "raise", ...
Given a ProtoFeed, return a DataFrame representing ``stops.txt``. If ``pfeed.stops`` is not ``None``, then return that. Otherwise, require built shapes output by :func:`build_shapes`, create one stop at the beginning (the first point) of each shape and one at the end (the last point) of each shape, ...
[ "Given", "a", "ProtoFeed", "return", "a", "DataFrame", "representing", "stops", ".", "txt", ".", "If", "pfeed", ".", "stops", "is", "not", "None", "then", "return", "that", ".", "Otherwise", "require", "built", "shapes", "output", "by", ":", "func", ":", ...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L139-L174
mrcagney/make_gtfs
make_gtfs/main.py
build_trips
def build_trips(pfeed, routes, service_by_window): """ Given a ProtoFeed and its corresponding routes (DataFrame), service-by-window (dictionary), return a DataFrame representing ``trips.txt``. Trip IDs encode route, direction, and service window information to make it easy to compute stop times...
python
def build_trips(pfeed, routes, service_by_window): """ Given a ProtoFeed and its corresponding routes (DataFrame), service-by-window (dictionary), return a DataFrame representing ``trips.txt``. Trip IDs encode route, direction, and service window information to make it easy to compute stop times...
[ "def", "build_trips", "(", "pfeed", ",", "routes", ",", "service_by_window", ")", ":", "# Put together the route and service data", "routes", "=", "pd", ".", "merge", "(", "routes", "[", "[", "'route_id'", ",", "'route_short_name'", "]", "]", ",", "pfeed", ".", ...
Given a ProtoFeed and its corresponding routes (DataFrame), service-by-window (dictionary), return a DataFrame representing ``trips.txt``. Trip IDs encode route, direction, and service window information to make it easy to compute stop times later.
[ "Given", "a", "ProtoFeed", "and", "its", "corresponding", "routes", "(", "DataFrame", ")", "service", "-", "by", "-", "window", "(", "dictionary", ")", "return", "a", "DataFrame", "representing", "trips", ".", "txt", ".", "Trip", "IDs", "encode", "route", ...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L176-L225
mrcagney/make_gtfs
make_gtfs/main.py
buffer_side
def buffer_side(linestring, side, buffer): """ Given a Shapely LineString, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), and a buffer size in the distance units of the LineString, buffer the LineString o...
python
def buffer_side(linestring, side, buffer): """ Given a Shapely LineString, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), and a buffer size in the distance units of the LineString, buffer the LineString o...
[ "def", "buffer_side", "(", "linestring", ",", "side", ",", "buffer", ")", ":", "b", "=", "linestring", ".", "buffer", "(", "buffer", ",", "cap_style", "=", "2", ")", "if", "side", "in", "[", "'left'", ",", "'right'", "]", "and", "buffer", ">", "0", ...
Given a Shapely LineString, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), and a buffer size in the distance units of the LineString, buffer the LineString on the given side by the buffer size and return the ...
[ "Given", "a", "Shapely", "LineString", "a", "side", "of", "the", "LineString", "(", "string", ";", "left", "=", "left", "hand", "side", "of", "LineString", "right", "=", "right", "hand", "side", "of", "LineString", "or", "both", "=", "both", "sides", ")"...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L227-L250
mrcagney/make_gtfs
make_gtfs/main.py
get_nearby_stops
def get_nearby_stops(geo_stops, linestring, side, buffer=cs.BUFFER): """ Given a GeoDataFrame of stops, a Shapely LineString in the same coordinate system, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), a...
python
def get_nearby_stops(geo_stops, linestring, side, buffer=cs.BUFFER): """ Given a GeoDataFrame of stops, a Shapely LineString in the same coordinate system, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), a...
[ "def", "get_nearby_stops", "(", "geo_stops", ",", "linestring", ",", "side", ",", "buffer", "=", "cs", ".", "BUFFER", ")", ":", "b", "=", "buffer_side", "(", "linestring", ",", "side", ",", "buffer", ")", "# Collect stops", "return", "geo_stops", ".", "loc...
Given a GeoDataFrame of stops, a Shapely LineString in the same coordinate system, a side of the LineString (string; 'left' = left hand side of LineString, 'right' = right hand side of LineString, or 'both' = both sides), and a buffer in the distance units of that coordinate system, do the following...
[ "Given", "a", "GeoDataFrame", "of", "stops", "a", "Shapely", "LineString", "in", "the", "same", "coordinate", "system", "a", "side", "of", "the", "LineString", "(", "string", ";", "left", "=", "left", "hand", "side", "of", "LineString", "right", "=", "righ...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L252-L266
mrcagney/make_gtfs
make_gtfs/main.py
build_stop_times
def build_stop_times(pfeed, routes, shapes, stops, trips, buffer=cs.BUFFER): """ Given a ProtoFeed and its corresponding routes (DataFrame), shapes (DataFrame), stops (DataFrame), trips (DataFrame), return DataFrame representing ``stop_times.txt``. Includes the optional ``shape_dist_traveled`` colum...
python
def build_stop_times(pfeed, routes, shapes, stops, trips, buffer=cs.BUFFER): """ Given a ProtoFeed and its corresponding routes (DataFrame), shapes (DataFrame), stops (DataFrame), trips (DataFrame), return DataFrame representing ``stop_times.txt``. Includes the optional ``shape_dist_traveled`` colum...
[ "def", "build_stop_times", "(", "pfeed", ",", "routes", ",", "shapes", ",", "stops", ",", "trips", ",", "buffer", "=", "cs", ".", "BUFFER", ")", ":", "# Get the table of trips and add frequency and service window details", "routes", "=", "(", "routes", ".", "filte...
Given a ProtoFeed and its corresponding routes (DataFrame), shapes (DataFrame), stops (DataFrame), trips (DataFrame), return DataFrame representing ``stop_times.txt``. Includes the optional ``shape_dist_traveled`` column. Don't make stop times for trips with no nearby stops.
[ "Given", "a", "ProtoFeed", "and", "its", "corresponding", "routes", "(", "DataFrame", ")", "shapes", "(", "DataFrame", ")", "stops", "(", "DataFrame", ")", "trips", "(", "DataFrame", ")", "return", "DataFrame", "representing", "stop_times", ".", "txt", ".", ...
train
https://github.com/mrcagney/make_gtfs/blob/37b6f88e03bac708c2e85d6f4b6d48a0c92e4a59/make_gtfs/main.py#L268-L384
j0ack/flask-codemirror
flask_codemirror/widgets.py
CodeMirrorWidget._generate_content
def _generate_content(self): """Dumps content using JSON to send to CodeMirror""" # concat into a dict dic = self.config dic['mode'] = self.language if self.theme: dic['theme'] = self.theme # dumps with json return json.dumps(dic, indent=8, separators=...
python
def _generate_content(self): """Dumps content using JSON to send to CodeMirror""" # concat into a dict dic = self.config dic['mode'] = self.language if self.theme: dic['theme'] = self.theme # dumps with json return json.dumps(dic, indent=8, separators=...
[ "def", "_generate_content", "(", "self", ")", ":", "# concat into a dict", "dic", "=", "self", ".", "config", "dic", "[", "'mode'", "]", "=", "self", ".", "language", "if", "self", ".", "theme", ":", "dic", "[", "'theme'", "]", "=", "self", ".", "theme...
Dumps content using JSON to send to CodeMirror
[ "Dumps", "content", "using", "JSON", "to", "send", "to", "CodeMirror" ]
train
https://github.com/j0ack/flask-codemirror/blob/81ad831ff849b60bb34de5db727ad626ff3c9bdc/flask_codemirror/widgets.py#L70-L78
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_token_details
def get_token_details(self, show_listing_details=False, show_inactive=False): """ Function to fetch the available tokens available to trade on the Switcheo exchange. Execution of this function is as follows:: get_token_details() get_token_details(show_listing_details=Tru...
python
def get_token_details(self, show_listing_details=False, show_inactive=False): """ Function to fetch the available tokens available to trade on the Switcheo exchange. Execution of this function is as follows:: get_token_details() get_token_details(show_listing_details=Tru...
[ "def", "get_token_details", "(", "self", ",", "show_listing_details", "=", "False", ",", "show_inactive", "=", "False", ")", ":", "api_params", "=", "{", "\"show_listing_details\"", ":", "show_listing_details", ",", "\"show_inactive\"", ":", "show_inactive", "}", "r...
Function to fetch the available tokens available to trade on the Switcheo exchange. Execution of this function is as follows:: get_token_details() get_token_details(show_listing_details=True) get_token_details(show_inactive=True) get_token_details(show_listing_de...
[ "Function", "to", "fetch", "the", "available", "tokens", "available", "to", "trade", "on", "the", "Switcheo", "exchange", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L94-L132
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_candlesticks
def get_candlesticks(self, pair, start_time, end_time, interval): """ Function to fetch trading metrics from the past 24 hours for all trading pairs offered on the exchange. Execution of this function is as follows:: get_candlesticks(pair="SWTH_NEO", sta...
python
def get_candlesticks(self, pair, start_time, end_time, interval): """ Function to fetch trading metrics from the past 24 hours for all trading pairs offered on the exchange. Execution of this function is as follows:: get_candlesticks(pair="SWTH_NEO", sta...
[ "def", "get_candlesticks", "(", "self", ",", "pair", ",", "start_time", ",", "end_time", ",", "interval", ")", ":", "api_params", "=", "{", "\"pair\"", ":", "pair", ",", "\"interval\"", ":", "interval", ",", "\"start_time\"", ":", "start_time", ",", "\"end_t...
Function to fetch trading metrics from the past 24 hours for all trading pairs offered on the exchange. Execution of this function is as follows:: get_candlesticks(pair="SWTH_NEO", start_time=round(time.time()) - 350000, end_time=round(time....
[ "Function", "to", "fetch", "trading", "metrics", "from", "the", "past", "24", "hours", "for", "all", "trading", "pairs", "offered", "on", "the", "exchange", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L134-L183
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_last_price
def get_last_price(self, symbols=None, bases=None): """ Function to fetch the most recently executed trade on the order book for each trading pair. Execution of this function is as follows:: get_last_price() get_last_price(symbols=['SWTH','GAS']) get_last_pri...
python
def get_last_price(self, symbols=None, bases=None): """ Function to fetch the most recently executed trade on the order book for each trading pair. Execution of this function is as follows:: get_last_price() get_last_price(symbols=['SWTH','GAS']) get_last_pri...
[ "def", "get_last_price", "(", "self", ",", "symbols", "=", "None", ",", "bases", "=", "None", ")", ":", "api_params", "=", "{", "}", "if", "symbols", "is", "not", "None", ":", "api_params", "[", "'symbols'", "]", "=", "symbols", "if", "bases", "is", ...
Function to fetch the most recently executed trade on the order book for each trading pair. Execution of this function is as follows:: get_last_price() get_last_price(symbols=['SWTH','GAS']) get_last_price(bases=['NEO']) get_last_price(symbols=['SWTH','GAS'], bas...
[ "Function", "to", "fetch", "the", "most", "recently", "executed", "trade", "on", "the", "order", "book", "for", "each", "trading", "pair", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L218-L252
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_offers
def get_offers(self, pair="SWTH_NEO"): """ Function to fetch the open orders on the order book for the trade pair requested. Execution of this function is as follows:: get_offers(pair="SWTH_NEO") The expected return result for this function is as follows:: [{ ...
python
def get_offers(self, pair="SWTH_NEO"): """ Function to fetch the open orders on the order book for the trade pair requested. Execution of this function is as follows:: get_offers(pair="SWTH_NEO") The expected return result for this function is as follows:: [{ ...
[ "def", "get_offers", "(", "self", ",", "pair", "=", "\"SWTH_NEO\"", ")", ":", "api_params", "=", "{", "\"pair\"", ":", "pair", ",", "\"contract_hash\"", ":", "self", ".", "contract_hash", "}", "return", "self", ".", "request", ".", "get", "(", "path", "=...
Function to fetch the open orders on the order book for the trade pair requested. Execution of this function is as follows:: get_offers(pair="SWTH_NEO") The expected return result for this function is as follows:: [{ 'id': '2716c0ca-59bb-4c86-8ee4-6b9528d0e5d2'...
[ "Function", "to", "fetch", "the", "open", "orders", "on", "the", "order", "book", "for", "the", "trade", "pair", "requested", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L254-L283
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_trades
def get_trades(self, pair="SWTH_NEO", start_time=None, end_time=None, limit=5000): """ Function to fetch a list of filled trades for the parameters requested. Execution of this function is as follows:: get_trades(pair="SWTH_NEO", limit=3) The expected return result for this...
python
def get_trades(self, pair="SWTH_NEO", start_time=None, end_time=None, limit=5000): """ Function to fetch a list of filled trades for the parameters requested. Execution of this function is as follows:: get_trades(pair="SWTH_NEO", limit=3) The expected return result for this...
[ "def", "get_trades", "(", "self", ",", "pair", "=", "\"SWTH_NEO\"", ",", "start_time", "=", "None", ",", "end_time", "=", "None", ",", "limit", "=", "5000", ")", ":", "if", "limit", ">", "10000", "or", "limit", "<", "1", ":", "raise", "ValueError", "...
Function to fetch a list of filled trades for the parameters requested. Execution of this function is as follows:: get_trades(pair="SWTH_NEO", limit=3) The expected return result for this function is as follows:: [{ 'id': '15bb16e2-7a80-4de1-bb59-bcaff877dee0',...
[ "Function", "to", "fetch", "a", "list", "of", "filled", "trades", "for", "the", "parameters", "requested", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L325-L377
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_recent_trades
def get_recent_trades(self, pair="SWTH_NEO"): """ Function to fetch a list of the 20 most recently filled trades for the parameters requested. Execution of this function is as follows:: get_recent_trades(pair="SWTH_NEO") The expected return result for this function is as fo...
python
def get_recent_trades(self, pair="SWTH_NEO"): """ Function to fetch a list of the 20 most recently filled trades for the parameters requested. Execution of this function is as follows:: get_recent_trades(pair="SWTH_NEO") The expected return result for this function is as fo...
[ "def", "get_recent_trades", "(", "self", ",", "pair", "=", "\"SWTH_NEO\"", ")", ":", "api_params", "=", "{", "\"pair\"", ":", "pair", "}", "return", "self", ".", "request", ".", "get", "(", "path", "=", "'/trades/recent'", ",", "params", "=", "api_params",...
Function to fetch a list of the 20 most recently filled trades for the parameters requested. Execution of this function is as follows:: get_recent_trades(pair="SWTH_NEO") The expected return result for this function is as follows:: [{ 'id': '15bb16e2-7a80-4de1-...
[ "Function", "to", "fetch", "a", "list", "of", "the", "20", "most", "recently", "filled", "trades", "for", "the", "parameters", "requested", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L379-L415
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_pairs
def get_pairs(self, base=None, show_details=False): """ Function to fetch a list of trading pairs offered on the Switcheo decentralized exchange. Execution of this function is as follows:: get_pairs() # Fetch all pairs get_pairs(base="SWTH") # Fetc...
python
def get_pairs(self, base=None, show_details=False): """ Function to fetch a list of trading pairs offered on the Switcheo decentralized exchange. Execution of this function is as follows:: get_pairs() # Fetch all pairs get_pairs(base="SWTH") # Fetc...
[ "def", "get_pairs", "(", "self", ",", "base", "=", "None", ",", "show_details", "=", "False", ")", ":", "api_params", "=", "{", "}", "if", "show_details", ":", "api_params", "[", "\"show_details\"", "]", "=", "show_details", "if", "base", "is", "not", "N...
Function to fetch a list of trading pairs offered on the Switcheo decentralized exchange. Execution of this function is as follows:: get_pairs() # Fetch all pairs get_pairs(base="SWTH") # Fetch only SWTH base pairs get_pairs(show_details=True) # Fetch ...
[ "Function", "to", "fetch", "a", "list", "of", "trading", "pairs", "offered", "on", "the", "Switcheo", "decentralized", "exchange", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L417-L464
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_orders
def get_orders(self, address, chain_name='NEO', contract_version='V2', pair=None, from_epoch_time=None, order_status=None, before_id=None, limit=50): """ Function to fetch the order history of the given address. Execution of this function is as follows:: get_order...
python
def get_orders(self, address, chain_name='NEO', contract_version='V2', pair=None, from_epoch_time=None, order_status=None, before_id=None, limit=50): """ Function to fetch the order history of the given address. Execution of this function is as follows:: get_order...
[ "def", "get_orders", "(", "self", ",", "address", ",", "chain_name", "=", "'NEO'", ",", "contract_version", "=", "'V2'", ",", "pair", "=", "None", ",", "from_epoch_time", "=", "None", ",", "order_status", "=", "None", ",", "before_id", "=", "None", ",", ...
Function to fetch the order history of the given address. Execution of this function is as follows:: get_orders(address=neo_get_scripthash_from_address(address=address)) The expected return result for this function is as follows:: [{ 'id': '7cbdf481-6acf-4bf3-a...
[ "Function", "to", "fetch", "the", "order", "history", "of", "the", "given", "address", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L490-L585
KeithSSmith/switcheo-python
switcheo/public_client.py
PublicClient.get_balance
def get_balance(self, addresses, contracts): """ Function to fetch the current account balance for the given address in the Switcheo smart contract. Execution of this function is as follows:: get_balance(address=neo_get_scripthash_from_address(address=address)) The expected...
python
def get_balance(self, addresses, contracts): """ Function to fetch the current account balance for the given address in the Switcheo smart contract. Execution of this function is as follows:: get_balance(address=neo_get_scripthash_from_address(address=address)) The expected...
[ "def", "get_balance", "(", "self", ",", "addresses", ",", "contracts", ")", ":", "api_params", "=", "{", "\"addresses[]\"", ":", "addresses", ",", "\"contract_hashes[]\"", ":", "contracts", "}", "return", "self", ".", "request", ".", "get", "(", "path", "=",...
Function to fetch the current account balance for the given address in the Switcheo smart contract. Execution of this function is as follows:: get_balance(address=neo_get_scripthash_from_address(address=address)) The expected return result for this function is as follows:: { ...
[ "Function", "to", "fetch", "the", "current", "account", "balance", "for", "the", "given", "address", "in", "the", "Switcheo", "smart", "contract", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
train
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/public_client.py#L587-L616
tjwalch/django-livereload-server
livereload/server.py
Server.ignore_file_extension
def ignore_file_extension(self, extension): """ Configure a file extension to be ignored. :param extension: file extension to be ignored (ex. .less, .scss, etc) """ logger.info('Ignoring file extension: {}'.format(extension)) self.watcher.ignore...
python
def ignore_file_extension(self, extension): """ Configure a file extension to be ignored. :param extension: file extension to be ignored (ex. .less, .scss, etc) """ logger.info('Ignoring file extension: {}'.format(extension)) self.watcher.ignore...
[ "def", "ignore_file_extension", "(", "self", ",", "extension", ")", ":", "logger", ".", "info", "(", "'Ignoring file extension: {}'", ".", "format", "(", "extension", ")", ")", "self", ".", "watcher", ".", "ignore_file_extension", "(", "extension", ")" ]
Configure a file extension to be ignored. :param extension: file extension to be ignored (ex. .less, .scss, etc)
[ "Configure", "a", "file", "extension", "to", "be", "ignored", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/server.py#L97-L105
tjwalch/django-livereload-server
livereload/server.py
Server.watch
def watch(self, filepath, func=None, delay=None): """Add the given filepath for watcher list. Once you have intialized a server, watch file changes before serve the server:: server.watch('static/*.stylus', 'make static') def alert(): print('foo') ...
python
def watch(self, filepath, func=None, delay=None): """Add the given filepath for watcher list. Once you have intialized a server, watch file changes before serve the server:: server.watch('static/*.stylus', 'make static') def alert(): print('foo') ...
[ "def", "watch", "(", "self", ",", "filepath", ",", "func", "=", "None", ",", "delay", "=", "None", ")", ":", "if", "isinstance", "(", "func", ",", "string_types", ")", ":", "func", "=", "shell", "(", "func", ")", "self", ".", "watcher", ".", "watch...
Add the given filepath for watcher list. Once you have intialized a server, watch file changes before serve the server:: server.watch('static/*.stylus', 'make static') def alert(): print('foo') server.watch('foo.txt', alert) server.serve(...
[ "Add", "the", "given", "filepath", "for", "watcher", "list", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/server.py#L107-L131
tjwalch/django-livereload-server
livereload/server.py
Server.serve
def serve(self, liveport=None, host=None, restart_delay=2): """Start serve the server with the given port. :param liveport: live reload on this port :param host: serve on this hostname, default is 127.0.0.1 :param open_url_delay: open webbrowser after the delay seconds """ ...
python
def serve(self, liveport=None, host=None, restart_delay=2): """Start serve the server with the given port. :param liveport: live reload on this port :param host: serve on this hostname, default is 127.0.0.1 :param open_url_delay: open webbrowser after the delay seconds """ ...
[ "def", "serve", "(", "self", ",", "liveport", "=", "None", ",", "host", "=", "None", ",", "restart_delay", "=", "2", ")", ":", "host", "=", "host", "or", "'127.0.0.1'", "logger", ".", "info", "(", "'Serving on http://%s:%s'", "%", "(", "host", ",", "li...
Start serve the server with the given port. :param liveport: live reload on this port :param host: serve on this hostname, default is 127.0.0.1 :param open_url_delay: open webbrowser after the delay seconds
[ "Start", "serve", "the", "server", "with", "the", "given", "port", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/server.py#L143-L160
tjwalch/django-livereload-server
livereload/watcher.py
Watcher.should_ignore
def should_ignore(self, filename): """Should ignore a given filename?""" _, ext = os.path.splitext(filename) return ext in self.ignored_file_extensions
python
def should_ignore(self, filename): """Should ignore a given filename?""" _, ext = os.path.splitext(filename) return ext in self.ignored_file_extensions
[ "def", "should_ignore", "(", "self", ",", "filename", ")", ":", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "return", "ext", "in", "self", ".", "ignored_file_extensions" ]
Should ignore a given filename?
[ "Should", "ignore", "a", "given", "filename?" ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/watcher.py#L37-L40
tjwalch/django-livereload-server
livereload/watcher.py
Watcher.examine
def examine(self): """Check if there are changes, if true, run the given task.""" if self._changes: return self._changes.pop() # clean filepath self.filepath = None delays = set([0]) for path in self._tasks: item = self._tasks[path] if...
python
def examine(self): """Check if there are changes, if true, run the given task.""" if self._changes: return self._changes.pop() # clean filepath self.filepath = None delays = set([0]) for path in self._tasks: item = self._tasks[path] if...
[ "def", "examine", "(", "self", ")", ":", "if", "self", ".", "_changes", ":", "return", "self", ".", "_changes", ".", "pop", "(", ")", "# clean filepath", "self", ".", "filepath", "=", "None", "delays", "=", "set", "(", "[", "0", "]", ")", "for", "p...
Check if there are changes, if true, run the given task.
[ "Check", "if", "there", "are", "changes", "if", "true", "run", "the", "given", "task", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/watcher.py#L67-L88
tjwalch/django-livereload-server
livereload/management/commands/runserver.py
Command.livereload_request
def livereload_request(self, **options): """ Performs the LiveReload request. """ style = color_style() verbosity = int(options['verbosity']) host = '%s:%d' % ( options['livereload_host'], options['livereload_port'], ) try: ...
python
def livereload_request(self, **options): """ Performs the LiveReload request. """ style = color_style() verbosity = int(options['verbosity']) host = '%s:%d' % ( options['livereload_host'], options['livereload_port'], ) try: ...
[ "def", "livereload_request", "(", "self", ",", "*", "*", "options", ")", ":", "style", "=", "color_style", "(", ")", "verbosity", "=", "int", "(", "options", "[", "'verbosity'", "]", ")", "host", "=", "'%s:%d'", "%", "(", "options", "[", "'livereload_hos...
Performs the LiveReload request.
[ "Performs", "the", "LiveReload", "request", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/management/commands/runserver.py#L53-L68
tjwalch/django-livereload-server
livereload/management/commands/runserver.py
Command.get_handler
def get_handler(self, *args, **options): """ Entry point to plug the LiveReload feature. """ handler = super(Command, self).get_handler(*args, **options) if options['use_livereload']: threading.Timer(1, self.livereload_request, kwargs=options).start() return h...
python
def get_handler(self, *args, **options): """ Entry point to plug the LiveReload feature. """ handler = super(Command, self).get_handler(*args, **options) if options['use_livereload']: threading.Timer(1, self.livereload_request, kwargs=options).start() return h...
[ "def", "get_handler", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "handler", "=", "super", "(", "Command", ",", "self", ")", ".", "get_handler", "(", "*", "args", ",", "*", "*", "options", ")", "if", "options", "[", "'use_liv...
Entry point to plug the LiveReload feature.
[ "Entry", "point", "to", "plug", "the", "LiveReload", "feature", "." ]
train
https://github.com/tjwalch/django-livereload-server/blob/ea3edaa1a5b2f8cb49761dd32f2fcc4554c4aa0c/livereload/management/commands/runserver.py#L70-L77
brutasse/django-password-reset
password_reset/views.py
loads_with_timestamp
def loads_with_timestamp(value, salt): """Returns the unsigned value along with its timestamp, the time when it got dumped.""" try: signing.loads(value, salt=salt, max_age=-999999) except signing.SignatureExpired as e: age = float(str(e).split('Signature age ')[1].split(' >')[0]) ...
python
def loads_with_timestamp(value, salt): """Returns the unsigned value along with its timestamp, the time when it got dumped.""" try: signing.loads(value, salt=salt, max_age=-999999) except signing.SignatureExpired as e: age = float(str(e).split('Signature age ')[1].split(' >')[0]) ...
[ "def", "loads_with_timestamp", "(", "value", ",", "salt", ")", ":", "try", ":", "signing", ".", "loads", "(", "value", ",", "salt", "=", "salt", ",", "max_age", "=", "-", "999999", ")", "except", "signing", ".", "SignatureExpired", "as", "e", ":", "age...
Returns the unsigned value along with its timestamp, the time when it got dumped.
[ "Returns", "the", "unsigned", "value", "along", "with", "its", "timestamp", "the", "time", "when", "it", "got", "dumped", "." ]
train
https://github.com/brutasse/django-password-reset/blob/3f3a531d8bbd7e456af214757afccdf06b0d12d1/password_reset/views.py#L27-L35
socialwifi/RouterOS-api
routeros_api/api_socket.py
set_keepalive
def set_keepalive(sock, after_idle_sec=1, interval_sec=3, max_fails=5): """Set TCP keepalive on an open socket. It activates after 1 second (after_idle_sec) of idleness, then sends a keepalive ping once every 3 seconds (interval_sec), and closes the connection after 5 failed ping (max_fails), or 15 sec...
python
def set_keepalive(sock, after_idle_sec=1, interval_sec=3, max_fails=5): """Set TCP keepalive on an open socket. It activates after 1 second (after_idle_sec) of idleness, then sends a keepalive ping once every 3 seconds (interval_sec), and closes the connection after 5 failed ping (max_fails), or 15 sec...
[ "def", "set_keepalive", "(", "sock", ",", "after_idle_sec", "=", "1", ",", "interval_sec", "=", "3", ",", "max_fails", "=", "5", ")", ":", "if", "hasattr", "(", "socket", ",", "\"SO_KEEPALIVE\"", ")", ":", "sock", ".", "setsockopt", "(", "socket", ".", ...
Set TCP keepalive on an open socket. It activates after 1 second (after_idle_sec) of idleness, then sends a keepalive ping once every 3 seconds (interval_sec), and closes the connection after 5 failed ping (max_fails), or 15 seconds
[ "Set", "TCP", "keepalive", "on", "an", "open", "socket", "." ]
train
https://github.com/socialwifi/RouterOS-api/blob/d4eb2422f2437b3c99193a79fa857fc1e2c672af/routeros_api/api_socket.py#L37-L51
thespacedoctor/sherlock
sherlock/imports/veron.py
veron.ingest
def ingest(self): """ingest the veron catalogue into the catalogues database See class docstring for usage. """ self.log.debug('starting the ``get`` method') dictList = self._create_dictionary_of_veron() tableName = self.dbTableName createStatement = """ CR...
python
def ingest(self): """ingest the veron catalogue into the catalogues database See class docstring for usage. """ self.log.debug('starting the ``get`` method') dictList = self._create_dictionary_of_veron() tableName = self.dbTableName createStatement = """ CR...
[ "def", "ingest", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``get`` method'", ")", "dictList", "=", "self", ".", "_create_dictionary_of_veron", "(", ")", "tableName", "=", "self", ".", "dbTableName", "createStatement", "=", "\...
ingest the veron catalogue into the catalogues database See class docstring for usage.
[ "ingest", "the", "veron", "catalogue", "into", "the", "catalogues", "database" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/imports/veron.py#L75-L121
thespacedoctor/sherlock
sherlock/imports/veron.py
veron._create_dictionary_of_veron
def _create_dictionary_of_veron( self): """create a list of dictionaries containing all the rows in the veron catalogue **Return:** - ``dictList`` - a list of dictionaries containing all the rows in the veron catalogue .. todo :: - update key arguments valu...
python
def _create_dictionary_of_veron( self): """create a list of dictionaries containing all the rows in the veron catalogue **Return:** - ``dictList`` - a list of dictionaries containing all the rows in the veron catalogue .. todo :: - update key arguments valu...
[ "def", "_create_dictionary_of_veron", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_create_dictionary_of_veron`` method'", ")", "dictList", "=", "[", "]", "lines", "=", "string", ".", "split", "(", "self", ".", "catData", ",", ...
create a list of dictionaries containing all the rows in the veron catalogue **Return:** - ``dictList`` - a list of dictionaries containing all the rows in the veron catalogue .. todo :: - update key arguments values and definitions with defaults - update return va...
[ "create", "a", "list", "of", "dictionaries", "containing", "all", "the", "rows", "in", "the", "veron", "catalogue" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/imports/veron.py#L123-L208
thespacedoctor/sherlock
sherlock/cl_utils.py
main
def main(arguments=None): """ The main function used when ``cl_utils.py`` is run as a single script from the cl, or when installed as a cl command .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples a...
python
def main(arguments=None): """ The main function used when ``cl_utils.py`` is run as a single script from the cl, or when installed as a cl command .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples a...
[ "def", "main", "(", "arguments", "=", "None", ")", ":", "# setup the command-line util settings", "su", "=", "tools", "(", "arguments", "=", "arguments", ",", "docString", "=", "__doc__", ",", "logLevel", "=", "\"WARNING\"", ",", "options_first", "=", "False", ...
The main function used when ``cl_utils.py`` is run as a single script from the cl, or when installed as a cl command .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring tex...
[ "The", "main", "function", "used", "when", "cl_utils", ".", "py", "is", "run", "as", "a", "single", "script", "from", "the", "cl", "or", "when", "installed", "as", "a", "cl", "command" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/cl_utils.py#L75-L283
andrewda/frc-livescore
livescore/simpleocr_utils/segmentation_filters.py
Filter.display
def display(self, display_before=False): """shows the effect of this filter""" try: copy = self.image.copy() except AttributeError: raise Exception("You need to set the Filter.image attribute for displaying") copy = BrightnessProcessor(brightness=0.6).process(copy...
python
def display(self, display_before=False): """shows the effect of this filter""" try: copy = self.image.copy() except AttributeError: raise Exception("You need to set the Filter.image attribute for displaying") copy = BrightnessProcessor(brightness=0.6).process(copy...
[ "def", "display", "(", "self", ",", "display_before", "=", "False", ")", ":", "try", ":", "copy", "=", "self", ".", "image", ".", "copy", "(", ")", "except", "AttributeError", ":", "raise", "Exception", "(", "\"You need to set the Filter.image attribute for disp...
shows the effect of this filter
[ "shows", "the", "effect", "of", "this", "filter" ]
train
https://github.com/andrewda/frc-livescore/blob/71594cd6d2c8b6c5feb3889bb05552d09b8128b1/livescore/simpleocr_utils/segmentation_filters.py#L18-L28
Clinical-Genomics/trailblazer
trailblazer/mip/trending.py
parse_mip_analysis
def parse_mip_analysis(mip_config_raw: dict, qcmetrics_raw: dict, sampleinfo_raw: dict) -> dict: """Parse the output analysis files from MIP for adding info to trend database Args: mip_config_raw (dict): raw YAML input from MIP analysis config file qcmetrics_raw (dict): raw YAML input from ...
python
def parse_mip_analysis(mip_config_raw: dict, qcmetrics_raw: dict, sampleinfo_raw: dict) -> dict: """Parse the output analysis files from MIP for adding info to trend database Args: mip_config_raw (dict): raw YAML input from MIP analysis config file qcmetrics_raw (dict): raw YAML input from ...
[ "def", "parse_mip_analysis", "(", "mip_config_raw", ":", "dict", ",", "qcmetrics_raw", ":", "dict", ",", "sampleinfo_raw", ":", "dict", ")", "->", "dict", ":", "outdata", "=", "_define_output_dict", "(", ")", "_config", "(", "mip_config_raw", ",", "outdata", "...
Parse the output analysis files from MIP for adding info to trend database Args: mip_config_raw (dict): raw YAML input from MIP analysis config file qcmetrics_raw (dict): raw YAML input from MIP analysis qc metric file sampleinfo_raw (dict): raw YAML input from MIP analysis qc sample in...
[ "Parse", "the", "output", "analysis", "files", "from", "MIP", "for", "adding", "info", "to", "trend", "database" ]
train
https://github.com/Clinical-Genomics/trailblazer/blob/27f3cd21043a1077bd7029e85783459a50a7b798/trailblazer/mip/trending.py#L7-L24
thespacedoctor/sherlock
sherlock/database_cleaner.py
database_cleaner.clean
def clean(self): """*clean up and run some maintance tasks on the crossmatch catalogue helper tables* .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update ...
python
def clean(self): """*clean up and run some maintance tasks on the crossmatch catalogue helper tables* .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update ...
[ "def", "clean", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``get`` method'", ")", "self", ".", "_update_tcs_helper_catalogue_tables_info_with_new_tables", "(", ")", "self", ".", "_updated_row_counts_in_tcs_helper_catalogue_tables_info", "...
*clean up and run some maintance tasks on the crossmatch catalogue helper tables* .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text -...
[ "*", "clean", "up", "and", "run", "some", "maintance", "tasks", "on", "the", "crossmatch", "catalogue", "helper", "tables", "*" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/database_cleaner.py#L86-L111
thespacedoctor/sherlock
sherlock/database_cleaner.py
database_cleaner._updated_row_counts_in_tcs_helper_catalogue_tables_info
def _updated_row_counts_in_tcs_helper_catalogue_tables_info( self): """ updated row counts in tcs catalogue tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and t...
python
def _updated_row_counts_in_tcs_helper_catalogue_tables_info( self): """ updated row counts in tcs catalogue tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and t...
[ "def", "_updated_row_counts_in_tcs_helper_catalogue_tables_info", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_updated_row_counts_in_tcs_helper_catalogue_tables_info`` method'", ")", "sqlQuery", "=", "u\"\"\"\n select * from tcs_helper_ca...
updated row counts in tcs catalogue tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists ...
[ "updated", "row", "counts", "in", "tcs", "catalogue", "tables" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/database_cleaner.py#L113-L177
thespacedoctor/sherlock
sherlock/database_cleaner.py
database_cleaner._update_tcs_helper_catalogue_tables_info_with_new_tables
def _update_tcs_helper_catalogue_tables_info_with_new_tables( self): """update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage e...
python
def _update_tcs_helper_catalogue_tables_info_with_new_tables( self): """update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage e...
[ "def", "_update_tcs_helper_catalogue_tables_info_with_new_tables", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_update_tcs_helper_catalogue_tables_info_with_new_tables`` method'", ")", "sqlQuery", "=", "u\"\"\"\n SELECT max(id) as thisId ...
update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exi...
[ "update", "tcs", "helper", "catalogue", "tables", "info", "with", "new", "tables" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/database_cleaner.py#L179-L262
thespacedoctor/sherlock
sherlock/database_cleaner.py
database_cleaner._clean_up_columns
def _clean_up_columns( self): """clean up columns .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check subli...
python
def _clean_up_columns( self): """clean up columns .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check subli...
[ "def", "_clean_up_columns", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_clean_up_columns`` method'", ")", "sqlQueries", "=", "[", "\"update tcs_helper_catalogue_tables_info set old_table_name = table_name where old_table_name is null;\"", ",", ...
clean up columns .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exists - clip any useful text ...
[ "clean", "up", "columns" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/database_cleaner.py#L264-L346
thespacedoctor/sherlock
sherlock/database_cleaner.py
database_cleaner._update_tcs_helper_catalogue_views_info_with_new_views
def _update_tcs_helper_catalogue_views_info_with_new_views( self): """ update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage ex...
python
def _update_tcs_helper_catalogue_views_info_with_new_views( self): """ update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage ex...
[ "def", "_update_tcs_helper_catalogue_views_info_with_new_views", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_update_tcs_helper_catalogue_views_info_with_new_views`` method'", ")", "sqlQuery", "=", "u\"\"\"\n SELECT max(id) as thisId FROM...
update tcs helper catalogue tables info with new tables .. todo :: - update key arguments values and definitions with defaults - update return values and definitions - update usage examples and text - update docstring text - check sublime snippet exi...
[ "update", "tcs", "helper", "catalogue", "tables", "info", "with", "new", "tables" ]
train
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/database_cleaner.py#L348-L424
pytroll/posttroll
posttroll/listener.py
ListenerContainer.restart_listener
def restart_listener(self, topics): '''Restart listener after configuration update. ''' if self.listener is not None: if self.listener.running: self.stop() self.__init__(topics=topics)
python
def restart_listener(self, topics): '''Restart listener after configuration update. ''' if self.listener is not None: if self.listener.running: self.stop() self.__init__(topics=topics)
[ "def", "restart_listener", "(", "self", ",", "topics", ")", ":", "if", "self", ".", "listener", "is", "not", "None", ":", "if", "self", ".", "listener", ".", "running", ":", "self", ".", "stop", "(", ")", "self", ".", "__init__", "(", "topics", "=", ...
Restart listener after configuration update.
[ "Restart", "listener", "after", "configuration", "update", "." ]
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/listener.py#L65-L71
pytroll/posttroll
posttroll/listener.py
ListenerContainer.stop
def stop(self): '''Stop listener.''' self.logger.debug("Stopping listener.") self.listener.stop() if self.thread is not None: self.thread.join() self.thread = None self.logger.debug("Listener stopped.")
python
def stop(self): '''Stop listener.''' self.logger.debug("Stopping listener.") self.listener.stop() if self.thread is not None: self.thread.join() self.thread = None self.logger.debug("Listener stopped.")
[ "def", "stop", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Stopping listener.\"", ")", "self", ".", "listener", ".", "stop", "(", ")", "if", "self", ".", "thread", "is", "not", "None", ":", "self", ".", "thread", ".", "join", ...
Stop listener.
[ "Stop", "listener", "." ]
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/listener.py#L73-L80
pytroll/posttroll
posttroll/listener.py
Listener.create_subscriber
def create_subscriber(self): '''Create a subscriber instance using specified addresses and message types. ''' if self.subscriber is None: if self.topics: self.subscriber = NSSubscriber(self.services, self.topics, ...
python
def create_subscriber(self): '''Create a subscriber instance using specified addresses and message types. ''' if self.subscriber is None: if self.topics: self.subscriber = NSSubscriber(self.services, self.topics, ...
[ "def", "create_subscriber", "(", "self", ")", ":", "if", "self", ".", "subscriber", "is", "None", ":", "if", "self", ".", "topics", ":", "self", ".", "subscriber", "=", "NSSubscriber", "(", "self", ".", "services", ",", "self", ".", "topics", ",", "add...
Create a subscriber instance using specified addresses and message types.
[ "Create", "a", "subscriber", "instance", "using", "specified", "addresses", "and", "message", "types", "." ]
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/listener.py#L105-L115
pytroll/posttroll
posttroll/listener.py
Listener.run
def run(self): '''Run listener ''' self.running = True for msg in self.recv(1): if msg is None: if self.running: continue else: break self.logger.debug("New message received: %s", str(msg))...
python
def run(self): '''Run listener ''' self.running = True for msg in self.recv(1): if msg is None: if self.running: continue else: break self.logger.debug("New message received: %s", str(msg))...
[ "def", "run", "(", "self", ")", ":", "self", ".", "running", "=", "True", "for", "msg", "in", "self", ".", "recv", "(", "1", ")", ":", "if", "msg", "is", "None", ":", "if", "self", ".", "running", ":", "continue", "else", ":", "break", "self", ...
Run listener
[ "Run", "listener" ]
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/listener.py#L122-L136
pytroll/posttroll
posttroll/listener.py
Listener.stop
def stop(self): '''Stop subscriber and delete the instance ''' self.running = False time.sleep(1) if self.subscriber is not None: self.subscriber.stop() self.subscriber = None
python
def stop(self): '''Stop subscriber and delete the instance ''' self.running = False time.sleep(1) if self.subscriber is not None: self.subscriber.stop() self.subscriber = None
[ "def", "stop", "(", "self", ")", ":", "self", ".", "running", "=", "False", "time", ".", "sleep", "(", "1", ")", "if", "self", ".", "subscriber", "is", "not", "None", ":", "self", ".", "subscriber", ".", "stop", "(", ")", "self", ".", "subscriber",...
Stop subscriber and delete the instance
[ "Stop", "subscriber", "and", "delete", "the", "instance" ]
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/listener.py#L138-L145
ARMmbed/autoversion
src/auto_version/semver.py
get_current_semver
def get_current_semver(data): """Given a dictionary of all version data available, determine the current version""" # get the not-none values from data known = { key: data.get(alias) for key, alias in config._forward_aliases.items() if data.get(alias) is not None } # prefer ...
python
def get_current_semver(data): """Given a dictionary of all version data available, determine the current version""" # get the not-none values from data known = { key: data.get(alias) for key, alias in config._forward_aliases.items() if data.get(alias) is not None } # prefer ...
[ "def", "get_current_semver", "(", "data", ")", ":", "# get the not-none values from data", "known", "=", "{", "key", ":", "data", ".", "get", "(", "alias", ")", "for", "key", ",", "alias", "in", "config", ".", "_forward_aliases", ".", "items", "(", ")", "i...
Given a dictionary of all version data available, determine the current version
[ "Given", "a", "dictionary", "of", "all", "version", "data", "available", "determine", "the", "current", "version" ]
train
https://github.com/ARMmbed/autoversion/blob/c5b127d2059c8219f5637fe45bf9e1be3a0af2aa/src/auto_version/semver.py#L15-L50
ARMmbed/autoversion
src/auto_version/semver.py
make_new_semver
def make_new_semver(current_semver, all_triggers, **overrides): """Defines how to increment semver based on which significant figure is triggered""" new_semver = {} bumped = False for sig_fig in SemVerSigFig: # iterate sig figs in order of significance value = getattr(current_semver, sig_fig) ...
python
def make_new_semver(current_semver, all_triggers, **overrides): """Defines how to increment semver based on which significant figure is triggered""" new_semver = {} bumped = False for sig_fig in SemVerSigFig: # iterate sig figs in order of significance value = getattr(current_semver, sig_fig) ...
[ "def", "make_new_semver", "(", "current_semver", ",", "all_triggers", ",", "*", "*", "overrides", ")", ":", "new_semver", "=", "{", "}", "bumped", "=", "False", "for", "sig_fig", "in", "SemVerSigFig", ":", "# iterate sig figs in order of significance", "value", "=...
Defines how to increment semver based on which significant figure is triggered
[ "Defines", "how", "to", "increment", "semver", "based", "on", "which", "significant", "figure", "is", "triggered" ]
train
https://github.com/ARMmbed/autoversion/blob/c5b127d2059c8219f5637fe45bf9e1be3a0af2aa/src/auto_version/semver.py#L53-L71
lbenitez000/trparse
trparse.py
loads
def loads(data): """Parser entry point. Parses the output of a traceroute execution""" data += "\n_EOS_" # Append EOS token. Helps to match last RE_HOP # Get headers match_dest = RE_HEADER.search(data) dest_name = match_dest.group(1) dest_ip = match_dest.group(2) # The Traceroute is the ro...
python
def loads(data): """Parser entry point. Parses the output of a traceroute execution""" data += "\n_EOS_" # Append EOS token. Helps to match last RE_HOP # Get headers match_dest = RE_HEADER.search(data) dest_name = match_dest.group(1) dest_ip = match_dest.group(2) # The Traceroute is the ro...
[ "def", "loads", "(", "data", ")", ":", "data", "+=", "\"\\n_EOS_\"", "# Append EOS token. Helps to match last RE_HOP", "# Get headers", "match_dest", "=", "RE_HEADER", ".", "search", "(", "data", ")", "dest_name", "=", "match_dest", ".", "group", "(", "1", ")", ...
Parser entry point. Parses the output of a traceroute execution
[ "Parser", "entry", "point", ".", "Parses", "the", "output", "of", "a", "traceroute", "execution" ]
train
https://github.com/lbenitez000/trparse/blob/1f932d882a98b062b540b6f4bc2ecb0f35b92e97/trparse.py#L88-L158
lbenitez000/trparse
trparse.py
Hop.add_probe
def add_probe(self, probe): """Adds a Probe instance to this hop's results.""" if self.probes: probe_last = self.probes[-1] if not probe.ip: probe.ip = probe_last.ip probe.name = probe_last.name self.probes.append(probe)
python
def add_probe(self, probe): """Adds a Probe instance to this hop's results.""" if self.probes: probe_last = self.probes[-1] if not probe.ip: probe.ip = probe_last.ip probe.name = probe_last.name self.probes.append(probe)
[ "def", "add_probe", "(", "self", ",", "probe", ")", ":", "if", "self", ".", "probes", ":", "probe_last", "=", "self", ".", "probes", "[", "-", "1", "]", "if", "not", "probe", ".", "ip", ":", "probe", ".", "ip", "=", "probe_last", ".", "ip", "prob...
Adds a Probe instance to this hop's results.
[ "Adds", "a", "Probe", "instance", "to", "this", "hop", "s", "results", "." ]
train
https://github.com/lbenitez000/trparse/blob/1f932d882a98b062b540b6f4bc2ecb0f35b92e97/trparse.py#L48-L55
emichael/PyREM
pyrem/utils.py
synchronized
def synchronized(func, *args, **kwargs): """Function decorator to make function synchronized on ``self._lock``. If the first argument to the function (hopefully self) does not have a _lock attribute, then this decorator does nothing. """ if not (args and hasattr(args[0], '_lock')): return f...
python
def synchronized(func, *args, **kwargs): """Function decorator to make function synchronized on ``self._lock``. If the first argument to the function (hopefully self) does not have a _lock attribute, then this decorator does nothing. """ if not (args and hasattr(args[0], '_lock')): return f...
[ "def", "synchronized", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "(", "args", "and", "hasattr", "(", "args", "[", "0", "]", ",", "'_lock'", ")", ")", ":", "return", "func", "(", "*", "args", ",", "*", "*", ...
Function decorator to make function synchronized on ``self._lock``. If the first argument to the function (hopefully self) does not have a _lock attribute, then this decorator does nothing.
[ "Function", "decorator", "to", "make", "function", "synchronized", "on", "self", ".", "_lock", "." ]
train
https://github.com/emichael/PyREM/blob/2609249ead197cd9496d164f4998ca9985503579/pyrem/utils.py#L10-L19
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
normalize_job_id
def normalize_job_id(job_id): """ Convert a value to a job id. :param job_id: Value to convert. :type job_id: int, str :return: The job id. :rtype: :py:class:`uuid.UUID` """ if not isinstance(job_id, uuid.UUID): job_id = uuid.UUID(job_id) return job_id
python
def normalize_job_id(job_id): """ Convert a value to a job id. :param job_id: Value to convert. :type job_id: int, str :return: The job id. :rtype: :py:class:`uuid.UUID` """ if not isinstance(job_id, uuid.UUID): job_id = uuid.UUID(job_id) return job_id
[ "def", "normalize_job_id", "(", "job_id", ")", ":", "if", "not", "isinstance", "(", "job_id", ",", "uuid", ".", "UUID", ")", ":", "job_id", "=", "uuid", ".", "UUID", "(", "job_id", ")", "return", "job_id" ]
Convert a value to a job id. :param job_id: Value to convert. :type job_id: int, str :return: The job id. :rtype: :py:class:`uuid.UUID`
[ "Convert", "a", "value", "to", "a", "job", "id", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L41-L52
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.now
def now(self): """ Return a :py:class:`datetime.datetime` instance representing the current time. :rtype: :py:class:`datetime.datetime` """ if self.use_utc: return datetime.datetime.utcnow() else: return datetime.datetime.now()
python
def now(self): """ Return a :py:class:`datetime.datetime` instance representing the current time. :rtype: :py:class:`datetime.datetime` """ if self.use_utc: return datetime.datetime.utcnow() else: return datetime.datetime.now()
[ "def", "now", "(", "self", ")", ":", "if", "self", ".", "use_utc", ":", "return", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "else", ":", "return", "datetime", ".", "datetime", ".", "now", "(", ")" ]
Return a :py:class:`datetime.datetime` instance representing the current time. :rtype: :py:class:`datetime.datetime`
[ "Return", "a", ":", "py", ":", "class", ":", "datetime", ".", "datetime", "instance", "representing", "the", "current", "time", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L176-L185
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.start
def start(self): """ Start the JobManager thread. """ if self._thread_running.is_set(): raise RuntimeError('the JobManager has already been started') self._thread.start() self._thread_running.wait() return
python
def start(self): """ Start the JobManager thread. """ if self._thread_running.is_set(): raise RuntimeError('the JobManager has already been started') self._thread.start() self._thread_running.wait() return
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_thread_running", ".", "is_set", "(", ")", ":", "raise", "RuntimeError", "(", "'the JobManager has already been started'", ")", "self", ".", "_thread", ".", "start", "(", ")", "self", ".", "_thread_r...
Start the JobManager thread.
[ "Start", "the", "JobManager", "thread", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L209-L217
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.stop
def stop(self): """ Stop the JobManager thread. """ self.logger.debug('stopping the job manager') self._thread_running.clear() self._thread_shutdown.wait() self._job_lock.acquire() self.logger.debug('waiting on ' + str(len(self._jobs)) + ' job threads') for job_desc in self._jobs.values(): if job_d...
python
def stop(self): """ Stop the JobManager thread. """ self.logger.debug('stopping the job manager') self._thread_running.clear() self._thread_shutdown.wait() self._job_lock.acquire() self.logger.debug('waiting on ' + str(len(self._jobs)) + ' job threads') for job_desc in self._jobs.values(): if job_d...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "'stopping the job manager'", ")", "self", ".", "_thread_running", ".", "clear", "(", ")", "self", ".", "_thread_shutdown", ".", "wait", "(", ")", "self", ".", "_job_lock", "...
Stop the JobManager thread.
[ "Stop", "the", "JobManager", "thread", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L219-L241
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.job_run
def job_run(self, callback, parameters=None): """ Add a job and run it once immediately. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tuple :return: The job id. :rtype: :py:class:`uuid.UUID` """ ...
python
def job_run(self, callback, parameters=None): """ Add a job and run it once immediately. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tuple :return: The job id. :rtype: :py:class:`uuid.UUID` """ ...
[ "def", "job_run", "(", "self", ",", "callback", ",", "parameters", "=", "None", ")", ":", "if", "not", "self", ".", "_thread_running", ".", "is_set", "(", ")", ":", "raise", "RuntimeError", "(", "'the JobManager is not running'", ")", "parameters", "=", "(",...
Add a job and run it once immediately. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tuple :return: The job id. :rtype: :py:class:`uuid.UUID`
[ "Add", "a", "job", "and", "run", "it", "once", "immediately", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L243-L273
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.job_add
def job_add(self, callback, parameters=None, hours=0, minutes=0, seconds=0, tolerate_exceptions=True, expiration=None): """ Add a job to the job manager. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tup...
python
def job_add(self, callback, parameters=None, hours=0, minutes=0, seconds=0, tolerate_exceptions=True, expiration=None): """ Add a job to the job manager. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tup...
[ "def", "job_add", "(", "self", ",", "callback", ",", "parameters", "=", "None", ",", "hours", "=", "0", ",", "minutes", "=", "0", ",", "seconds", "=", "0", ",", "tolerate_exceptions", "=", "True", ",", "expiration", "=", "None", ")", ":", "if", "not"...
Add a job to the job manager. :param function callback: The function to run asynchronously. :param parameters: The parameters to be provided to the callback. :type parameters: list, tuple :param int hours: Number of hours to sleep between running the callback. :param int minutes: Number of minutes to sleep b...
[ "Add", "a", "job", "to", "the", "job", "manager", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L275-L320
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.job_count_enabled
def job_count_enabled(self): """ Return the number of enabled jobs. :return: The number of jobs that are enabled. :rtype: int """ enabled = 0 for job_desc in self._jobs.values(): if job_desc['enabled']: enabled += 1 return enabled
python
def job_count_enabled(self): """ Return the number of enabled jobs. :return: The number of jobs that are enabled. :rtype: int """ enabled = 0 for job_desc in self._jobs.values(): if job_desc['enabled']: enabled += 1 return enabled
[ "def", "job_count_enabled", "(", "self", ")", ":", "enabled", "=", "0", "for", "job_desc", "in", "self", ".", "_jobs", ".", "values", "(", ")", ":", "if", "job_desc", "[", "'enabled'", "]", ":", "enabled", "+=", "1", "return", "enabled" ]
Return the number of enabled jobs. :return: The number of jobs that are enabled. :rtype: int
[ "Return", "the", "number", "of", "enabled", "jobs", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L331-L342
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.job_enable
def job_enable(self, job_id): """ Enable a job. :param job_id: Job identifier to enable. :type job_id: :py:class:`uuid.UUID` """ job_id = normalize_job_id(job_id) with self._job_lock: job_desc = self._jobs[job_id] job_desc['enabled'] = True
python
def job_enable(self, job_id): """ Enable a job. :param job_id: Job identifier to enable. :type job_id: :py:class:`uuid.UUID` """ job_id = normalize_job_id(job_id) with self._job_lock: job_desc = self._jobs[job_id] job_desc['enabled'] = True
[ "def", "job_enable", "(", "self", ",", "job_id", ")", ":", "job_id", "=", "normalize_job_id", "(", "job_id", ")", "with", "self", ".", "_job_lock", ":", "job_desc", "=", "self", ".", "_jobs", "[", "job_id", "]", "job_desc", "[", "'enabled'", "]", "=", ...
Enable a job. :param job_id: Job identifier to enable. :type job_id: :py:class:`uuid.UUID`
[ "Enable", "a", "job", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L344-L354
zeroSteiner/smoke-zephyr
smoke_zephyr/job.py
JobManager.job_disable
def job_disable(self, job_id): """ Disable a job. Disabled jobs will not be executed. :param job_id: Job identifier to disable. :type job_id: :py:class:`uuid.UUID` """ job_id = normalize_job_id(job_id) with self._job_lock: job_desc = self._jobs[job_id] job_desc['enabled'] = False
python
def job_disable(self, job_id): """ Disable a job. Disabled jobs will not be executed. :param job_id: Job identifier to disable. :type job_id: :py:class:`uuid.UUID` """ job_id = normalize_job_id(job_id) with self._job_lock: job_desc = self._jobs[job_id] job_desc['enabled'] = False
[ "def", "job_disable", "(", "self", ",", "job_id", ")", ":", "job_id", "=", "normalize_job_id", "(", "job_id", ")", "with", "self", ".", "_job_lock", ":", "job_desc", "=", "self", ".", "_jobs", "[", "job_id", "]", "job_desc", "[", "'enabled'", "]", "=", ...
Disable a job. Disabled jobs will not be executed. :param job_id: Job identifier to disable. :type job_id: :py:class:`uuid.UUID`
[ "Disable", "a", "job", ".", "Disabled", "jobs", "will", "not", "be", "executed", "." ]
train
https://github.com/zeroSteiner/smoke-zephyr/blob/a6d2498aeacc72ee52e7806f783a4d83d537ffb2/smoke_zephyr/job.py#L356-L366