body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
a88696432c3aff222de448a2865f8ba5abbe6fbffc33e3fbd592e1dcf7caed9b | def update_quality(self):
'Update quality score for all items'
for value in self.organised_items.values():
for item in value:
'Constants'
QUALITY_MAX = 50
QUALITY_MIN = 0
'Update Quality: General Items and Conjured Items'
if (('Aged Brie' not i... | Update quality score for all items | python/gilded_rose.py | update_quality | Mayo-Theodore/GildedRose-Refactoring-Kata | 0 | python | def update_quality(self):
for value in self.organised_items.values():
for item in value:
'Constants'
QUALITY_MAX = 50
QUALITY_MIN = 0
'Update Quality: General Items and Conjured Items'
if (('Aged Brie' not in item.name) and ('Sulfuras' not in ... | def update_quality(self):
for value in self.organised_items.values():
for item in value:
'Constants'
QUALITY_MAX = 50
QUALITY_MIN = 0
'Update Quality: General Items and Conjured Items'
if (('Aged Brie' not in item.name) and ('Sulfuras' not in ... |
9978f3bce744996e4fe2829dde7005150fc38f7bb428fc8e64c3cd0471198082 | def parse_numprocesses(s):
'\n A little bit of processing to get number of parallel processes to use (since "auto" can be used to represent\n # of cores on machine)\n :param s: text to process\n :return: number of parallel worker processes to use\n '
try:
if s.startswith('auto'):
... | A little bit of processing to get number of parallel processes to use (since "auto" can be used to represent
# of cores on machine)
:param s: text to process
:return: number of parallel worker processes to use | src/pytest_mproc/plugin.py | parse_numprocesses | nak/pytest_mproc | 6 | python | def parse_numprocesses(s):
'\n A little bit of processing to get number of parallel processes to use (since "auto" can be used to represent\n # of cores on machine)\n :param s: text to process\n :return: number of parallel worker processes to use\n '
try:
if s.startswith('auto'):
... | def parse_numprocesses(s):
'\n A little bit of processing to get number of parallel processes to use (since "auto" can be used to represent\n # of cores on machine)\n :param s: text to process\n :return: number of parallel worker processes to use\n '
try:
if s.startswith('auto'):
... |
e041bf2453fc205377c632fc4e4b5d4a8da4f3e016a6aa2f8b7ed4d491b16b83 | @pytest.mark.tryfirst
def pytest_addoption(parser):
'\n add options to given parser for this plugin\n '
group = parser.getgroup('pytest_mproc', 'better distributed testing through multiprocessing')
group._addoption('--cores', dest='mproc_numcores', metavar='mproc_numcores', action='store', type=parse_... | add options to given parser for this plugin | src/pytest_mproc/plugin.py | pytest_addoption | nak/pytest_mproc | 6 | python | @pytest.mark.tryfirst
def pytest_addoption(parser):
'\n \n '
group = parser.getgroup('pytest_mproc', 'better distributed testing through multiprocessing')
group._addoption('--cores', dest='mproc_numcores', metavar='mproc_numcores', action='store', type=parse_numprocesses, help="you can use 'auto' here... | @pytest.mark.tryfirst
def pytest_addoption(parser):
'\n \n '
group = parser.getgroup('pytest_mproc', 'better distributed testing through multiprocessing')
group._addoption('--cores', dest='mproc_numcores', metavar='mproc_numcores', action='store', type=parse_numprocesses, help="you can use 'auto' here... |
6393360af69c4829b8772832b9e4d826816bbc2a92ea4b1e1fb5a6ed7f2cd532 | @pytest.mark.tryfirst
def pytest_cmdline_main(config):
'\n Called before "true" main routine. This is to set up config values well ahead of time\n for things like pytest-cov that needs to know we are running distributed\n\n Mostly taken from other implementations (such as xdist)\n '
if config.optio... | Called before "true" main routine. This is to set up config values well ahead of time
for things like pytest-cov that needs to know we are running distributed
Mostly taken from other implementations (such as xdist) | src/pytest_mproc/plugin.py | pytest_cmdline_main | nak/pytest_mproc | 6 | python | @pytest.mark.tryfirst
def pytest_cmdline_main(config):
'\n Called before "true" main routine. This is to set up config values well ahead of time\n for things like pytest-cov that needs to know we are running distributed\n\n Mostly taken from other implementations (such as xdist)\n '
if config.optio... | @pytest.mark.tryfirst
def pytest_cmdline_main(config):
'\n Called before "true" main routine. This is to set up config values well ahead of time\n for things like pytest-cov that needs to know we are running distributed\n\n Mostly taken from other implementations (such as xdist)\n '
if config.optio... |
dd5a610c8cba83c811e797dd3fa42925abaa6a195cb5ba25682892817e0ca8f9 | @pytest.fixture(scope='node')
def mp_tmpdir_factory():
"\n :return: a factory for creating unique tmp directories, unique across all Process's\n "
with TmpDirFactory() as factory:
(yield factory) | :return: a factory for creating unique tmp directories, unique across all Process's | src/pytest_mproc/plugin.py | mp_tmpdir_factory | nak/pytest_mproc | 6 | python | @pytest.fixture(scope='node')
def mp_tmpdir_factory():
"\n \n "
with TmpDirFactory() as factory:
(yield factory) | @pytest.fixture(scope='node')
def mp_tmpdir_factory():
"\n \n "
with TmpDirFactory() as factory:
(yield factory)<|docstring|>:return: a factory for creating unique tmp directories, unique across all Process's<|endoftext|> |
61662189d229cb9b9ee2975fd8ec1dd1c2bf09848abd95bafec7a5ba6b7ff73a | @contextmanager
def create_tmp_dir(self, cleanup_immediately: bool=True):
"\n :param cleanup_immediately: if True, rm the directory and all contents when associated fixture is no longer\n in use, otherwise wait until end of test session when everything is cleaned up\n :return: newly create t... | :param cleanup_immediately: if True, rm the directory and all contents when associated fixture is no longer
in use, otherwise wait until end of test session when everything is cleaned up
:return: newly create temp directory unique across all Process's | src/pytest_mproc/plugin.py | create_tmp_dir | nak/pytest_mproc | 6 | python | @contextmanager
def create_tmp_dir(self, cleanup_immediately: bool=True):
"\n :param cleanup_immediately: if True, rm the directory and all contents when associated fixture is no longer\n in use, otherwise wait until end of test session when everything is cleaned up\n :return: newly create t... | @contextmanager
def create_tmp_dir(self, cleanup_immediately: bool=True):
"\n :param cleanup_immediately: if True, rm the directory and all contents when associated fixture is no longer\n in use, otherwise wait until end of test session when everything is cleaned up\n :return: newly create t... |
0bcf74486541f16a5d4ef7c1e79d358da21ad5bab406a00bed11176cad09402e | def setup(self, sub):
' Initialize this solver.\n\n Args\n ----\n sub: `System`\n System that owns this solver.\n '
if sub.is_active():
self.unknowns_cache = np.empty(sub.unknowns.vec.shape) | Initialize this solver.
Args
----
sub: `System`
System that owns this solver. | aerostructures/solvers/nl_gauss_seidel.py | setup | NitroCortex/aerostructures | 5 | python | def setup(self, sub):
' Initialize this solver.\n\n Args\n ----\n sub: `System`\n System that owns this solver.\n '
if sub.is_active():
self.unknowns_cache = np.empty(sub.unknowns.vec.shape) | def setup(self, sub):
' Initialize this solver.\n\n Args\n ----\n sub: `System`\n System that owns this solver.\n '
if sub.is_active():
self.unknowns_cache = np.empty(sub.unknowns.vec.shape)<|docstring|>Initialize this solver.
Args
----
sub: `System`
System th... |
3ed693fb709e0283492d0004ed88378a14a6597e7e3f3370fe66e77542f2c450 | @error_wrap_nl
def solve(self, params, unknowns, resids, system, metadata=None):
' Solves the system using Gauss Seidel.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs a... | Solves the system using Gauss Seidel.
Args
----
params : `VecWrapper`
`VecWrapper` containing parameters. (p)
unknowns : `VecWrapper`
`VecWrapper` containing outputs and states. (u)
resids : `VecWrapper`
`VecWrapper` containing residuals. (r)
system : `System`
Parent `System` object.
metadata : dic... | aerostructures/solvers/nl_gauss_seidel.py | solve | NitroCortex/aerostructures | 5 | python | @error_wrap_nl
def solve(self, params, unknowns, resids, system, metadata=None):
' Solves the system using Gauss Seidel.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs a... | @error_wrap_nl
def solve(self, params, unknowns, resids, system, metadata=None):
' Solves the system using Gauss Seidel.\n\n Args\n ----\n params : `VecWrapper`\n `VecWrapper` containing parameters. (p)\n\n unknowns : `VecWrapper`\n `VecWrapper` containing outputs a... |
aa70849eac878156fe534007ace7cfe7261abd2c900aed6a14b66ff8f4d436ea | def train_classifier(X_train, X_test, y_train, alphas, l1_ratios, seed, n_folds=4, max_iter=1000):
'\n Build the logic and sklearn pipelines to predict binary y from dataset x\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training data\n X_test: pandas DataFrame of featu... | Build the logic and sklearn pipelines to predict binary y from dataset x
Arguments
---------
X_train: pandas DataFrame of feature matrix for training data
X_test: pandas DataFrame of feature matrix for testing data
y_train: pandas DataFrame of processed y matrix (output from align_matrices())
alphas: list of alphas to... | mpmp/prediction/classification.py | train_classifier | greenelab/mpmp | 1 | python | def train_classifier(X_train, X_test, y_train, alphas, l1_ratios, seed, n_folds=4, max_iter=1000):
'\n Build the logic and sklearn pipelines to predict binary y from dataset x\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training data\n X_test: pandas DataFrame of featu... | def train_classifier(X_train, X_test, y_train, alphas, l1_ratios, seed, n_folds=4, max_iter=1000):
'\n Build the logic and sklearn pipelines to predict binary y from dataset x\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training data\n X_test: pandas DataFrame of featu... |
c6819f54d18c4f90edbfde7984d22a6bf0792ae44a99c29be2db746cf47d173c | def train_gb_classifier(X_train, X_test, y_train, learning_rates, alphas, lambdas, seed, n_folds=4, max_iter=1000):
'\n Fit gradient-boosted tree classifier to training data, and generate predictions\n for test data.\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training... | Fit gradient-boosted tree classifier to training data, and generate predictions
for test data.
Arguments
---------
X_train: pandas DataFrame of feature matrix for training data
X_test: pandas DataFrame of feature matrix for testing data
y_train: pandas DataFrame of processed y matrix (output from align_matrices())
n_f... | mpmp/prediction/classification.py | train_gb_classifier | greenelab/mpmp | 1 | python | def train_gb_classifier(X_train, X_test, y_train, learning_rates, alphas, lambdas, seed, n_folds=4, max_iter=1000):
'\n Fit gradient-boosted tree classifier to training data, and generate predictions\n for test data.\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training... | def train_gb_classifier(X_train, X_test, y_train, learning_rates, alphas, lambdas, seed, n_folds=4, max_iter=1000):
'\n Fit gradient-boosted tree classifier to training data, and generate predictions\n for test data.\n\n Arguments\n ---------\n X_train: pandas DataFrame of feature matrix for training... |
645a6ed5e2dba03b74d8534453451b033642ce865e12547c9930f385d330970e | def get_preds(X_test_df, y_test_df, cv_pipeline, fold_no):
'Get model-predicted probability of positive class for test data.\n\n Also returns true class, to enable quantitative comparisons in analyses.\n '
y_scores_test = cv_pipeline.decision_function(X_test_df)
y_probs_test = cv_pipeline.predict_prob... | Get model-predicted probability of positive class for test data.
Also returns true class, to enable quantitative comparisons in analyses. | mpmp/prediction/classification.py | get_preds | greenelab/mpmp | 1 | python | def get_preds(X_test_df, y_test_df, cv_pipeline, fold_no):
'Get model-predicted probability of positive class for test data.\n\n Also returns true class, to enable quantitative comparisons in analyses.\n '
y_scores_test = cv_pipeline.decision_function(X_test_df)
y_probs_test = cv_pipeline.predict_prob... | def get_preds(X_test_df, y_test_df, cv_pipeline, fold_no):
'Get model-predicted probability of positive class for test data.\n\n Also returns true class, to enable quantitative comparisons in analyses.\n '
y_scores_test = cv_pipeline.decision_function(X_test_df)
y_probs_test = cv_pipeline.predict_prob... |
694f22686604f81267891f046e410da76ab5231d7f68f9753043321357f2852b | def get_threshold_metrics(y_true, y_pred, drop=False):
'\n Retrieve true/false positive rates and auroc/aupr for class predictions\n\n Arguments\n ---------\n y_true: an array of gold standard mutation status\n y_pred: an array of predicted mutation status\n drop: boolean if intermediate threshold... | Retrieve true/false positive rates and auroc/aupr for class predictions
Arguments
---------
y_true: an array of gold standard mutation status
y_pred: an array of predicted mutation status
drop: boolean if intermediate thresholds are dropped
Returns
-------
dict of AUROC, AUPR, pandas dataframes of ROC and PR data, an... | mpmp/prediction/classification.py | get_threshold_metrics | greenelab/mpmp | 1 | python | def get_threshold_metrics(y_true, y_pred, drop=False):
'\n Retrieve true/false positive rates and auroc/aupr for class predictions\n\n Arguments\n ---------\n y_true: an array of gold standard mutation status\n y_pred: an array of predicted mutation status\n drop: boolean if intermediate threshold... | def get_threshold_metrics(y_true, y_pred, drop=False):
'\n Retrieve true/false positive rates and auroc/aupr for class predictions\n\n Arguments\n ---------\n y_true: an array of gold standard mutation status\n y_pred: an array of predicted mutation status\n drop: boolean if intermediate threshold... |
b1bae4ae05cbc7eef9b1ddef8965fe809905411d8b07bbea812b3510a820385b | def summarize_results(results, identifier, training_data, signal, seed, data_type, fold_no):
'\n Given an input results file, summarize and output all pertinent files\n\n Arguments\n ---------\n results: a results object output from `get_threshold_metrics`\n identifier: string describing the label be... | Given an input results file, summarize and output all pertinent files
Arguments
---------
results: a results object output from `get_threshold_metrics`
identifier: string describing the label being predicted
training_data: the data type being used to train the model
signal: the signal of interest
seed: the seed used t... | mpmp/prediction/classification.py | summarize_results | greenelab/mpmp | 1 | python | def summarize_results(results, identifier, training_data, signal, seed, data_type, fold_no):
'\n Given an input results file, summarize and output all pertinent files\n\n Arguments\n ---------\n results: a results object output from `get_threshold_metrics`\n identifier: string describing the label be... | def summarize_results(results, identifier, training_data, signal, seed, data_type, fold_no):
'\n Given an input results file, summarize and output all pertinent files\n\n Arguments\n ---------\n results: a results object output from `get_threshold_metrics`\n identifier: string describing the label be... |
fc9b1995516513ae6e48f9c3af73b0ec14f573834931d4c6b6ca3600f9842555 | def run(self):
"The task's main loop.\n\n Processes messages and handles state changes."
with picamera.PiCamera() as cam:
cam.resolution = self.shape
cam.framerate = 8
cam.rotation = 180
cam.exposure_mode = 'sports'
while True:
if (self.requested_state_... | The task's main loop.
Processes messages and handles state changes. | app/imprint_engine.py | run | YoonChi/alto | 257 | python | def run(self):
"The task's main loop.\n\n Processes messages and handles state changes."
with picamera.PiCamera() as cam:
cam.resolution = self.shape
cam.framerate = 8
cam.rotation = 180
cam.exposure_mode = 'sports'
while True:
if (self.requested_state_... | def run(self):
"The task's main loop.\n\n Processes messages and handles state changes."
with picamera.PiCamera() as cam:
cam.resolution = self.shape
cam.framerate = 8
cam.rotation = 180
cam.exposure_mode = 'sports'
while True:
if (self.requested_state_... |
09f6c3e19551e71f28378dc2dd2cca258c4220cd9a4065ed5888b4b4a1475d15 | def idle(self):
'Stops learning / classifying.'
self.requested_state_change = self.IDLE | Stops learning / classifying. | app/imprint_engine.py | idle | YoonChi/alto | 257 | python | def idle(self):
self.requested_state_change = self.IDLE | def idle(self):
self.requested_state_change = self.IDLE<|docstring|>Stops learning / classifying.<|endoftext|> |
ed14151e35720f508b76b05dbb181e96a46ec8a22d71b4f0994c2ea59d97400c | def start_learning(self, label):
'Starts learning for the given label.\n\n Args:\n label: Any\n\n If there is already learning data for the given label then it is\n augmented with the new data.'
self.requested_state_change = self.LEARNING
self.label = label | Starts learning for the given label.
Args:
label: Any
If there is already learning data for the given label then it is
augmented with the new data. | app/imprint_engine.py | start_learning | YoonChi/alto | 257 | python | def start_learning(self, label):
'Starts learning for the given label.\n\n Args:\n label: Any\n\n If there is already learning data for the given label then it is\n augmented with the new data.'
self.requested_state_change = self.LEARNING
self.label = label | def start_learning(self, label):
'Starts learning for the given label.\n\n Args:\n label: Any\n\n If there is already learning data for the given label then it is\n augmented with the new data.'
self.requested_state_change = self.LEARNING
self.label = label<|docstring|>Starts l... |
a91ddb4f88083a6aab5f8b122a22b515c852bab3af229584ff380ee81c4b5b67 | def start_classifying(self):
'Starts classifying images from the camera.'
self.requested_state_change = self.CLASSIFYING | Starts classifying images from the camera. | app/imprint_engine.py | start_classifying | YoonChi/alto | 257 | python | def start_classifying(self):
self.requested_state_change = self.CLASSIFYING | def start_classifying(self):
self.requested_state_change = self.CLASSIFYING<|docstring|>Starts classifying images from the camera.<|endoftext|> |
74b6a9423f36272445708460f2d2016cb83a2e68e0ae6c7cd83933759ad90102 | def reset(self):
'Stops learning / classifying and resets all learning data.'
self.state = self.IDLE
self.label = None
self.engine.clear() | Stops learning / classifying and resets all learning data. | app/imprint_engine.py | reset | YoonChi/alto | 257 | python | def reset(self):
self.state = self.IDLE
self.label = None
self.engine.clear() | def reset(self):
self.state = self.IDLE
self.label = None
self.engine.clear()<|docstring|>Stops learning / classifying and resets all learning data.<|endoftext|> |
3548155842bc7f8e3136fd194b739ddf0d44d59ca18b3fa0fd655977eee05472 | def _get_shape(self):
'Returns the input tensor shape as (width, height).'
input_tensor_shape = self.engine.get_input_tensor_shape()
return (input_tensor_shape[2], input_tensor_shape[1]) | Returns the input tensor shape as (width, height). | app/imprint_engine.py | _get_shape | YoonChi/alto | 257 | python | def _get_shape(self):
input_tensor_shape = self.engine.get_input_tensor_shape()
return (input_tensor_shape[2], input_tensor_shape[1]) | def _get_shape(self):
input_tensor_shape = self.engine.get_input_tensor_shape()
return (input_tensor_shape[2], input_tensor_shape[1])<|docstring|>Returns the input tensor shape as (width, height).<|endoftext|> |
68b8e4b29d570453d155c243129a4a63add1168cb1847134b766dfbb1102b263 | def _get_emb(self, image):
'Returns the embedding vector for the given image.\n\n Args:\n image: numpy.array, a uint8 RGB image with the correct shape.'
return self.engine.RunInference(image.flatten())[1].copy() | Returns the embedding vector for the given image.
Args:
image: numpy.array, a uint8 RGB image with the correct shape. | app/imprint_engine.py | _get_emb | YoonChi/alto | 257 | python | def _get_emb(self, image):
'Returns the embedding vector for the given image.\n\n Args:\n image: numpy.array, a uint8 RGB image with the correct shape.'
return self.engine.RunInference(image.flatten())[1].copy() | def _get_emb(self, image):
'Returns the embedding vector for the given image.\n\n Args:\n image: numpy.array, a uint8 RGB image with the correct shape.'
return self.engine.RunInference(image.flatten())[1].copy()<|docstring|>Returns the embedding vector for the given image.
Args:
image: numpy.... |
2358e2b565d92b11e634ad1d86d3d18928672db29a6b8d6caaa7f0357409dc4c | def _run_learning(self, cam, label):
'Performs a learning loop until the state changes.\n\n Args:\n cam: The RPi camera.\n label: Any, the label to use for the new data.'
log.info('learning started')
output = np.empty((self.shape[0], self.shape[1], 3), dtype=np.uint8)
gen = cam.... | Performs a learning loop until the state changes.
Args:
cam: The RPi camera.
label: Any, the label to use for the new data. | app/imprint_engine.py | _run_learning | YoonChi/alto | 257 | python | def _run_learning(self, cam, label):
'Performs a learning loop until the state changes.\n\n Args:\n cam: The RPi camera.\n label: Any, the label to use for the new data.'
log.info('learning started')
output = np.empty((self.shape[0], self.shape[1], 3), dtype=np.uint8)
gen = cam.... | def _run_learning(self, cam, label):
'Performs a learning loop until the state changes.\n\n Args:\n cam: The RPi camera.\n label: Any, the label to use for the new data.'
log.info('learning started')
output = np.empty((self.shape[0], self.shape[1], 3), dtype=np.uint8)
gen = cam.... |
db6f6a6d3476de847b2437ee8017f651a3f07198ab7c2667496ae78d61e399c9 | def _run_classifying(self, cam):
'Performs a classifying loop until the state changes.\n\n Args:\n cam: The RPi camera.'
log.info('classifying started')
self.results = collections.defaultdict((lambda : InfiniteImpulseResponseFilter(self.iir_weight)))
current_label = None
output = np.... | Performs a classifying loop until the state changes.
Args:
cam: The RPi camera. | app/imprint_engine.py | _run_classifying | YoonChi/alto | 257 | python | def _run_classifying(self, cam):
'Performs a classifying loop until the state changes.\n\n Args:\n cam: The RPi camera.'
log.info('classifying started')
self.results = collections.defaultdict((lambda : InfiniteImpulseResponseFilter(self.iir_weight)))
current_label = None
output = np.... | def _run_classifying(self, cam):
'Performs a classifying loop until the state changes.\n\n Args:\n cam: The RPi camera.'
log.info('classifying started')
self.results = collections.defaultdict((lambda : InfiniteImpulseResponseFilter(self.iir_weight)))
current_label = None
output = np.... |
f8aac537fef727bdda530432c58abbcd8037f6efdefb90f96f33b04a27c6cc6d | def __init__(self, weight, value=0):
'Constructor.\n\n Args:\n weight: float, the weight (0-1) to give new inputs.\n value: float, the initial value.'
self.weight = weight
self.output = value | Constructor.
Args:
weight: float, the weight (0-1) to give new inputs.
value: float, the initial value. | app/imprint_engine.py | __init__ | YoonChi/alto | 257 | python | def __init__(self, weight, value=0):
'Constructor.\n\n Args:\n weight: float, the weight (0-1) to give new inputs.\n value: float, the initial value.'
self.weight = weight
self.output = value | def __init__(self, weight, value=0):
'Constructor.\n\n Args:\n weight: float, the weight (0-1) to give new inputs.\n value: float, the initial value.'
self.weight = weight
self.output = value<|docstring|>Constructor.
Args:
weight: float, the weight (0-1) to give new inputs.
val... |
605988015ea32c192d604fe530775153b643279a9ea65e9226c2b0bb43541c95 | def update(self, input):
'Updates the output.\n\n Args:\n input: float, the current input.'
self.output *= (1 - self.weight)
self.output += (input * self.weight) | Updates the output.
Args:
input: float, the current input. | app/imprint_engine.py | update | YoonChi/alto | 257 | python | def update(self, input):
'Updates the output.\n\n Args:\n input: float, the current input.'
self.output *= (1 - self.weight)
self.output += (input * self.weight) | def update(self, input):
'Updates the output.\n\n Args:\n input: float, the current input.'
self.output *= (1 - self.weight)
self.output += (input * self.weight)<|docstring|>Updates the output.
Args:
input: float, the current input.<|endoftext|> |
b6f258458be3b649beba8cc5fda9e6254368cab1dff4f276cec05472ff05706e | def reset(self, value=0):
'Resets the output.\n\n Args:\n value: float, the new output.'
self.output = value | Resets the output.
Args:
value: float, the new output. | app/imprint_engine.py | reset | YoonChi/alto | 257 | python | def reset(self, value=0):
'Resets the output.\n\n Args:\n value: float, the new output.'
self.output = value | def reset(self, value=0):
'Resets the output.\n\n Args:\n value: float, the new output.'
self.output = value<|docstring|>Resets the output.
Args:
value: float, the new output.<|endoftext|> |
525ffdb2060e64d01389bb7533ea9f22a44fe9b9680a668426778af72041dde5 | def __init__(self, model_path):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: str, path to a TF-Lite Flatbuffer file.\n\n Raises:\n ValueError: The model output is invalid.\n '
super().__init__(model_path)
output_tensors_sizes = self.get_all_outp... | Creates a EmbeddingEngine with given model.
Args:
model_path: str, path to a TF-Lite Flatbuffer file.
Raises:
ValueError: The model output is invalid. | app/imprint_engine.py | __init__ | YoonChi/alto | 257 | python | def __init__(self, model_path):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: str, path to a TF-Lite Flatbuffer file.\n\n Raises:\n ValueError: The model output is invalid.\n '
super().__init__(model_path)
output_tensors_sizes = self.get_all_outp... | def __init__(self, model_path):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: str, path to a TF-Lite Flatbuffer file.\n\n Raises:\n ValueError: The model output is invalid.\n '
super().__init__(model_path)
output_tensors_sizes = self.get_all_outp... |
b169247282b678d08385f1aef0367adb116673bab7e78ac153a25a96120347be | def __init__(self, model_path, k_nearest_neighbors=3, maxlen=1000):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: String, path to TF-Lite Flatbuffer file.\n k_nearest_neighbors: int, the number of neighbors to use for\n confidences.\n maxlen: int, ... | Creates a EmbeddingEngine with given model.
Args:
model_path: String, path to TF-Lite Flatbuffer file.
k_nearest_neighbors: int, the number of neighbors to use for
confidences.
maxlen: int, the maximum number of embeddings to store per label.
Raises:
ValueError: The model output is invalid. | app/imprint_engine.py | __init__ | YoonChi/alto | 257 | python | def __init__(self, model_path, k_nearest_neighbors=3, maxlen=1000):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: String, path to TF-Lite Flatbuffer file.\n k_nearest_neighbors: int, the number of neighbors to use for\n confidences.\n maxlen: int, ... | def __init__(self, model_path, k_nearest_neighbors=3, maxlen=1000):
'Creates a EmbeddingEngine with given model.\n\n Args:\n model_path: String, path to TF-Lite Flatbuffer file.\n k_nearest_neighbors: int, the number of neighbors to use for\n confidences.\n maxlen: int, ... |
17fb6f3c583352bab4d797721202b9372c44e4b6e2a767445d921d019e638c80 | def clear(self):
'Clear the store: forgets all stored embeddings.'
self.embedding_map = collections.defaultdict(list) | Clear the store: forgets all stored embeddings. | app/imprint_engine.py | clear | YoonChi/alto | 257 | python | def clear(self):
self.embedding_map = collections.defaultdict(list) | def clear(self):
self.embedding_map = collections.defaultdict(list)<|docstring|>Clear the store: forgets all stored embeddings.<|endoftext|> |
4153982f74a20f42b34ca88f9f0e942d470819597151a48c722cfdf1190fcd5c | def add_embedding(self, label, emb):
'Add an embedding vector to the store.'
normal = (emb / np.sqrt((emb ** 2).sum()))
embeddings = self.embedding_map[label]
embeddings.append(normal)
if (len(embeddings) > self.maxlen):
self.embedding_map[label] = embeddings[(- self.maxlen):] | Add an embedding vector to the store. | app/imprint_engine.py | add_embedding | YoonChi/alto | 257 | python | def add_embedding(self, label, emb):
normal = (emb / np.sqrt((emb ** 2).sum()))
embeddings = self.embedding_map[label]
embeddings.append(normal)
if (len(embeddings) > self.maxlen):
self.embedding_map[label] = embeddings[(- self.maxlen):] | def add_embedding(self, label, emb):
normal = (emb / np.sqrt((emb ** 2).sum()))
embeddings = self.embedding_map[label]
embeddings.append(normal)
if (len(embeddings) > self.maxlen):
self.embedding_map[label] = embeddings[(- self.maxlen):]<|docstring|>Add an embedding vector to the store.<|en... |
78a1db3b2f5bd3eb26dcd98ed75bf69241cf1c9d49936dfeecd8375b006a9b34 | def get_confidences(self, query_emb):
'Returns the match confidences for a query embedding.\n\n Args:\n query_emb: The embedding vector to match against.\n\n Returns:\n Dict[Any, float], a mapping of labels to match confidences.'
query_emb = (query_emb / np.sqrt((query_emb ** 2).... | Returns the match confidences for a query embedding.
Args:
query_emb: The embedding vector to match against.
Returns:
Dict[Any, float], a mapping of labels to match confidences. | app/imprint_engine.py | get_confidences | YoonChi/alto | 257 | python | def get_confidences(self, query_emb):
'Returns the match confidences for a query embedding.\n\n Args:\n query_emb: The embedding vector to match against.\n\n Returns:\n Dict[Any, float], a mapping of labels to match confidences.'
query_emb = (query_emb / np.sqrt((query_emb ** 2).... | def get_confidences(self, query_emb):
'Returns the match confidences for a query embedding.\n\n Args:\n query_emb: The embedding vector to match against.\n\n Returns:\n Dict[Any, float], a mapping of labels to match confidences.'
query_emb = (query_emb / np.sqrt((query_emb ** 2).... |
74e37846e88e2b65705953aaafb1160a4dab5eb332d06f52b0058d356110409c | def add_arguments(self, parser):
'\n Adds custom arguments specific to this command.\n '
super(Command, self).add_arguments(parser)
parser.add_argument('release-date', help='Date that the version was released (format: YYYY-MM-DD)')
parser.add_argument('--skip-clean', action='store_false', ... | Adds custom arguments specific to this command. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | add_arguments | rkiddy/django-calaccess-raw-data | 48 | python | def add_arguments(self, parser):
'\n \n '
super(Command, self).add_arguments(parser)
parser.add_argument('release-date', help='Date that the version was released (format: YYYY-MM-DD)')
parser.add_argument('--skip-clean', action='store_false', dest='clean', default=True, help='Skip cleaning... | def add_arguments(self, parser):
'\n \n '
super(Command, self).add_arguments(parser)
parser.add_argument('release-date', help='Date that the version was released (format: YYYY-MM-DD)')
parser.add_argument('--skip-clean', action='store_false', dest='clean', default=True, help='Skip cleaning... |
c7a732493fff7f112152798efe23a94aca2facdf59ba6f7ef3fab8ba504db14d | def handle(self, *args, **options):
'\n Make it happen.\n '
super(Command, self).handle(*args, **options)
self.release_date = datetime.strptime(options['release-date'], '%Y-%m-%d').date()
self.app_name = options['app_name']
self.keep_files = options['keep_files']
self.cleaning = op... | Make it happen. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | handle | rkiddy/django-calaccess-raw-data | 48 | python | def handle(self, *args, **options):
'\n \n '
super(Command, self).handle(*args, **options)
self.release_date = datetime.strptime(options['release-date'], '%Y-%m-%d').date()
self.app_name = options['app_name']
self.keep_files = options['keep_files']
self.cleaning = options['clean']
... | def handle(self, *args, **options):
'\n \n '
super(Command, self).handle(*args, **options)
self.release_date = datetime.strptime(options['release-date'], '%Y-%m-%d').date()
self.app_name = options['app_name']
self.keep_files = options['keep_files']
self.cleaning = options['clean']
... |
c576d834b2dbe78ae4367c63836c4a5a0fcbe6693d87ff55910bcb3bc1a08a69 | def unzip(self):
'\n Unzip the snapshot file.\n '
if self.verbosity:
self.log(' Unzipping archive')
with zipfile.ZipFile(self.zip_path) as zf:
for member in zf.infolist():
words = member.filename.split('/')
path = self.data_dir
for word in wo... | Unzip the snapshot file. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | unzip | rkiddy/django-calaccess-raw-data | 48 | python | def unzip(self):
'\n \n '
if self.verbosity:
self.log(' Unzipping archive')
with zipfile.ZipFile(self.zip_path) as zf:
for member in zf.infolist():
words = member.filename.split('/')
path = self.data_dir
for word in words[:(- 1)]:
... | def unzip(self):
'\n \n '
if self.verbosity:
self.log(' Unzipping archive')
with zipfile.ZipFile(self.zip_path) as zf:
for member in zf.infolist():
words = member.filename.split('/')
path = self.data_dir
for word in words[:(- 1)]:
... |
68ffd6c6de33b06b811ffd4432a52992f28b24cbb20a371af85e2ffebc493567 | def prep(self):
"\n Rearrange the unzipped files and get rid of the stuff we don't want.\n "
if self.verbosity:
self.log(' Prepping unzipped data')
shutil.move(os.path.join(self.data_dir, 'CalAccess/DATA/CalAccess/DATA/'), self.data_dir)
if os.path.exists(self.tsv_dir):
shu... | Rearrange the unzipped files and get rid of the stuff we don't want. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | prep | rkiddy/django-calaccess-raw-data | 48 | python | def prep(self):
"\n \n "
if self.verbosity:
self.log(' Prepping unzipped data')
shutil.move(os.path.join(self.data_dir, 'CalAccess/DATA/CalAccess/DATA/'), self.data_dir)
if os.path.exists(self.tsv_dir):
shutil.rmtree(self.tsv_dir)
shutil.move(os.path.join(self.data_dir,... | def prep(self):
"\n \n "
if self.verbosity:
self.log(' Prepping unzipped data')
shutil.move(os.path.join(self.data_dir, 'CalAccess/DATA/CalAccess/DATA/'), self.data_dir)
if os.path.exists(self.tsv_dir):
shutil.rmtree(self.tsv_dir)
shutil.move(os.path.join(self.data_dir,... |
caf921a79f958ef4ef90bac107937fa37f902e47f10b928050f13e01913e9a80 | def clean(self):
'\n Clean up the raw data files from the state so they are ready to get loaded into the database.\n '
if self.verbosity:
self.header('Cleaning data files')
tsv_list = os.listdir(self.tsv_dir)
if self.resume_mode:
prev_cleaned = [(x.file_name + '.TSV') for x... | Clean up the raw data files from the state so they are ready to get loaded into the database. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | clean | rkiddy/django-calaccess-raw-data | 48 | python | def clean(self):
'\n \n '
if self.verbosity:
self.header('Cleaning data files')
tsv_list = os.listdir(self.tsv_dir)
if self.resume_mode:
prev_cleaned = [(x.file_name + '.TSV') for x in self.log_record.called.filter(command='cleancalaccessrawfile', finish_datetime__isnull=Fa... | def clean(self):
'\n \n '
if self.verbosity:
self.header('Cleaning data files')
tsv_list = os.listdir(self.tsv_dir)
if self.resume_mode:
prev_cleaned = [(x.file_name + '.TSV') for x in self.log_record.called.filter(command='cleancalaccessrawfile', finish_datetime__isnull=Fa... |
9d9daef461a940e0b4387e05a2405a129ac6f900ac0e15ca4fc2754b3c4612b0 | def load(self):
'\n Loads the cleaned up csv files into the database.\n '
if self.verbosity:
self.header('Loading data files')
model_list = [x for x in get_model_list() if os.path.exists(x.objects.get_csv_path())]
if self.resume_mode:
prev_loaded = [x.file_name for x in sel... | Loads the cleaned up csv files into the database. | example/toolbox/management/commands/reprocesscalaccessrawdata.py | load | rkiddy/django-calaccess-raw-data | 48 | python | def load(self):
'\n \n '
if self.verbosity:
self.header('Loading data files')
model_list = [x for x in get_model_list() if os.path.exists(x.objects.get_csv_path())]
if self.resume_mode:
prev_loaded = [x.file_name for x in self.log_record.called.filter(command='loadcalaccess... | def load(self):
'\n \n '
if self.verbosity:
self.header('Loading data files')
model_list = [x for x in get_model_list() if os.path.exists(x.objects.get_csv_path())]
if self.resume_mode:
prev_loaded = [x.file_name for x in self.log_record.called.filter(command='loadcalaccess... |
0dfb0a65c9d27482ec83c0f7e53ac1f3836f37496ed7bf9301ed237aeb0f1371 | def __hash__(self) -> int:
'Overrides the default implementation'
_result_hash: int = ((hash(self.datasource_name) ^ hash(self.data_connector_name)) ^ hash(self.data_asset_name))
if (self.definition is not None):
for (key, value) in self.partition_definition.items():
_result_hash = ((_re... | Overrides the default implementation | great_expectations/core/batch.py | __hash__ | aworld1/great_expectations | 1 | python | def __hash__(self) -> int:
_result_hash: int = ((hash(self.datasource_name) ^ hash(self.data_connector_name)) ^ hash(self.data_asset_name))
if (self.definition is not None):
for (key, value) in self.partition_definition.items():
_result_hash = ((_result_hash ^ hash(key)) ^ hash(str(valu... | def __hash__(self) -> int:
_result_hash: int = ((hash(self.datasource_name) ^ hash(self.data_connector_name)) ^ hash(self.data_asset_name))
if (self.definition is not None):
for (key, value) in self.partition_definition.items():
_result_hash = ((_result_hash ^ hash(key)) ^ hash(str(valu... |
3973812941afec7b2e8e461a13a3fac9dd0a7134d046f7489270ed054775fcde | @pytest.mark.parametrize('model', [AutoETS, ExponentialSmoothing, SARIMAX, UnobservedComponents, VAR])
def test_random_state(model):
'Function to test random_state parameter.'
obj = model.create_test_instance()
if (model == VAR):
obj.fit(y=y_1, fh=fh)
y = obj.predict()
obj.fit(y=y_1,... | Function to test random_state parameter. | sktime/forecasting/base/tests/randomtest.py | test_random_state | khrapovs/sktime | 1 | python | @pytest.mark.parametrize('model', [AutoETS, ExponentialSmoothing, SARIMAX, UnobservedComponents, VAR])
def test_random_state(model):
obj = model.create_test_instance()
if (model == VAR):
obj.fit(y=y_1, fh=fh)
y = obj.predict()
obj.fit(y=y_1, fh=fh)
y1 = obj.predict()
els... | @pytest.mark.parametrize('model', [AutoETS, ExponentialSmoothing, SARIMAX, UnobservedComponents, VAR])
def test_random_state(model):
obj = model.create_test_instance()
if (model == VAR):
obj.fit(y=y_1, fh=fh)
y = obj.predict()
obj.fit(y=y_1, fh=fh)
y1 = obj.predict()
els... |
12a77b913be0215115585ff275708e3f51ca7fded598c775de81a6850f555c8e | def openVisaResource_1(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... | openVisaResource(address)
Creates the intsrument handle
Arguments:
address:GPIB address :Integer | utils.py | openVisaResource_1 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def openVisaResource_1(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... | def openVisaResource_1(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... |
c5d280a313295fdfa9fe4ea990f62fc26ba657bc9d45828a6943b9c6ca29f3b3 | def openVisaResource_2(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... | openVisaResource(address)
Creates the intsrument handle
Arguments:
address:GPIB address :Integer | utils.py | openVisaResource_2 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def openVisaResource_2(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... | def openVisaResource_2(address, parents):
' \n openVisaResource(address)\n \n Creates the intsrument handle \n\n Arguments:\n \n address:GPIB address :Integer \n '
try:
rm = visa.ResourceManager()
inst_handle = rm.open_resource((('GPIB0::' + str(address)) + '::INSTR'))
... |
971df7832706addff3f977aa7bc78e4f80becef6e72e7609681654c21dc397f9 | def close_(parents, address_1=2, address_2=14):
' \n close VisaResource(address)\n \n reset the intsrument handle \n\n Arguments:\n \n address_1:GPIB address0 :Integer \n address_2:GPIB address0 :Integer \n '
inst_handle_1 = openVisaResource_1(address_1, parents)
inst_handle_1.writ... | close VisaResource(address)
reset the intsrument handle
Arguments:
address_1:GPIB address0 :Integer
address_2:GPIB address0 :Integer | utils.py | close_ | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def close_(parents, address_1=2, address_2=14):
' \n close VisaResource(address)\n \n reset the intsrument handle \n\n Arguments:\n \n address_1:GPIB address0 :Integer \n address_2:GPIB address0 :Integer \n '
inst_handle_1 = openVisaResource_1(address_1, parents)
inst_handle_1.writ... | def close_(parents, address_1=2, address_2=14):
' \n close VisaResource(address)\n \n reset the intsrument handle \n\n Arguments:\n \n address_1:GPIB address0 :Integer \n address_2:GPIB address0 :Integer \n '
inst_handle_1 = openVisaResource_1(address_1, parents)
inst_handle_1.writ... |
4140e1bce74d11bc685c7d26bdc534937b9d610555652c7aea7d33d0dd4c6ef8 | def initInstrument_1(inst_handle_1, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... | initInstrument(inst_handle)
Initializes the instrument and returns the instrument name
Arguments:
inst_handle:intsrument handle from 'openVisaResource()'
do_reset:True/False | utils.py | initInstrument_1 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def initInstrument_1(inst_handle_1, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... | def initInstrument_1(inst_handle_1, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... |
79352a4061d94f33dfba02d16e6a5af7d6ade1381ab7eab43d03d446a3994f7b | def initInstrument_2(inst_handle_2, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... | initInstrument(inst_handle)
Initializes the instrument and returns the instrument name
Arguments:
inst_handle:intsrument handle from 'openVisaResource()'
do_reset:True/False | utils.py | initInstrument_2 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def initInstrument_2(inst_handle_2, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... | def initInstrument_2(inst_handle_2, do_reset):
" \n initInstrument(inst_handle)\n \n Initializes the instrument and returns the instrument name\n \n Arguments:\n \n inst_handle:intsrument handle from 'openVisaResource()' \n do_reset:True/False\n \n "
try:
name = inst_handle... |
977d40ccaa3f1a6105d603b30744c223dabcd2c54fdf01a22624011a5719e31e | def setdefaultParameters_1(inst_handle_1):
" \n setCorrectionParameters(inst_handle)\n \n corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
set_cal('C', 'D')
try:
command = ':SEN... | setCorrectionParameters(inst_handle)
corrections before the measurements
Arguments:
inst_handle:instrument handle from 'openVisaResource()' | utils.py | setdefaultParameters_1 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def setdefaultParameters_1(inst_handle_1):
" \n setCorrectionParameters(inst_handle)\n \n corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
set_cal('C', 'D')
try:
command = ':SEN... | def setdefaultParameters_1(inst_handle_1):
" \n setCorrectionParameters(inst_handle)\n \n corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
set_cal('C', 'D')
try:
command = ':SEN... |
06ab145c691a446e9e2636d09b16f04c05eb25e7d685e66905acbb25d3c3d20c | def setdefaultParameters_2(inst_handle_2):
' \n setCorrectionParameters()\n \n Carries our any corrections before the measurements \n \n '
try:
inst_handle_2.write('sense:voltage:guard 0')
inst_handle_2.write('calculate:state 0')
inst_handle_2.write... | setCorrectionParameters()
Carries our any corrections before the measurements | utils.py | setdefaultParameters_2 | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def setdefaultParameters_2(inst_handle_2):
' \n setCorrectionParameters()\n \n Carries our any corrections before the measurements \n \n '
try:
inst_handle_2.write('sense:voltage:guard 0')
inst_handle_2.write('calculate:state 0')
inst_handle_2.write... | def setdefaultParameters_2(inst_handle_2):
' \n setCorrectionParameters()\n \n Carries our any corrections before the measurements \n \n '
try:
inst_handle_2.write('sense:voltage:guard 0')
inst_handle_2.write('calculate:state 0')
inst_handle_2.write... |
44bf9ecfa7c4b66ed1c0d1661a48c1e02185586e84493c4658c7710215b287aa | def setCorrectionParameters(inst_handle_1, calc_1, calc_2, cable_length):
' \n setCorrectionParameters(inst_handle,calc_1,calc_2,cable_length)\n \n Carries our any corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaReso... | setCorrectionParameters(inst_handle,calc_1,calc_2,cable_length)
Carries our any corrections before the measurements
Arguments:
inst_handle:instrument handle from 'openVisaResource()'
cable_length: Length in meters : Positive Integer
Calcuation_1-->["Z","C","Cs","CPRP","Cp","Ls","Lp"])
calcu... | utils.py | setCorrectionParameters | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def setCorrectionParameters(inst_handle_1, calc_1, calc_2, cable_length):
' \n setCorrectionParameters(inst_handle,calc_1,calc_2,cable_length)\n \n Carries our any corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaReso... | def setCorrectionParameters(inst_handle_1, calc_1, calc_2, cable_length):
' \n setCorrectionParameters(inst_handle,calc_1,calc_2,cable_length)\n \n Carries our any corrections before the measurements \n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaReso... |
3e213818b4877d96b9e2e6d2278e97c928dff5c3f55e731da0b6480bf45f2f48 | def setSignalLevelAndFrequency(inst_handle_1, frequency, ac_signl):
' \n SetSignalLevelAndFrequency(inst_handle,frequency, \n is_voltage_signal)\n \n Sets the Signal type(Voltage) and frequency\n \n '
try:
command = '... | SetSignalLevelAndFrequency(inst_handle,frequency,
is_voltage_signal)
Sets the Signal type(Voltage) and frequency | utils.py | setSignalLevelAndFrequency | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def setSignalLevelAndFrequency(inst_handle_1, frequency, ac_signl):
' \n SetSignalLevelAndFrequency(inst_handle,frequency, \n is_voltage_signal)\n \n Sets the Signal type(Voltage) and frequency\n \n '
try:
command = '... | def setSignalLevelAndFrequency(inst_handle_1, frequency, ac_signl):
' \n SetSignalLevelAndFrequency(inst_handle,frequency, \n is_voltage_signal)\n \n Sets the Signal type(Voltage) and frequency\n \n '
try:
command = '... |
c7652bf998703bd635570ac8d9059ac3ac82948eec2ad773e48e8d84d30bbf42 | def fetchData(inst_handle_1, v_n, delay):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
WAIT_TIME_SEC = 1.0
try:
inst_handle_1.write((':SOUR:VOLT:OFFS ' + str(v_n)))
inst_handl... | fetchData(inst_handle):
Fetches the data
Arguments:
inst_handle:instrument handle from 'openVisaResource()' | utils.py | fetchData | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def fetchData(inst_handle_1, v_n, delay):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
WAIT_TIME_SEC = 1.0
try:
inst_handle_1.write((':SOUR:VOLT:OFFS ' + str(v_n)))
inst_handl... | def fetchData(inst_handle_1, v_n, delay):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
WAIT_TIME_SEC = 1.0
try:
inst_handle_1.write((':SOUR:VOLT:OFFS ' + str(v_n)))
inst_handl... |
00fb24c994049499f05242036ad81710d23e4f2ede8a88fe14ee1efe9398de01 | def fetch_emv(inst_handle_2):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
try:
inst_handle_2.write('*CLS')
inst_handle_2.write('trace:clear')
inst_handle_2.write('trace:p... | fetchData(inst_handle):
Fetches the data
Arguments:
inst_handle:instrument handle from 'openVisaResource()' | utils.py | fetch_emv | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def fetch_emv(inst_handle_2):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
try:
inst_handle_2.write('*CLS')
inst_handle_2.write('trace:clear')
inst_handle_2.write('trace:p... | def fetch_emv(inst_handle_2):
" \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from 'openVisaResource()'\n \n "
try:
inst_handle_2.write('*CLS')
inst_handle_2.write('trace:clear')
inst_handle_2.write('trace:p... |
7ae809db7cd45059e2da9d26bf5d88080f559c94d957cb52bf26289efbe42231 | def runCVLoop(inst_handle_1, inst_handle_2, VBias, filename, parent, time_s):
' \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaResource()\'\n freq:Frequency in HZ at which to measure CV\n VBias:Array with voltage data poi... | fetchData(inst_handle):
Fetches the data
Arguments:
inst_handle:instrument handle from 'openVisaResource()'
freq:Frequency in HZ at which to measure CV
VBias:Array with voltage data points at which to measure Capacitance
Calcuation_1-->["Z","C","Cs","CPRP","Cp","Ls","Lp"])
calculation_2-->["Rs","Rp","PHAS","D"] | utils.py | runCVLoop | dnsmalla/Water-splitting-measurement-LCR-GUI | 0 | python | def runCVLoop(inst_handle_1, inst_handle_2, VBias, filename, parent, time_s):
' \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaResource()\'\n freq:Frequency in HZ at which to measure CV\n VBias:Array with voltage data poi... | def runCVLoop(inst_handle_1, inst_handle_2, VBias, filename, parent, time_s):
' \n fetchData(inst_handle):\n \n Fetches the data\n \n Arguments:\n \n inst_handle:instrument handle from \'openVisaResource()\'\n freq:Frequency in HZ at which to measure CV\n VBias:Array with voltage data poi... |
7d595eed4dc9a67709b151d58a7dcda2f8f04e70f98d9dd8cffeedcbd695c6b1 | def prepare_data(self):
'Prepares the data'
self.counter_attack_vs_flying = self.close_enemies_to_base = False
self.structures = self.units.structure
self.initialize_bases()
self.initialize_units()
self.initialize_buildings()
self.initialize_enemies()
self.close_enemy_production = self.c... | Prepares the data | data_container.py | prepare_data | drakonnan1st/JackBot | 0 | python | def prepare_data(self):
self.counter_attack_vs_flying = self.close_enemies_to_base = False
self.structures = self.units.structure
self.initialize_bases()
self.initialize_units()
self.initialize_buildings()
self.initialize_enemies()
self.close_enemy_production = self.check_for_proxy_buil... | def prepare_data(self):
self.counter_attack_vs_flying = self.close_enemies_to_base = False
self.structures = self.units.structure
self.initialize_bases()
self.initialize_units()
self.initialize_buildings()
self.initialize_enemies()
self.close_enemy_production = self.check_for_proxy_buil... |
2b64e4f3771bc3c4b42e105f1fe98958540a6e4119a35a246ab0dffd9ae229cb | def check_for_proxy_buildings(self) -> bool:
'Check if there are any proxy buildings'
return bool(self.enemy_structures.of_type({BARRACKS, GATEWAY, HATCHERY}).closer_than(75, self.start_location)) | Check if there are any proxy buildings | data_container.py | check_for_proxy_buildings | drakonnan1st/JackBot | 0 | python | def check_for_proxy_buildings(self) -> bool:
return bool(self.enemy_structures.of_type({BARRACKS, GATEWAY, HATCHERY}).closer_than(75, self.start_location)) | def check_for_proxy_buildings(self) -> bool:
return bool(self.enemy_structures.of_type({BARRACKS, GATEWAY, HATCHERY}).closer_than(75, self.start_location))<|docstring|>Check if there are any proxy buildings<|endoftext|> |
308c05602924918f41171834b60246679363f42d782a96c7ecea98af5577f3c5 | def check_for_floating_buildings(self) -> bool:
'Check if some terran wants to be funny with lifting up'
return bool((self.enemy_structures.flying and (len(self.enemy_structures) == len(self.enemy_structures.flying)) and (self.time > 300))) | Check if some terran wants to be funny with lifting up | data_container.py | check_for_floating_buildings | drakonnan1st/JackBot | 0 | python | def check_for_floating_buildings(self) -> bool:
return bool((self.enemy_structures.flying and (len(self.enemy_structures) == len(self.enemy_structures.flying)) and (self.time > 300))) | def check_for_floating_buildings(self) -> bool:
return bool((self.enemy_structures.flying and (len(self.enemy_structures) == len(self.enemy_structures.flying)) and (self.time > 300)))<|docstring|>Check if some terran wants to be funny with lifting up<|endoftext|> |
5b0653a01c517f13bc0ce6835cdce256b768df943ac0ed59a3352376256460e4 | def check_for_second_bases(self) -> bool:
'Check if its a one base play'
return bool((self.overlords and (not self.enemy_structures.of_type({NEXUS, COMMANDCENTER, HATCHERY}).closer_than(25, self.overlords.furthest_to(self.start_location))) and (self.time > 165) and (not self.close_enemy_production))) | Check if its a one base play | data_container.py | check_for_second_bases | drakonnan1st/JackBot | 0 | python | def check_for_second_bases(self) -> bool:
return bool((self.overlords and (not self.enemy_structures.of_type({NEXUS, COMMANDCENTER, HATCHERY}).closer_than(25, self.overlords.furthest_to(self.start_location))) and (self.time > 165) and (not self.close_enemy_production))) | def check_for_second_bases(self) -> bool:
return bool((self.overlords and (not self.enemy_structures.of_type({NEXUS, COMMANDCENTER, HATCHERY}).closer_than(25, self.overlords.furthest_to(self.start_location))) and (self.time > 165) and (not self.close_enemy_production)))<|docstring|>Check if its a one base play... |
73e2fbda0bb8f2eaf37214cdf6f11ced1272d9dfbeaa14db8c951eb02692e6d7 | def prepare_enemy_data_points(self):
'Prepare data related to enemy units'
if self.enemies:
excluded_from_flying = {DRONE, SCV, PROBE, OVERLORD, OVERSEER, RAVEN, OBSERVER, WARPPRISM, MEDIVAC, VIPER, CORRUPTOR}
for hatch in self.townhalls:
close_enemy = self.ground_enemies.closer_than... | Prepare data related to enemy units | data_container.py | prepare_enemy_data_points | drakonnan1st/JackBot | 0 | python | def prepare_enemy_data_points(self):
if self.enemies:
excluded_from_flying = {DRONE, SCV, PROBE, OVERLORD, OVERSEER, RAVEN, OBSERVER, WARPPRISM, MEDIVAC, VIPER, CORRUPTOR}
for hatch in self.townhalls:
close_enemy = self.ground_enemies.closer_than(20, hatch.position)
clos... | def prepare_enemy_data_points(self):
if self.enemies:
excluded_from_flying = {DRONE, SCV, PROBE, OVERLORD, OVERSEER, RAVEN, OBSERVER, WARPPRISM, MEDIVAC, VIPER, CORRUPTOR}
for hatch in self.townhalls:
close_enemy = self.ground_enemies.closer_than(20, hatch.position)
clos... |
ab0072f03178ac45ab2eb7f15bb48d2f97018757615978dd2e4bcb3611c5bbae | def initialize_bases(self):
'Initialize the bases'
self.hatcheries = self.units(HATCHERY)
self.lairs = self.units(LAIR)
self.hives = self.units(HIVE)
self.prepare_bases_data() | Initialize the bases | data_container.py | initialize_bases | drakonnan1st/JackBot | 0 | python | def initialize_bases(self):
self.hatcheries = self.units(HATCHERY)
self.lairs = self.units(LAIR)
self.hives = self.units(HIVE)
self.prepare_bases_data() | def initialize_bases(self):
self.hatcheries = self.units(HATCHERY)
self.lairs = self.units(LAIR)
self.hives = self.units(HIVE)
self.prepare_bases_data()<|docstring|>Initialize the bases<|endoftext|> |
ed3024e6abffe98cf3e015be65d1cda66c17a57fb632dc36648b3b24ca83f1d7 | def initialize_units(self):
'Initialize our units'
self.overlords = self.units(OVERLORD)
self.drones = self.units(DRONE)
self.queens = self.units(QUEEN)
self.zerglings = (self.units(ZERGLING).tags_not_in(self.burrowed_lings) if self.burrowed_lings else self.units(ZERGLING))
self.ultralisks = sel... | Initialize our units | data_container.py | initialize_units | drakonnan1st/JackBot | 0 | python | def initialize_units(self):
self.overlords = self.units(OVERLORD)
self.drones = self.units(DRONE)
self.queens = self.units(QUEEN)
self.zerglings = (self.units(ZERGLING).tags_not_in(self.burrowed_lings) if self.burrowed_lings else self.units(ZERGLING))
self.ultralisks = self.units(ULTRALISK)
... | def initialize_units(self):
self.overlords = self.units(OVERLORD)
self.drones = self.units(DRONE)
self.queens = self.units(QUEEN)
self.zerglings = (self.units(ZERGLING).tags_not_in(self.burrowed_lings) if self.burrowed_lings else self.units(ZERGLING))
self.ultralisks = self.units(ULTRALISK)
... |
e40d37085b0a357af12b595c610775dec94e6fb15af0f29d41c4c8b96084a194 | def initialize_buildings(self):
'Initialize our buildings'
self.evochambers = self.units(EVOLUTIONCHAMBER)
self.caverns = self.units(ULTRALISKCAVERN)
self.hydradens = self.units(HYDRALISKDEN)
self.pools = self.units(SPAWNINGPOOL)
self.pits = self.units(INFESTATIONPIT)
self.spines = self.unit... | Initialize our buildings | data_container.py | initialize_buildings | drakonnan1st/JackBot | 0 | python | def initialize_buildings(self):
self.evochambers = self.units(EVOLUTIONCHAMBER)
self.caverns = self.units(ULTRALISKCAVERN)
self.hydradens = self.units(HYDRALISKDEN)
self.pools = self.units(SPAWNINGPOOL)
self.pits = self.units(INFESTATIONPIT)
self.spines = self.units(SPINECRAWLER)
self.t... | def initialize_buildings(self):
self.evochambers = self.units(EVOLUTIONCHAMBER)
self.caverns = self.units(ULTRALISKCAVERN)
self.hydradens = self.units(HYDRALISKDEN)
self.pools = self.units(SPAWNINGPOOL)
self.pits = self.units(INFESTATIONPIT)
self.spines = self.units(SPINECRAWLER)
self.t... |
a4caad6870898e0b6bdbe5e0d4881b9e5641c06db95a3c04456d5f81b2842654 | def initialize_enemies(self):
'Initialize everything related to enemies'
excluded_from_ground = {DRONE, SCV, PROBE}
self.enemies = self.known_enemy_units
self.flying_enemies = self.enemies.flying
self.ground_enemies = self.enemies.not_flying.not_structure.exclude_type(excluded_from_ground)
self.... | Initialize everything related to enemies | data_container.py | initialize_enemies | drakonnan1st/JackBot | 0 | python | def initialize_enemies(self):
excluded_from_ground = {DRONE, SCV, PROBE}
self.enemies = self.known_enemy_units
self.flying_enemies = self.enemies.flying
self.ground_enemies = self.enemies.not_flying.not_structure.exclude_type(excluded_from_ground)
self.enemy_structures = self.known_enemy_struct... | def initialize_enemies(self):
excluded_from_ground = {DRONE, SCV, PROBE}
self.enemies = self.known_enemy_units
self.flying_enemies = self.enemies.flying
self.ground_enemies = self.enemies.not_flying.not_structure.exclude_type(excluded_from_ground)
self.enemy_structures = self.known_enemy_struct... |
3e10cdab99d6c90931b1ba415120187c7528033616dbd06f652184560a4664c8 | def prepare_bases_data(self):
'Prepare data related to our bases'
if self.townhalls:
self.furthest_townhall_to_map_center = self.townhalls.furthest_to(self.game_info.map_center) | Prepare data related to our bases | data_container.py | prepare_bases_data | drakonnan1st/JackBot | 0 | python | def prepare_bases_data(self):
if self.townhalls:
self.furthest_townhall_to_map_center = self.townhalls.furthest_to(self.game_info.map_center) | def prepare_bases_data(self):
if self.townhalls:
self.furthest_townhall_to_map_center = self.townhalls.furthest_to(self.game_info.map_center)<|docstring|>Prepare data related to our bases<|endoftext|> |
3caaa0bc00f2ea5bf54f72a2344e1f33e36a416125de8cea73dce1dd11dce6d7 | def duplicates(self, other_rule):
"Returns True if rules have got same values in fields defined in\n 'duplicates_compare_fields' list.\n\n In case when subclass don't have defined any field in\n duplicates_compare_fields, only rule types are compared.\n "
if (self.rule_type != other_... | Returns True if rules have got same values in fields defined in
'duplicates_compare_fields' list.
In case when subclass don't have defined any field in
duplicates_compare_fields, only rule types are compared. | neutron/objects/qos/rule.py | duplicates | urimeba/neutron | 1,080 | python | def duplicates(self, other_rule):
"Returns True if rules have got same values in fields defined in\n 'duplicates_compare_fields' list.\n\n In case when subclass don't have defined any field in\n duplicates_compare_fields, only rule types are compared.\n "
if (self.rule_type != other_... | def duplicates(self, other_rule):
"Returns True if rules have got same values in fields defined in\n 'duplicates_compare_fields' list.\n\n In case when subclass don't have defined any field in\n duplicates_compare_fields, only rule types are compared.\n "
if (self.rule_type != other_... |
067cdd9259f87aa196d78f78053972e28a8262355f3208fdeadf9a5425f02bb8 | def should_apply_to_port(self, port):
'Check whether a rule can be applied to a specific port.\n\n This function has the logic to decide whether a rule should\n be applied to a port or not, depending on the source of the\n policy (network, or port). Eventually rules could override\n this... | Check whether a rule can be applied to a specific port.
This function has the logic to decide whether a rule should
be applied to a port or not, depending on the source of the
policy (network, or port). Eventually rules could override
this method, or we could make it abstract to allow different
rule behaviour. | neutron/objects/qos/rule.py | should_apply_to_port | urimeba/neutron | 1,080 | python | def should_apply_to_port(self, port):
'Check whether a rule can be applied to a specific port.\n\n This function has the logic to decide whether a rule should\n be applied to a port or not, depending on the source of the\n policy (network, or port). Eventually rules could override\n this... | def should_apply_to_port(self, port):
'Check whether a rule can be applied to a specific port.\n\n This function has the logic to decide whether a rule should\n be applied to a port or not, depending on the source of the\n policy (network, or port). Eventually rules could override\n this... |
08c69e28353c6e89dc47636cbbde919804f7b4bac147eb1ca0d1cd77dd708f7a | def write_proto(self, dst_path: str, package_name: str):
'Write the protobuf code for the graph to file.\n\n Args:\n dst_path (str): Path to the output directory where code has to be\n written.\n package_name (str): Package name for the proto code.\n '
... | Write the protobuf code for the graph to file.
Args:
dst_path (str): Path to the output directory where code has to be
written.
package_name (str): Package name for the proto code. | protogenerator/core/schema_generator.py | write_proto | googleinterns/schemaorg-generator | 0 | python | def write_proto(self, dst_path: str, package_name: str):
'Write the protobuf code for the graph to file.\n\n Args:\n dst_path (str): Path to the output directory where code has to be\n written.\n package_name (str): Package name for the proto code.\n '
... | def write_proto(self, dst_path: str, package_name: str):
'Write the protobuf code for the graph to file.\n\n Args:\n dst_path (str): Path to the output directory where code has to be\n written.\n package_name (str): Package name for the proto code.\n '
... |
a3b06aad484d86db439760ed0e52a2a2bc3df4fc29366039e07c7fe1db64d629 | def __class_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call ClassDescriptor.to_proto() and get proto code for every schema\n class.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... | Call ClassDescriptor.to_proto() and get proto code for every schema
class.
Args:
class_to_prop (dict(set): Dictionary containing set of properties
for every class.
enumerations (set): Set containing the enumerations in the schema.
Returns:
str: The proto code for all the sche... | protogenerator/core/schema_generator.py | __class_to_proto | googleinterns/schemaorg-generator | 0 | python | def __class_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call ClassDescriptor.to_proto() and get proto code for every schema\n class.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... | def __class_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call ClassDescriptor.to_proto() and get proto code for every schema\n class.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... |
e056102112887965979bbf0d02cb7e5686d5b9d8894cc812c673193d131f67b0 | def __prop_to_proto(self, prop_to_class: Dict[(str, Set[str])], class_list: Set[str]):
'Call PropertyDescriptor.to_proto() and get proto code for every\n schema property.\n\n Args:\n prop_to_class (dict(set)): Dictionary containing range of\n class/data... | Call PropertyDescriptor.to_proto() and get proto code for every
schema property.
Args:
prop_to_class (dict(set)): Dictionary containing range of
class/datatypes for every property.
class_list (set): Set of defined classes.
Returns:
str: The proto code for all the schema prop... | protogenerator/core/schema_generator.py | __prop_to_proto | googleinterns/schemaorg-generator | 0 | python | def __prop_to_proto(self, prop_to_class: Dict[(str, Set[str])], class_list: Set[str]):
'Call PropertyDescriptor.to_proto() and get proto code for every\n schema property.\n\n Args:\n prop_to_class (dict(set)): Dictionary containing range of\n class/data... | def __prop_to_proto(self, prop_to_class: Dict[(str, Set[str])], class_list: Set[str]):
'Call PropertyDescriptor.to_proto() and get proto code for every\n schema property.\n\n Args:\n prop_to_class (dict(set)): Dictionary containing range of\n class/data... |
4729afdcd019575ffed34d01f45a2511e7c8efd183f821e0e49482cd401d7dfe | def __enum_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call EnumDescriptor.to_proto() and get proto code for every schema\n enumeration.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... | Call EnumDescriptor.to_proto() and get proto code for every schema
enumeration.
Args:
class_to_prop (dict(set): Dictionary containing set of properties
for every class.
enumerations (set): Set containing the enumerations in the schema.
Returns:
str: The proto code for all the... | protogenerator/core/schema_generator.py | __enum_to_proto | googleinterns/schemaorg-generator | 0 | python | def __enum_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call EnumDescriptor.to_proto() and get proto code for every schema\n enumeration.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... | def __enum_to_proto(self, class_to_prop: Dict[(str, Set[PropertyToParent])], enumerations: Set[str]):
'Call EnumDescriptor.to_proto() and get proto code for every schema\n enumeration.\n\n Args:\n class_to_prop (dict(set): Dictionary containing set of properties\n ... |
633744b7046573bea7ecef9cdbe4d78a43659add95588ebb9e27894dbb589ad5 | def __get_values(self) -> Tuple[(Dict[(str, Set[PropertyToParent])], Dict[(str, Set[str])], Set[str])]:
'Call utils.toplogical_sort(), compress the inheritance heirarchy and\n return mappings between schema classes, schema properties and schema\n enumerations.\n\n Returns:\n dict[str... | Call utils.toplogical_sort(), compress the inheritance heirarchy and
return mappings between schema classes, schema properties and schema
enumerations.
Returns:
dict[str, set[PropertyToParent]]: Dictionary containing set of
properties for every class.
dict[str, set[str]]: ... | protogenerator/core/schema_generator.py | __get_values | googleinterns/schemaorg-generator | 0 | python | def __get_values(self) -> Tuple[(Dict[(str, Set[PropertyToParent])], Dict[(str, Set[str])], Set[str])]:
'Call utils.toplogical_sort(), compress the inheritance heirarchy and\n return mappings between schema classes, schema properties and schema\n enumerations.\n\n Returns:\n dict[str... | def __get_values(self) -> Tuple[(Dict[(str, Set[PropertyToParent])], Dict[(str, Set[str])], Set[str])]:
'Call utils.toplogical_sort(), compress the inheritance heirarchy and\n return mappings between schema classes, schema properties and schema\n enumerations.\n\n Returns:\n dict[str... |
d6bca56b3028dc1cf6de95125114f6dfb64f23025c310d7c14f606acd821d6a7 | def __get_header(self, package_name: str) -> str:
'Return the header for proto code file.\n\n Args:\n package_name (str): Package name for the proto code.\n\n Returns:\n str: The proto code of header as a string.\n '
file_loader = FileSystemLoader('./core/templates')
... | Return the header for proto code file.
Args:
package_name (str): Package name for the proto code.
Returns:
str: The proto code of header as a string. | protogenerator/core/schema_generator.py | __get_header | googleinterns/schemaorg-generator | 0 | python | def __get_header(self, package_name: str) -> str:
'Return the header for proto code file.\n\n Args:\n package_name (str): Package name for the proto code.\n\n Returns:\n str: The proto code of header as a string.\n '
file_loader = FileSystemLoader('./core/templates')
... | def __get_header(self, package_name: str) -> str:
'Return the header for proto code file.\n\n Args:\n package_name (str): Package name for the proto code.\n\n Returns:\n str: The proto code of header as a string.\n '
file_loader = FileSystemLoader('./core/templates')
... |
02890b76cd43741d5fe4210bffb12fec81e6e3473b23c1a5d2560b440e607a2c | def __get_options(self) -> str:
'Return the options for JSONLD serializer.\n\n Returns:\n str: The proto code of options for JSONLD serializer as a string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_loader)
proto_options = env.get_templa... | Return the options for JSONLD serializer.
Returns:
str: The proto code of options for JSONLD serializer as a string. | protogenerator/core/schema_generator.py | __get_options | googleinterns/schemaorg-generator | 0 | python | def __get_options(self) -> str:
'Return the options for JSONLD serializer.\n\n Returns:\n str: The proto code of options for JSONLD serializer as a string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_loader)
proto_options = env.get_templa... | def __get_options(self) -> str:
'Return the options for JSONLD serializer.\n\n Returns:\n str: The proto code of options for JSONLD serializer as a string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_loader)
proto_options = env.get_templa... |
79d7b96f591a0316c3669d1e4d16ef7f63a7caa946accf9ce71777393896c111 | def __get_datatypes(self) -> str:
'Return the datatypes in accordance with schemaorg.\n\n Returns:\n str: The proto code of datatypes in accordance with schemaorg as a\n string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_load... | Return the datatypes in accordance with schemaorg.
Returns:
str: The proto code of datatypes in accordance with schemaorg as a
string. | protogenerator/core/schema_generator.py | __get_datatypes | googleinterns/schemaorg-generator | 0 | python | def __get_datatypes(self) -> str:
'Return the datatypes in accordance with schemaorg.\n\n Returns:\n str: The proto code of datatypes in accordance with schemaorg as a\n string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_load... | def __get_datatypes(self) -> str:
'Return the datatypes in accordance with schemaorg.\n\n Returns:\n str: The proto code of datatypes in accordance with schemaorg as a\n string.\n '
file_loader = FileSystemLoader('./core/templates')
env = Environment(loader=file_load... |
9c4e8be95e3ffe05c05bee832ed66b91c0a6912e0f5a91ce845f669d5d97b510 | def __get_json_descriptor(self, class_to_prop: Dict[(str, Set[PropertyToParent])], prop_to_class: Dict[(str, Set[str])], enumerations: Set[str]) -> Dict:
'Return a json descriptor for the given schema.\n\n Args:\n dict[str, set[PropertyToParent]]: Dictionary containing set of\n ... | Return a json descriptor for the given schema.
Args:
dict[str, set[PropertyToParent]]: Dictionary containing set of
properties for every class.
dict[str, set[str]]: Dictionary containing range of class/datatypes
for every property.
set[str]: Se... | protogenerator/core/schema_generator.py | __get_json_descriptor | googleinterns/schemaorg-generator | 0 | python | def __get_json_descriptor(self, class_to_prop: Dict[(str, Set[PropertyToParent])], prop_to_class: Dict[(str, Set[str])], enumerations: Set[str]) -> Dict:
'Return a json descriptor for the given schema.\n\n Args:\n dict[str, set[PropertyToParent]]: Dictionary containing set of\n ... | def __get_json_descriptor(self, class_to_prop: Dict[(str, Set[PropertyToParent])], prop_to_class: Dict[(str, Set[str])], enumerations: Set[str]) -> Dict:
'Return a json descriptor for the given schema.\n\n Args:\n dict[str, set[PropertyToParent]]: Dictionary containing set of\n ... |
ba98f31ce759246d4f4d895a04f1b6e6870de4e065b0597ea7ec85f9023214e8 | def create(node):
'Create an instance of the appropriate DriverFields class.\n\n :param node: a node object returned from ironicclient\n :returns: GenericDriverFields or a subclass thereof, as appropriate\n for the supplied node.\n '
if ('pxe' in node.driver):
return PXEDriverField... | Create an instance of the appropriate DriverFields class.
:param node: a node object returned from ironicclient
:returns: GenericDriverFields or a subclass thereof, as appropriate
for the supplied node. | nova/virt/ironic/patcher.py | create | Metaswitch/calico-nova | 7 | python | def create(node):
'Create an instance of the appropriate DriverFields class.\n\n :param node: a node object returned from ironicclient\n :returns: GenericDriverFields or a subclass thereof, as appropriate\n for the supplied node.\n '
if ('pxe' in node.driver):
return PXEDriverField... | def create(node):
'Create an instance of the appropriate DriverFields class.\n\n :param node: a node object returned from ironicclient\n :returns: GenericDriverFields or a subclass thereof, as appropriate\n for the supplied node.\n '
if ('pxe' in node.driver):
return PXEDriverField... |
c94036e1e653b0fd5d3d6fff595d8bdeb8f386427594d2837ef611647caaaadc | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n :param instance: the instance object.\n :param image_meta: the metadata associated with the instance\n image.\n :param fla... | Build a patch to add the required fields to deploy a node.
:param instance: the instance object.
:param image_meta: the metadata associated with the instance
image.
:param flavor: the flavor object.
:param preserve_ephemeral: preserve_ephemeral status (bool) to be
specifie... | nova/virt/ironic/patcher.py | get_deploy_patch | Metaswitch/calico-nova | 7 | python | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n :param instance: the instance object.\n :param image_meta: the metadata associated with the instance\n image.\n :param fla... | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n :param instance: the instance object.\n :param image_meta: the metadata associated with the instance\n image.\n :param fla... |
b453b0de24f68073e03e44d745fe44953779a5fd8ea7ee316005acbf26033166 | def get_cleanup_patch(self, instance, network_info, flavor):
'Build a patch to clean up the fields.\n\n :param instance: the instance object.\n :param network_info: the instance network information.\n :param flavor: the flavor object.\n :returns: a json-patch with the fields that needs t... | Build a patch to clean up the fields.
:param instance: the instance object.
:param network_info: the instance network information.
:param flavor: the flavor object.
:returns: a json-patch with the fields that needs to be updated. | nova/virt/ironic/patcher.py | get_cleanup_patch | Metaswitch/calico-nova | 7 | python | def get_cleanup_patch(self, instance, network_info, flavor):
'Build a patch to clean up the fields.\n\n :param instance: the instance object.\n :param network_info: the instance network information.\n :param flavor: the flavor object.\n :returns: a json-patch with the fields that needs t... | def get_cleanup_patch(self, instance, network_info, flavor):
'Build a patch to clean up the fields.\n\n :param instance: the instance object.\n :param network_info: the instance network information.\n :param flavor: the flavor object.\n :returns: a json-patch with the fields that needs t... |
e755cc6171efc10dd3e66ada7bad67137ae27df7d91af22f9c91496556faf52e | def _get_kernel_ramdisk_dict(self, flavor):
'Get the deploy ramdisk and kernel IDs from the flavor.\n\n :param flavor: the flavor object.\n :returns: a dict with the pxe options for the deploy ramdisk and\n kernel if the IDs were found in the flavor, otherwise an empty\n dict is ... | Get the deploy ramdisk and kernel IDs from the flavor.
:param flavor: the flavor object.
:returns: a dict with the pxe options for the deploy ramdisk and
kernel if the IDs were found in the flavor, otherwise an empty
dict is returned. | nova/virt/ironic/patcher.py | _get_kernel_ramdisk_dict | Metaswitch/calico-nova | 7 | python | def _get_kernel_ramdisk_dict(self, flavor):
'Get the deploy ramdisk and kernel IDs from the flavor.\n\n :param flavor: the flavor object.\n :returns: a dict with the pxe options for the deploy ramdisk and\n kernel if the IDs were found in the flavor, otherwise an empty\n dict is ... | def _get_kernel_ramdisk_dict(self, flavor):
'Get the deploy ramdisk and kernel IDs from the flavor.\n\n :param flavor: the flavor object.\n :returns: a dict with the pxe options for the deploy ramdisk and\n kernel if the IDs were found in the flavor, otherwise an empty\n dict is ... |
cb9c73af466208f98708d8ab16ad9b06b98261ce40da1981808db5366be4f4fe | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n Build a json-patch to add the required fields to deploy a node\n using the PXE driver.\n\n :param instance: the instance object.\n :param ima... | Build a patch to add the required fields to deploy a node.
Build a json-patch to add the required fields to deploy a node
using the PXE driver.
:param instance: the instance object.
:param image_meta: the metadata associated with the instance
image.
:param flavor: the flavor object.
:param preserve... | nova/virt/ironic/patcher.py | get_deploy_patch | Metaswitch/calico-nova | 7 | python | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n Build a json-patch to add the required fields to deploy a node\n using the PXE driver.\n\n :param instance: the instance object.\n :param ima... | def get_deploy_patch(self, instance, image_meta, flavor, preserve_ephemeral=None):
'Build a patch to add the required fields to deploy a node.\n\n Build a json-patch to add the required fields to deploy a node\n using the PXE driver.\n\n :param instance: the instance object.\n :param ima... |
cacf25792a0d132ad11ff6bdd3fe9b795f160dcff7ac89e3c4684386fc2b16ef | def get_cleanup_patch(self, instance, network_info, flavor):
"Build a patch to clean up the fields.\n\n Build a json-patch to remove the fields used to deploy a node\n using the PXE driver. Note that the fields added to the Node's\n instance_info don't need to be removed because they are purged... | Build a patch to clean up the fields.
Build a json-patch to remove the fields used to deploy a node
using the PXE driver. Note that the fields added to the Node's
instance_info don't need to be removed because they are purged
during the Node's tear down.
:param instance: the instance object.
:param network_info: the ... | nova/virt/ironic/patcher.py | get_cleanup_patch | Metaswitch/calico-nova | 7 | python | def get_cleanup_patch(self, instance, network_info, flavor):
"Build a patch to clean up the fields.\n\n Build a json-patch to remove the fields used to deploy a node\n using the PXE driver. Note that the fields added to the Node's\n instance_info don't need to be removed because they are purged... | def get_cleanup_patch(self, instance, network_info, flavor):
"Build a patch to clean up the fields.\n\n Build a json-patch to remove the fields used to deploy a node\n using the PXE driver. Note that the fields added to the Node's\n instance_info don't need to be removed because they are purged... |
38f2049c1ed06db9e1538adbe96ca2118567fce29d4e27c9625e511609267069 | def evaluate(self, state):
'Evaluate the fitness of a state vector.\n\n Parameters\n ----------\n state: array\n State array for evaluation.\n\n Returns\n -------\n fitness: float\n Value of fitness function.\n '
fitness = self.fitness_fn(st... | Evaluate the fitness of a state vector.
Parameters
----------
state: array
State array for evaluation.
Returns
-------
fitness: float
Value of fitness function. | mlrose_hiive/fitness/custom_fitness.py | evaluate | Inquisitive-ME/mlrose | 63 | python | def evaluate(self, state):
'Evaluate the fitness of a state vector.\n\n Parameters\n ----------\n state: array\n State array for evaluation.\n\n Returns\n -------\n fitness: float\n Value of fitness function.\n '
fitness = self.fitness_fn(st... | def evaluate(self, state):
'Evaluate the fitness of a state vector.\n\n Parameters\n ----------\n state: array\n State array for evaluation.\n\n Returns\n -------\n fitness: float\n Value of fitness function.\n '
fitness = self.fitness_fn(st... |
b358c98222c33f66fb5b47a2466431faaf2fb426e41176a76ba09724f73565ae | def get_prob_type(self):
" Return the problem type.\n\n Returns\n -------\n self.prob_type: string\n Specifies problem type as 'discrete', 'continuous', 'tsp'\n or 'either'.\n "
return self.problem_type | Return the problem type.
Returns
-------
self.prob_type: string
Specifies problem type as 'discrete', 'continuous', 'tsp'
or 'either'. | mlrose_hiive/fitness/custom_fitness.py | get_prob_type | Inquisitive-ME/mlrose | 63 | python | def get_prob_type(self):
" Return the problem type.\n\n Returns\n -------\n self.prob_type: string\n Specifies problem type as 'discrete', 'continuous', 'tsp'\n or 'either'.\n "
return self.problem_type | def get_prob_type(self):
" Return the problem type.\n\n Returns\n -------\n self.prob_type: string\n Specifies problem type as 'discrete', 'continuous', 'tsp'\n or 'either'.\n "
return self.problem_type<|docstring|>Return the problem type.
Returns
-------
self.... |
c70dafa0e7fb1e660a286253e12043d8b37c79babaa43bd2aad09d9959de24c2 | def learn(self, experiences, gamma):
"Update value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Variable]): tuple of (s, a, r, s', done) tuples\n gamma (float): discount factor\n "
self.optimizer.zero_grad()
(sta... | Update value parameters using given batch of experience tuples.
Params
======
experiences (Tuple[torch.Variable]): tuple of (s, a, r, s', done) tuples
gamma (float): discount factor | agents/double_dqn_agent.py | learn | itraveribon/banana_dqn_udacity | 0 | python | def learn(self, experiences, gamma):
"Update value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Variable]): tuple of (s, a, r, s', done) tuples\n gamma (float): discount factor\n "
self.optimizer.zero_grad()
(sta... | def learn(self, experiences, gamma):
"Update value parameters using given batch of experience tuples.\n\n Params\n ======\n experiences (Tuple[torch.Variable]): tuple of (s, a, r, s', done) tuples\n gamma (float): discount factor\n "
self.optimizer.zero_grad()
(sta... |
fd152d0aa17cf22d2257ab3c4cb1b46af1475be9d4028f9a7c64c0fc9526e740 | def create_reverse_many_to_one_manager(superclass, rel):
'\n Create a manager for the reverse side of a many-to-one relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-one relations.\n '
class RelatedMan... | Create a manager for the reverse side of a many-to-one relation.
This manager subclasses another manager, generally the default manager of
the related model, and adds behaviors specific to many-to-one relations. | django/db/models/fields/related_descriptors.py | create_reverse_many_to_one_manager | cangSDARM/django | 61,676 | python | def create_reverse_many_to_one_manager(superclass, rel):
'\n Create a manager for the reverse side of a many-to-one relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-one relations.\n '
class RelatedMan... | def create_reverse_many_to_one_manager(superclass, rel):
'\n Create a manager for the reverse side of a many-to-one relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-one relations.\n '
class RelatedMan... |
326247d1d2c37ac814f379d4ade21909a171346d0a293b11731c747b4f8547d7 | def create_forward_many_to_many_manager(superclass, rel, reverse):
'\n Create a manager for the either side of a many-to-many relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-many relations.\n '
class... | Create a manager for the either side of a many-to-many relation.
This manager subclasses another manager, generally the default manager of
the related model, and adds behaviors specific to many-to-many relations. | django/db/models/fields/related_descriptors.py | create_forward_many_to_many_manager | cangSDARM/django | 61,676 | python | def create_forward_many_to_many_manager(superclass, rel, reverse):
'\n Create a manager for the either side of a many-to-many relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-many relations.\n '
class... | def create_forward_many_to_many_manager(superclass, rel, reverse):
'\n Create a manager for the either side of a many-to-many relation.\n\n This manager subclasses another manager, generally the default manager of\n the related model, and adds behaviors specific to many-to-many relations.\n '
class... |
d136ef9c88edcd82efd4cfb45788c6ff0fe555965affd1020f4a28726d7b864c | def __get__(self, instance, cls=None):
"\n Get the related instance through the forward relation.\n\n With the example above, when getting ``child.parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``cls`` is... | Get the related instance through the forward relation.
With the example above, when getting ``child.parent``:
- ``self`` is the descriptor managing the ``parent`` attribute
- ``instance`` is the ``child`` instance
- ``cls`` is the ``Child`` class (we don't need it) | django/db/models/fields/related_descriptors.py | __get__ | cangSDARM/django | 61,676 | python | def __get__(self, instance, cls=None):
"\n Get the related instance through the forward relation.\n\n With the example above, when getting ``child.parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``cls`` is... | def __get__(self, instance, cls=None):
"\n Get the related instance through the forward relation.\n\n With the example above, when getting ``child.parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``cls`` is... |
2928fbb49c164fa2c7ab66f992cf435e4b7232fb741ae09857d6764079b86b4b | def __set__(self, instance, value):
'\n Set the related instance through the forward relation.\n\n With the example above, when setting ``child.parent = parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``va... | Set the related instance through the forward relation.
With the example above, when setting ``child.parent = parent``:
- ``self`` is the descriptor managing the ``parent`` attribute
- ``instance`` is the ``child`` instance
- ``value`` is the ``parent`` instance on the right of the equal sign | django/db/models/fields/related_descriptors.py | __set__ | cangSDARM/django | 61,676 | python | def __set__(self, instance, value):
'\n Set the related instance through the forward relation.\n\n With the example above, when setting ``child.parent = parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``va... | def __set__(self, instance, value):
'\n Set the related instance through the forward relation.\n\n With the example above, when setting ``child.parent = parent``:\n\n - ``self`` is the descriptor managing the ``parent`` attribute\n - ``instance`` is the ``child`` instance\n - ``va... |
8edd1cca65d873d65c417a438245c0c81a591c57ae1dba30e9541e0f8b8ba528 | def __reduce__(self):
'\n Pickling should return the instance attached by self.field on the\n model, not a new copy of that descriptor. Use getattr() to retrieve\n the instance directly from the model.\n '
return (getattr, (self.field.model, self.field.name)) | Pickling should return the instance attached by self.field on the
model, not a new copy of that descriptor. Use getattr() to retrieve
the instance directly from the model. | django/db/models/fields/related_descriptors.py | __reduce__ | cangSDARM/django | 61,676 | python | def __reduce__(self):
'\n Pickling should return the instance attached by self.field on the\n model, not a new copy of that descriptor. Use getattr() to retrieve\n the instance directly from the model.\n '
return (getattr, (self.field.model, self.field.name)) | def __reduce__(self):
'\n Pickling should return the instance attached by self.field on the\n model, not a new copy of that descriptor. Use getattr() to retrieve\n the instance directly from the model.\n '
return (getattr, (self.field.model, self.field.name))<|docstring|>Pickling sho... |
80cdb0ce0d0ba93a1ecdd13352f2c0ee0451e0942e32073a386261c3faf470dc | def __get__(self, instance, cls=None):
'\n Get the related instance through the reverse relation.\n\n With the example above, when getting ``place.restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n - ``... | Get the related instance through the reverse relation.
With the example above, when getting ``place.restaurant``:
- ``self`` is the descriptor managing the ``restaurant`` attribute
- ``instance`` is the ``place`` instance
- ``cls`` is the ``Place`` class (unused)
Keep in mind that ``Restaurant`` holds the foreign ke... | django/db/models/fields/related_descriptors.py | __get__ | cangSDARM/django | 61,676 | python | def __get__(self, instance, cls=None):
'\n Get the related instance through the reverse relation.\n\n With the example above, when getting ``place.restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n - ``... | def __get__(self, instance, cls=None):
'\n Get the related instance through the reverse relation.\n\n With the example above, when getting ``place.restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n - ``... |
c1f895473fdbcffa9438437de8f9af0f0f371ded8c6e5944c1b3fc041f1aebd9 | def __set__(self, instance, value):
'\n Set the related instance through the reverse relation.\n\n With the example above, when setting ``place.restaurant = restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n ... | Set the related instance through the reverse relation.
With the example above, when setting ``place.restaurant = restaurant``:
- ``self`` is the descriptor managing the ``restaurant`` attribute
- ``instance`` is the ``place`` instance
- ``value`` is the ``restaurant`` instance on the right of the equal sign
Keep in ... | django/db/models/fields/related_descriptors.py | __set__ | cangSDARM/django | 61,676 | python | def __set__(self, instance, value):
'\n Set the related instance through the reverse relation.\n\n With the example above, when setting ``place.restaurant = restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n ... | def __set__(self, instance, value):
'\n Set the related instance through the reverse relation.\n\n With the example above, when setting ``place.restaurant = restaurant``:\n\n - ``self`` is the descriptor managing the ``restaurant`` attribute\n - ``instance`` is the ``place`` instance\n ... |
827222b5ba39c92fc6367abb0da37a6678b82de1d54f9743a8d4fd70758fe196 | def __get__(self, instance, cls=None):
'\n Get the related objects through the reverse relation.\n\n With the example above, when getting ``parent.children``:\n\n - ``self`` is the descriptor managing the ``children`` attribute\n - ``instance`` is the ``parent`` instance\n - ``cls... | Get the related objects through the reverse relation.
With the example above, when getting ``parent.children``:
- ``self`` is the descriptor managing the ``children`` attribute
- ``instance`` is the ``parent`` instance
- ``cls`` is the ``Parent`` class (unused) | django/db/models/fields/related_descriptors.py | __get__ | cangSDARM/django | 61,676 | python | def __get__(self, instance, cls=None):
'\n Get the related objects through the reverse relation.\n\n With the example above, when getting ``parent.children``:\n\n - ``self`` is the descriptor managing the ``children`` attribute\n - ``instance`` is the ``parent`` instance\n - ``cls... | def __get__(self, instance, cls=None):
'\n Get the related objects through the reverse relation.\n\n With the example above, when getting ``parent.children``:\n\n - ``self`` is the descriptor managing the ``children`` attribute\n - ``instance`` is the ``parent`` instance\n - ``cls... |
690164ed1c57b5b8fe67c4d9f13bafb1f1388b255017a8bb3abada40a0c9800d | def _apply_rel_filters(self, queryset):
'\n Filter the queryset for the instance this manager is bound to.\n '
db = (self._db or router.db_for_read(self.model, instance=self.instance))
empty_strings_as_null = connections[db].features.interprets_empty_strings_as_nulls
queryset._add_... | Filter the queryset for the instance this manager is bound to. | django/db/models/fields/related_descriptors.py | _apply_rel_filters | cangSDARM/django | 61,676 | python | def _apply_rel_filters(self, queryset):
'\n \n '
db = (self._db or router.db_for_read(self.model, instance=self.instance))
empty_strings_as_null = connections[db].features.interprets_empty_strings_as_nulls
queryset._add_hints(instance=self.instance)
if self._db:
queryse... | def _apply_rel_filters(self, queryset):
'\n \n '
db = (self._db or router.db_for_read(self.model, instance=self.instance))
empty_strings_as_null = connections[db].features.interprets_empty_strings_as_nulls
queryset._add_hints(instance=self.instance)
if self._db:
queryse... |
28ae2cf22d0b7257827e4d7b989185edacf613269336db9f1d9a80c802eca8fd | def _apply_rel_filters(self, queryset):
'\n Filter the queryset for the instance this manager is bound to.\n '
queryset._add_hints(instance=self.instance)
if self._db:
queryset = queryset.using(self._db)
queryset._defer_next_filter = True
return queryset._next_is_sticky... | Filter the queryset for the instance this manager is bound to. | django/db/models/fields/related_descriptors.py | _apply_rel_filters | cangSDARM/django | 61,676 | python | def _apply_rel_filters(self, queryset):
'\n \n '
queryset._add_hints(instance=self.instance)
if self._db:
queryset = queryset.using(self._db)
queryset._defer_next_filter = True
return queryset._next_is_sticky().filter(**self.core_filters) | def _apply_rel_filters(self, queryset):
'\n \n '
queryset._add_hints(instance=self.instance)
if self._db:
queryset = queryset.using(self._db)
queryset._defer_next_filter = True
return queryset._next_is_sticky().filter(**self.core_filters)<|docstring|>Filter the queryset... |
1f23aed951f377dab52d37065255f074cc7f2023a1058771d46b929e799e8f9f | def _get_target_ids(self, target_field_name, objs):
'\n Return the set of ids of `objs` that the target field references.\n '
from django.db.models import Model
target_ids = set()
target_field = self.through._meta.get_field(target_field_name)
for obj in objs:
if isinsta... | Return the set of ids of `objs` that the target field references. | django/db/models/fields/related_descriptors.py | _get_target_ids | cangSDARM/django | 61,676 | python | def _get_target_ids(self, target_field_name, objs):
'\n \n '
from django.db.models import Model
target_ids = set()
target_field = self.through._meta.get_field(target_field_name)
for obj in objs:
if isinstance(obj, self.model):
if (not router.allow_relation(o... | def _get_target_ids(self, target_field_name, objs):
'\n \n '
from django.db.models import Model
target_ids = set()
target_field = self.through._meta.get_field(target_field_name)
for obj in objs:
if isinstance(obj, self.model):
if (not router.allow_relation(o... |
79c27c3e7e771cafaddf01336bf6c38a3ce3b3ac81d13ebdd964655850c68cde | def _get_missing_target_ids(self, source_field_name, target_field_name, db, target_ids):
"\n Return the subset of ids of `objs` that aren't already assigned to\n this relationship.\n "
vals = self.through._default_manager.using(db).values_list(target_field_name, flat=True).filte... | Return the subset of ids of `objs` that aren't already assigned to
this relationship. | django/db/models/fields/related_descriptors.py | _get_missing_target_ids | cangSDARM/django | 61,676 | python | def _get_missing_target_ids(self, source_field_name, target_field_name, db, target_ids):
"\n Return the subset of ids of `objs` that aren't already assigned to\n this relationship.\n "
vals = self.through._default_manager.using(db).values_list(target_field_name, flat=True).filte... | def _get_missing_target_ids(self, source_field_name, target_field_name, db, target_ids):
"\n Return the subset of ids of `objs` that aren't already assigned to\n this relationship.\n "
vals = self.through._default_manager.using(db).values_list(target_field_name, flat=True).filte... |
00b269b5e10d6b7f8c54852c231b6c7ec0734410160963c482373f20dc09f277 | def _get_add_plan(self, db, source_field_name):
'\n Return a boolean triple of the way the add should be performed.\n\n The first element is whether or not bulk_create(ignore_conflicts)\n can be used, the second whether or not signals must be sent, and\n the third element... | Return a boolean triple of the way the add should be performed.
The first element is whether or not bulk_create(ignore_conflicts)
can be used, the second whether or not signals must be sent, and
the third element is whether or not the immediate bulk insertion
with conflicts ignored can be performed. | django/db/models/fields/related_descriptors.py | _get_add_plan | cangSDARM/django | 61,676 | python | def _get_add_plan(self, db, source_field_name):
'\n Return a boolean triple of the way the add should be performed.\n\n The first element is whether or not bulk_create(ignore_conflicts)\n can be used, the second whether or not signals must be sent, and\n the third element... | def _get_add_plan(self, db, source_field_name):
'\n Return a boolean triple of the way the add should be performed.\n\n The first element is whether or not bulk_create(ignore_conflicts)\n can be used, the second whether or not signals must be sent, and\n the third element... |
b7e5fb957d3eb0589aabeb73c9465b3fdf3ca99f8c63b2997fe6ee6d021076da | @staticmethod
def dispatch(f: Callable) -> Callable:
'\n This method allows the use of singledispatch on methods, \n a feature that will be implemented in functools in Python 3.8.x+ in the future.\n\n :param f: The decorated method.\n :type f: Callable\n\n :returns: Decorator meth... | This method allows the use of singledispatch on methods,
a feature that will be implemented in functools in Python 3.8.x+ in the future.
:param f: The decorated method.
:type f: Callable
:returns: Decorator method which takes the type of the second parameter instead of the first,
as the first is self in a... | TheNounProjectAPI/call.py | dispatch | CubieDev/TheNounProjectAPI | 8 | python | @staticmethod
def dispatch(f: Callable) -> Callable:
'\n This method allows the use of singledispatch on methods, \n a feature that will be implemented in functools in Python 3.8.x+ in the future.\n\n :param f: The decorated method.\n :type f: Callable\n\n :returns: Decorator meth... | @staticmethod
def dispatch(f: Callable) -> Callable:
'\n This method allows the use of singledispatch on methods, \n a feature that will be implemented in functools in Python 3.8.x+ in the future.\n\n :param f: The decorated method.\n :type f: Callable\n\n :returns: Decorator meth... |
e132044d7e8f31e749ce83d1691db0652363c2dcd301b05e33af8682e9fded3f | @staticmethod
def _get_endpoint(model_class: Union[(Type[Model], Type[ModelList])], method: str) -> Callable:
'\n Returns wrapper which receives a requests.PreparedRequests, \n sends this request, checks for exceptions, and returns the json parsed through the correct model.\n\n :param model_cla... | Returns wrapper which receives a requests.PreparedRequests,
sends this request, checks for exceptions, and returns the json parsed through the correct model.
:param model_class: The class of the model to use for the output data.
:type model_class: Union[Type[Model], Type[ModelList]]
:param method: String form of whic... | TheNounProjectAPI/call.py | _get_endpoint | CubieDev/TheNounProjectAPI | 8 | python | @staticmethod
def _get_endpoint(model_class: Union[(Type[Model], Type[ModelList])], method: str) -> Callable:
'\n Returns wrapper which receives a requests.PreparedRequests, \n sends this request, checks for exceptions, and returns the json parsed through the correct model.\n\n :param model_cla... | @staticmethod
def _get_endpoint(model_class: Union[(Type[Model], Type[ModelList])], method: str) -> Callable:
'\n Returns wrapper which receives a requests.PreparedRequests, \n sends this request, checks for exceptions, and returns the json parsed through the correct model.\n\n :param model_cla... |
af029fbddc7428c9b180565c4988d7e9076dea70e8e8209f3eb4f8c749900233 | def error(bot, update, error):
'Log Errors caused by Updates.'
logger.warning('Update "%s" caused error "%s"', update, error) | Log Errors caused by Updates. | src/bot.py | error | ViniciusBernardo/exercicio-estagio | 0 | python | def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"', update, error) | def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"', update, error)<|docstring|>Log Errors caused by Updates.<|endoftext|> |
68d09f0aadf248f34b51823deffe7b9277b0f1e66194d06c02a84601f953ac7a | def testExpandUsersHomeDirectoryPathSegments(self):
'Tests the _ExpandUsersHomeDirectoryPathSegments function.'
user_account_artifact1 = artifacts.UserAccountArtifact(user_directory='/home/Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(user_directory='/Users/Test2', usernam... | Tests the _ExpandUsersHomeDirectoryPathSegments function. | tests/engine/path_helper.py | testExpandUsersHomeDirectoryPathSegments | roshanmaskey/plaso | 1,253 | python | def testExpandUsersHomeDirectoryPathSegments(self):
user_account_artifact1 = artifacts.UserAccountArtifact(user_directory='/home/Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(user_directory='/Users/Test2', username='Test2')
user_account_artifact3 = artifacts.UserAccou... | def testExpandUsersHomeDirectoryPathSegments(self):
user_account_artifact1 = artifacts.UserAccountArtifact(user_directory='/home/Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(user_directory='/Users/Test2', username='Test2')
user_account_artifact3 = artifacts.UserAccou... |
daf0f897cd79ea5007b5f2628c6f16c18d6a3f9140bb0e6325046f78565e146a | def testExpandUsersVariablePathSegments(self):
'Tests the _ExpandUsersVariablePathSegments function.'
user_account_artifact1 = artifacts.UserAccountArtifact(identifier='1000', path_separator='\\', user_directory='C:\\Users\\Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(ide... | Tests the _ExpandUsersVariablePathSegments function. | tests/engine/path_helper.py | testExpandUsersVariablePathSegments | roshanmaskey/plaso | 1,253 | python | def testExpandUsersVariablePathSegments(self):
user_account_artifact1 = artifacts.UserAccountArtifact(identifier='1000', path_separator='\\', user_directory='C:\\Users\\Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(identifier='1001', path_separator='\\', user_directory='%... | def testExpandUsersVariablePathSegments(self):
user_account_artifact1 = artifacts.UserAccountArtifact(identifier='1000', path_separator='\\', user_directory='C:\\Users\\Test1', username='Test1')
user_account_artifact2 = artifacts.UserAccountArtifact(identifier='1001', path_separator='\\', user_directory='%... |
0f885e5358a2ce6feba199abd96308d5add75912b5f058f5524f5dc33c033dba | def testIsWindowsDrivePathSegment(self):
'Tests the _IsWindowsDrivePathSegment function.'
result = path_helper.PathHelper._IsWindowsDrivePathSegment('C:')
self.assertTrue(result)
result = path_helper.PathHelper._IsWindowsDrivePathSegment('%SystemDrive%')
self.assertTrue(result)
result = path_hel... | Tests the _IsWindowsDrivePathSegment function. | tests/engine/path_helper.py | testIsWindowsDrivePathSegment | roshanmaskey/plaso | 1,253 | python | def testIsWindowsDrivePathSegment(self):
result = path_helper.PathHelper._IsWindowsDrivePathSegment('C:')
self.assertTrue(result)
result = path_helper.PathHelper._IsWindowsDrivePathSegment('%SystemDrive%')
self.assertTrue(result)
result = path_helper.PathHelper._IsWindowsDrivePathSegment('%%env... | def testIsWindowsDrivePathSegment(self):
result = path_helper.PathHelper._IsWindowsDrivePathSegment('C:')
self.assertTrue(result)
result = path_helper.PathHelper._IsWindowsDrivePathSegment('%SystemDrive%')
self.assertTrue(result)
result = path_helper.PathHelper._IsWindowsDrivePathSegment('%%env... |
480946e3f1df20a7620bb903db8d93b996bdf179162c91cd716fd3b8f9246d6b | def testExpandGlobStars(self):
'Tests the ExpandGlobStars function.'
paths = path_helper.PathHelper.ExpandGlobStars('/etc/sysconfig/**', '/')
self.assertEqual(len(paths), 10)
expected_paths = sorted(['/etc/sysconfig/*', '/etc/sysconfig/*/*', '/etc/sysconfig/*/*/*', '/etc/sysconfig/*/*/*/*', '/etc/syscon... | Tests the ExpandGlobStars function. | tests/engine/path_helper.py | testExpandGlobStars | roshanmaskey/plaso | 1,253 | python | def testExpandGlobStars(self):
paths = path_helper.PathHelper.ExpandGlobStars('/etc/sysconfig/**', '/')
self.assertEqual(len(paths), 10)
expected_paths = sorted(['/etc/sysconfig/*', '/etc/sysconfig/*/*', '/etc/sysconfig/*/*/*', '/etc/sysconfig/*/*/*/*', '/etc/sysconfig/*/*/*/*/*', '/etc/sysconfig/*/*/*... | def testExpandGlobStars(self):
paths = path_helper.PathHelper.ExpandGlobStars('/etc/sysconfig/**', '/')
self.assertEqual(len(paths), 10)
expected_paths = sorted(['/etc/sysconfig/*', '/etc/sysconfig/*/*', '/etc/sysconfig/*/*/*', '/etc/sysconfig/*/*/*/*', '/etc/sysconfig/*/*/*/*/*', '/etc/sysconfig/*/*/*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.