blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
d5955aac4c932d0010a56c7633dcc293bd822ba0
[ "request = self.context.get('request', None)\nif request.user.is_anonymous:\n return\n_, created = LikedChefRecipe.objects.get_or_create(recipe=self.instance, user=request.user)\nif not created:\n raise ValidationError('User liked this object')", "request = self.context.get('request', None)\nif request.user...
<|body_start_0|> request = self.context.get('request', None) if request.user.is_anonymous: return _, created = LikedChefRecipe.objects.get_or_create(recipe=self.instance, user=request.user) if not created: raise ValidationError('User liked this object') <|end_body...
Chef seriazlier class
ChefRecipeSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChefRecipeSerializer: """Chef seriazlier class""" def like(self): """Like the post""" <|body_0|> def unlike(self): """Unlike the post""" <|body_1|> <|end_skeleton|> <|body_start_0|> request = self.context.get('request', None) if request....
stack_v2_sparse_classes_36k_train_017500
1,867
no_license
[ { "docstring": "Like the post", "name": "like", "signature": "def like(self)" }, { "docstring": "Unlike the post", "name": "unlike", "signature": "def unlike(self)" } ]
2
null
Implement the Python class `ChefRecipeSerializer` described below. Class description: Chef seriazlier class Method signatures and docstrings: - def like(self): Like the post - def unlike(self): Unlike the post
Implement the Python class `ChefRecipeSerializer` described below. Class description: Chef seriazlier class Method signatures and docstrings: - def like(self): Like the post - def unlike(self): Unlike the post <|skeleton|> class ChefRecipeSerializer: """Chef seriazlier class""" def like(self): """Li...
2f50b3815474845dd8c08f2a6f0213d5da3a5413
<|skeleton|> class ChefRecipeSerializer: """Chef seriazlier class""" def like(self): """Like the post""" <|body_0|> def unlike(self): """Unlike the post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChefRecipeSerializer: """Chef seriazlier class""" def like(self): """Like the post""" request = self.context.get('request', None) if request.user.is_anonymous: return _, created = LikedChefRecipe.objects.get_or_create(recipe=self.instance, user=request.user) ...
the_stack_v2_python_sparse
community/serializers/chef_recipe.py
raviteja2250/tabletop-backend-develop
train
0
ac0a7bcb212ab02d93461d9be4fc5b92dbc16198
[ "invalid_filters = check_filters(self, special_filters=['ids', 'organism__name', 'dataset_id', 'experiment_accession_code', 'accession_codes', 'filter_by'])\nif invalid_filters:\n raise InvalidFilters(invalid_filters=invalid_filters)\nqueryset = Sample.public_objects.select_related('organism').prefetch_related('...
<|body_start_0|> invalid_filters = check_filters(self, special_filters=['ids', 'organism__name', 'dataset_id', 'experiment_accession_code', 'accession_codes', 'filter_by']) if invalid_filters: raise InvalidFilters(invalid_filters=invalid_filters) queryset = Sample.public_objects.sele...
Returns detailed information about Samples
SampleListView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleListView: """Returns detailed information about Samples""" def get_queryset(self): """ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters""" <|body_0|> def get_query_params_filters(self): """We do advanced filte...
stack_v2_sparse_classes_36k_train_017501
9,331
permissive
[ { "docstring": "ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "We do advanced filtering on the queryset depending on the query parameters. This returns the parame...
2
stack_v2_sparse_classes_30k_train_020081
Implement the Python class `SampleListView` described below. Class description: Returns detailed information about Samples Method signatures and docstrings: - def get_queryset(self): ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters - def get_query_params_filters(self):...
Implement the Python class `SampleListView` described below. Class description: Returns detailed information about Samples Method signatures and docstrings: - def get_queryset(self): ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters - def get_query_params_filters(self):...
99d853dd2583e42c76a28d1a59baa2d65d953119
<|skeleton|> class SampleListView: """Returns detailed information about Samples""" def get_queryset(self): """ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters""" <|body_0|> def get_query_params_filters(self): """We do advanced filte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SampleListView: """Returns detailed information about Samples""" def get_queryset(self): """ref https://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters""" invalid_filters = check_filters(self, special_filters=['ids', 'organism__name', 'dataset_id', 'e...
the_stack_v2_python_sparse
api/data_refinery_api/views/sample.py
AlexsLemonade/refinebio
train
117
b5a11abdbed5c40b1a3a49a3d4794ca10c94c4fd
[ "if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path", "assert lreads != rreads\nself.__build_cmd(lreads, rreads, threads, outdir, prefix)\nif dry_run:\n return self._cmd\npipe = subprocess.run(self._cmd, shell=True, stdo...
<|body_start_0|> if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path <|end_body_0|> <|body_start_1|> assert lreads != rreads self.__build_cmd(lreads, rreads, threads, outdir, prefix) ...
Class for working with PEAR
Pear
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): """Run PEAR to merge passed read files - lreads - forward reads -...
stack_v2_sparse_classes_36k_train_017502
3,102
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path)" }, { "docstring": "Run PEAR to merge passed read files - lreads - forward reads - rreads - reverse reads - threads - number of threads for pear to use - outdir - output direc...
3
stack_v2_sparse_classes_30k_train_004462
Implement the Python class `Pear` described below. Class description: Class for working with PEAR Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run PEAR to merge passed read files - lre...
Implement the Python class `Pear` described below. Class description: Class for working with PEAR Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run PEAR to merge passed read files - lre...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): """Run PEAR to merge passed read files - lreads - forward reads -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path def r...
the_stack_v2_python_sparse
metapy/pycits/pear.py
peterthorpe5/public_scripts
train
35
22151e931bb257f03b15915f228ef012e09576e4
[ "self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(X_init, X_init)", "a = np.sum(X1 ** 2, 1).reshape(-1, 1)\nsqdist = a + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T)\nreturn self.sigma_f ** 2 * np.exp(-0.5 / self.l ** 2 * sqdist)" ]
<|body_start_0|> self.X = X_init self.Y = Y_init self.l = l self.sigma_f = sigma_f self.K = self.kernel(X_init, X_init) <|end_body_0|> <|body_start_1|> a = np.sum(X1 ** 2, 1).reshape(-1, 1) sqdist = a + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T) return sel...
Gaussian Class
GaussianProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcess: """Gaussian Class""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init (np.ndarray): shape (t, 1) representing the outputs of th...
stack_v2_sparse_classes_36k_train_017503
1,354
no_license
[ { "docstring": "Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init (np.ndarray): shape (t, 1) representing the outputs of the black-box function for each input in X_init. l (int): the length parameter for the kernel. sigma_f (int...
2
stack_v2_sparse_classes_30k_train_010881
Implement the Python class `GaussianProcess` described below. Class description: Gaussian Class Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init ...
Implement the Python class `GaussianProcess` described below. Class description: Gaussian Class Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init ...
5aff923277cfe9f2b5324a773e4e5c3cac810a0c
<|skeleton|> class GaussianProcess: """Gaussian Class""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init (np.ndarray): shape (t, 1) representing the outputs of th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcess: """Gaussian Class""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Class constructor Args: X_init (np.ndarray): shape (t, 1) representing the inputs already sampled with the black-box function. Y_init (np.ndarray): shape (t, 1) representing the outputs of the black-box f...
the_stack_v2_python_sparse
unsupervised_learning/0x03-hyperparameter_tuning/0-gp.py
cmmolanos1/holbertonschool-machine_learning
train
1
6bc1ad67f8a266b9953a6818c9cb37404874509c
[ "super(Decoder, self).__init__()\nself.code_length = code_length\nself.deepest_shape = deepest_shape\nself.output_shape = output_shape\nactivation_fn = nn.LeakyReLU()\nself.fc = nn.Sequential(nn.Linear(in_features=code_length, out_features=64), nn.BatchNorm1d(num_features=64), activation_fn, nn.Linear(in_features=6...
<|body_start_0|> super(Decoder, self).__init__() self.code_length = code_length self.deepest_shape = deepest_shape self.output_shape = output_shape activation_fn = nn.LeakyReLU() self.fc = nn.Sequential(nn.Linear(in_features=code_length, out_features=64), nn.BatchNorm1d(n...
MNIST model decoder.
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """MNIST model decoder.""" def __init__(self, code_length, deepest_shape, output_shape): """Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the encoder's deepest convolutional map. :param output_shape: ...
stack_v2_sparse_classes_36k_train_017504
3,686
no_license
[ { "docstring": "Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the encoder's deepest convolutional map. :param output_shape: the shape of MNIST samples.", "name": "__init__", "signature": "def __init__(self, code_length, deepest_s...
2
stack_v2_sparse_classes_30k_train_008557
Implement the Python class `Decoder` described below. Class description: MNIST model decoder. Method signatures and docstrings: - def __init__(self, code_length, deepest_shape, output_shape): Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the e...
Implement the Python class `Decoder` described below. Class description: MNIST model decoder. Method signatures and docstrings: - def __init__(self, code_length, deepest_shape, output_shape): Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the e...
9192c0862db430c21762e2c752435e8e153ae3cf
<|skeleton|> class Decoder: """MNIST model decoder.""" def __init__(self, code_length, deepest_shape, output_shape): """Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the encoder's deepest convolutional map. :param output_shape: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """MNIST model decoder.""" def __init__(self, code_length, deepest_shape, output_shape): """Class constructor. :param code_length: the dimensionality of latent vectors. :param deepest_shape: the dimensionality of the encoder's deepest convolutional map. :param output_shape: the shape of ...
the_stack_v2_python_sparse
LDE-video/models/networks/inv_mapping.py
ArmandCom/VariationalKoopman
train
3
875aef1d6a491e0cb4d4095f5b720f8a26070477
[ "super().__init__()\nself._solution_dim = solution_dim\nself._population_size = population_size\nself._upper_bound = upper_bound\nself._lower_bound = lower_bound\nself._cost_func = cost_func\nself._elite_size = elite_size\nself._max_iter_num = max_iter_num\nself._epsilon = epsilon\nself._tau = tau\nself._min_var = ...
<|body_start_0|> super().__init__() self._solution_dim = solution_dim self._population_size = population_size self._upper_bound = upper_bound self._lower_bound = lower_bound self._cost_func = cost_func self._elite_size = elite_size self._max_iter_num = max...
CEMOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CEMOptimizer: def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound, elite_size=50, max_iter_num=5, epsilon=0.01, tau=0.9, min_var=1e-05): """Creates a CEM Optimizer This module optimizes a given cost function via the `Cross-Enrtopy Method <https://en.wiki...
stack_v2_sparse_classes_36k_train_017505
8,541
permissive
[ { "docstring": "Creates a CEM Optimizer This module optimizes a given cost function via the `Cross-Enrtopy Method <https://en.wikipedia.org/wiki/Cross-entropy_method>`_, which iterates between evaluating a population of samples generated from a probability distribution and updating the distribution based on the...
2
null
Implement the Python class `CEMOptimizer` described below. Class description: Implement the CEMOptimizer class. Method signatures and docstrings: - def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound, elite_size=50, max_iter_num=5, epsilon=0.01, tau=0.9, min_var=1e-05): Creates a CEM...
Implement the Python class `CEMOptimizer` described below. Class description: Implement the CEMOptimizer class. Method signatures and docstrings: - def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound, elite_size=50, max_iter_num=5, epsilon=0.01, tau=0.9, min_var=1e-05): Creates a CEM...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class CEMOptimizer: def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound, elite_size=50, max_iter_num=5, epsilon=0.01, tau=0.9, min_var=1e-05): """Creates a CEM Optimizer This module optimizes a given cost function via the `Cross-Enrtopy Method <https://en.wiki...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CEMOptimizer: def __init__(self, solution_dim, population_size, cost_func, upper_bound, lower_bound, elite_size=50, max_iter_num=5, epsilon=0.01, tau=0.9, min_var=1e-05): """Creates a CEM Optimizer This module optimizes a given cost function via the `Cross-Enrtopy Method <https://en.wikipedia.org/wiki...
the_stack_v2_python_sparse
alf/optimizers/traj_optimizers.py
HorizonRobotics/alf
train
288
f72afca769004d0f477b3ecff28d5c5d025e5c63
[ "self._entity_component = self.hass.data[DATA_INSTANCES][self.domain]\nawait super().async_activate()\n\nasync def _async_update_listener(_hass: HomeAssistant, _entry: ConfigEntry) -> None:\n \"\"\"Handle options update.\"\"\"\n await self.inspect_debouncer.async_call()\nasync_dispatcher_connect(self.hass, SI...
<|body_start_0|> self._entity_component = self.hass.data[DATA_INSTANCES][self.domain] await super().async_activate() async def _async_update_listener(_hass: HomeAssistant, _entry: ConfigEntry) -> None: """Handle options update.""" await self.inspect_debouncer.async_call(...
Spook repair tries to find unknown referenced entity in scripts.
SpookRepair
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpookRepair: """Spook repair tries to find unknown referenced entity in scripts.""" async def async_activate(self) -> None: """Handle the activating a repair.""" <|body_0|> async def async_inspect(self) -> None: """Trigger a inspection.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_017506
5,085
permissive
[ { "docstring": "Handle the activating a repair.", "name": "async_activate", "signature": "async def async_activate(self) -> None" }, { "docstring": "Trigger a inspection.", "name": "async_inspect", "signature": "async def async_inspect(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_003065
Implement the Python class `SpookRepair` described below. Class description: Spook repair tries to find unknown referenced entity in scripts. Method signatures and docstrings: - async def async_activate(self) -> None: Handle the activating a repair. - async def async_inspect(self) -> None: Trigger a inspection.
Implement the Python class `SpookRepair` described below. Class description: Spook repair tries to find unknown referenced entity in scripts. Method signatures and docstrings: - async def async_activate(self) -> None: Handle the activating a repair. - async def async_inspect(self) -> None: Trigger a inspection. <|sk...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class SpookRepair: """Spook repair tries to find unknown referenced entity in scripts.""" async def async_activate(self) -> None: """Handle the activating a repair.""" <|body_0|> async def async_inspect(self) -> None: """Trigger a inspection.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpookRepair: """Spook repair tries to find unknown referenced entity in scripts.""" async def async_activate(self) -> None: """Handle the activating a repair.""" self._entity_component = self.hass.data[DATA_INSTANCES][self.domain] await super().async_activate() async def ...
the_stack_v2_python_sparse
custom_components/spook/ectoplasms/script/repairs/unknown_entity_references.py
bacco007/HomeAssistantConfig
train
98
27738b07d8e12b56f02e77f5cce3dbecc70f1751
[ "self.quorum = quorum\nself.quorum_duration = quorum_duration\nself.stale_limit = stale_limit\nself.logger = logging.getLogger('Perspectives.Policy')\nself.logger.debug('Initialized.')", "self.logger.debug('check(%s) called with %s responses' % (fingerprint, len(responses)))\nagree_now = responses.key_agreement_c...
<|body_start_0|> self.quorum = quorum self.quorum_duration = quorum_duration self.stale_limit = stale_limit self.logger = logging.getLogger('Perspectives.Policy') self.logger.debug('Initialized.') <|end_body_0|> <|body_start_1|> self.logger.debug('check(%s) called with %...
Class for representing and implementing a Perspectives policy
Policy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Policy: """Class for representing and implementing a Perspectives policy""" def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600): """Create a policy requiring the given quorum and quorum duration. Quorum == number of notaries that support given key. Quorum duration ==...
stack_v2_sparse_classes_36k_train_017507
2,706
no_license
[ { "docstring": "Create a policy requiring the given quorum and quorum duration. Quorum == number of notaries that support given key. Quorum duration == length of time (sec) that quorum is met.", "name": "__init__", "signature": "def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600)" }, ...
2
stack_v2_sparse_classes_30k_test_000431
Implement the Python class `Policy` described below. Class description: Class for representing and implementing a Perspectives policy Method signatures and docstrings: - def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600): Create a policy requiring the given quorum and quorum duration. Quorum == numb...
Implement the Python class `Policy` described below. Class description: Class for representing and implementing a Perspectives policy Method signatures and docstrings: - def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600): Create a policy requiring the given quorum and quorum duration. Quorum == numb...
92883090bb3e9f8ccdf3e4a39dce47ba3697ed63
<|skeleton|> class Policy: """Class for representing and implementing a Perspectives policy""" def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600): """Create a policy requiring the given quorum and quorum duration. Quorum == number of notaries that support given key. Quorum duration ==...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Policy: """Class for representing and implementing a Perspectives policy""" def __init__(self, quorum, quorum_duration=0, stale_limit=24 * 3600): """Create a policy requiring the given quorum and quorum duration. Quorum == number of notaries that support given key. Quorum duration == length of ti...
the_stack_v2_python_sparse
Perspectives/Policy.py
von/pyPerspectives
train
2
f0913172965055a60aae137c7a7a38428a172554
[ "self.pipe = pipe\nself.cache_file_path = cache_file_path\nself.lang_orig = lang_orig\nself.lang_dest = lang_dest\nif not cache_file_path.exists():\n self.cached_tran = {}\n return\nself.cached_tran = json.loads(cache_file_path.read_text())", "if str_orig not in self.cached_tran:\n if self.pipe is None:\...
<|body_start_0|> self.pipe = pipe self.cache_file_path = cache_file_path self.lang_orig = lang_orig self.lang_dest = lang_dest if not cache_file_path.exists(): self.cached_tran = {} return self.cached_tran = json.loads(cache_file_path.read_text()) ...
A cached translation pipeline.
TranslationPipelineCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" <|body_0|> def __call__(self, str_orig: str): ...
stack_v2_sparse_classes_36k_train_017508
1,437
no_license
[ { "docstring": "Initialize a cached TranslationPipeline.", "name": "__init__", "signature": "def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str)" }, { "docstring": "Call an instance of the class with a string to return the translation.",...
2
stack_v2_sparse_classes_30k_train_011112
Implement the Python class `TranslationPipelineCache` described below. Class description: A cached translation pipeline. Method signatures and docstrings: - def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): Initialize a cached TranslationPipeline. - def __...
Implement the Python class `TranslationPipelineCache` described below. Class description: A cached translation pipeline. Method signatures and docstrings: - def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): Initialize a cached TranslationPipeline. - def __...
1d7e5657014b00612cde87b78d5506a9e8b6adfc
<|skeleton|> class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" <|body_0|> def __call__(self, str_orig: str): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" self.pipe = pipe self.cache_file_path = cache_file_path ...
the_stack_v2_python_sparse
python/streamlit-sample/align-epub/cached_pipe.py
Pitrified/snippet
train
2
61e7b7dc054a879b0886ebc436cc07266c17dd78
[ "z = jnp.exp(-1j * angle) * (x - center_x + (y - center_y) * 1j)\nscale_length = theta_e * jnp.sqrt(axis_ratio)\ncomplex_derivative = EPL._complex_derivative(z.real, z.imag, scale_length, axis_ratio, slope) * jnp.exp(1j * angle)\nreturn (complex_derivative.real, complex_derivative.imag)", "ellip_vector = x * axis...
<|body_start_0|> z = jnp.exp(-1j * angle) * (x - center_x + (y - center_y) * 1j) scale_length = theta_e * jnp.sqrt(axis_ratio) complex_derivative = EPL._complex_derivative(z.real, z.imag, scale_length, axis_ratio, slope) * jnp.exp(1j * angle) return (complex_derivative.real, complex_deri...
Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy.
EPL
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EPL: """Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy.""" def derivatives(x, y, theta_e, slope, axis_ratio, angle, ...
stack_v2_sparse_classes_36k_train_017509
13,457
permissive
[ { "docstring": "Calculate the derivative of the potential for the EPL mass profile. Args: x: X-coordinates at which to evaluate the derivative. y: Y-coordinates at which to evaluate the derivative. theta_e: Einstein radius of the EPL profile. slope: Power-law slope of the EPL profile. axis_ratio: Axis ratio of ...
3
stack_v2_sparse_classes_30k_train_002738
Implement the Python class `EPL` described below. Class description: Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy. Method signatures and doc...
Implement the Python class `EPL` described below. Class description: Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy. Method signatures and doc...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class EPL: """Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy.""" def derivatives(x, y, theta_e, slope, axis_ratio, angle, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EPL: """Elliptical Power Law mass profile. Elliptical Power Law mass profile functions, with calculation following those described in Tessore & Metcalf (2015) and implementation closely following the EPL_numba class in Lenstronomy.""" def derivatives(x, y, theta_e, slope, axis_ratio, angle, center_x, cen...
the_stack_v2_python_sparse
jaxstronomy/lens_models.py
Jimmy-INL/google-research
train
1
a29bc23e97b98afd4c39417c6d0b71a7f5a796cc
[ "self.name = name\nself.id = id\nself.voa = voa\nself.voi = voi\nself.state_agg = state_agg\nself.ach = ach\nself.trans_agg = trans_agg\nself.aha = aha\nself.child_institutions = child_institutions\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nname = dictionary.ge...
<|body_start_0|> self.name = name self.id = id self.voa = voa self.voi = voi self.state_agg = state_agg self.ach = ach self.trans_agg = trans_agg self.aha = aha self.child_institutions = child_institutions self.additional_properties = addit...
Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach (bool): ACH Certification trans_agg (bool): Tran...
CertifiedInstitution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CertifiedInstitution: """Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach ...
stack_v2_sparse_classes_36k_train_017510
3,628
permissive
[ { "docstring": "Constructor for the CertifiedInstitution class", "name": "__init__", "signature": "def __init__(self, name=None, id=None, voa=None, voi=None, state_agg=None, ach=None, trans_agg=None, aha=None, child_institutions=None, additional_properties={})" }, { "docstring": "Creates an inst...
2
null
Implement the Python class `CertifiedInstitution` described below. Class description: Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_a...
Implement the Python class `CertifiedInstitution` described below. Class description: Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_a...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class CertifiedInstitution: """Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CertifiedInstitution: """Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach (bool): ACH C...
the_stack_v2_python_sparse
finicityapi/models/certified_institution.py
monarchmoney/finicity-python
train
0
5de2b29ccaa7cd99f03f820c00e592a863a74c55
[ "from random import choice\nif name == 'ip':\n result = choice(['127.0.0.1', '192.168.2.1'])\nelif name == 'user':\n result = choice(['leander', 'simone', 'helene'])\nelse:\n result = self.__dict__.get(name, '?')\nreturn result", "keys = ['ip', 'user']\nkeys.extend(self.__dict__.keys())\nreturn keys.__it...
<|body_start_0|> from random import choice if name == 'ip': result = choice(['127.0.0.1', '192.168.2.1']) elif name == 'user': result = choice(['leander', 'simone', 'helene']) else: result = self.__dict__.get(name, '?') return result <|end_body...
an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter.
ConnInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnInfo: """an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter.""" def __getitem__(self, name): """To allow this instance to look like a dict.""" <|body_0|> def __iter__(self): "...
stack_v2_sparse_classes_36k_train_017511
1,846
no_license
[ { "docstring": "To allow this instance to look like a dict.", "name": "__getitem__", "signature": "def __getitem__(self, name)" }, { "docstring": "To allow iteration over keys, whcih will be merged into the LogRecord dict before formatting and output.", "name": "__iter__", "signature": "...
2
stack_v2_sparse_classes_30k_train_002430
Implement the Python class `ConnInfo` described below. Class description: an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter. Method signatures and docstrings: - def __getitem__(self, name): To allow this instance to look like a dict....
Implement the Python class `ConnInfo` described below. Class description: an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter. Method signatures and docstrings: - def __getitem__(self, name): To allow this instance to look like a dict....
aed124ce0b1a1669c26df3826c01db88bf29d0e7
<|skeleton|> class ConnInfo: """an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter.""" def __getitem__(self, name): """To allow this instance to look like a dict.""" <|body_0|> def __iter__(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConnInfo: """an example class which shows how an abitrary class can be used as the 'extra' context information repository passed to a LoggerAdapter.""" def __getitem__(self, name): """To allow this instance to look like a dict.""" from random import choice if name == 'ip': ...
the_stack_v2_python_sparse
Socket/conninfo.py
jedamus/qpython-scripts
train
1
96ee618eeda7a3b9608ede99a7bc61fcefbf705d
[ "self.targets = [0 for i in range(target + 1)]\nself.new_nums = [0]\nwhile self.new_nums != []:\n self.nums = []\n for i in self.new_nums:\n for j in nums:\n a = i + j\n if a <= target:\n self.nums.append(a)\n self.targets[a] += 1\n self.new_nums =...
<|body_start_0|> self.targets = [0 for i in range(target + 1)] self.new_nums = [0] while self.new_nums != []: self.nums = [] for i in self.new_nums: for j in nums: a = i + j if a <= target: se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum4_1(self, nums, target): """:type nums: List[int] :type target: int :rtype: int 52ms""" <|body_1|> def combinationSu...
stack_v2_sparse_classes_36k_train_017512
2,089
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "combinationSum4", "signature": "def combinationSum4(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int 52ms", "name": "combinationSum4_1", "signature": "def combination...
3
stack_v2_sparse_classes_30k_train_016659
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum4_1(self, nums, target): :type nums: List[int] :type target: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum4_1(self, nums, target): :type nums: List[int] :type target: int ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum4_1(self, nums, target): """:type nums: List[int] :type target: int :rtype: int 52ms""" <|body_1|> def combinationSu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" self.targets = [0 for i in range(target + 1)] self.new_nums = [0] while self.new_nums != []: self.nums = [] for i in self.new_nums: ...
the_stack_v2_python_sparse
CombinationSumIV_MID_377.py
953250587/leetcode-python
train
2
abbc48f739d8f9c19fb1163f379c317d992b7d82
[ "EasyFrame.__init__(self, title='Tax Calculator')\nself.standardDeduction = 10000\nself.exemptionPerDependent = 3000\nself.taxRate = 0.2\nself.taxToDisplay = 0.0\nself.incomeField = self.addLabel(text='Gross income', row=0, column=0)\nself.incomeField = self.addFloatField(value='0.0', row=0, column=1)\nself.depFiel...
<|body_start_0|> EasyFrame.__init__(self, title='Tax Calculator') self.standardDeduction = 10000 self.exemptionPerDependent = 3000 self.taxRate = 0.2 self.taxToDisplay = 0.0 self.incomeField = self.addLabel(text='Gross income', row=0, column=0) self.incomeField = ...
Application window for the tax calculator.
TaxCalculator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaxCalculator: """Application window for the tax calculator.""" def __init__(self): """Sets up the window and the widgets.""" <|body_0|> def computeTax(self): """Obtains the data from the input field and uses them to compute the tax, which is sent to the output f...
stack_v2_sparse_classes_36k_train_017513
2,234
no_license
[ { "docstring": "Sets up the window and the widgets.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Obtains the data from the input field and uses them to compute the tax, which is sent to the output field.", "name": "computeTax", "signature": "def computeTax(s...
2
stack_v2_sparse_classes_30k_train_001663
Implement the Python class `TaxCalculator` described below. Class description: Application window for the tax calculator. Method signatures and docstrings: - def __init__(self): Sets up the window and the widgets. - def computeTax(self): Obtains the data from the input field and uses them to compute the tax, which is...
Implement the Python class `TaxCalculator` described below. Class description: Application window for the tax calculator. Method signatures and docstrings: - def __init__(self): Sets up the window and the widgets. - def computeTax(self): Obtains the data from the input field and uses them to compute the tax, which is...
38bc4619d139c48853c4864a094df9afaa89b6e8
<|skeleton|> class TaxCalculator: """Application window for the tax calculator.""" def __init__(self): """Sets up the window and the widgets.""" <|body_0|> def computeTax(self): """Obtains the data from the input field and uses them to compute the tax, which is sent to the output f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaxCalculator: """Application window for the tax calculator.""" def __init__(self): """Sets up the window and the widgets.""" EasyFrame.__init__(self, title='Tax Calculator') self.standardDeduction = 10000 self.exemptionPerDependent = 3000 self.taxRate = 0.2 ...
the_stack_v2_python_sparse
Module3/pe.py
juliecoding/IntroToOOP
train
0
da9fe439af3d65a216d67ba4ca0043025586241f
[ "self.qualifier = parent.get('qualifier', '')\nself.rtype = parent.get('rtype', [])\nself.red_index = parent.get('red_index', None)\nself.red_dim = parent.get('red_dim', None)\nself.csigns = kwargs.get(self.qualifier + '_csigns', kwargs.get('csigns', None))", "self.csigns = kwargs.get(self.qualifier + '_csigns', ...
<|body_start_0|> self.qualifier = parent.get('qualifier', '') self.rtype = parent.get('rtype', []) self.red_index = parent.get('red_index', None) self.red_dim = parent.get('red_dim', None) self.csigns = kwargs.get(self.qualifier + '_csigns', kwargs.get('csigns', None)) <|end_body...
SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign.
SplitSignSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SplitSignSampling: """SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sa...
stack_v2_sparse_classes_36k_train_017514
7,623
permissive
[ { "docstring": "Initialize the sampler. [inputs] (parent=dict(), **kwargs) parent: object or dictionary composed of the parent instantiation or namespace (e.g. class HyperManager from mner.solvers.manager.py) from which the sampler is instantiated. - qualifier: (default=\"\") string that preprends a prefix to t...
2
stack_v2_sparse_classes_30k_train_007880
Implement the Python class `SplitSignSampling` described below. Class description: SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign. Method signatures and docstrings: - def _...
Implement the Python class `SplitSignSampling` described below. Class description: SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign. Method signatures and docstrings: - def _...
97d2f67304478dcf6fb26294ed357f8c31601d01
<|skeleton|> class SplitSignSampling: """SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SplitSignSampling: """SplitSignSampling (class) Sample a feasible point for nuclear-norm regularization with either the "UV-linear" or "UV-linear-insert" equality constraints. See mner.solvers.constraints.SplitSign.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sampler. [input...
the_stack_v2_python_sparse
mner/solvers/samplers.py
jkaardal/mner
train
5
c10abe83dae3de5ebb50715cd198f6d47de37a08
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Service to manage labels.
LabelServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelServiceServicer: """Service to manage labels.""" def GetLabel(self, request, context): """Returns the requested label in full detail.""" <|body_0|> def MutateLabels(self, request, context): """Creates, updates, or removes labels. Operation statuses are retur...
stack_v2_sparse_classes_36k_train_017515
4,966
permissive
[ { "docstring": "Returns the requested label in full detail.", "name": "GetLabel", "signature": "def GetLabel(self, request, context)" }, { "docstring": "Creates, updates, or removes labels. Operation statuses are returned.", "name": "MutateLabels", "signature": "def MutateLabels(self, re...
2
null
Implement the Python class `LabelServiceServicer` described below. Class description: Service to manage labels. Method signatures and docstrings: - def GetLabel(self, request, context): Returns the requested label in full detail. - def MutateLabels(self, request, context): Creates, updates, or removes labels. Operati...
Implement the Python class `LabelServiceServicer` described below. Class description: Service to manage labels. Method signatures and docstrings: - def GetLabel(self, request, context): Returns the requested label in full detail. - def MutateLabels(self, request, context): Creates, updates, or removes labels. Operati...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class LabelServiceServicer: """Service to manage labels.""" def GetLabel(self, request, context): """Returns the requested label in full detail.""" <|body_0|> def MutateLabels(self, request, context): """Creates, updates, or removes labels. Operation statuses are retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelServiceServicer: """Service to manage labels.""" def GetLabel(self, request, context): """Returns the requested label in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method no...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/label_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
3efb833479d4497aa4daf427b357d9cbf4dbc08d
[ "filename = Path.cwd().with_name('data') / filename\nwith open(filename, newline='') as csvfile:\n dict_list = []\n csv_data = csv.reader(csvfile)\n headers = next(csv_data, None)\n if headers[0].startswith(''):\n headers[0] = headers[0][3:]\n for row in csv_data:\n row_dict = {colum...
<|body_start_0|> filename = Path.cwd().with_name('data') / filename with open(filename, newline='') as csvfile: dict_list = [] csv_data = csv.reader(csvfile) headers = next(csv_data, None) if headers[0].startswith(''): headers[0] = heade...
Class to encap the original database program
Database
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """Class to encap the original database program""" def _import_csv(self, filename): """Returns a list of dictionaries. One dictionary for each row of data in a csv file.""" <|body_0|> def _add_bulk_data(self, collection, directory_name, filename): """Ad...
stack_v2_sparse_classes_36k_train_017516
8,052
no_license
[ { "docstring": "Returns a list of dictionaries. One dictionary for each row of data in a csv file.", "name": "_import_csv", "signature": "def _import_csv(self, filename)" }, { "docstring": "Adds data in bulk to database.", "name": "_add_bulk_data", "signature": "def _add_bulk_data(self, ...
6
null
Implement the Python class `Database` described below. Class description: Class to encap the original database program Method signatures and docstrings: - def _import_csv(self, filename): Returns a list of dictionaries. One dictionary for each row of data in a csv file. - def _add_bulk_data(self, collection, director...
Implement the Python class `Database` described below. Class description: Class to encap the original database program Method signatures and docstrings: - def _import_csv(self, filename): Returns a list of dictionaries. One dictionary for each row of data in a csv file. - def _add_bulk_data(self, collection, director...
ac12beeae8aa57135bbcd03ac7a4f977fa3bdb56
<|skeleton|> class Database: """Class to encap the original database program""" def _import_csv(self, filename): """Returns a list of dictionaries. One dictionary for each row of data in a csv file.""" <|body_0|> def _add_bulk_data(self, collection, directory_name, filename): """Ad...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: """Class to encap the original database program""" def _import_csv(self, filename): """Returns a list of dictionaries. One dictionary for each row of data in a csv file.""" filename = Path.cwd().with_name('data') / filename with open(filename, newline='') as csvfile: ...
the_stack_v2_python_sparse
students/alex_w/lesson01/assignment/src/database.py
UWPCE-PythonCert-ClassRepos/py220-online-201904-V2
train
1
b51e406eb5407c683aeb88af0c09e31f97b84e74
[ "if self.action_type == Action.PERSONALIZED_TEXT or self.action_type == Action.RUBRIC_TEXT or self.action_type == Action.EMAIL_REPORT or (self.action_type == Action.JSON_REPORT) or (self.action_type == Action.PERSONALIZED_CANVAS_EMAIL and settings.CANVAS_INFO_DICT is not None):\n return None\nif self.action_type...
<|body_start_0|> if self.action_type == Action.PERSONALIZED_TEXT or self.action_type == Action.RUBRIC_TEXT or self.action_type == Action.EMAIL_REPORT or (self.action_type == Action.JSON_REPORT) or (self.action_type == Action.PERSONALIZED_CANVAS_EMAIL and settings.CANVAS_INFO_DICT is not None): retur...
Object storing an action: content, conditions, filter, etc.
Action
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """Object storing an action: content, conditions, filter, etc.""" def is_executable(self) -> Optional[str]: """Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.""" <|body_0|> def log(self, user, operation_typ...
stack_v2_sparse_classes_36k_train_017517
18,431
permissive
[ { "docstring": "Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.", "name": "is_executable", "signature": "def is_executable(self) -> Optional[str]" }, { "docstring": "Log the operation with the object.", "name": "log", "signature": ...
2
null
Implement the Python class `Action` described below. Class description: Object storing an action: content, conditions, filter, etc. Method signatures and docstrings: - def is_executable(self) -> Optional[str]: Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why. - d...
Implement the Python class `Action` described below. Class description: Object storing an action: content, conditions, filter, etc. Method signatures and docstrings: - def is_executable(self) -> Optional[str]: Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why. - d...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class Action: """Object storing an action: content, conditions, filter, etc.""" def is_executable(self) -> Optional[str]: """Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.""" <|body_0|> def log(self, user, operation_typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Action: """Object storing an action: content, conditions, filter, etc.""" def is_executable(self) -> Optional[str]: """Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.""" if self.action_type == Action.PERSONALIZED_TEXT or self.action...
the_stack_v2_python_sparse
ontask/models/action.py
abelardopardo/ontask_b
train
43
bf6986abbbc7712c848b3778cab7dc1cf0273435
[ "if not template_dirs:\n template_dirs = self.get_dirs(app_label=app_label, model_name=model_name)\nfor template_dir in template_dirs:\n try:\n name = safe_join(template_dir, template_name)\n except SuspiciousFileOperation:\n continue\n yield Origin(name=name, template_name=template_name, ...
<|body_start_0|> if not template_dirs: template_dirs = self.get_dirs(app_label=app_label, model_name=model_name) for template_dir in template_dirs: try: name = safe_join(template_dir, template_name) except SuspiciousFileOperation: conti...
FoundationMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it ...
stack_v2_sparse_classes_36k_train_017518
2,535
permissive
[ { "docstring": "Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it is excluded from the result set. Source: django.template.loaders.filesystem.Loader Hard override accepts app_label and model_nam...
2
stack_v2_sparse_classes_30k_train_016972
Implement the Python class `FoundationMixin` described below. Class description: Implement the FoundationMixin class. Method signatures and docstrings: - def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): Return an Origin object pointing to an absolute path in each dir...
Implement the Python class `FoundationMixin` described below. Class description: Implement the FoundationMixin class. Method signatures and docstrings: - def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): Return an Origin object pointing to an absolute path in each dir...
3762baf7e10bf80bfb6efb44a585beff8e8fc882
<|skeleton|> class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FoundationMixin: def get_template_sources(self, template_name, template_dirs=None, app_label=None, model_name=None): """Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn't lie inside one of the template_dirs it is excluded fr...
the_stack_v2_python_sparse
foundation/template/loaders/base.py
altio/foundation
train
5
f8e56dcab782df4e870963fd31b2fc66de2f498c
[ "if not conflicting_files:\n return SkipReason.NO_CONFLICTING_FILES\nelse:\n return SkipReason.CONFLICTING_FILES.format(RELEASE_NOTES_DIR, PACK_METADATA_FILE, conflicting_files)", "pr_files = list(self.pr.get_files())\nadded_rn_files = [f.filename for f in pr_files if f.status == 'added' and RELEASE_NOTES_D...
<|body_start_0|> if not conflicting_files: return SkipReason.NO_CONFLICTING_FILES else: return SkipReason.CONFLICTING_FILES.format(RELEASE_NOTES_DIR, PACK_METADATA_FILE, conflicting_files) <|end_body_0|> <|body_start_1|> pr_files = list(self.pr.get_files()) added...
HasConflictOnAllowedFilesCondition
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HasConflictOnAllowedFilesCondition: def generate_skip_reason(self, conflicting_files, **kwargs) -> str: """Args: conflicting_files: files on the pr that conflicts with base. Returns: Reason why the condition failed, and pr skipped.""" <|body_0|> def _check(self, previous_res...
stack_v2_sparse_classes_36k_train_017519
29,534
permissive
[ { "docstring": "Args: conflicting_files: files on the pr that conflicts with base. Returns: Reason why the condition failed, and pr skipped.", "name": "generate_skip_reason", "signature": "def generate_skip_reason(self, conflicting_files, **kwargs) -> str" }, { "docstring": "Checks if the PR con...
3
null
Implement the Python class `HasConflictOnAllowedFilesCondition` described below. Class description: Implement the HasConflictOnAllowedFilesCondition class. Method signatures and docstrings: - def generate_skip_reason(self, conflicting_files, **kwargs) -> str: Args: conflicting_files: files on the pr that conflicts wi...
Implement the Python class `HasConflictOnAllowedFilesCondition` described below. Class description: Implement the HasConflictOnAllowedFilesCondition class. Method signatures and docstrings: - def generate_skip_reason(self, conflicting_files, **kwargs) -> str: Args: conflicting_files: files on the pr that conflicts wi...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class HasConflictOnAllowedFilesCondition: def generate_skip_reason(self, conflicting_files, **kwargs) -> str: """Args: conflicting_files: files on the pr that conflicts with base. Returns: Reason why the condition failed, and pr skipped.""" <|body_0|> def _check(self, previous_res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HasConflictOnAllowedFilesCondition: def generate_skip_reason(self, conflicting_files, **kwargs) -> str: """Args: conflicting_files: files on the pr that conflicts with base. Returns: Reason why the condition failed, and pr skipped.""" if not conflicting_files: return SkipReason.NO_...
the_stack_v2_python_sparse
Utils/github_workflow_scripts/autobump_release_notes/skip_conditions.py
demisto/content
train
1,023
12df9e6b950a62c1b7cb1da34981034cc25aeaa6
[ "sample_input = 'R8, R4, R4, R8'\nwalker = Walker2(sample_input)\nassert walker.run() == 4", "sample_input = 'R4, L4, L4, L3, L3, L2, L2, L1, L1, L1'\nwalker = Walker2(sample_input)\nassert walker.run() == 5\n'\\n START\\n 0,0\\n E4 (R4)\\n 1,0\\n 2,0\\n ...
<|body_start_0|> sample_input = 'R8, R4, R4, R8' walker = Walker2(sample_input) assert walker.run() == 4 <|end_body_0|> <|body_start_1|> sample_input = 'R4, L4, L4, L3, L3, L2, L2, L1, L1, L1' walker = Walker2(sample_input) assert walker.run() == 5 '\n STA...
.
TestPart2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPart2: """.""" def test_example_1(self): """.""" <|body_0|> def test_example_2(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sample_input = 'R8, R4, R4, R8' walker = Walker2(sample_input) assert walker.run() == ...
stack_v2_sparse_classes_36k_train_017520
1,340
permissive
[ { "docstring": ".", "name": "test_example_1", "signature": "def test_example_1(self)" }, { "docstring": ".", "name": "test_example_2", "signature": "def test_example_2(self)" } ]
2
stack_v2_sparse_classes_30k_train_004430
Implement the Python class `TestPart2` described below. Class description: . Method signatures and docstrings: - def test_example_1(self): . - def test_example_2(self): .
Implement the Python class `TestPart2` described below. Class description: . Method signatures and docstrings: - def test_example_1(self): . - def test_example_2(self): . <|skeleton|> class TestPart2: """.""" def test_example_1(self): """.""" <|body_0|> def test_example_2(self): ...
17c729af2af5f1d95ba6ff68771a82ca6d00b05d
<|skeleton|> class TestPart2: """.""" def test_example_1(self): """.""" <|body_0|> def test_example_2(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPart2: """.""" def test_example_1(self): """.""" sample_input = 'R8, R4, R4, R8' walker = Walker2(sample_input) assert walker.run() == 4 def test_example_2(self): """.""" sample_input = 'R4, L4, L4, L3, L3, L2, L2, L1, L1, L1' walker = Walk...
the_stack_v2_python_sparse
2016/day01_no_time_for_a_taxicab/python/src/test_solutions.py
tlake/advent-of-code
train
0
eddc8eb62a93f89b2879a81c80c054cfb626ec9a
[ "t = TableFu(self.csv_file)\nself.table.pop(0)\nauthors = [row[0] for row in self.table]\nself.assertEqual(authors, t.values('Author'))", "t = TableFu(self.table)\nself.table.pop(0)\nstyles = set([row[-1] for row in self.table])\nself.assertEqual(t.values('Style', unique=True), styles)", "t = TableFu(self.csv_f...
<|body_start_0|> t = TableFu(self.csv_file) self.table.pop(0) authors = [row[0] for row in self.table] self.assertEqual(authors, t.values('Author')) <|end_body_0|> <|body_start_1|> t = TableFu(self.table) self.table.pop(0) styles = set([row[-1] for row in self.ta...
ValuesTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValuesTest: def test_values(self): """Return one column's values for all rows""" <|body_0|> def test_unique_values(self): """Adding unique=True returns a set""" <|body_1|> def test_totals(self): """Total values for a table across rows""" ...
stack_v2_sparse_classes_36k_train_017521
30,557
no_license
[ { "docstring": "Return one column's values for all rows", "name": "test_values", "signature": "def test_values(self)" }, { "docstring": "Adding unique=True returns a set", "name": "test_unique_values", "signature": "def test_unique_values(self)" }, { "docstring": "Total values fo...
3
null
Implement the Python class `ValuesTest` described below. Class description: Implement the ValuesTest class. Method signatures and docstrings: - def test_values(self): Return one column's values for all rows - def test_unique_values(self): Adding unique=True returns a set - def test_totals(self): Total values for a ta...
Implement the Python class `ValuesTest` described below. Class description: Implement the ValuesTest class. Method signatures and docstrings: - def test_values(self): Return one column's values for all rows - def test_unique_values(self): Adding unique=True returns a set - def test_totals(self): Total values for a ta...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class ValuesTest: def test_values(self): """Return one column's values for all rows""" <|body_0|> def test_unique_values(self): """Adding unique=True returns a set""" <|body_1|> def test_totals(self): """Total values for a table across rows""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValuesTest: def test_values(self): """Return one column's values for all rows""" t = TableFu(self.csv_file) self.table.pop(0) authors = [row[0] for row in self.table] self.assertEqual(authors, t.values('Author')) def test_unique_values(self): """Adding uniq...
the_stack_v2_python_sparse
repoData/eyeseast-python-tablefu/allPythonContent.py
aCoffeeYin/pyreco
train
0
f9bbeff16ca6dbc18fb68914879884e4de8a4c63
[ "super().__init__(app, pipeline, analyze_on_clock=analyze_on_clock, id=id, config=config)\nmax_size = int(self.Config.get('latch_max_size'))\nif max_size == 0:\n self.Latch = collections.deque()\nelse:\n self.Latch = collections.deque(maxlen=max_size)\nif isinstance(query, bool):\n self.Query = query\nelse...
<|body_start_0|> super().__init__(app, pipeline, analyze_on_clock=analyze_on_clock, id=id, config=config) max_size = int(self.Config.get('latch_max_size')) if max_size == 0: self.Latch = collections.deque() else: self.Latch = collections.deque(maxlen=max_size) ...
The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_max_size` then first event is dropped. `Latch` can be filled based on the `query`...
LatchAnalyzer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LatchAnalyzer: """The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_max_size` then first event is dropped. `...
stack_v2_sparse_classes_36k_train_017522
2,390
permissive
[ { "docstring": "Description: **Parameters** app : Application Name of the Application. pipeline : Pipeline Name of the Pipeline. query : bool, default = True description analyze_on_clock : bool, default = False inclusive : bool, default = False id : str, default = None config : JSON, default = None configuratio...
2
stack_v2_sparse_classes_30k_train_015706
Implement the Python class `LatchAnalyzer` described below. Class description: The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_m...
Implement the Python class `LatchAnalyzer` described below. Class description: The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_m...
11ee3689d0ff6e9b662deeb3fc5e18bb0aabc8f2
<|skeleton|> class LatchAnalyzer: """The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_max_size` then first event is dropped. `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LatchAnalyzer: """The `LatchAnalyzer` accumulates events in the `Latch` variable. The `Latch` is a queue of maximum size specified in configuration - `latch_max_size` If `latch_max_size` is 0 then `Latch` is not limited If accumulated events exceeds `latch_max_size` then first event is dropped. `Latch` can be...
the_stack_v2_python_sparse
bspump/analyzer/latch.py
LibertyAces/BitSwanPump
train
24
99c3c1b966c4f3037e7b35909ea5c5a885bf9c03
[ "session = DBSession()\nsession.merge(trans)\nsession.commit()\nsession.close()", "session = DBSession()\nfilterList = []\nif 'trans_id' in kwargs:\n _trans_id = kwargs['trans_id']\n filterList.append(Trans.contract_type == _trans_id)\nif 'ex_trans_ids' in kwargs:\n _ex_trans_ids = f\"({kwargs['ex_trans_...
<|body_start_0|> session = DBSession() session.merge(trans) session.commit() session.close() <|end_body_0|> <|body_start_1|> session = DBSession() filterList = [] if 'trans_id' in kwargs: _trans_id = kwargs['trans_id'] filterList.append(Tr...
交易model类
Trans
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trans: """交易model类""" def save(trans): """新加/修改交易表 :param trans: :return:""" <|body_0|> def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> session = DBSession() session.merge(tr...
stack_v2_sparse_classes_36k_train_017523
8,115
no_license
[ { "docstring": "新加/修改交易表 :param trans: :return:", "name": "save", "signature": "def save(trans)" }, { "docstring": "新加/修改交易表 :param trans: :return:", "name": "select", "signature": "def select(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_val_001159
Implement the Python class `Trans` described below. Class description: 交易model类 Method signatures and docstrings: - def save(trans): 新加/修改交易表 :param trans: :return: - def select(self, **kwargs): 新加/修改交易表 :param trans: :return:
Implement the Python class `Trans` described below. Class description: 交易model类 Method signatures and docstrings: - def save(trans): 新加/修改交易表 :param trans: :return: - def select(self, **kwargs): 新加/修改交易表 :param trans: :return: <|skeleton|> class Trans: """交易model类""" def save(trans): """新加/修改交易表 :pa...
1bc744a6d331b4b733f6b6658b8310eb0c30524e
<|skeleton|> class Trans: """交易model类""" def save(trans): """新加/修改交易表 :param trans: :return:""" <|body_0|> def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trans: """交易model类""" def save(trans): """新加/修改交易表 :param trans: :return:""" session = DBSession() session.merge(trans) session.commit() session.close() def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" session = DBSession() ...
the_stack_v2_python_sparse
investment/transaction/models.py
cliicy/vtrade
train
0
cb700db517ae6ea03cff0c4edbb22ebec2cc2154
[ "g = [{} for _ in range(n + 1)]\nfor a, b, d in roads:\n g[a][b] = g[b][a] = d\n\ndef dijkstra(a, dest):\n dists = {}\n h = []\n for b, d in g[a].items():\n heappush(h, (d, b))\n while h:\n d, b = heappop(h)\n if d < dists.get(b, float('inf')):\n dists[b] = d\n ...
<|body_start_0|> g = [{} for _ in range(n + 1)] for a, b, d in roads: g[a][b] = g[b][a] = d def dijkstra(a, dest): dists = {} h = [] for b, d in g[a].items(): heappush(h, (d, b)) while h: d, b = heappop(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """Apr 23, 2023 19:11""" <|body_0|> def minScore(self, n: int, roads: List[List[int]]) -> int: """Apr 23, 2023 19:19 Simply the minimum path connected to the start point""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_017524
3,292
no_license
[ { "docstring": "Apr 23, 2023 19:11", "name": "minScore", "signature": "def minScore(self, n: int, roads: List[List[int]]) -> int" }, { "docstring": "Apr 23, 2023 19:19 Simply the minimum path connected to the start point", "name": "minScore", "signature": "def minScore(self, n: int, road...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minScore(self, n: int, roads: List[List[int]]) -> int: Apr 23, 2023 19:11 - def minScore(self, n: int, roads: List[List[int]]) -> int: Apr 23, 2023 19:19 Simply the minimum p...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minScore(self, n: int, roads: List[List[int]]) -> int: Apr 23, 2023 19:11 - def minScore(self, n: int, roads: List[List[int]]) -> int: Apr 23, 2023 19:19 Simply the minimum p...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """Apr 23, 2023 19:11""" <|body_0|> def minScore(self, n: int, roads: List[List[int]]) -> int: """Apr 23, 2023 19:19 Simply the minimum path connected to the start point""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """Apr 23, 2023 19:11""" g = [{} for _ in range(n + 1)] for a, b, d in roads: g[a][b] = g[b][a] = d def dijkstra(a, dest): dists = {} h = [] for b, d in g[a].it...
the_stack_v2_python_sparse
leetcode/solved/2582_Minimum_Score_of_a_Path_Between_Two_Cities/solution.py
sungminoh/algorithms
train
0
c46a70515c76527af4b3923e771c11cda7f03345
[ "super().__init__(observation_space=observation_space, action_space=action_space, model_config_dict=model_config_dict)\nself.model_size = self._model_config_dict['model_size']\nself.is_img_space = len(self.observation_space.shape) in [2, 3]\nself.is_gray_scale = self.is_img_space and len(self.observation_space.shap...
<|body_start_0|> super().__init__(observation_space=observation_space, action_space=action_space, model_config_dict=model_config_dict) self.model_size = self._model_config_dict['model_size'] self.is_img_space = len(self.observation_space.shape) in [2, 3] self.is_gray_scale = self.is_img_...
The Catalog class used to build all the models needed for DreamerV3 training.
DreamerV3Catalog
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DreamerV3Catalog: """The Catalog class used to build all the models needed for DreamerV3 training.""" def __init__(self, observation_space: gym.Space, action_space: gym.Space, model_config_dict: dict): """Initializes a DreamerV3Catalog instance. Args: observation_space: The observati...
stack_v2_sparse_classes_36k_train_017525
2,876
permissive
[ { "docstring": "Initializes a DreamerV3Catalog instance. Args: observation_space: The observation space of the environment. action_space: The action space of the environment. model_config_dict: The model config to use.", "name": "__init__", "signature": "def __init__(self, observation_space: gym.Space, ...
3
null
Implement the Python class `DreamerV3Catalog` described below. Class description: The Catalog class used to build all the models needed for DreamerV3 training. Method signatures and docstrings: - def __init__(self, observation_space: gym.Space, action_space: gym.Space, model_config_dict: dict): Initializes a DreamerV...
Implement the Python class `DreamerV3Catalog` described below. Class description: The Catalog class used to build all the models needed for DreamerV3 training. Method signatures and docstrings: - def __init__(self, observation_space: gym.Space, action_space: gym.Space, model_config_dict: dict): Initializes a DreamerV...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class DreamerV3Catalog: """The Catalog class used to build all the models needed for DreamerV3 training.""" def __init__(self, observation_space: gym.Space, action_space: gym.Space, model_config_dict: dict): """Initializes a DreamerV3Catalog instance. Args: observation_space: The observati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DreamerV3Catalog: """The Catalog class used to build all the models needed for DreamerV3 training.""" def __init__(self, observation_space: gym.Space, action_space: gym.Space, model_config_dict: dict): """Initializes a DreamerV3Catalog instance. Args: observation_space: The observation space of t...
the_stack_v2_python_sparse
rllib/algorithms/dreamerv3/dreamerv3_catalog.py
ray-project/ray
train
29,482
02557ed984aa25ff72fa476012d11cb805fd9e6f
[ "\"\"\"\n For clients to authenticate, the token token should be included in the Authorization\n HTTP header. The token should be prefixed by the string literal \"Token\", with\n whitespace separating the two strings. For example:\n\n Authorization: Token 9944b09199c62bcf9418ad846dd0e4bb...
<|body_start_0|> """ For clients to authenticate, the token token should be included in the Authorization HTTP header. The token should be prefixed by the string literal "Token", with whitespace separating the two strings. For example: Authorizati...
BaseAPITest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAPITest: def call_api(self, url, token=None): """Call API with auth and return the response object Assumes self.email and self.password exist.""" <|body_0|> def post_api(self, url, data, token=None): """Data should be a python object. It'll be jsonified and poste...
stack_v2_sparse_classes_36k_train_017526
3,545
permissive
[ { "docstring": "Call API with auth and return the response object Assumes self.email and self.password exist.", "name": "call_api", "signature": "def call_api(self, url, token=None)" }, { "docstring": "Data should be a python object. It'll be jsonified and posted.", "name": "post_api", "...
2
null
Implement the Python class `BaseAPITest` described below. Class description: Implement the BaseAPITest class. Method signatures and docstrings: - def call_api(self, url, token=None): Call API with auth and return the response object Assumes self.email and self.password exist. - def post_api(self, url, data, token=Non...
Implement the Python class `BaseAPITest` described below. Class description: Implement the BaseAPITest class. Method signatures and docstrings: - def call_api(self, url, token=None): Call API with auth and return the response object Assumes self.email and self.password exist. - def post_api(self, url, data, token=Non...
43eb3e3b78c19f9e1dc02158ca12fc0c5d6bb270
<|skeleton|> class BaseAPITest: def call_api(self, url, token=None): """Call API with auth and return the response object Assumes self.email and self.password exist.""" <|body_0|> def post_api(self, url, data, token=None): """Data should be a python object. It'll be jsonified and poste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseAPITest: def call_api(self, url, token=None): """Call API with auth and return the response object Assumes self.email and self.password exist.""" """ For clients to authenticate, the token token should be included in the Authorization HTTP header. The token ...
the_stack_v2_python_sparse
api/tests.py
theirc/CTS
train
25
25f84a8b61fa75926b6c459bdc6df88e4b746913
[ "self.object = None\nform_class = self.get_form_class()\nform = self.get_form(form_class)\nadditional_page_form = AdditionalPageFormSet()\nreturn self.render_to_response(self.get_context_data(form=form, additional_page_form=additional_page_form))", "self.object = None\nform_class = self.get_form_class()\nform = s...
<|body_start_0|> self.object = None form_class = self.get_form_class() form = self.get_form(form_class) additional_page_form = AdditionalPageFormSet() return self.render_to_response(self.get_context_data(form=form, additional_page_form=additional_page_form)) <|end_body_0|> <|bod...
B2BProductCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class B2BProductCreate: def get(self, request, *args, **kwargs): """Handles GET requests and instantiates blank versions of the form and its inline formsets.""" <|body_0|> def post(self, request, *args, **kwargs): """Handles POST requests, instantiating a form instance and...
stack_v2_sparse_classes_36k_train_017527
48,592
no_license
[ { "docstring": "Handles GET requests and instantiates blank versions of the form and its inline formsets.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Handles POST requests, instantiating a form instance and its inline formsets with the passed POST v...
4
stack_v2_sparse_classes_30k_train_004154
Implement the Python class `B2BProductCreate` described below. Class description: Implement the B2BProductCreate class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests and instantiates blank versions of the form and its inline formsets. - def post(self, request, *args...
Implement the Python class `B2BProductCreate` described below. Class description: Implement the B2BProductCreate class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests and instantiates blank versions of the form and its inline formsets. - def post(self, request, *args...
32e71879751393a8b54de49f41a11835c7830712
<|skeleton|> class B2BProductCreate: def get(self, request, *args, **kwargs): """Handles GET requests and instantiates blank versions of the form and its inline formsets.""" <|body_0|> def post(self, request, *args, **kwargs): """Handles POST requests, instantiating a form instance and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class B2BProductCreate: def get(self, request, *args, **kwargs): """Handles GET requests and instantiates blank versions of the form and its inline formsets.""" self.object = None form_class = self.get_form_class() form = self.get_form(form_class) additional_page_form = Addit...
the_stack_v2_python_sparse
b24project/b24online/Product/views.py
alexvnukoff/project
train
0
55b40ed88c7de608ff1ae5d5fe14d375d7597956
[ "self.attributes_descriptor = attributes_descriptor\nself.enable_rollup = enable_rollup\nself.entities_time_to_live_secs = entities_time_to_live_secs\nself.flush_interval_secs = flush_interval_secs\nself.is_internal_schema = is_internal_schema\nself.largest_flush_interval_secs = largest_flush_interval_secs\nself.na...
<|body_start_0|> self.attributes_descriptor = attributes_descriptor self.enable_rollup = enable_rollup self.entities_time_to_live_secs = entities_time_to_live_secs self.flush_interval_secs = flush_interval_secs self.is_internal_schema = is_internal_schema self.largest_flu...
Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool): Timeseries for an entity schema is rolled up...
EntitySchemaProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool):...
stack_v2_sparse_classes_36k_train_017528
7,912
permissive
[ { "docstring": "Constructor for the EntitySchemaProto class", "name": "__init__", "signature": "def __init__(self, attributes_descriptor=None, enable_rollup=None, entities_time_to_live_secs=None, flush_interval_secs=None, is_internal_schema=None, largest_flush_interval_secs=None, name=None, rollup_granu...
2
stack_v2_sparse_classes_30k_train_003779
Implement the Python class `EntitySchemaProto` described below. Class description: Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type ...
Implement the Python class `EntitySchemaProto` described below. Class description: Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool): Timeseries f...
the_stack_v2_python_sparse
cohesity_management_sdk/models/entity_schema_proto.py
cohesity/management-sdk-python
train
24
1a1454eacd3b957b84b294aec4651be266bb78b2
[ "m, n = (len(word1), len(word2))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor j in range(1, n + 1):\n dp[0][j] = j\nfor i in range(1, m + 1):\n dp[i][0] = i\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n dp[i][j] = dp[i - 1][j - 1] if word1[i - 1] == word2[j - 1] else min(dp[i - 1][j -...
<|body_start_0|> m, n = (len(word1), len(word2)) dp = [[0] * (n + 1) for _ in range(m + 1)] for j in range(1, n + 1): dp[0][j] = j for i in range(1, m + 1): dp[i][0] = i for i in range(1, m + 1): for j in range(1, n + 1): dp[i][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短回文串.py][j-1_最短回文串.py], dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + 1_最短回文串.py dp[0][0] = 0 dp[0][...
stack_v2_sparse_classes_36k_train_017529
2,182
no_license
[ { "docstring": "dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短回文串.py][j-1_最短回文串.py], dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + 1_最短回文串.py dp[0][0] = 0 dp[0][j] = j dp[i][0] = i res = dp[-1_最短回文串.py][-1_最短回文串.py]", "name": "minDi...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短回文串.py][j-1_最短回文串.py], dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + 1_最短回文串.py dp[0][0] = 0 dp[0][...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance(self, word1: str, word2: str) -> int: """dp[i][j] w1前i个,w2前j个 最少操作数 dp[i][j] = dp[i-1_最短回文串.py][j-1_最短回文串.py] if w1[i-1_最短回文串.py] == w2[j-1_最短回文串.py] = min(dp[i-1_最短回文串.py][j-1_最短回文串.py], dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + 1_最短回文串.py dp[0][0] = 0 dp[0][j] = j dp[i][0...
the_stack_v2_python_sparse
4_LEETCODE/2_DP/字符串匹配问题/72_编辑距离.py
fzingithub/SwordRefers2Offer
train
1
34011a731a9401b078b263851ca392b07880e427
[ "if extended:\n ser_class = ExtendedBackupDefineSerializer\nelse:\n ser_class = BackupDefineSerializer\nif many:\n if self.full or self.extended:\n if define:\n res = ser_class(self.request, define, many=True).data\n else:\n res = []\n else:\n res = list(define...
<|body_start_0|> if extended: ser_class = ExtendedBackupDefineSerializer else: ser_class = BackupDefineSerializer if many: if self.full or self.extended: if define: res = ser_class(self.request, define, many=True).data ...
BackupDefineView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupDefineView: def get(self, vm, define, many=False, extended=False): """Get backup definition(s)""" <|body_0|> def post(self, vm, define, vm_template=False, **kwargs): """Create backup definition""" <|body_1|> def put(self, vm, define, **kwargs): ...
stack_v2_sparse_classes_36k_train_017530
4,565
permissive
[ { "docstring": "Get backup definition(s)", "name": "get", "signature": "def get(self, vm, define, many=False, extended=False)" }, { "docstring": "Create backup definition", "name": "post", "signature": "def post(self, vm, define, vm_template=False, **kwargs)" }, { "docstring": "U...
5
null
Implement the Python class `BackupDefineView` described below. Class description: Implement the BackupDefineView class. Method signatures and docstrings: - def get(self, vm, define, many=False, extended=False): Get backup definition(s) - def post(self, vm, define, vm_template=False, **kwargs): Create backup definitio...
Implement the Python class `BackupDefineView` described below. Class description: Implement the BackupDefineView class. Method signatures and docstrings: - def get(self, vm, define, many=False, extended=False): Get backup definition(s) - def post(self, vm, define, vm_template=False, **kwargs): Create backup definitio...
7e3dedddbe821283d909393f333eed4acd452953
<|skeleton|> class BackupDefineView: def get(self, vm, define, many=False, extended=False): """Get backup definition(s)""" <|body_0|> def post(self, vm, define, vm_template=False, **kwargs): """Create backup definition""" <|body_1|> def put(self, vm, define, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupDefineView: def get(self, vm, define, many=False, extended=False): """Get backup definition(s)""" if extended: ser_class = ExtendedBackupDefineSerializer else: ser_class = BackupDefineSerializer if many: if self.full or self.extended: ...
the_stack_v2_python_sparse
api/vm/backup/vm_define_backup.py
erigones/esdc-ce
train
123
01c511dc14d74ed5ccb6a96f7ce4ab8c526afd89
[ "n = S(n)\nprod_term = lambda j: gamma(1 + beta * S(j) / 2) / gamma(S.One + beta / S(2))\nj = Dummy('j', integer=True, positive=True)\nterm1 = Product(prod_term(j), (j, 1, n)).doit()\nterm2 = (2 / (beta * n)) ** (beta * n * (n - 1) / 4 + n / 2)\nterm3 = (2 * pi) ** (n / 2)\nreturn term1 * term2 * term3", "n = sel...
<|body_start_0|> n = S(n) prod_term = lambda j: gamma(1 + beta * S(j) / 2) / gamma(S.One + beta / S(2)) j = Dummy('j', integer=True, positive=True) term1 = Product(prod_term(j), (j, 1, n)).doit() term2 = (2 / (beta * n)) ** (beta * n * (n - 1) / 4 + n / 2) term3 = (2 * pi...
Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903.pdf
GaussianEnsembleModel
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianEnsembleModel: """Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903.pdf""" def _compute_normalization...
stack_v2_sparse_classes_36k_train_017531
15,328
permissive
[ { "docstring": "Helper function for computing normalization constant for joint probability density of eigen values of Gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Selberg_integral#Mehta's_integral", "name": "_compute_normalization_constant", "signature": "def _compute_n...
2
null
Implement the Python class `GaussianEnsembleModel` described below. Class description: Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903...
Implement the Python class `GaussianEnsembleModel` described below. Class description: Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903...
69f98fb2b0d845e76874067a381dba37b577e8c5
<|skeleton|> class GaussianEnsembleModel: """Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903.pdf""" def _compute_normalization...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianEnsembleModel: """Abstract class for Gaussian ensembles. Contains the properties common to all the gaussian ensembles. References ========== .. [1] https://en.wikipedia.org/wiki/Random_matrix#Gaussian_ensembles .. [2] https://arxiv.org/pdf/1712.07903.pdf""" def _compute_normalization_constant(sel...
the_stack_v2_python_sparse
sympy/stats/random_matrix_models.py
sympy/sympy
train
10,928
950227362711cd66a615f501256807407aadef8f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserInstallStateSummary()", "from .device_install_state import DeviceInstallState\nfrom .entity import Entity\nfrom .device_install_state import DeviceInstallState\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] =...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserInstallStateSummary() <|end_body_0|> <|body_start_1|> from .device_install_state import DeviceInstallState from .entity import Entity from .device_install_state import Device...
Contains properties for the installation state summary for a user.
UserInstallStateSummary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInstallStateSummary: """Contains properties for the installation state summary for a user.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserInstallStateSummary: """Creates a new instance of the appropriate class based on discriminator value Args...
stack_v2_sparse_classes_36k_train_017532
3,361
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserInstallStateSummary", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
null
Implement the Python class `UserInstallStateSummary` described below. Class description: Contains properties for the installation state summary for a user. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserInstallStateSummary: Creates a new instance o...
Implement the Python class `UserInstallStateSummary` described below. Class description: Contains properties for the installation state summary for a user. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserInstallStateSummary: Creates a new instance o...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserInstallStateSummary: """Contains properties for the installation state summary for a user.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserInstallStateSummary: """Creates a new instance of the appropriate class based on discriminator value Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserInstallStateSummary: """Contains properties for the installation state summary for a user.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserInstallStateSummary: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
the_stack_v2_python_sparse
msgraph/generated/models/user_install_state_summary.py
microsoftgraph/msgraph-sdk-python
train
135
e8757510f01e318dba95862d835874c69e97286d
[ "low, high = (0, len(height) - 1)\nret = 0\nwhile low < high:\n ret = max(min(height[low], height[high]) * (high - low), ret)\n if height[low] <= height[high]:\n low += 1\n else:\n high -= 1\nreturn ret", "i = 0\nj = len(height) - 1\nmax_value = 0\ntop = max(height)\nwhile i < j:\n if to...
<|body_start_0|> low, high = (0, len(height) - 1) ret = 0 while low < high: ret = max(min(height[low], height[high]) * (high - low), ret) if height[low] <= height[high]: low += 1 else: high -= 1 return ret <|end_body_0|>...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" <|body_0|> def maxArea2(self, heigh...
stack_v2_sparse_classes_36k_train_017533
1,839
permissive
[ { "docstring": "Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:", "name": "maxArea", "signature": "def maxArea(self, height: List[int]) -> int" }, { "docstring": "Up...
2
stack_v2_sparse_classes_30k_train_019875
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height: List[int]) -> int: Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height: List[int]) -> int: Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" <|body_0|> def maxArea2(self, heigh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" low, high = (0, len(height) - 1) ret = 0 ...
the_stack_v2_python_sparse
src/11-ContainerWithMostWater.py
Jiezhi/myleetcode
train
1
c58b50a6f63428669b30f3f3d35d9c414a4097b0
[ "if request.user.is_anonymous:\n return request.session.get('user', {}).get('id')\nreturn None", "id = AnonUser.get_id(request)\nif id:\n anon_user, created = AnonUser.objects.get_or_create(id=id)\n return anon_user\nelse:\n anon_user = AnonUser.objects.create()\n request.session['user'] = {'anon':...
<|body_start_0|> if request.user.is_anonymous: return request.session.get('user', {}).get('id') return None <|end_body_0|> <|body_start_1|> id = AnonUser.get_id(request) if id: anon_user, created = AnonUser.objects.get_or_create(id=id) return anon_use...
A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.
AnonUser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnonUser: """A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.""" def get_id(request: HttpRequest) -> Optional[str]: """Get the id of the...
stack_v2_sparse_classes_36k_train_017534
17,416
permissive
[ { "docstring": "Get the id of the anonymous user, if any.", "name": "get_id", "signature": "def get_id(request: HttpRequest) -> Optional[str]" }, { "docstring": "Create an instance in the database. Only use this when necessary. e.g when you need to associated an anonymous user with another objec...
2
stack_v2_sparse_classes_30k_train_017669
Implement the Python class `AnonUser` described below. Class description: A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes. Method signatures and docstrings: - def get_id(...
Implement the Python class `AnonUser` described below. Class description: A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes. Method signatures and docstrings: - def get_id(...
b0edf060f4cc5494eef81fce62a563bd5b4e8e31
<|skeleton|> class AnonUser: """A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.""" def get_id(request: HttpRequest) -> Optional[str]: """Get the id of the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnonUser: """A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.""" def get_id(request: HttpRequest) -> Optional[str]: """Get the id of the anonymous us...
the_stack_v2_python_sparse
manager/users/models.py
stencila/hub
train
31
39286c7d7d038c205e614719750c8cf1ac45a85d
[ "super().__init__(count_per_class)\nself.confidence_channel = confidence_channel\nself.search_count_multiplier = search_count_multiplier\nself.search_proportion = search_proportion\nassert search_count_multiplier is None or search_proportion is None, f'Cannot specify both search_count_multiplier (={search_count_mul...
<|body_start_0|> super().__init__(count_per_class) self.confidence_channel = confidence_channel self.search_count_multiplier = search_count_multiplier self.search_proportion = search_proportion assert search_count_multiplier is None or search_proportion is None, f'Cannot specify ...
Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.
DensePoseConfidenceBasedSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DensePoseConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, confidence_channel: str, count_per_class: int=8, search_count_multiplier: Optional[float]=None, search_proportion: O...
stack_v2_sparse_classes_36k_train_017535
4,801
permissive
[ { "docstring": "Constructor Args: confidence_channel (str): confidence channel to use for sampling; possible values: \"sigma_2\": confidences for UV values \"fine_segm_confidence\": confidences for fine segmentation \"coarse_segm_confidence\": confidences for coarse segmentation (default: \"sigma_2\") count_per...
3
stack_v2_sparse_classes_30k_val_000712
Implement the Python class `DensePoseConfidenceBasedSampler` described below. Class description: Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates. Method signatures and docstrings: - def __init__(self, confidence_channel: str, count_per_class: int=8,...
Implement the Python class `DensePoseConfidenceBasedSampler` described below. Class description: Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates. Method signatures and docstrings: - def __init__(self, confidence_channel: str, count_per_class: int=8,...
80307d2d5e06f06a8a677cc2653f23a4c56402ac
<|skeleton|> class DensePoseConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, confidence_channel: str, count_per_class: int=8, search_count_multiplier: Optional[float]=None, search_proportion: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DensePoseConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, confidence_channel: str, count_per_class: int=8, search_count_multiplier: Optional[float]=None, search_proportion: Optional[float...
the_stack_v2_python_sparse
projects/DensePose/densepose/data/samplers/densepose_confidence_based.py
facebookresearch/detectron2
train
27,469
d1742ec12dc4bb8a2f78e3cb02a4f54815bdfcbc
[ "self.module = types.ModuleType('stocks')\n\nclass GetQuoteRequest(messages.Message):\n __module__ = 'stocks'\n symbols = messages.StringField(1, repeated=True)\n\nclass GetQuoteResponse(messages.Message):\n __module__ = 'stocks'\n prices = messages.IntegerField(1, repeated=True)\nself.module.GetQuoteRe...
<|body_start_0|> self.module = types.ModuleType('stocks') class GetQuoteRequest(messages.Message): __module__ = 'stocks' symbols = messages.StringField(1, repeated=True) class GetQuoteResponse(messages.Message): __module__ = 'stocks' prices = mes...
Test service proxy definition.
DefineServiceTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefineServiceTest: """Test service proxy definition.""" def setUp(self): """Set up mock and request classes.""" <|body_0|> def testDefineService(self): """Test service definition from descriptor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_017536
23,499
permissive
[ { "docstring": "Set up mock and request classes.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test service definition from descriptor.", "name": "testDefineService", "signature": "def testDefineService(self)" } ]
2
stack_v2_sparse_classes_30k_train_007017
Implement the Python class `DefineServiceTest` described below. Class description: Test service proxy definition. Method signatures and docstrings: - def setUp(self): Set up mock and request classes. - def testDefineService(self): Test service definition from descriptor.
Implement the Python class `DefineServiceTest` described below. Class description: Test service proxy definition. Method signatures and docstrings: - def setUp(self): Set up mock and request classes. - def testDefineService(self): Test service definition from descriptor. <|skeleton|> class DefineServiceTest: """...
2cb4493d796746cb46c8519a100ef3ef128a761a
<|skeleton|> class DefineServiceTest: """Test service proxy definition.""" def setUp(self): """Set up mock and request classes.""" <|body_0|> def testDefineService(self): """Test service definition from descriptor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefineServiceTest: """Test service proxy definition.""" def setUp(self): """Set up mock and request classes.""" self.module = types.ModuleType('stocks') class GetQuoteRequest(messages.Message): __module__ = 'stocks' symbols = messages.StringField(1, repeat...
the_stack_v2_python_sparse
src/lib/protorpc/definition_test.py
thonkify/thonkify
train
17
e5336e886b35016083020cacdfc62baca8759176
[ "if not crvs:\n msg = 'Intrinsic mutual informations require a conditional variable.'\n raise ditException(msg)\nsuper().__init__(dist, rvs, crvs, rv_mode=rv_mode)\ncrv_index = len(self._shape) - 1\ncrv_size = self._shape[crv_index]\nbound = min([bound, crv_size]) if bound is not None else crv_size\nself._con...
<|body_start_0|> if not crvs: msg = 'Intrinsic mutual informations require a conditional variable.' raise ditException(msg) super().__init__(dist, rvs, crvs, rv_mode=rv_mode) crv_index = len(self._shape) - 1 crv_size = self._shape[crv_index] bound = min([b...
Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z]
BaseIntrinsicMutualInformation
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseIntrinsicMutualInformation: """Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z]""" def __init__(self, dist, rvs=None, crvs=None, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution T...
stack_v2_sparse_classes_36k_train_017537
25,213
permissive
[ { "docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute the intrinsic mutual information of. rvs : list, None A list of lists. Each inner list specifies the indexes of the random variables used to calculate the intrinsic mutual information. If None, then i...
3
null
Implement the Python class `BaseIntrinsicMutualInformation` described below. Class description: Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z] Method signatures and docstrings: - def __init__(self, dist, rvs=None, crvs=None, bound=None, rv_mode=None): Initialize t...
Implement the Python class `BaseIntrinsicMutualInformation` described below. Class description: Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z] Method signatures and docstrings: - def __init__(self, dist, rvs=None, crvs=None, bound=None, rv_mode=None): Initialize t...
b13c5020a2b8524527a4a0db5a81d8549142228c
<|skeleton|> class BaseIntrinsicMutualInformation: """Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z]""" def __init__(self, dist, rvs=None, crvs=None, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseIntrinsicMutualInformation: """Compute a generalized intrinsic mutual information: .. math:: IMI[X:Y|Z] = min_{p(z_bar|z)} I[X:Y|Z]""" def __init__(self, dist, rvs=None, crvs=None, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution The distributi...
the_stack_v2_python_sparse
dit/multivariate/secret_key_agreement/base_skar_optimizers.py
dit/dit
train
468
e4a625023e38fdaa487a4c4295df26d7a650d534
[ "try:\n detail_html = source.pop('bbd_html', '')\n detail_url = source.get('bbd_url', '')\n self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))\n json_data = json.loads(detail_html)['results']\n res_dict = {'company_name': self.get_value(json_data, 'LEGALPERSON'), 'punish_org': self.g...
<|body_start_0|> try: detail_html = source.pop('bbd_html', '') detail_url = source.get('bbd_url', '') self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url)) json_data = json.loads(detail_html)['results'] res_dict = {'company_name': self.ge...
class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析
Parser__qyxg_xzcf__credit_dongying
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser__qyxg_xzcf__credit_dongying: """class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析""" def parse(self, source, *args, **kwargs): """parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" <|body_0|> def get_value(self, data...
stack_v2_sparse_classes_36k_train_017538
4,048
no_license
[ { "docstring": "parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None", "name": "parse", "signature": "def parse(self, source, *args, **kwargs)" }, { "docstring": ":Keyword Arguments: self -- data_dic -- :return: None", "name": "get_value", "signature": "de...
3
stack_v2_sparse_classes_30k_train_010345
Implement the Python class `Parser__qyxg_xzcf__credit_dongying` described below. Class description: class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析 Method signatures and docstrings: - def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return:...
Implement the Python class `Parser__qyxg_xzcf__credit_dongying` described below. Class description: class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析 Method signatures and docstrings: - def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return:...
991902517a94e26fbe6378610d3cd12ff4a5c1f7
<|skeleton|> class Parser__qyxg_xzcf__credit_dongying: """class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析""" def parse(self, source, *args, **kwargs): """parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" <|body_0|> def get_value(self, data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser__qyxg_xzcf__credit_dongying: """class Parser__qyxg_xzcf__credit_dongying for 行政处罚-信用中国(东营)解析""" def parse(self, source, *args, **kwargs): """parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None""" try: detail_html = source.pop('bbd_html',...
the_stack_v2_python_sparse
parse/qyxg_xzcf/Parser__qyxg_xzcf__credit_dongying.py
ZhouForrest/Spider
train
0
24cfa4537b34d1abc086292a71d163eeb73c6bc5
[ "record.data = {'time': datetime.now(timezone.utc)}\nrecord.time = record.data['time'].strftime(self.datetime_format)\nrecord.level = record.levelname\nrecord.stack_trace = None\nif record.exc_info:\n record.stack_trace = ''.join(traceback.format_exception(*record.exc_info)) if record.exc_info else ''\nreturn re...
<|body_start_0|> record.data = {'time': datetime.now(timezone.utc)} record.time = record.data['time'].strftime(self.datetime_format) record.level = record.levelname record.stack_trace = None if record.exc_info: record.stack_trace = ''.join(traceback.format_exception(*...
Log event record in JSON format. Subclass this for finer control.
JSONBaseLogFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONBaseLogFormatter: """Log event record in JSON format. Subclass this for finer control.""" def prep_record(self, record): """Prepare event record for logging. :param record: Record of event to be logged :type record: LogRecord :return: Transformed LogRecord object :trype: LogRecor...
stack_v2_sparse_classes_36k_train_017539
6,498
permissive
[ { "docstring": "Prepare event record for logging. :param record: Record of event to be logged :type record: LogRecord :return: Transformed LogRecord object :trype: LogRecord", "name": "prep_record", "signature": "def prep_record(self, record)" }, { "docstring": "Prepare request for logging. :par...
4
stack_v2_sparse_classes_30k_train_009148
Implement the Python class `JSONBaseLogFormatter` described below. Class description: Log event record in JSON format. Subclass this for finer control. Method signatures and docstrings: - def prep_record(self, record): Prepare event record for logging. :param record: Record of event to be logged :type record: LogReco...
Implement the Python class `JSONBaseLogFormatter` described below. Class description: Log event record in JSON format. Subclass this for finer control. Method signatures and docstrings: - def prep_record(self, record): Prepare event record for logging. :param record: Record of event to be logged :type record: LogReco...
fdf6dc02ab73d588919f38d6017788f7822cfd04
<|skeleton|> class JSONBaseLogFormatter: """Log event record in JSON format. Subclass this for finer control.""" def prep_record(self, record): """Prepare event record for logging. :param record: Record of event to be logged :type record: LogRecord :return: Transformed LogRecord object :trype: LogRecor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONBaseLogFormatter: """Log event record in JSON format. Subclass this for finer control.""" def prep_record(self, record): """Prepare event record for logging. :param record: Record of event to be logged :type record: LogRecord :return: Transformed LogRecord object :trype: LogRecord""" ...
the_stack_v2_python_sparse
application/src/main/python/lib/logger/json_base_log_formatter.py
okebinda/base.api.python
train
0
957dfaa24d2691c1f009285e5044206712165d44
[ "super(DoubleCritic, self).__init__()\nself.critic1 = tf.keras.Sequential([tf.keras.layers.Dense(256, input_shape=(state_dim + action_dim,), activation=tf.nn.relu, kernel_initializer='orthogonal'), tf.keras.layers.Dense(256, activation=tf.nn.relu, kernel_initializer='orthogonal'), tf.keras.layers.Dense(1, kernel_in...
<|body_start_0|> super(DoubleCritic, self).__init__() self.critic1 = tf.keras.Sequential([tf.keras.layers.Dense(256, input_shape=(state_dim + action_dim,), activation=tf.nn.relu, kernel_initializer='orthogonal'), tf.keras.layers.Dense(256, activation=tf.nn.relu, kernel_initializer='orthogonal'), tf.kera...
A critic network that estimates a dual Q-function.
DoubleCritic
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleCritic: """A critic network that estimates a dual Q-function.""" def __init__(self, state_dim, action_dim): """Creates networks. Args: state_dim: State size. action_dim: Action size.""" <|body_0|> def call(self, states, actions): """Returns Q-value estimate...
stack_v2_sparse_classes_36k_train_017540
19,382
permissive
[ { "docstring": "Creates networks. Args: state_dim: State size. action_dim: Action size.", "name": "__init__", "signature": "def __init__(self, state_dim, action_dim)" }, { "docstring": "Returns Q-value estimates for given states and actions. Args: states: A batch of states. actions: A batch of a...
2
stack_v2_sparse_classes_30k_train_014584
Implement the Python class `DoubleCritic` described below. Class description: A critic network that estimates a dual Q-function. Method signatures and docstrings: - def __init__(self, state_dim, action_dim): Creates networks. Args: state_dim: State size. action_dim: Action size. - def call(self, states, actions): Ret...
Implement the Python class `DoubleCritic` described below. Class description: A critic network that estimates a dual Q-function. Method signatures and docstrings: - def __init__(self, state_dim, action_dim): Creates networks. Args: state_dim: State size. action_dim: Action size. - def call(self, states, actions): Ret...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class DoubleCritic: """A critic network that estimates a dual Q-function.""" def __init__(self, state_dim, action_dim): """Creates networks. Args: state_dim: State size. action_dim: Action size.""" <|body_0|> def call(self, states, actions): """Returns Q-value estimate...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoubleCritic: """A critic network that estimates a dual Q-function.""" def __init__(self, state_dim, action_dim): """Creates networks. Args: state_dim: State size. action_dim: Action size.""" super(DoubleCritic, self).__init__() self.critic1 = tf.keras.Sequential([tf.keras.layers....
the_stack_v2_python_sparse
algae_dice/algae.py
Ayoob7/google-research
train
2
da9fe439af3d65a216d67ba4ca0043025586241f
[ "self.qualifier = parent.get('qualifier', '')\nself.rtype = parent.get('rtype', [])\nself.red_index = parent.get('red_index', None)\nself.red_dim = parent.get('red_dim', None)\nself.apply_to = kwargs.get(self.qualifier + '_apply_to', kwargs.get('apply_to', []))\nif self.apply_to is None:\n self.apply_to = []\nif...
<|body_start_0|> self.qualifier = parent.get('qualifier', '') self.rtype = parent.get('rtype', []) self.red_index = parent.get('red_index', None) self.red_dim = parent.get('red_dim', None) self.apply_to = kwargs.get(self.qualifier + '_apply_to', kwargs.get('apply_to', [])) ...
InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype.
InvariantRtypeSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvariantRtypeSampling: """InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sampler. [inputs] (parent=dict(), **kwargs) parent: object o...
stack_v2_sparse_classes_36k_train_017541
7,623
permissive
[ { "docstring": "Initialize the sampler. [inputs] (parent=dict(), **kwargs) parent: object or dictionary composed of the parent instantiation or namespace (e.g. class HyperManager from mner.solvers.manager.py) from which the sampler is instantiated. - qualifier: (default=\"\") string that preprends a prefix to t...
2
stack_v2_sparse_classes_30k_train_005640
Implement the Python class `InvariantRtypeSampling` described below. Class description: InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype. Method signatures and docstrings: - def __init__(self, parent=dict(), **kwargs): Initialize the sam...
Implement the Python class `InvariantRtypeSampling` described below. Class description: InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype. Method signatures and docstrings: - def __init__(self, parent=dict(), **kwargs): Initialize the sam...
97d2f67304478dcf6fb26294ed357f8c31601d01
<|skeleton|> class InvariantRtypeSampling: """InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sampler. [inputs] (parent=dict(), **kwargs) parent: object o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvariantRtypeSampling: """InvariantRtypeSampling (class) Sample a feasible point for invariant hyperparameters. See mner.solvers.constraints.InvariantRtype.""" def __init__(self, parent=dict(), **kwargs): """Initialize the sampler. [inputs] (parent=dict(), **kwargs) parent: object or dictionary ...
the_stack_v2_python_sparse
mner/solvers/samplers.py
jkaardal/mner
train
5
e7c5b8207d45c3708ccade8e6a49532a0c207425
[ "def dfs(i):\n for j in range(self.m):\n if M[i][j] == 1 and (not visited[j]):\n visited[j] = 1\n dfs(j)\nres = 0\nself.m, self.n = (len(M), len(M[0]))\nvisited = [0] * self.n\nfor i in range(self.m):\n for j in range(self.n):\n if not visited[i]:\n dfs(i)\n ...
<|body_start_0|> def dfs(i): for j in range(self.m): if M[i][j] == 1 and (not visited[j]): visited[j] = 1 dfs(j) res = 0 self.m, self.n = (len(M), len(M[0])) visited = [0] * self.n for i in range(self.m): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_union_found(self, M): """:type M: List[List[int]] :rtype: int [-1, 0, 1] 0, 1, 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(i)...
stack_v2_sparse_classes_36k_train_017542
2,383
no_license
[ { "docstring": ":type M: List[List[int]] :rtype: int", "name": "findCircleNum", "signature": "def findCircleNum(self, M)" }, { "docstring": ":type M: List[List[int]] :rtype: int [-1, 0, 1] 0, 1, 2", "name": "findCircleNum_union_found", "signature": "def findCircleNum_union_found(self, M)...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_union_found(self, M): :type M: List[List[int]] :rtype: int [-1, 0, 1] 0, 1, 2
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_union_found(self, M): :type M: List[List[int]] :rtype: int [-1, 0, 1] 0, 1, 2 <|skeleton|> c...
2e1751263f484709102f7f2caf18776a004c8230
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_union_found(self, M): """:type M: List[List[int]] :rtype: int [-1, 0, 1] 0, 1, 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" def dfs(i): for j in range(self.m): if M[i][j] == 1 and (not visited[j]): visited[j] = 1 dfs(j) res = 0 self.m, self.n = (len(M),...
the_stack_v2_python_sparse
Python/Leetcode Daily Practice/Graph/547. Friend Circles.py
YaqianQi/Algorithm-and-Data-Structure
train
1
0b16ba59eec2d77e012fb8d975f94cca7a921172
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('aquan_erj826', 'aquan_erj826')\ncollection = repo.aquan_erj826.firearms\nrepo.dropCollection('gunsRecovered')\nrepo.createCollection('gunsRecovered')\nfor point in collection.find():\n total = int(poi...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('aquan_erj826', 'aquan_erj826') collection = repo.aquan_erj826.firearms repo.dropCollection('gunsRecovered') repo.createCollection('gunsRec...
gunsRecovered
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gunsRecovered: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything...
stack_v2_sparse_classes_36k_train_017543
4,457
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_014714
Implement the Python class `gunsRecovered` described below. Class description: Implement the gunsRecovered class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, e...
Implement the Python class `gunsRecovered` described below. Class description: Implement the gunsRecovered class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, e...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class gunsRecovered: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class gunsRecovered: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('aquan_erj826', 'aquan_erj826') ...
the_stack_v2_python_sparse
aquan_erj826/gunsRecovered.py
ROODAY/course-2017-fal-proj
train
3
6391941463f7b8c05574ffd7c09be11c5b2e0ea8
[ "cls.database = TransportDatabase()\ncls.database.load(os.path.join(settings['database.directory'], 'transport'), ['GRI-Mech', 'PrimaryTransportLibrary'])\ncls.speciesList = [Species().from_smiles('C'), Species().from_smiles('CCCC'), Species().from_smiles('O'), Species().from_smiles('[CH3]'), Species().from_smiles(...
<|body_start_0|> cls.database = TransportDatabase() cls.database.load(os.path.join(settings['database.directory'], 'transport'), ['GRI-Mech', 'PrimaryTransportLibrary']) cls.speciesList = [Species().from_smiles('C'), Species().from_smiles('CCCC'), Species().from_smiles('O'), Species().from_smile...
Contains unit tests of the :class:`TransportDatabase` class.
TestTransportDatabase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTransportDatabase: """Contains unit tests of the :class:`TransportDatabase` class.""" def setUpClass(cls): """A function that is run ONCE before all unit tests in this class.""" <|body_0|> def test_joback(self): """Test transport property estimation via Jobac...
stack_v2_sparse_classes_36k_train_017544
10,300
permissive
[ { "docstring": "A function that is run ONCE before all unit tests in this class.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test transport property estimation via Joback groups.", "name": "test_joback", "signature": "def test_joback(self)" }, { ...
5
null
Implement the Python class `TestTransportDatabase` described below. Class description: Contains unit tests of the :class:`TransportDatabase` class. Method signatures and docstrings: - def setUpClass(cls): A function that is run ONCE before all unit tests in this class. - def test_joback(self): Test transport property...
Implement the Python class `TestTransportDatabase` described below. Class description: Contains unit tests of the :class:`TransportDatabase` class. Method signatures and docstrings: - def setUpClass(cls): A function that is run ONCE before all unit tests in this class. - def test_joback(self): Test transport property...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestTransportDatabase: """Contains unit tests of the :class:`TransportDatabase` class.""" def setUpClass(cls): """A function that is run ONCE before all unit tests in this class.""" <|body_0|> def test_joback(self): """Test transport property estimation via Jobac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTransportDatabase: """Contains unit tests of the :class:`TransportDatabase` class.""" def setUpClass(cls): """A function that is run ONCE before all unit tests in this class.""" cls.database = TransportDatabase() cls.database.load(os.path.join(settings['database.directory'], '...
the_stack_v2_python_sparse
rmgpy/data/transportTest.py
CanePan-cc/CanePanWorkshop
train
2
3881ec7a9aa8e8b88a1518f7663a807e5b4798da
[ "super().__init__(name=name, add_dry=add_dry, trainable=trainable)\nself._reverb_length = reverb_length\nself._scale_fn = scale_fn", "gain = self._scale_fn(gain)\ndecay_exponent = 2.0 + tf.exp(decay)\ntime = tf.linspace(0.0, 1.0, self._reverb_length)[tf.newaxis, :]\nnoise = tf.random.uniform([1, self._reverb_leng...
<|body_start_0|> super().__init__(name=name, add_dry=add_dry, trainable=trainable) self._reverb_length = reverb_length self._scale_fn = scale_fn <|end_body_0|> <|body_start_1|> gain = self._scale_fn(gain) decay_exponent = 2.0 + tf.exp(decay) time = tf.linspace(0.0, 1.0, ...
Parameterize impulse response as a simple exponential decay.
ExpDecayReverb
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpDecayReverb: """Parameterize impulse response as a simple exponential decay.""" def __init__(self, trainable=False, reverb_length=48000, scale_fn=core.exp_sigmoid, add_dry=True, name='exp_decay_reverb'): """Constructor. Args: trainable: Learn the impulse_response as a single varia...
stack_v2_sparse_classes_36k_train_017545
13,484
permissive
[ { "docstring": "Constructor. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. reverb_length: Length of the impulse response. scale_fn: Function by which to scale the network outputs. add_dry: Add dry signal to reverberated signal on output. name: Name of processor module....
4
null
Implement the Python class `ExpDecayReverb` described below. Class description: Parameterize impulse response as a simple exponential decay. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, scale_fn=core.exp_sigmoid, add_dry=True, name='exp_decay_reverb'): Constructor. Args...
Implement the Python class `ExpDecayReverb` described below. Class description: Parameterize impulse response as a simple exponential decay. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, scale_fn=core.exp_sigmoid, add_dry=True, name='exp_decay_reverb'): Constructor. Args...
7e0a39420f3bd87d9efd54cf0d36f4e258311340
<|skeleton|> class ExpDecayReverb: """Parameterize impulse response as a simple exponential decay.""" def __init__(self, trainable=False, reverb_length=48000, scale_fn=core.exp_sigmoid, add_dry=True, name='exp_decay_reverb'): """Constructor. Args: trainable: Learn the impulse_response as a single varia...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpDecayReverb: """Parameterize impulse response as a simple exponential decay.""" def __init__(self, trainable=False, reverb_length=48000, scale_fn=core.exp_sigmoid, add_dry=True, name='exp_decay_reverb'): """Constructor. Args: trainable: Learn the impulse_response as a single variable for the e...
the_stack_v2_python_sparse
ddsp/effects.py
magenta/ddsp
train
2,666
7365b6ac70ccad11cfdc5c9f2f4256e8a76a827f
[ "self.min_heap = []\nself.heap_size = 0\nself.k = k\nfor num in nums:\n self.add(num)", "heapq.heappush(self.min_heap, val)\nself.heap_size += 1\nif self.heap_size > self.k:\n self.heap_size -= 1\n heapq.heappop(self.min_heap)\nreturn self.min_heap[0]" ]
<|body_start_0|> self.min_heap = [] self.heap_size = 0 self.k = k for num in nums: self.add(num) <|end_body_0|> <|body_start_1|> heapq.heappush(self.min_heap, val) self.heap_size += 1 if self.heap_size > self.k: self.heap_size -= 1 ...
KthLargest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.min_heap = [] self.heap_size = 0 self...
stack_v2_sparse_classes_36k_train_017546
702
permissive
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_018193
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.min_heap = [] self.heap_size = 0 self.k = k for num in nums: self.add(num) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.mi...
the_stack_v2_python_sparse
701-800/701-710/703-kthLargestElementInStream/kthLargestElementInStream.py
xuychen/Leetcode
train
0
c7343e36430c63026d8a3c6cd5fe11726cb84ca3
[ "pm_operations = ('suspend', 'hibernate', 'poweroff', 'reboot')\ndescription = 'Run power management operation as many times as needed'\nepilog = 'Unknown arguments will be passed to the underlying command: pm-suspend, pm-hibernate, poweroff or reboot.'\nparser = ArgumentParser(description=description, epilog=epilo...
<|body_start_0|> pm_operations = ('suspend', 'hibernate', 'poweroff', 'reboot') description = 'Run power management operation as many times as needed' epilog = 'Unknown arguments will be passed to the underlying command: pm-suspend, pm-hibernate, poweroff or reboot.' parser = ArgumentPar...
Command-line argument parser
MyArgumentParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyArgumentParser: """Command-line argument parser""" def __init__(self): """Create parser object""" <|body_0|> def parse(self): """Parse command-line arguments""" <|body_1|> <|end_skeleton|> <|body_start_0|> pm_operations = ('suspend', 'hibernat...
stack_v2_sparse_classes_36k_train_017547
33,067
permissive
[ { "docstring": "Create parser object", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parse command-line arguments", "name": "parse", "signature": "def parse(self)" } ]
2
stack_v2_sparse_classes_30k_train_014845
Implement the Python class `MyArgumentParser` described below. Class description: Command-line argument parser Method signatures and docstrings: - def __init__(self): Create parser object - def parse(self): Parse command-line arguments
Implement the Python class `MyArgumentParser` described below. Class description: Command-line argument parser Method signatures and docstrings: - def __init__(self): Create parser object - def parse(self): Parse command-line arguments <|skeleton|> class MyArgumentParser: """Command-line argument parser""" ...
40ceac081f5181d01e188a5a1c40463d891203e6
<|skeleton|> class MyArgumentParser: """Command-line argument parser""" def __init__(self): """Create parser object""" <|body_0|> def parse(self): """Parse command-line arguments""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyArgumentParser: """Command-line argument parser""" def __init__(self): """Create parser object""" pm_operations = ('suspend', 'hibernate', 'poweroff', 'reboot') description = 'Run power management operation as many times as needed' epilog = 'Unknown arguments will be pas...
the_stack_v2_python_sparse
work/pm.py
sebastian-code/ideas_sueltas
train
0
8759db8511b71ca538f7077b755f7c88e2094a6b
[ "self.__keyframepath = keyframepath\nself.__featuressavepath = featuressavepath\nself.__resizeheight = resizeheight\nself.__resizewidth = resizewidth", "if os.path.isdir(self.__keyframepath):\n for dirpath, dirnames, filenames in os.walk(self.__keyframepath):\n for filename in filenames:\n se...
<|body_start_0|> self.__keyframepath = keyframepath self.__featuressavepath = featuressavepath self.__resizeheight = resizeheight self.__resizewidth = resizewidth <|end_body_0|> <|body_start_1|> if os.path.isdir(self.__keyframepath): for dirpath, dirnames, filenames ...
FeaturesExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_017548
8,999
no_license
[ { "docstring": "初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽", "name": "__init__", "signature": "def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320)" }, { ...
5
stack_v2_sparse_classes_30k_train_010815
Implement the Python class `FeaturesExtractor` described below. Class description: Implement the FeaturesExtractor class. Method signatures and docstrings: - def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): 初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: h...
Implement the Python class `FeaturesExtractor` described below. Class description: Implement the FeaturesExtractor class. Method signatures and docstrings: - def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): 初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: h...
805ae46ab3a6585b89c5360e55f42108e4b66fd5
<|skeleton|> class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" self.__keyframepath = keyfram...
the_stack_v2_python_sparse
myFirstPoint/FeaturesExtractor.py
SunBite/ProvincialProject
train
1
99f9cda242fbf8f4ea55a30b7055431636debd44
[ "format_msg = '%(asctime)s [%(levelname)s] %(message)s'\nself._log_level = int(log_level)\nself._formatter = logging.Formatter(format_msg)\nfor h in reversed(list(logging.getLogger().handlers)):\n logging.getLogger().removeHandler(h)\nself._handler = logging.NullHandler()\nlogging.getLogger().addHandler(self._ha...
<|body_start_0|> format_msg = '%(asctime)s [%(levelname)s] %(message)s' self._log_level = int(log_level) self._formatter = logging.Formatter(format_msg) for h in reversed(list(logging.getLogger().handlers)): logging.getLogger().removeHandler(h) self._handler = logging...
Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi
sppasLogSetup
[ "GPL-3.0-only", "GFDL-1.1-or-later", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasLogSetup: """Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi""" def __init__(self, log_leve...
stack_v2_sparse_classes_36k_train_017549
7,943
permissive
[ { "docstring": "Create a sppasLogSetup instance. By default, the NullHandler is assigned. The numeric values of logging levels are given in the following: - CRITICAL 50 - ERROR 40 - WARNING 30 - INFO 20 - DEBUG 10 - NOTSET 0 :param log_level: Sets the threshold for this logger. Logging messages which are less s...
6
null
Implement the Python class `sppasLogSetup` described below. Class description: Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte B...
Implement the Python class `sppasLogSetup` described below. Class description: Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte B...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasLogSetup: """Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi""" def __init__(self, log_leve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sppasLogSetup: """Utility class to initialize the python logging system. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi""" def __init__(self, log_level=0): ...
the_stack_v2_python_sparse
sppas/sppas/src/ui/logs.py
mirfan899/MTTS
train
0
ce2d9685bfb3e088b13c668bd9dda946cd9539eb
[ "self.vae = vae\nself.vgmm = vgmm\nself.hps = hps\nself.utils = utils\nself.is_chief = is_chief\nself.gamma_steps = resolve_simple_number(hps, 'gammaSteps')\nself.gmm_steps = resolve_simple_number(hps, 'gmmSteps')\nself.gamma_gmm_training_steps = self.gamma_steps + self.gmm_steps\nself.beta_steps = resolve_simple_n...
<|body_start_0|> self.vae = vae self.vgmm = vgmm self.hps = hps self.utils = utils self.is_chief = is_chief self.gamma_steps = resolve_simple_number(hps, 'gammaSteps') self.gmm_steps = resolve_simple_number(hps, 'gmmSteps') self.gamma_gmm_training_steps = ...
S3VDC Training flow control
S3VDCHook
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3VDCHook: """S3VDC Training flow control""" def __init__(self, vae: dict, vgmm: dict, hps: Union[tf.contrib.training.HParams, dict], utils: dict, is_chief: bool) -> None: """Initialize the S3VDCHook. Arguments: vae {dict} -- The tuple return by calling function get_cvae(). vgmm {dic...
stack_v2_sparse_classes_36k_train_017550
26,382
permissive
[ { "docstring": "Initialize the S3VDCHook. Arguments: vae {dict} -- The tuple return by calling function get_cvae(). vgmm {dict} -- The global GMM model weights/paramters. hps {Union[tf.contrib.training.HParams, dict]} -- Hyper parameters. utils {dict} -- The utility Tensors to be used by this class. is_chief {b...
3
stack_v2_sparse_classes_30k_train_017047
Implement the Python class `S3VDCHook` described below. Class description: S3VDC Training flow control Method signatures and docstrings: - def __init__(self, vae: dict, vgmm: dict, hps: Union[tf.contrib.training.HParams, dict], utils: dict, is_chief: bool) -> None: Initialize the S3VDCHook. Arguments: vae {dict} -- T...
Implement the Python class `S3VDCHook` described below. Class description: S3VDC Training flow control Method signatures and docstrings: - def __init__(self, vae: dict, vgmm: dict, hps: Union[tf.contrib.training.HParams, dict], utils: dict, is_chief: bool) -> None: Initialize the S3VDCHook. Arguments: vae {dict} -- T...
baa6689a6344f417758d4d8b4e6c6e966a510b32
<|skeleton|> class S3VDCHook: """S3VDC Training flow control""" def __init__(self, vae: dict, vgmm: dict, hps: Union[tf.contrib.training.HParams, dict], utils: dict, is_chief: bool) -> None: """Initialize the S3VDCHook. Arguments: vae {dict} -- The tuple return by calling function get_cvae(). vgmm {dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3VDCHook: """S3VDC Training flow control""" def __init__(self, vae: dict, vgmm: dict, hps: Union[tf.contrib.training.HParams, dict], utils: dict, is_chief: bool) -> None: """Initialize the S3VDCHook. Arguments: vae {dict} -- The tuple return by calling function get_cvae(). vgmm {dict} -- The glo...
the_stack_v2_python_sparse
lib/user_custom_model.py
tmaone/s3vdc
train
0
11e4939c10aedc6d4517fcbe409a099f5181e2d9
[ "self.drone = drone\nself.Kp_lin_vel = np.array([[5.0], [5.0], [5.0]])\nself.Kd_lin_vel = np.array([[2.5], [2.5], [0]])\nself.Kp_ang_vel = 10.0\nself.Kd_ang_vel = 5.0\nself.Kp_yaw_vel = 1.0", "world_acc_cmd = self.Kp_lin_vel * (xdot_desired - self.drone.xdot)\n-self.Kd_lin_vel * self.drone.xdoubledot\nworld_acc_c...
<|body_start_0|> self.drone = drone self.Kp_lin_vel = np.array([[5.0], [5.0], [5.0]]) self.Kd_lin_vel = np.array([[2.5], [2.5], [0]]) self.Kp_ang_vel = 10.0 self.Kd_ang_vel = 5.0 self.Kp_yaw_vel = 1.0 <|end_body_0|> <|body_start_1|> world_acc_cmd = self.Kp_lin_ve...
A class defining a simple PID Controller. for a simulated drone
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """A class defining a simple PID Controller. for a simulated drone""" def __init__(self, drone): """Initialize an instance of a drone controller.""" <|body_0|> def calculate_control_command(self, dt, xdot_desired, yawdot_desired): """Calculate a contr...
stack_v2_sparse_classes_36k_train_017551
1,644
no_license
[ { "docstring": "Initialize an instance of a drone controller.", "name": "__init__", "signature": "def __init__(self, drone)" }, { "docstring": "Calculate a control command for an xdot and thetadot desired.", "name": "calculate_control_command", "signature": "def calculate_control_command...
2
stack_v2_sparse_classes_30k_train_008720
Implement the Python class `Controller` described below. Class description: A class defining a simple PID Controller. for a simulated drone Method signatures and docstrings: - def __init__(self, drone): Initialize an instance of a drone controller. - def calculate_control_command(self, dt, xdot_desired, yawdot_desire...
Implement the Python class `Controller` described below. Class description: A class defining a simple PID Controller. for a simulated drone Method signatures and docstrings: - def __init__(self, drone): Initialize an instance of a drone controller. - def calculate_control_command(self, dt, xdot_desired, yawdot_desire...
301121da01382c1d0acb9af20d7b269ba177f820
<|skeleton|> class Controller: """A class defining a simple PID Controller. for a simulated drone""" def __init__(self, drone): """Initialize an instance of a drone controller.""" <|body_0|> def calculate_control_command(self, dt, xdot_desired, yawdot_desired): """Calculate a contr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """A class defining a simple PID Controller. for a simulated drone""" def __init__(self, drone): """Initialize an instance of a drone controller.""" self.drone = drone self.Kp_lin_vel = np.array([[5.0], [5.0], [5.0]]) self.Kd_lin_vel = np.array([[2.5], [2.5], [...
the_stack_v2_python_sparse
phx_simulator/src/simulator/controller.py
tum-phoenix/phx_quadrocopter_ros
train
2
32b9e78961547634f7218d040a588a14fa4d12bc
[ "try:\n super(InitCmd, self).__init__(config, services)\n self.setup_type = self.get_confvalue_with_defaults('CONFIG>CONFSTORE_SETUP_TYPE')\n Log.info(f'log file path : {self.setup_type}')\n self.cluster_id = self.get_confvalue_with_defaults('CONFIG>CONFSTORE_CLUSTER_ID_KEY')\n Log.info(f'Cluster\\ti...
<|body_start_0|> try: super(InitCmd, self).__init__(config, services) self.setup_type = self.get_confvalue_with_defaults('CONFIG>CONFSTORE_SETUP_TYPE') Log.info(f'log file path : {self.setup_type}') self.cluster_id = self.get_confvalue_with_defaults('CONFIG>CONFST...
Init Setup Cmd.
InitCmd
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitCmd: """Init Setup Cmd.""" def __init__(self, config: str, services: str=None): """Constructor.""" <|body_0|> def process(self): """Main processing function.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: super(InitCmd, sel...
stack_v2_sparse_classes_36k_train_017552
4,826
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, config: str, services: str=None)" }, { "docstring": "Main processing function.", "name": "process", "signature": "def process(self)" } ]
2
stack_v2_sparse_classes_30k_val_000572
Implement the Python class `InitCmd` described below. Class description: Init Setup Cmd. Method signatures and docstrings: - def __init__(self, config: str, services: str=None): Constructor. - def process(self): Main processing function.
Implement the Python class `InitCmd` described below. Class description: Init Setup Cmd. Method signatures and docstrings: - def __init__(self, config: str, services: str=None): Constructor. - def process(self): Main processing function. <|skeleton|> class InitCmd: """Init Setup Cmd.""" def __init__(self, c...
b1987967aec7e24530c9703db6f100d2c8289624
<|skeleton|> class InitCmd: """Init Setup Cmd.""" def __init__(self, config: str, services: str=None): """Constructor.""" <|body_0|> def process(self): """Main processing function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InitCmd: """Init Setup Cmd.""" def __init__(self, config: str, services: str=None): """Constructor.""" try: super(InitCmd, self).__init__(config, services) self.setup_type = self.get_confvalue_with_defaults('CONFIG>CONFSTORE_SETUP_TYPE') Log.info(f'log ...
the_stack_v2_python_sparse
scripts/provisioning/initcmd.py
Seagate/cortx-s3server
train
38
fccf0a093fabd4960d36d194df00087e15c6b8d7
[ "self.node_name = node_name\nself.batch_normalize = batch_normalize\nassert len(conv_weight_dims) == 4\nself.conv_weight_dims = conv_weight_dims", "assert suffix\nassert param_category in ['bn', 'conv']\nassert suffix in ['scale', 'mean', 'var', 'weights', 'bias']\nif param_category == 'bn':\n assert self.batc...
<|body_start_0|> self.node_name = node_name self.batch_normalize = batch_normalize assert len(conv_weight_dims) == 4 self.conv_weight_dims = conv_weight_dims <|end_body_0|> <|body_start_1|> assert suffix assert param_category in ['bn', 'conv'] assert suffix in ['...
Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe names for all weights, checking on feasible combinations.
ConvParams
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvParams: """Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe names for all weights, checking on feasi...
stack_v2_sparse_classes_36k_train_017553
29,876
permissive
[ { "docstring": "Constructor based on the base node name (e.g. 101_convolutional), the batch normalization setting, and the convolutional weights shape. Keyword arguments: node_name -- base name of this YOLO convolutional layer batch_normalize -- bool value if batch normalization is used conv_weight_dims -- the ...
2
stack_v2_sparse_classes_30k_train_007512
Implement the Python class `ConvParams` described below. Class description: Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe n...
Implement the Python class `ConvParams` described below. Class description: Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe n...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class ConvParams: """Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe names for all weights, checking on feasi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvParams: """Helper class to store the hyper parameters of a Conv layer, including its prefix name in the ONNX graph and the expected dimensions of weights for convolution, bias, and batch normalization. Additionally acts as a wrapper for generating safe names for all weights, checking on feasible combinati...
the_stack_v2_python_sparse
samples/python/yolov3_onnx/yolov3_to_onnx.py
NVIDIA/TensorRT
train
8,026
ab13cad3d494677b33821e9473c61a533631d073
[ "pre_order = []\nin_order = []\n\ndef pre_search(root):\n if not root:\n return\n pre_order.append(root.val)\n pre_search(root.left)\n pre_search(root.right)\n\ndef in_search(root):\n if not root:\n return\n in_search(root.left)\n in_order.append(root.val)\n in_search(root.righ...
<|body_start_0|> pre_order = [] in_order = [] def pre_search(root): if not root: return pre_order.append(root.val) pre_search(root.left) pre_search(root.right) def in_search(root): if not root: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_017554
4,279
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_014241
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
7ffdb772ad7252f3d4b9aa2689a92cb1f10c8f37
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" pre_order = [] in_order = [] def pre_search(root): if not root: return pre_order.append(root.val) pre_search(root.lef...
the_stack_v2_python_sparse
二叉树/297-二叉树的序列化和反序列化.py
zhengsizuo/leetcode-zhs
train
0
6b0ae4f2450912af142d3c414a4aef035202e0b3
[ "if not strs:\n return ''\nelse:\n encoded = ''\n for s in strs:\n encoded += str(len(s)) + '/' + s\n return encoded", "if s is None:\n return []\nelse:\n start = 0\n decodes = []\n while start < len(s):\n delimiter = s.index('/', start)\n length = int(s[start:delimite...
<|body_start_0|> if not strs: return '' else: encoded = '' for s in strs: encoded += str(len(s)) + '/' + s return encoded <|end_body_0|> <|body_start_1|> if s is None: return [] else: start = 0 ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_017555
980
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
08c6d27498e35f636045fed05a6f94b760ab69ca
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" if not strs: return '' else: encoded = '' for s in strs: encoded += str(len(s)) + '/' + s return encoded ...
the_stack_v2_python_sparse
solutions/string/271.Encode.and.Decode.Strings.py
ljia2/leetcode.py
train
0
6e8232eead4a1f47b24718ff0c85c9d620cf1f1b
[ "if self.on and mode.lighting and (mode.lightingAmbient or mode.lightingDiffuse):\n glEnable(GL_LIGHTING)\n glEnable(lightID)\n if mode.lightingAmbient:\n x, y, z = self.color * self.ambientIntensity\n else:\n x, y, z = (0.0, 0.0, 0.0)\n glLightfv(lightID, GL_AMBIENT, array((x, y, z, 1....
<|body_start_0|> if self.on and mode.lighting and (mode.lightingAmbient or mode.lightingDiffuse): glEnable(GL_LIGHTING) glEnable(lightID) if mode.lightingAmbient: x, y, z = self.color * self.ambientIntensity else: x, y, z = (0.0, 0....
Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-directional) or direction -- direction a directional or spotlight is shinin...
Light
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Light: """Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-directional) or direction -- direction a d...
stack_v2_sparse_classes_36k_train_017556
6,768
permissive
[ { "docstring": "Render light using given light ID for the given mode This will check for: mode.lighting mode.lightingAmbient mode.lightingDiffuse and appropriately enable/disable the various features. Returns whether or not the light ID has been used, which allows us to reuse the light ID in case this light doe...
3
null
Implement the Python class `Light` described below. Class description: Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-dir...
Implement the Python class `Light` described below. Class description: Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-dir...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class Light: """Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-directional) or direction -- direction a d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Light: """Abstract base class for all lights attributes: pointSource -- whether or not we are a point light source, stored as a float value, if false, the light is a directional light location -- the object-space location of point-source lights (i.e. non-directional) or direction -- direction a directional or...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/light.py
alexus37/AugmentedRealityChess
train
1
7b27e3c61da94bb5b84f8110ae4e27c812df962b
[ "if not root:\n return []\ndeque = [root]\nres = [root.val]\nwhile deque:\n node = deque.pop(0)\n if node.left:\n deque.append(node.left)\n res.append(node.left.val)\n else:\n res.append(None)\n if node.right:\n deque.append(node.right)\n res.append(node.right.val)\...
<|body_start_0|> if not root: return [] deque = [root] res = [root.val] while deque: node = deque.pop(0) if node.left: deque.append(node.left) res.append(node.left.val) else: res.append(None) ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_017557
3,176
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_005037
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
15637e260ab547022ac0c828dd196337bd8d50a3
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] deque = [root] res = [root.val] while deque: node = deque.pop(0) if node.left: deque.ap...
the_stack_v2_python_sparse
Widen/LC297_Serialize_and_Deserialize_Binary_Tree.py
crazywiden/Leetcode_daily_submit
train
0
dc0ceff1b63af4846d225c84fa3be36ae9f462b2
[ "self.P_spec_given_gcf = []\nself.P_spec_not_gcf = []\nself.P_gcf_given_spec = []\nself.P_gcf_not_spec = []\nself.P_fam_given_gcf = []\nself.P_fam_not_gcf = []\nself.P_gcf_given_fam = []\nself.P_gcf_not_fam = []", "if type == 'spec-gcf':\n M_type1_type2 = data_links.cooccurrence_spec_gcf\n M_type1_nottype2 ...
<|body_start_0|> self.P_spec_given_gcf = [] self.P_spec_not_gcf = [] self.P_gcf_given_spec = [] self.P_gcf_not_spec = [] self.P_fam_given_gcf = [] self.P_fam_not_gcf = [] self.P_gcf_given_fam = [] self.P_gcf_not_fam = [] <|end_body_0|> <|body_start_1|> ...
Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links
LinkLikelihood
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkLikelihood: """Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links""" def __init__(self): """Matrices that store likelihoods of empirically found co-occurence Example: P_spec_givengcf contains likelihoods P(spec_x|gcf_y...
stack_v2_sparse_classes_36k_train_017558
3,710
permissive
[ { "docstring": "Matrices that store likelihoods of empirically found co-occurence Example: P_spec_givengcf contains likelihoods P(spec_x|gcf_y), which is the probability of finding spec_x given there is a gcf_y", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Calulate l...
2
null
Implement the Python class `LinkLikelihood` described below. Class description: Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links Method signatures and docstrings: - def __init__(self): Matrices that store likelihoods of empirically found co-occurence Exa...
Implement the Python class `LinkLikelihood` described below. Class description: Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links Method signatures and docstrings: - def __init__(self): Matrices that store likelihoods of empirically found co-occurence Exa...
e1973da6b667ee0e0c18112ae235a76bbeeead49
<|skeleton|> class LinkLikelihood: """Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links""" def __init__(self): """Matrices that store likelihoods of empirically found co-occurence Example: P_spec_givengcf contains likelihoods P(spec_x|gcf_y...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkLikelihood: """Class to: 1) create ansd store likelihood matrices (from co-occurences) 2) select potential calculates for links""" def __init__(self): """Matrices that store likelihoods of empirically found co-occurence Example: P_spec_givengcf contains likelihoods P(spec_x|gcf_y), which is t...
the_stack_v2_python_sparse
src/nplinker/scoring/linking/link_likelihood.py
NPLinker/nplinker
train
9
612474ec474c976d80b4bd68a95b3d59746fea29
[ "json_str = request.body\njson_obj = json.loads(json_str)\nreceiver = json_obj['receiver']\nreceiver_phone = json_obj['receiver_phone']\naddress = json_obj['address']\npostcode = json_obj['postcode']\ntag = json_obj['tag']\nuser = request.myuser\nold_address = Address.objects.filter(username=user, is_active=True)\n...
<|body_start_0|> json_str = request.body json_obj = json.loads(json_str) receiver = json_obj['receiver'] receiver_phone = json_obj['receiver_phone'] address = json_obj['address'] postcode = json_obj['postcode'] tag = json_obj['tag'] user = request.myuser ...
AddressView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressView: def post(self, request, username): """新建地址""" <|body_0|> def get(self, request, username): """查看地址""" <|body_1|> def put(self, request, address_id, username): """修改地址""" <|body_2|> def delete(self, request, username, add...
stack_v2_sparse_classes_36k_train_017559
10,804
no_license
[ { "docstring": "新建地址", "name": "post", "signature": "def post(self, request, username)" }, { "docstring": "查看地址", "name": "get", "signature": "def get(self, request, username)" }, { "docstring": "修改地址", "name": "put", "signature": "def put(self, request, address_id, usern...
4
stack_v2_sparse_classes_30k_train_006939
Implement the Python class `AddressView` described below. Class description: Implement the AddressView class. Method signatures and docstrings: - def post(self, request, username): 新建地址 - def get(self, request, username): 查看地址 - def put(self, request, address_id, username): 修改地址 - def delete(self, request, username, ...
Implement the Python class `AddressView` described below. Class description: Implement the AddressView class. Method signatures and docstrings: - def post(self, request, username): 新建地址 - def get(self, request, username): 查看地址 - def put(self, request, address_id, username): 修改地址 - def delete(self, request, username, ...
de9776bad68fcb25a7dbe8b1767e9df980a8b83c
<|skeleton|> class AddressView: def post(self, request, username): """新建地址""" <|body_0|> def get(self, request, username): """查看地址""" <|body_1|> def put(self, request, address_id, username): """修改地址""" <|body_2|> def delete(self, request, username, add...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddressView: def post(self, request, username): """新建地址""" json_str = request.body json_obj = json.loads(json_str) receiver = json_obj['receiver'] receiver_phone = json_obj['receiver_phone'] address = json_obj['address'] postcode = json_obj['postcode'] ...
the_stack_v2_python_sparse
fruit_vegetable/user/views.py
txd-git/fruit_vegetables
train
0
ede13065510e4903d5f52abfd5b7ae28abab7134
[ "identifier = self.data['id']\nitem = self.core.item_manager.items.get(identifier)\nif not item:\n return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404)\nreturn self.json({'item': item.identifier, 'type': item.type, 'states': await item.states.dump()})", "identifier = self...
<|body_start_0|> identifier = self.data['id'] item = self.core.item_manager.items.get(identifier) if not item: return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404) return self.json({'item': item.identifier, 'type': item.type, 'states': a...
Item states view
ItemStatesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" <|body_0|> async def post(self) -> JSONResponse: """POST /item/{id}/states""" <|body_1|> <|end_skeleton|> <|body_start_0|> identifier = self....
stack_v2_sparse_classes_36k_train_017560
10,547
permissive
[ { "docstring": "GET /item/{id}/states", "name": "get", "signature": "async def get(self) -> JSONResponse" }, { "docstring": "POST /item/{id}/states", "name": "post", "signature": "async def post(self) -> JSONResponse" } ]
2
stack_v2_sparse_classes_30k_train_005162
Implement the Python class `ItemStatesView` described below. Class description: Item states view Method signatures and docstrings: - async def get(self) -> JSONResponse: GET /item/{id}/states - async def post(self) -> JSONResponse: POST /item/{id}/states
Implement the Python class `ItemStatesView` described below. Class description: Item states view Method signatures and docstrings: - async def get(self) -> JSONResponse: GET /item/{id}/states - async def post(self) -> JSONResponse: POST /item/{id}/states <|skeleton|> class ItemStatesView: """Item states view""" ...
ee630d3ebf96d5b1d2055487d49968bdbb93d5b9
<|skeleton|> class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" <|body_0|> async def post(self) -> JSONResponse: """POST /item/{id}/states""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" identifier = self.data['id'] item = self.core.item_manager.items.get(identifier) if not item: return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with id...
the_stack_v2_python_sparse
homecontrol/modules/api/endpoints.py
lennart-k/HomeControl
train
7
cf09d86ec3eee51348ffaf79f42bb226cf91b885
[ "if 'tune_embeds' not in config.keys():\n raise ValueError('config must define \"tune_embeds\".')\nsuper(TextModel, self).__init__(name, config)\nself.embeds = nn.Embedding(embed_mat.shape[0], embed_mat.shape[1])\nself.embeds.weight = nn.Parameter(torch.from_numpy(embed_mat), requires_grad=self.tune_embeds)", ...
<|body_start_0|> if 'tune_embeds' not in config.keys(): raise ValueError('config must define "tune_embeds".') super(TextModel, self).__init__(name, config) self.embeds = nn.Embedding(embed_mat.shape[0], embed_mat.shape[1]) self.embeds.weight = nn.Parameter(torch.from_numpy(em...
Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding.
TextModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextModel: """Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding.""" def __init__(self, name, config, embed_mat): """Create a new TextModel. Expects config to have a ...
stack_v2_sparse_classes_36k_train_017561
5,995
no_license
[ { "docstring": "Create a new TextModel. Expects config to have a boolean \"tune_embeds\". Raises: ValueError: if \"tune_embeds\" not in config.", "name": "__init__", "signature": "def __init__(self, name, config, embed_mat)" }, { "docstring": "Embedding lookup. Args: ixs: numpy.ndarray of intege...
2
stack_v2_sparse_classes_30k_train_002779
Implement the Python class `TextModel` described below. Class description: Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding. Method signatures and docstrings: - def __init__(self, name, config, embe...
Implement the Python class `TextModel` described below. Class description: Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding. Method signatures and docstrings: - def __init__(self, name, config, embe...
b35744011fcf6622cbd32481290b6d33bc46cd08
<|skeleton|> class TextModel: """Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding.""" def __init__(self, name, config, embed_mat): """Create a new TextModel. Expects config to have a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextModel: """Base text model. Extends base mode with embedding and lookup. Attributes: param_groups: List of dictionaries defining named parameter groups. embeds: torch.nn.Embedding.""" def __init__(self, name, config, embed_mat): """Create a new TextModel. Expects config to have a boolean "tune...
the_stack_v2_python_sparse
ext/models.py
IKMLab/arct
train
8
946d5c9cf9e4cb627e3b51d14465ccf60cb00664
[ "self.V = V\nself.VW = VW\nself.E = E\nself.EW = EW\nself.D = []\nself.P = []\nself.BP = []", "self.D = np.full(shape=np.shape(self.V), fill_value=0.0)\nself.P = np.full(shape=np.shape(self.V), fill_value=0.0)\nfor i in range(np.shape(self.V)[0]):\n if 0 == i:\n self.D[i] = np.multiply(self.V[i], self.V...
<|body_start_0|> self.V = V self.VW = VW self.E = E self.EW = EW self.D = [] self.P = [] self.BP = [] <|end_body_0|> <|body_start_1|> self.D = np.full(shape=np.shape(self.V), fill_value=0.0) self.P = np.full(shape=np.shape(self.V), fill_value=0.0)...
实现条件随机场预测问题的维特比算法
CRFLgb_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CRFLgb_1: """实现条件随机场预测问题的维特比算法""" def __init__(self, V, VW, E, EW): """Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值""" <|body_0|> def Viterbi(self): """条件随机场预测问题的维特比算法,此算法一定要结合CRF参数化形式对应的状态路径图来...
stack_v2_sparse_classes_36k_train_017562
3,764
no_license
[ { "docstring": "Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值", "name": "__init__", "signature": "def __init__(self, V, VW, E, EW)" }, { "docstring": "条件随机场预测问题的维特比算法,此算法一定要结合CRF参数化形式对应的状态路径图来理解,更容易理解.", "name": "Viterbi", ...
2
null
Implement the Python class `CRFLgb_1` described below. Class description: 实现条件随机场预测问题的维特比算法 Method signatures and docstrings: - def __init__(self, V, VW, E, EW): Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值 - def Viterbi(self): 条件随机场预测问题的维特比算法,此算法一...
Implement the Python class `CRFLgb_1` described below. Class description: 实现条件随机场预测问题的维特比算法 Method signatures and docstrings: - def __init__(self, V, VW, E, EW): Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值 - def Viterbi(self): 条件随机场预测问题的维特比算法,此算法一...
32ba7b316a4945d062377a3cc37a926aa79b10b9
<|skeleton|> class CRFLgb_1: """实现条件随机场预测问题的维特比算法""" def __init__(self, V, VW, E, EW): """Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值""" <|body_0|> def Viterbi(self): """条件随机场预测问题的维特比算法,此算法一定要结合CRF参数化形式对应的状态路径图来...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CRFLgb_1: """实现条件随机场预测问题的维特比算法""" def __init__(self, V, VW, E, EW): """Init CRFLgb class :param V: 是定义在节点上的特征函数,称为状态特征 :param VW: 是V对应的权值 :param E: 是定义在边上的特征函数,称为转移特征 :param EW: 是E对应的权值""" self.V = V self.VW = VW self.E = E self.EW = EW self.D = [] ...
the_stack_v2_python_sparse
longgb/Algorithm/TextMining/NLP/methods/CRF.py
longgb246/pythonstudy
train
20
f887f5c163d452818f0a0de76196b476c6d5b86d
[ "if interval1.start > interval2.end or interval2.start > interval1.end:\n return False\nreturn True", "m = 0\nwhile m < len(intervals):\n n = m + 1\n changed = False\n while n < len(intervals):\n if self.isOverlap(intervals[m], intervals[n]):\n intervals[m].start = min(intervals[m].s...
<|body_start_0|> if interval1.start > interval2.end or interval2.start > interval1.end: return False return True <|end_body_0|> <|body_start_1|> m = 0 while m < len(intervals): n = m + 1 changed = False while n < len(intervals): ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isOverlap(self, interval1, interval2): """检测两个区间是否重叠""" <|body_0|> def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if interval1.start > interval2.end...
stack_v2_sparse_classes_36k_train_017563
2,002
permissive
[ { "docstring": "检测两个区间是否重叠", "name": "isOverlap", "signature": "def isOverlap(self, interval1, interval2)" }, { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge", "signature": "def merge(self, intervals)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isOverlap(self, interval1, interval2): 检测两个区间是否重叠 - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isOverlap(self, interval1, interval2): 检测两个区间是否重叠 - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] <|skeleton|> class Solution: def ...
3e2484d19e6845f0f93e78f7b447909bba3efadd
<|skeleton|> class Solution: def isOverlap(self, interval1, interval2): """检测两个区间是否重叠""" <|body_0|> def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isOverlap(self, interval1, interval2): """检测两个区间是否重叠""" if interval1.start > interval2.end or interval2.start > interval1.end: return False return True def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" ...
the_stack_v2_python_sparse
explore_medium/sorting_and_searching/Merge.py
niefy/LeetCodeExam
train
0
8c42522c263eb8d0c4d6be04b4102fab36834681
[ "args = failed_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_by = args['sort_by']\nsort_order = args['order']\nif sort_by == 'failure_time':\n sort_by = 'tof'\nif per_page > 100:\n per_page = 100\ndescending = sort_order == 'desc'\nif per_page > 100:\n per_page = 100\nstart = ...
<|body_start_0|> args = failed_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if sort_by == 'failure_time': sort_by = 'tof' if per_page > 100: per_page = 100 ...
RetryFailed
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetryFailed: def get(self, session=None): """List all failed entries""" <|body_0|> def delete(self, session=None): """Clear all failed entries""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = failed_parser.parse_args() page = args['pag...
stack_v2_sparse_classes_36k_train_017564
4,968
permissive
[ { "docstring": "List all failed entries", "name": "get", "signature": "def get(self, session=None)" }, { "docstring": "Clear all failed entries", "name": "delete", "signature": "def delete(self, session=None)" } ]
2
stack_v2_sparse_classes_30k_train_021616
Implement the Python class `RetryFailed` described below. Class description: Implement the RetryFailed class. Method signatures and docstrings: - def get(self, session=None): List all failed entries - def delete(self, session=None): Clear all failed entries
Implement the Python class `RetryFailed` described below. Class description: Implement the RetryFailed class. Method signatures and docstrings: - def get(self, session=None): List all failed entries - def delete(self, session=None): Clear all failed entries <|skeleton|> class RetryFailed: def get(self, session=...
2b7e8314d103c94cf4552bd0152699eeca0ad159
<|skeleton|> class RetryFailed: def get(self, session=None): """List all failed entries""" <|body_0|> def delete(self, session=None): """Clear all failed entries""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetryFailed: def get(self, session=None): """List all failed entries""" args = failed_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if sort_by == 'failure_time': sort_...
the_stack_v2_python_sparse
flexget/components/failed/api.py
BrutuZ/Flexget
train
1
814035ec0b62709c87d5fd50dd6e931c9c26ffef
[ "self.physics_controller = physics_controller\nself.elevatorGearbox = wpimath.system.plant.DCMotor.vex775Pro(4)\nself.elevatorSim = wpilib.simulation.ElevatorSim(self.elevatorGearbox, robot.kElevatorGearing, robot.kCarriageMass, robot.kElevatorDrumRadius, robot.kMinElevatorHeight, robot.kMaxElevatorHeight, True, [0...
<|body_start_0|> self.physics_controller = physics_controller self.elevatorGearbox = wpimath.system.plant.DCMotor.vex775Pro(4) self.elevatorSim = wpilib.simulation.ElevatorSim(self.elevatorGearbox, robot.kElevatorGearing, robot.kCarriageMass, robot.kElevatorDrumRadius, robot.kMinElevatorHeight, ...
PhysicsEngine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhysicsEngine: def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot'): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to :param robot: your robot object""" <|body_0|> def update_sim(self, now: float, tm...
stack_v2_sparse_classes_36k_train_017565
3,432
no_license
[ { "docstring": ":param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to :param robot: your robot object", "name": "__init__", "signature": "def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot')" }, { "docstring": "Called when the s...
2
stack_v2_sparse_classes_30k_train_017466
Implement the Python class `PhysicsEngine` described below. Class description: Implement the PhysicsEngine class. Method signatures and docstrings: - def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot'): :param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation eff...
Implement the Python class `PhysicsEngine` described below. Class description: Implement the PhysicsEngine class. Method signatures and docstrings: - def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot'): :param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation eff...
edbaa498ef685bed516f6792089f88be1a5db865
<|skeleton|> class PhysicsEngine: def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot'): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to :param robot: your robot object""" <|body_0|> def update_sim(self, now: float, tm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhysicsEngine: def __init__(self, physics_controller: PhysicsInterface, robot: 'MyRobot'): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to :param robot: your robot object""" self.physics_controller = physics_controller self.elevato...
the_stack_v2_python_sparse
elevator-simulation/physics.py
robotpy/examples
train
38
237abd4a1448f0de08bb621423e1b5bd39852364
[ "if len(attrs_dict) > 2 or (len(attrs_dict) != 0 and 1 not in attrs_dict and (2 not in attrs_dict)):\n raise ValueError('Invalid address attributes')\nreturn cls(cbor2.loads(attrs_dict[1]) if 1 in attrs_dict else None, cbor2.loads(attrs_dict[2]) if 2 in attrs_dict else None)", "attrs = {}\nif self.hd_path_enc_...
<|body_start_0|> if len(attrs_dict) > 2 or (len(attrs_dict) != 0 and 1 not in attrs_dict and (2 not in attrs_dict)): raise ValueError('Invalid address attributes') return cls(cbor2.loads(attrs_dict[1]) if 1 in attrs_dict else None, cbor2.loads(attrs_dict[2]) if 2 in attrs_dict else None) <|e...
Utility class for Cardano Byron address attributes.
_AdaByronAddrAttrs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _AdaByronAddrAttrs: """Utility class for Cardano Byron address attributes.""" def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaByronAddrAttrs: """Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dictionary Returns: _AdaByronAddrAttrs object: _AdaByronAddr...
stack_v2_sparse_classes_36k_train_017566
17,963
permissive
[ { "docstring": "Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dictionary Returns: _AdaByronAddrAttrs object: _AdaByronAddrAttrs object Raises: ValueError: If the dictionary is not valid", "name": "FromDict", "signature": "def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaB...
2
null
Implement the Python class `_AdaByronAddrAttrs` described below. Class description: Utility class for Cardano Byron address attributes. Method signatures and docstrings: - def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaByronAddrAttrs: Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dic...
Implement the Python class `_AdaByronAddrAttrs` described below. Class description: Utility class for Cardano Byron address attributes. Method signatures and docstrings: - def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaByronAddrAttrs: Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dic...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class _AdaByronAddrAttrs: """Utility class for Cardano Byron address attributes.""" def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaByronAddrAttrs: """Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dictionary Returns: _AdaByronAddrAttrs object: _AdaByronAddr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _AdaByronAddrAttrs: """Utility class for Cardano Byron address attributes.""" def FromDict(cls, attrs_dict: Dict[int, bytes]) -> _AdaByronAddrAttrs: """Create from dictionary. Args: attrs_dict (dict[int, bytes]): Attributes dictionary Returns: _AdaByronAddrAttrs object: _AdaByronAddrAttrs object ...
the_stack_v2_python_sparse
bip_utils/addr/ada_byron_addr.py
ebellocchia/bip_utils
train
244
2e78dfd255a54c23b1e5667bb5794083a8b312ed
[ "reader = csv.reader(data)\nnext(reader)\nenum = []\nfor item in reader:\n name = item[0]\n dscp = item[2]\n rfcs = item[3]\n temp = []\n for rfc in filter(None, re.split('\\\\[|\\\\]', rfcs)):\n if 'RFC' in rfc and re.match('\\\\d+', rfc[3:]):\n temp.append(f'[:rfc:`{rfc[3:]}`]')\n...
<|body_start_0|> reader = csv.reader(data) next(reader) enum = [] for item in reader: name = item[0] dscp = item[2] rfcs = item[3] temp = [] for rfc in filter(None, re.split('\\[|\\]', rfcs)): if 'RFC' in rfc and...
Handover Acknowledge Flags
HandoverACKFlag
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandoverACKFlag: """Handover Acknowledge Flags""" def process(self, data: 'list[str]') -> 'list[str]': """Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields.""" <|body_0|> def context(self, data: 'list[str]') -> 'str': """Gener...
stack_v2_sparse_classes_36k_train_017567
3,921
permissive
[ { "docstring": "Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields.", "name": "process", "signature": "def process(self, data: 'list[str]') -> 'list[str]'" }, { "docstring": "Generate constant context. Args: soup: Parsed HTML source. Returns: Constant context....
2
null
Implement the Python class `HandoverACKFlag` described below. Class description: Handover Acknowledge Flags Method signatures and docstrings: - def process(self, data: 'list[str]') -> 'list[str]': Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields. - def context(self, data: 'list[s...
Implement the Python class `HandoverACKFlag` described below. Class description: Handover Acknowledge Flags Method signatures and docstrings: - def process(self, data: 'list[str]') -> 'list[str]': Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields. - def context(self, data: 'list[s...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class HandoverACKFlag: """Handover Acknowledge Flags""" def process(self, data: 'list[str]') -> 'list[str]': """Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields.""" <|body_0|> def context(self, data: 'list[str]') -> 'str': """Gener...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HandoverACKFlag: """Handover Acknowledge Flags""" def process(self, data: 'list[str]') -> 'list[str]': """Process CSV data. Args: data: CSV data. Returns: Enumeration fields and missing fields.""" reader = csv.reader(data) next(reader) enum = [] for item in reader:...
the_stack_v2_python_sparse
pcapkit/vendor/mh/handover_ack_flag.py
JarryShaw/PyPCAPKit
train
204
dd9e2e40bad663e26de28c59b3e78fdee63b5e7e
[ "image_name = 'base-image'\nhelper.build_image_impl(helper.Project(image_name), cache=False)\nself.assertIn('--no-cache', mock_docker_build.call_args_list[0][0][0])", "image_name = 'base-image'\nproject = helper.Project(image_name, is_external=True)\nself.assertTrue(helper.build_image_impl(project, pull=True))\nm...
<|body_start_0|> image_name = 'base-image' helper.build_image_impl(helper.Project(image_name), cache=False) self.assertIn('--no-cache', mock_docker_build.call_args_list[0][0][0]) <|end_body_0|> <|body_start_1|> image_name = 'base-image' project = helper.Project(image_name, is_ex...
Tests for build_image_impl.
BuildImageImplTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildImageImplTest: """Tests for build_image_impl.""" def test_no_cache(self, mock_docker_build): """Tests that cache=False is handled properly.""" <|body_0|> def test_pull(self, mock_pull_images, _): """Tests that pull=True is handled properly.""" <|body...
stack_v2_sparse_classes_36k_train_017568
9,554
permissive
[ { "docstring": "Tests that cache=False is handled properly.", "name": "test_no_cache", "signature": "def test_no_cache(self, mock_docker_build)" }, { "docstring": "Tests that pull=True is handled properly.", "name": "test_pull", "signature": "def test_pull(self, mock_pull_images, _)" }...
5
null
Implement the Python class `BuildImageImplTest` described below. Class description: Tests for build_image_impl. Method signatures and docstrings: - def test_no_cache(self, mock_docker_build): Tests that cache=False is handled properly. - def test_pull(self, mock_pull_images, _): Tests that pull=True is handled proper...
Implement the Python class `BuildImageImplTest` described below. Class description: Tests for build_image_impl. Method signatures and docstrings: - def test_no_cache(self, mock_docker_build): Tests that cache=False is handled properly. - def test_pull(self, mock_pull_images, _): Tests that pull=True is handled proper...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class BuildImageImplTest: """Tests for build_image_impl.""" def test_no_cache(self, mock_docker_build): """Tests that cache=False is handled properly.""" <|body_0|> def test_pull(self, mock_pull_images, _): """Tests that pull=True is handled properly.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildImageImplTest: """Tests for build_image_impl.""" def test_no_cache(self, mock_docker_build): """Tests that cache=False is handled properly.""" image_name = 'base-image' helper.build_image_impl(helper.Project(image_name), cache=False) self.assertIn('--no-cache', mock_d...
the_stack_v2_python_sparse
infra/helper_test.py
google/oss-fuzz
train
9,438
9c0b18fb5510ad478e35e98030b0a2faefea1264
[ "self.h = Heap()\nself.hash_map = {}\nself.ts_generator = 0\nself.cap = capacity", "if key in self.hash_map:\n self.hash_map[key].freq += 1\n self.hash_map[key].ts = self.ts_generator\n self.ts_generator += 1\n self.h.heapupdate(self.hash_map[key].idx)\n return self.hash_map[key].v\nelse:\n retu...
<|body_start_0|> self.h = Heap() self.hash_map = {} self.ts_generator = 0 self.cap = capacity <|end_body_0|> <|body_start_1|> if key in self.hash_map: self.hash_map[key].freq += 1 self.hash_map[key].ts = self.ts_generator self.ts_generator += ...
LFUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_017569
3,971
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
fc5b1744af7be93f4dd01d6ad58d2bd12f7ed33f
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.h = Heap() self.hash_map = {} self.ts_generator = 0 self.cap = capacity def get(self, key): """:type key: int :rtype: int""" if key in self.hash_map: self.hash_map[ke...
the_stack_v2_python_sparse
460.LFU-Cache.py
mickey0524/leetcode
train
27
c14e17774e61c98f925b979214dd844116f24c1f
[ "self.model_name = model_name\nself.view = view\nself.buttons = buttons\nassert len(self.buttons) == len(set((b.state for b in self.buttons)))\nassert len([b for b in self.buttons if b.default]) <= 1", "Model_ = Pool().get(self.model_name)\nModelData = Pool().get('ir.model.data')\nif self.view:\n module, fs_id...
<|body_start_0|> self.model_name = model_name self.view = view self.buttons = buttons assert len(self.buttons) == len(set((b.state for b in self.buttons))) assert len([b for b in self.buttons if b.default]) <= 1 <|end_body_0|> <|body_start_1|> Model_ = Pool().get(self.mo...
A view state of a wizard.
StateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateView: """A view state of a wizard.""" def __init__(self, model_name, view, buttons): """model_name is the name of the model view is the xml id of the view buttons is a list of Button""" <|body_0|> def get_view(self, wizard, state_name): """Returns the view d...
stack_v2_sparse_classes_36k_train_017570
11,857
no_license
[ { "docstring": "model_name is the name of the model view is the xml id of the view buttons is a list of Button", "name": "__init__", "signature": "def __init__(self, model_name, view, buttons)" }, { "docstring": "Returns the view definition", "name": "get_view", "signature": "def get_vie...
4
null
Implement the Python class `StateView` described below. Class description: A view state of a wizard. Method signatures and docstrings: - def __init__(self, model_name, view, buttons): model_name is the name of the model view is the xml id of the view buttons is a list of Button - def get_view(self, wizard, state_name...
Implement the Python class `StateView` described below. Class description: A view state of a wizard. Method signatures and docstrings: - def __init__(self, model_name, view, buttons): model_name is the name of the model view is the xml id of the view buttons is a list of Button - def get_view(self, wizard, state_name...
8d1ec4f2b623f7ca48f38bfda2ac15c01ded35a7
<|skeleton|> class StateView: """A view state of a wizard.""" def __init__(self, model_name, view, buttons): """model_name is the name of the model view is the xml id of the view buttons is a list of Button""" <|body_0|> def get_view(self, wizard, state_name): """Returns the view d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateView: """A view state of a wizard.""" def __init__(self, model_name, view, buttons): """model_name is the name of the model view is the xml id of the view buttons is a list of Button""" self.model_name = model_name self.view = view self.buttons = buttons asser...
the_stack_v2_python_sparse
lib/python3.8/site-packages/trytond/wizard/wizard.py
Davidoff2103/tryton-training
train
0
674683835e36ea210d81569323665976a5c22771
[ "so = sorted(timePoints, key=lambda a: a.split(':'))\nstart = so[0]\nself.min = 1500\n\ndef calc_diff(time1, time2):\n h = int(time1[0:2]) - int(time2[0:2])\n min_1 = int(time1[-2:]) - int(time2[-2:])\n return h * 60 + min_1\nprint(so)\nfor i in so[1:]:\n self.min = min(self.min, calc_diff(i, start))\n ...
<|body_start_0|> so = sorted(timePoints, key=lambda a: a.split(':')) start = so[0] self.min = 1500 def calc_diff(time1, time2): h = int(time1[0:2]) - int(time2[0:2]) min_1 = int(time1[-2:]) - int(time2[-2:]) return h * 60 + min_1 print(so) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int 219ms""" <|body_0|> def findMinDifference_1(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> def findMinDifference_2(self, timePoints...
stack_v2_sparse_classes_36k_train_017571
2,482
no_license
[ { "docstring": ":type timePoints: List[str] :rtype: int 219ms", "name": "findMinDifference", "signature": "def findMinDifference(self, timePoints)" }, { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference_1", "signature": "def findMinDifference_1(self, time...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int 219ms - def findMinDifference_1(self, timePoints): :type timePoints: List[str] :rtype: int - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int 219ms - def findMinDifference_1(self, timePoints): :type timePoints: List[str] :rtype: int - def ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int 219ms""" <|body_0|> def findMinDifference_1(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> def findMinDifference_2(self, timePoints...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int 219ms""" so = sorted(timePoints, key=lambda a: a.split(':')) start = so[0] self.min = 1500 def calc_diff(time1, time2): h = int(time1[0:2]) - int(time2[0:2]) ...
the_stack_v2_python_sparse
MinimumTimeDifference_MID_539.py
953250587/leetcode-python
train
2
656e6e8aa3f6481fc2c3685bf119f2f539fe577d
[ "res = [[0 for _ in range(m)] for _ in range(n)]\nfor i in range(m):\n res[0][i] = 1\nfor j in range(n):\n res[j][0] = 1\nfor i in range(1, n):\n for j in range(1, m):\n res[i][j] = res[i - 1][j] + res[i][j - 1]\nreturn res[-1][-1]", "if (m, n) in self.coor_path_dict:\n return self.coor_path_di...
<|body_start_0|> res = [[0 for _ in range(m)] for _ in range(n)] for i in range(m): res[0][i] = 1 for j in range(n): res[j][0] = 1 for i in range(1, n): for j in range(1, m): res[i][j] = res[i - 1][j] + res[i][j - 1] return res[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int dynamic programming""" <|body_0|> def uniquePaths0(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths1(self, m, n): """:type m: int :...
stack_v2_sparse_classes_36k_train_017572
1,514
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int dynamic programming", "name": "uniquePaths", "signature": "def uniquePaths(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths0", "signature": "def uniquePaths0(self, m, n)" }, { "docst...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int dynamic programming - def uniquePaths0(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths1(se...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int dynamic programming - def uniquePaths0(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths1(se...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int dynamic programming""" <|body_0|> def uniquePaths0(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths1(self, m, n): """:type m: int :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int dynamic programming""" res = [[0 for _ in range(m)] for _ in range(n)] for i in range(m): res[0][i] = 1 for j in range(n): res[j][0] = 1 for i in range(1, n): ...
the_stack_v2_python_sparse
PythonCode/src/0062_Unique_Paths.py
oneyuan/CodeforFun
train
0
8c1f20d35445bf12545fa6c9cd06ac6c9d1a0ae5
[ "tclasses = Class.objects.xall().filter(teachers__id=teacher_id, lps_version='3.0', class_type=Class.CLASS_TYPE_NORMAL, status=Class.STATUS_ONGOING, is_active=True)\nclass_list = list()\nfor tclass in tclasses:\n _students = tclass.students.all().filter(classstudents__status=ClassStudents.STATUS_NORMAL)\n csi...
<|body_start_0|> tclasses = Class.objects.xall().filter(teachers__id=teacher_id, lps_version='3.0', class_type=Class.CLASS_TYPE_NORMAL, status=Class.STATUS_ONGOING, is_active=True) class_list = list() for tclass in tclasses: _students = tclass.students.all().filter(classstudents__sta...
教师信息
TeacherOverview
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_cl...
stack_v2_sparse_classes_36k_train_017573
13,470
no_license
[ { "docstring": "接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_clmt': 即将开始的班会(见mz_lps3.functions_gt.get_classmeeting_list), 'class_begin_date': ...
3
null
Implement the Python class `TeacherOverview` described below. Class description: 教师信息 Method signatures and docstrings: - def processing_classes(teacher_id): 接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int...
Implement the Python class `TeacherOverview` described below. Class description: 教师信息 Method signatures and docstrings: - def processing_classes(teacher_id): 接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int...
aec5d23bb412f7dfca374fb5c5b9988c1b817347
<|skeleton|> class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_clmt': 即将开始的班会(...
the_stack_v2_python_sparse
hotfix/apps/mz_usercenter/teacher/interface.py
az0ne/python
train
0
79c613270671d83bc8586a16b460a8548c69ce63
[ "super().__init__()\nself.api_key = api_key\nself.engine_id = engine_id\nself.top_k = top_k\nself.allowed_domains = allowed_domains\nself.kwargs = search_engine_kwargs if search_engine_kwargs else {}", "if not self.api_key:\n raise ValueError('You need to provide an API key for the Google API. See https://deve...
<|body_start_0|> super().__init__() self.api_key = api_key self.engine_id = engine_id self.top_k = top_k self.allowed_domains = allowed_domains self.kwargs = search_engine_kwargs if search_engine_kwargs else {} <|end_body_0|> <|body_start_1|> if not self.api_key:...
Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.
GoogleAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoogleAPI: """Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.""" def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]...
stack_v2_sparse_classes_36k_train_017574
17,323
permissive
[ { "docstring": ":param top_k: Number of documents to return. :param allowed_domains: List of domains to limit the search to. :param api_key: API key for the Google API. :param engine_id: Engine ID for the Google API. :param search_engine_kwargs: Additional parameters passed to the Google API. As an example, you...
3
null
Implement the Python class `GoogleAPI` described below. Class description: Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details. Method signatures and docstrings: - def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[Li...
Implement the Python class `GoogleAPI` described below. Class description: Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details. Method signatures and docstrings: - def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[Li...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class GoogleAPI: """Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.""" def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoogleAPI: """Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.""" def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]=None, search...
the_stack_v2_python_sparse
haystack/nodes/search_engine/providers.py
deepset-ai/haystack
train
10,599
cbd0ef0ecb4c751f9bcaad01ca19239cb985318c
[ "id_asignacion = request.data['primary_key']\nasignacion = Asignacion.objects.get(id=id_asignacion)\nasignacion.delete()\nreturn Response({'mensaje': 'Cambio Aceptado'}, status=status.HTTP_200_OK)", "participante_id = request.data['participante']\ngrupo_id = request.data['grupo']\ngrupos = Grupo.objects.get(id=gr...
<|body_start_0|> id_asignacion = request.data['primary_key'] asignacion = Asignacion.objects.get(id=id_asignacion) asignacion.delete() return Response({'mensaje': 'Cambio Aceptado'}, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> participante_id = request.data['parti...
AsignacionViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" <|body_0|> def verificar_duplicidad(self, request, pk=None): """Metodo para ver si el participante esta asignado en otro grupo""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_017575
13,765
no_license
[ { "docstring": "Método que elimina una asignación", "name": "desactivar_asignacion", "signature": "def desactivar_asignacion(self, request, pk=None)" }, { "docstring": "Metodo para ver si el participante esta asignado en otro grupo", "name": "verificar_duplicidad", "signature": "def veri...
2
null
Implement the Python class `AsignacionViewSet` described below. Class description: Implement the AsignacionViewSet class. Method signatures and docstrings: - def desactivar_asignacion(self, request, pk=None): Método que elimina una asignación - def verificar_duplicidad(self, request, pk=None): Metodo para ver si el p...
Implement the Python class `AsignacionViewSet` described below. Class description: Implement the AsignacionViewSet class. Method signatures and docstrings: - def desactivar_asignacion(self, request, pk=None): Método que elimina una asignación - def verificar_duplicidad(self, request, pk=None): Metodo para ver si el p...
0e37786d7173abe820fd10b094ffcc2db9593a9c
<|skeleton|> class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" <|body_0|> def verificar_duplicidad(self, request, pk=None): """Metodo para ver si el participante esta asignado en otro grupo""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" id_asignacion = request.data['primary_key'] asignacion = Asignacion.objects.get(id=id_asignacion) asignacion.delete() return Response({'mensaje': 'Cambio Acepta...
the_stack_v2_python_sparse
src/apps/cyd/api_views.py
jinchuika/app-suni
train
7
d8e1dd597fe66f9c6249ad396dabb0152d2f43e0
[ "self.data = []\nif data is not None:\n if type(data) != list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n mean = sum(data) / len(data)\n num = 0\n for daticos in data:\n num1 = (daticos - mean) ** 2\n ...
<|body_start_0|> self.data = [] if data is not None: if type(data) != list: raise TypeError('data must be a list') if len(data) < 2: raise ValueError('data must contain multiple values') mean = sum(data) / len(data) num = 0 ...
This class is to represent a binomial distribution
Binomial
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """This class is to represent a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """All begins here""" <|body_0|> def pmf(self, k): """Method to calculate the pmf""" <|body_1|> def cdf(self, k): """This method cal...
stack_v2_sparse_classes_36k_train_017576
1,872
permissive
[ { "docstring": "All begins here", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "Method to calculate the pmf", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "This method calculates the CDF", "name": "cdf", ...
3
null
Implement the Python class `Binomial` described below. Class description: This class is to represent a binomial distribution Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): All begins here - def pmf(self, k): Method to calculate the pmf - def cdf(self, k): This method calculates the CDF
Implement the Python class `Binomial` described below. Class description: This class is to represent a binomial distribution Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): All begins here - def pmf(self, k): Method to calculate the pmf - def cdf(self, k): This method calculates the CDF...
58c367f3014919f95157426121093b9fe14d4035
<|skeleton|> class Binomial: """This class is to represent a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """All begins here""" <|body_0|> def pmf(self, k): """Method to calculate the pmf""" <|body_1|> def cdf(self, k): """This method cal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Binomial: """This class is to represent a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """All begins here""" self.data = [] if data is not None: if type(data) != list: raise TypeError('data must be a list') if len(data...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
linkem97/holbertonschool-machine_learning
train
0
97aafd1989c528678f4912e6853e09cff89b7daa
[ "self.change_action()\nlogging.info(f'###### Action disparada: {self.action} ######')\nif self.action == 'list':\n permission_classes = (IsAuthenticated, permissions.SeePage)\nelif self.action == 'retrieve':\n permission_classes = (IsAuthenticated, permissions.SeeObjPage)\nelif self.action == 'create':\n p...
<|body_start_0|> self.change_action() logging.info(f'###### Action disparada: {self.action} ######') if self.action == 'list': permission_classes = (IsAuthenticated, permissions.SeePage) elif self.action == 'retrieve': permission_classes = (IsAuthenticated, permis...
View para gerenciar disciplinas.
SectionViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SectionViewSet: """View para gerenciar disciplinas.""" def get_permissions(self): """Instancia e retorna a lista de permissões que essa ação requer.""" <|body_0|> def get_queryset(self): """Pega a lista de seções de uma determinada disciplina.""" <|body_1...
stack_v2_sparse_classes_36k_train_017577
3,054
no_license
[ { "docstring": "Instancia e retorna a lista de permissões que essa ação requer.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Pega a lista de seções de uma determinada disciplina.", "name": "get_queryset", "signature": "def get_queryset(self)" ...
4
stack_v2_sparse_classes_30k_train_012014
Implement the Python class `SectionViewSet` described below. Class description: View para gerenciar disciplinas. Method signatures and docstrings: - def get_permissions(self): Instancia e retorna a lista de permissões que essa ação requer. - def get_queryset(self): Pega a lista de seções de uma determinada disciplina...
Implement the Python class `SectionViewSet` described below. Class description: View para gerenciar disciplinas. Method signatures and docstrings: - def get_permissions(self): Instancia e retorna a lista de permissões que essa ação requer. - def get_queryset(self): Pega a lista de seções de uma determinada disciplina...
3a8009b17518384c269dfee3c8fe44cbe2567cc0
<|skeleton|> class SectionViewSet: """View para gerenciar disciplinas.""" def get_permissions(self): """Instancia e retorna a lista de permissões que essa ação requer.""" <|body_0|> def get_queryset(self): """Pega a lista de seções de uma determinada disciplina.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SectionViewSet: """View para gerenciar disciplinas.""" def get_permissions(self): """Instancia e retorna a lista de permissões que essa ação requer.""" self.change_action() logging.info(f'###### Action disparada: {self.action} ######') if self.action == 'list': ...
the_stack_v2_python_sparse
project/alma/sections/views.py
VWApplications/VWAlmaAPI
train
1
267e2d41e316ca9da35178d18f9b95b644442539
[ "if not self.base:\n raise AttributeError('Factory.base must be set to a Component')\nsuper().__init__(config=config, parent=tool, **kwargs)\nself.kwargs = copy(kwargs)", "if self.product:\n return self.product\nelse:\n raise AttributeError('The user has not specified a product for {}'.format(self.__clas...
<|body_start_0|> if not self.base: raise AttributeError('Factory.base must be set to a Component') super().__init__(config=config, parent=tool, **kwargs) self.kwargs = copy(kwargs) <|end_body_0|> <|body_start_1|> if self.product: return self.product else:...
A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message). The traits and kwargsthat correctl...
Factory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message)....
stack_v2_sparse_classes_36k_train_017578
8,843
no_license
[ { "docstring": "Base Factory class Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctapipe.core.Tool Tool executable that is calling this component. Passes the correct...
5
stack_v2_sparse_classes_30k_train_006690
Implement the Python class `Factory` described below. Class description: A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory ...
Implement the Python class `Factory` described below. Class description: A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory ...
1cb6f215f3a9c34e18f2d49bd36bbf9e757f5847
<|skeleton|> class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message)....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message). The traits a...
the_stack_v2_python_sparse
ctapipe/core/factory.py
18333/ctapipe
train
1
4d4697cc00b373934b00fe414e2b517810edf141
[ "super(ShareConvFc, self).__init__()\nself.num_shared_convs = desc['num_shared_convs'] if 'num_shared_convs' in desc else 0\nself.num_shared_fcs = desc['num_shared_fcs'] if 'num_shared_fcs' in desc else 0\nself.with_avg_pool = desc['with_avg_pool'] if 'with_avg_pool' in desc else False\nself.roi_feat_size = desc['r...
<|body_start_0|> super(ShareConvFc, self).__init__() self.num_shared_convs = desc['num_shared_convs'] if 'num_shared_convs' in desc else 0 self.num_shared_fcs = desc['num_shared_fcs'] if 'num_shared_fcs' in desc else 0 self.with_avg_pool = desc['with_avg_pool'] if 'with_avg_pool' in desc...
Share conv fc layer.
ShareConvFc
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShareConvFc: """Share conv fc layer.""" def __init__(self, desc): """Init share conv fc layer. :param desc: config dict""" <|body_0|> def _add_conv_fc_branch(self, num_branch_convs, num_branch_fcs, in_channels): """Add conv and fc. :param num_branch_convs: num of...
stack_v2_sparse_classes_36k_train_017579
5,402
permissive
[ { "docstring": "Init share conv fc layer. :param desc: config dict", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Add conv and fc. :param num_branch_convs: num of convolution layer :param num_branch_fcs: num of fc layers :param in_channels: input channel", "...
5
null
Implement the Python class `ShareConvFc` described below. Class description: Share conv fc layer. Method signatures and docstrings: - def __init__(self, desc): Init share conv fc layer. :param desc: config dict - def _add_conv_fc_branch(self, num_branch_convs, num_branch_fcs, in_channels): Add conv and fc. :param num...
Implement the Python class `ShareConvFc` described below. Class description: Share conv fc layer. Method signatures and docstrings: - def __init__(self, desc): Init share conv fc layer. :param desc: config dict - def _add_conv_fc_branch(self, num_branch_convs, num_branch_fcs, in_channels): Add conv and fc. :param num...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class ShareConvFc: """Share conv fc layer.""" def __init__(self, desc): """Init share conv fc layer. :param desc: config dict""" <|body_0|> def _add_conv_fc_branch(self, num_branch_convs, num_branch_fcs, in_channels): """Add conv and fc. :param num_branch_convs: num of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShareConvFc: """Share conv fc layer.""" def __init__(self, desc): """Init share conv fc layer. :param desc: config dict""" super(ShareConvFc, self).__init__() self.num_shared_convs = desc['num_shared_convs'] if 'num_shared_convs' in desc else 0 self.num_shared_fcs = desc['...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/pytorch/shared_heads/share_conv_fc.py
Huawei-Ascend/modelzoo
train
1
1d848125e7afea63d8e297613be7da742c858e1f
[ "try:\n self.tickers.pop(ticker, None)\n self.tickers_data.pop(ticker, None)\nexcept KeyError:\n print('Could not unsubscribe ticker {0} as it was never subscribed'.format(ticker))", "if ticker in self.tickers:\n timestamp = self.tickers[ticker]['timestamp']\n return timestamp\nelse:\n print('Ti...
<|body_start_0|> try: self.tickers.pop(ticker, None) self.tickers_data.pop(ticker, None) except KeyError: print('Could not unsubscribe ticker {0} as it was never subscribed'.format(ticker)) <|end_body_0|> <|body_start_1|> if ticker in self.tickers: ...
PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event queue. This will replicate how a live strategy w...
AbstractPriceHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractPriceHandler: """PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event ...
stack_v2_sparse_classes_36k_train_017580
2,436
no_license
[ { "docstring": "Unsubscribes the price handler from a current ticker symbol :param ticker: The ticker to unsubscribe :return:", "name": "unsubscribe_ticker", "signature": "def unsubscribe_ticker(self, ticker)" }, { "docstring": "Returns the most recent actual timestamp for a given ticker :param ...
2
stack_v2_sparse_classes_30k_train_001031
Implement the Python class `AbstractPriceHandler` described below. Class description: PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial i...
Implement the Python class `AbstractPriceHandler` described below. Class description: PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial i...
1dffb983ba3374f5f3a018e2b7d909bf5546947d
<|skeleton|> class AbstractPriceHandler: """PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractPriceHandler: """PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event queue. This w...
the_stack_v2_python_sparse
price_handler_base.py
TheGiddy/Backtester
train
0
a7c8d15e32fde66bf2e3ae7aee7ccc2f750d0a0c
[ "serializer = MoveSecretLinkSerializer(data=request.data, context=self.get_serializer_context())\nif not serializer.is_valid():\n return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\nlink_id = serializer.validated_data['link_id']\nnew_parent_share_id = serializer.validated_data['new_parent_sha...
<|body_start_0|> serializer = MoveSecretLinkSerializer(data=request.data, context=self.get_serializer_context()) if not serializer.is_valid(): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) link_id = serializer.validated_data['link_id'] new_parent_shar...
Secret Link View: Accepted Methods: POST, DELETE
SecretLinkView
[ "BSD-3-Clause", "MIT", "Apache-2.0", "BSD-2-Clause", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecretLinkView: """Secret Link View: Accepted Methods: POST, DELETE""" def post(self, request, *args, **kwargs): """Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_parent_share - write on new_datastore :param request: :param ...
stack_v2_sparse_classes_36k_train_017581
3,495
permissive
[ { "docstring": "Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_parent_share - write on new_datastore :param request: :param uuid: :param args: :param kwargs: :return: 200 / 400", "name": "post", "signature": "def post(self, request, *args, **kw...
2
stack_v2_sparse_classes_30k_train_020332
Implement the Python class `SecretLinkView` described below. Class description: Secret Link View: Accepted Methods: POST, DELETE Method signatures and docstrings: - def post(self, request, *args, **kwargs): Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_pare...
Implement the Python class `SecretLinkView` described below. Class description: Secret Link View: Accepted Methods: POST, DELETE Method signatures and docstrings: - def post(self, request, *args, **kwargs): Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_pare...
8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf
<|skeleton|> class SecretLinkView: """Secret Link View: Accepted Methods: POST, DELETE""" def post(self, request, *args, **kwargs): """Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_parent_share - write on new_datastore :param request: :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecretLinkView: """Secret Link View: Accepted Methods: POST, DELETE""" def post(self, request, *args, **kwargs): """Move Secret_Link obj Necessary Rights: - write on old_parent_share - write on old_datastore - write on new_parent_share - write on new_datastore :param request: :param uuid: :param ...
the_stack_v2_python_sparse
psono/restapi/views/secret_link.py
psono/psono-server
train
76
1a46db908b47d7c6395d88b40c228d52ec521b2d
[ "kw = super(OrganizationEventView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw", "context = super(OrganizationEventView, self).get_context_data(**kwargs)\norganization = get_object_or_404(Organization, id=self.kwargs['pk'])\nevents = organization.event_set.all()...
<|body_start_0|> kw = super(OrganizationEventView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw <|end_body_0|> <|body_start_1|> context = super(OrganizationEventView, self).get_context_data(**kwargs) organization = get_object_or_4...
Display all the events associated with an organization.
OrganizationEventView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationEventView: """Display all the events associated with an organization.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return events belonging to the organization.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_017582
12,378
permissive
[ { "docstring": "Pass organization to form.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Return events belonging to the organization.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
null
Implement the Python class `OrganizationEventView` described below. Class description: Display all the events associated with an organization. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return events belonging to the organization.
Implement the Python class `OrganizationEventView` described below. Class description: Display all the events associated with an organization. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return events belonging to the organization. ...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class OrganizationEventView: """Display all the events associated with an organization.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return events belonging to the organization.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationEventView: """Display all the events associated with an organization.""" def get_form_kwargs(self): """Pass organization to form.""" kw = super(OrganizationEventView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw ...
the_stack_v2_python_sparse
project/editorial/views/events.py
ProjectFacet/facet
train
25
d725f0385d6a0812c5b42836f08d8f7541e42143
[ "super(SubscriberMessage, self).__init__(*args, **kwargs)\nself.message_id = None\nself.publish_time = None\nself.ack_id = None\nself.set_subscribe_message(received_message)", "if received_message:\n pubsub_message = received_message.get('message')\n if pubsub_message:\n message = dict()\n mes...
<|body_start_0|> super(SubscriberMessage, self).__init__(*args, **kwargs) self.message_id = None self.publish_time = None self.ack_id = None self.set_subscribe_message(received_message) <|end_body_0|> <|body_start_1|> if received_message: pubsub_message = rec...
Pubsub publish message object
SubscriberMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscriberMessage: """Pubsub publish message object""" def __init__(self, received_message, *args, **kwargs): """data is a dictionary attributes is a dictionary""" <|body_0|> def create_message_dict(received_message): """creates a received message dictionary with...
stack_v2_sparse_classes_36k_train_017583
3,266
permissive
[ { "docstring": "data is a dictionary attributes is a dictionary", "name": "__init__", "signature": "def __init__(self, received_message, *args, **kwargs)" }, { "docstring": "creates a received message dictionary with set fields or None if message is empty", "name": "create_message_dict", ...
3
null
Implement the Python class `SubscriberMessage` described below. Class description: Pubsub publish message object Method signatures and docstrings: - def __init__(self, received_message, *args, **kwargs): data is a dictionary attributes is a dictionary - def create_message_dict(received_message): creates a received me...
Implement the Python class `SubscriberMessage` described below. Class description: Pubsub publish message object Method signatures and docstrings: - def __init__(self, received_message, *args, **kwargs): data is a dictionary attributes is a dictionary - def create_message_dict(received_message): creates a received me...
d2deb42c25cf83816993015532194a5fc0c4146a
<|skeleton|> class SubscriberMessage: """Pubsub publish message object""" def __init__(self, received_message, *args, **kwargs): """data is a dictionary attributes is a dictionary""" <|body_0|> def create_message_dict(received_message): """creates a received message dictionary with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscriberMessage: """Pubsub publish message object""" def __init__(self, received_message, *args, **kwargs): """data is a dictionary attributes is a dictionary""" super(SubscriberMessage, self).__init__(*args, **kwargs) self.message_id = None self.publish_time = None ...
the_stack_v2_python_sparse
gcloud/datastores/utils/pubsub_messages.py
pantheon-systems/etl-framework
train
2
0a48e14b6b283b777b9041049549529b10dbbe1d
[ "credentials = api_helpers.get_delegated_credential(global_configs.get('domain_super_admin_email'), REQUIRED_SCOPES)\nmax_calls, quota_period = api_helpers.get_ratelimiter_config(global_configs, API_NAME)\nself.repository = AdminDirectoryRepositoryClient(credentials=credentials, quota_max_calls=max_calls, quota_per...
<|body_start_0|> credentials = api_helpers.get_delegated_credential(global_configs.get('domain_super_admin_email'), REQUIRED_SCOPES) max_calls, quota_period = api_helpers.get_ratelimiter_config(global_configs, API_NAME) self.repository = AdminDirectoryRepositoryClient(credentials=credentials, qu...
GSuite Admin Directory API Client.
AdminDirectoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminDirectoryClient: """GSuite Admin Directory API Client.""" def __init__(self, global_configs, **kwargs): """Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.""" <|body_0|> def get_group_members(self, group_key): """G...
stack_v2_sparse_classes_36k_train_017584
9,750
permissive
[ { "docstring": "Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.", "name": "__init__", "signature": "def __init__(self, global_configs, **kwargs)" }, { "docstring": "Get all the members for specified groups. Args: group_key (str): The group's unique id...
4
stack_v2_sparse_classes_30k_train_019622
Implement the Python class `AdminDirectoryClient` described below. Class description: GSuite Admin Directory API Client. Method signatures and docstrings: - def __init__(self, global_configs, **kwargs): Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs. - def get_group_member...
Implement the Python class `AdminDirectoryClient` described below. Class description: GSuite Admin Directory API Client. Method signatures and docstrings: - def __init__(self, global_configs, **kwargs): Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs. - def get_group_member...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class AdminDirectoryClient: """GSuite Admin Directory API Client.""" def __init__(self, global_configs, **kwargs): """Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.""" <|body_0|> def get_group_members(self, group_key): """G...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminDirectoryClient: """GSuite Admin Directory API Client.""" def __init__(self, global_configs, **kwargs): """Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.""" credentials = api_helpers.get_delegated_credential(global_configs.get('domain_sup...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/admin_directory.py
kevensen/forseti-security
train
1
e0d63ec0544d73538d58b93fa29c5261f7c99f72
[ "instance = serializer.save(owner=self.request.user, sender=self.request.tenant_me)\ninstance.participants.add(instance.sender, instance.recipient)\ninstance.save()\nif instance.recipient.notify_when_new_messages:\n self.send_notification(instance)", "if self.request.user.is_authenticated():\n instance.part...
<|body_start_0|> instance = serializer.save(owner=self.request.user, sender=self.request.tenant_me) instance.participants.add(instance.sender, instance.recipient) instance.save() if instance.recipient.notify_when_new_messages: self.send_notification(instance) <|end_body_0|> ...
MessageViewSet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageViewSet: def perform_create(self, serializer): """Add owner to this model when being created for the first time""" <|body_0|> def perform_destroy(self, instance): """Override the deletion function to archive the message instead of deleting it.""" <|bod...
stack_v2_sparse_classes_36k_train_017585
4,316
permissive
[ { "docstring": "Add owner to this model when being created for the first time", "name": "perform_create", "signature": "def perform_create(self, serializer)" }, { "docstring": "Override the deletion function to archive the message instead of deleting it.", "name": "perform_destroy", "sig...
2
null
Implement the Python class `MessageViewSet` described below. Class description: Implement the MessageViewSet class. Method signatures and docstrings: - def perform_create(self, serializer): Add owner to this model when being created for the first time - def perform_destroy(self, instance): Override the deletion funct...
Implement the Python class `MessageViewSet` described below. Class description: Implement the MessageViewSet class. Method signatures and docstrings: - def perform_create(self, serializer): Add owner to this model when being created for the first time - def perform_destroy(self, instance): Override the deletion funct...
053973b5ff0b997c52bfaca8daf8e07db64a877c
<|skeleton|> class MessageViewSet: def perform_create(self, serializer): """Add owner to this model when being created for the first time""" <|body_0|> def perform_destroy(self, instance): """Override the deletion function to archive the message instead of deleting it.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageViewSet: def perform_create(self, serializer): """Add owner to this model when being created for the first time""" instance = serializer.save(owner=self.request.user, sender=self.request.tenant_me) instance.participants.add(instance.sender, instance.recipient) instance.s...
the_stack_v2_python_sparse
api/views/foundation_tenant_base/messageviewset.py
smegurus/smegurus-django
train
1
be76ad3d413e402df7e6ac137d0d26a444ef98f9
[ "super().__init__(2, 1, seed)\nself.stamp_size = stamp_size\nself.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0\nself.mag_name = mag_name\nself.bright_cut = bright_cut\nself.dim_cut = dim_cut", "if self.mag_name not in table.colnames:\n raise ValueError(f\"Catalog must have '{self....
<|body_start_0|> super().__init__(2, 1, seed) self.stamp_size = stamp_size self.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0 self.mag_name = mag_name self.bright_cut = bright_cut self.dim_cut = dim_cut <|end_body_0|> <|body_start_1|> ...
Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with magnitude cut larger than `bright_cut` and...
PairSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with ma...
stack_v2_sparse_classes_36k_train_017586
12,943
permissive
[ { "docstring": "Initializes the PairSampling function. Args: stamp_size: Size of the desired stamp (in arcseconds). max_shift: Maximum value of shift from center. If None then its set as one-tenth the stamp size (in arcseconds). mag_name: Name of the magnitude column in the catalog to be used. seed: See parent ...
2
stack_v2_sparse_classes_30k_train_009666
Implement the Python class `PairSampling` described below. Class description: Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cu...
Implement the Python class `PairSampling` described below. Class description: Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cu...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PairSampling: """Sampling function for pairs of galaxies. Picks one centered bright galaxy and second dim. The bright galaxy is centered at the center of the stamp and the dim galaxy is shifted. The bright galaxy is chosen with magnitude less than `bright_cut` and the dim galaxy is chosen with magnitude cut l...
the_stack_v2_python_sparse
btk/sampling_functions.py
LSSTDESC/BlendingToolKit
train
22
4f66e54fa3bcc32f894bf41c820bc313e319b963
[ "self.suits = Hist()\nself.ranks = Hist()\nfor c in self.cards:\n self.suits.count(c.suit)\n self.ranks.count(c.rank)\nself.sets = list(self.ranks.values())\nself.sets.sort(reverse=True)", "self.suits = {}\nfor card in self.cards:\n self.suits[card.suit] = self.suits.get(card.suit, 0) + 1", "ranks = se...
<|body_start_0|> self.suits = Hist() self.ranks = Hist() for c in self.cards: self.suits.count(c.suit) self.ranks.count(c.rank) self.sets = list(self.ranks.values()) self.sets.sort(reverse=True) <|end_body_0|> <|body_start_1|> self.suits = {} ...
Represents a poker hand.
PokerHand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PokerHand: """Represents a poker hand.""" def make_histograms(self): """Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted list of the rank sets in the hand.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_017587
3,720
no_license
[ { "docstring": "Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted list of the rank sets in the hand.", "name": "make_histograms", "signature": "def make_histograms(self)" }, { "docstring": "Bu...
6
stack_v2_sparse_classes_30k_train_004345
Implement the Python class `PokerHand` described below. Class description: Represents a poker hand. Method signatures and docstrings: - def make_histograms(self): Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted l...
Implement the Python class `PokerHand` described below. Class description: Represents a poker hand. Method signatures and docstrings: - def make_histograms(self): Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted l...
99014136922a16caa1f67db8027ff59a68d1bdcd
<|skeleton|> class PokerHand: """Represents a poker hand.""" def make_histograms(self): """Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted list of the rank sets in the hand.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PokerHand: """Represents a poker hand.""" def make_histograms(self): """Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted list of the rank sets in the hand.""" self.suits = Hist() ...
the_stack_v2_python_sparse
lab10/PokerHand.py
nwu-cs/class-materials
train
0
7fb69c58d063942ff64362d346c70be87e0cb7dd
[ "res = ''\nwhile n:\n res += str(n % 2)\n n //= 2\nreturn res[::-1]", "m = 0\nwhile n:\n m += 1\n n = n & n - 1\nreturn m", "m = 0\nflag = 1\nwhile n >= flag:\n if not n & flag:\n m += 1\n flag = flag << 1\nreturn m", "m = 0\nflag = 2 ** 7\nwhile flag:\n if n & flag:\n break...
<|body_start_0|> res = '' while n: res += str(n % 2) n //= 2 return res[::-1] <|end_body_0|> <|body_start_1|> m = 0 while n: m += 1 n = n & n - 1 return m <|end_body_1|> <|body_start_2|> m = 0 flag = 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def int2binaryStr(self, n: int): """整型int到二进制字符串""" <|body_0|> def nOneOfInt(self, n: int): """二进制中1的个数""" <|body_1|> def nZeroOfInt(self, n: int): """二进制中0的个数""" <|body_2|> def nZeroOfInt2(self, n: int): """8位二进制中0...
stack_v2_sparse_classes_36k_train_017588
1,382
permissive
[ { "docstring": "整型int到二进制字符串", "name": "int2binaryStr", "signature": "def int2binaryStr(self, n: int)" }, { "docstring": "二进制中1的个数", "name": "nOneOfInt", "signature": "def nOneOfInt(self, n: int)" }, { "docstring": "二进制中0的个数", "name": "nZeroOfInt", "signature": "def nZero...
4
stack_v2_sparse_classes_30k_train_006476
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def int2binaryStr(self, n: int): 整型int到二进制字符串 - def nOneOfInt(self, n: int): 二进制中1的个数 - def nZeroOfInt(self, n: int): 二进制中0的个数 - def nZeroOfInt2(self, n: int): 8位二进制中0的个数:从左开始零的个...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def int2binaryStr(self, n: int): 整型int到二进制字符串 - def nOneOfInt(self, n: int): 二进制中1的个数 - def nZeroOfInt(self, n: int): 二进制中0的个数 - def nZeroOfInt2(self, n: int): 8位二进制中0的个数:从左开始零的个...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def int2binaryStr(self, n: int): """整型int到二进制字符串""" <|body_0|> def nOneOfInt(self, n: int): """二进制中1的个数""" <|body_1|> def nZeroOfInt(self, n: int): """二进制中0的个数""" <|body_2|> def nZeroOfInt2(self, n: int): """8位二进制中0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def int2binaryStr(self, n: int): """整型int到二进制字符串""" res = '' while n: res += str(n % 2) n //= 2 return res[::-1] def nOneOfInt(self, n: int): """二进制中1的个数""" m = 0 while n: m += 1 n = n & n - ...
the_stack_v2_python_sparse
special/bit-opt.py
yuenliou/leetcode
train
0
3a74bd5b3088db2b47ad3c232996393896d6b2fc
[ "_initialize_stripe(live_mode=self.live_mode)\nitem = {}\nif isinstance(price_or_plan, str) or isinstance(price_or_plan, type(u'')):\n item['price'] = price_or_plan\nelif isinstance(price_or_plan, dict):\n item['price_data'] = price_or_plan\nelse:\n raise Exception('Unsupported price_or_plan type: %s' % ty...
<|body_start_0|> _initialize_stripe(live_mode=self.live_mode) item = {} if isinstance(price_or_plan, str) or isinstance(price_or_plan, type(u'')): item['price'] = price_or_plan elif isinstance(price_or_plan, dict): item['price_data'] = price_or_plan else: ...
Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions
BaseStripeSubscription
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseStripeSubscription: """Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions""" def create(self, price_or_plan, invoice=True): """Creates a new Subscription ht...
stack_v2_sparse_classes_36k_train_017589
22,449
permissive
[ { "docstring": "Creates a new Subscription https://stripe.com/docs/api/subscriptions/create", "name": "create", "signature": "def create(self, price_or_plan, invoice=True)" }, { "docstring": "Modifies a Subscription plan https://stripe.com/docs/api/subscriptions/update", "name": "modify", ...
3
null
Implement the Python class `BaseStripeSubscription` described below. Class description: Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions Method signatures and docstrings: - def create(self, pr...
Implement the Python class `BaseStripeSubscription` described below. Class description: Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions Method signatures and docstrings: - def create(self, pr...
935c4913e33d959f8c29583825f72b238f85b380
<|skeleton|> class BaseStripeSubscription: """Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions""" def create(self, price_or_plan, invoice=True): """Creates a new Subscription ht...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseStripeSubscription: """Django model for Stripe Subscription NOTE: This class is just used for structural purposes for now, and not intended to be persisted https://stripe.com/docs/api/subscriptions""" def create(self, price_or_plan, invoice=True): """Creates a new Subscription https://stripe....
the_stack_v2_python_sparse
lib/stripe_lib/models.py
hacktoolkit/django-htk
train
210
fd0ab845463dbedfb11b44276bb0828927b70605
[ "patron_bot = PatronBot(last_name=last_name, iii_id=iii_id)\nuser = None\nif patron_bot.is_valid:\n try:\n user = User.objects.get(username=iii_id)\n except User.DoesNotExist:\n user = User(username=iii_id, last_name=last_name, is_active=True)\n user.save()\nreturn user", "try:\n ret...
<|body_start_0|> patron_bot = PatronBot(last_name=last_name, iii_id=iii_id) user = None if patron_bot.is_valid: try: user = User.objects.get(username=iii_id) except User.DoesNotExist: user = User(username=iii_id, last_name=last_name, is_act...
This backend is used with III's Patron API to authenticate a user using a last name and an III identification number.
IIIUserBackend
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IIIUserBackend: """This backend is used with III's Patron API to authenticate a user using a last name and an III identification number.""" def authenticate(self, last_name=None, iii_id=None): """The ``last_name`` and ``iii_id`` are used to authenticate againest the III server using ...
stack_v2_sparse_classes_36k_train_017590
1,308
permissive
[ { "docstring": "The ``last_name`` and ``iii_id`` are used to authenticate againest the III server using the PatronBot Returns None if ``last_name`` and ``iii_id`` fail to authenticate.", "name": "authenticate", "signature": "def authenticate(self, last_name=None, iii_id=None)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_val_000391
Implement the Python class `IIIUserBackend` described below. Class description: This backend is used with III's Patron API to authenticate a user using a last name and an III identification number. Method signatures and docstrings: - def authenticate(self, last_name=None, iii_id=None): The ``last_name`` and ``iii_id`...
Implement the Python class `IIIUserBackend` described below. Class description: This backend is used with III's Patron API to authenticate a user using a last name and an III identification number. Method signatures and docstrings: - def authenticate(self, last_name=None, iii_id=None): The ``last_name`` and ``iii_id`...
b5c44fa008f9afb4441988803921a93ffd615c30
<|skeleton|> class IIIUserBackend: """This backend is used with III's Patron API to authenticate a user using a last name and an III identification number.""" def authenticate(self, last_name=None, iii_id=None): """The ``last_name`` and ``iii_id`` are used to authenticate againest the III server using ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IIIUserBackend: """This backend is used with III's Patron API to authenticate a user using a last name and an III identification number.""" def authenticate(self, last_name=None, iii_id=None): """The ``last_name`` and ``iii_id`` are used to authenticate againest the III server using the PatronBot...
the_stack_v2_python_sparse
aristotle/apps/vendors/iii/backends.py
jermnelson/Discover-Aristotle
train
15
3620ae30cfa5a3320c4d79b97f3176c91794cd0e
[ "with open('eqs.json') as qData:\n self.questions = json.load(qData)\nwith open('eqsave.json') as uData:\n self.records = json.load(uData)\nself.types = {'1': 'Reformer', '2': 'Helper', '3': 'Achiever', '4': 'Individualist', '5': 'Investigator', '6': 'Loyalist', '7': 'Enthusiast', '8': 'Challenger', '9': 'Pea...
<|body_start_0|> with open('eqs.json') as qData: self.questions = json.load(qData) with open('eqsave.json') as uData: self.records = json.load(uData) self.types = {'1': 'Reformer', '2': 'Helper', '3': 'Achiever', '4': 'Individualist', '5': 'Investigator', '6': 'Loyalist',...
enneagram
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class enneagram: def __init__(self): """loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {"S": list of statements[2] {"S": text of statement "E": eValue of statement, if chosen} "D": display decimal value (1 - 144) "K": display base12 value (...
stack_v2_sparse_classes_36k_train_017591
1,855
no_license
[ { "docstring": "loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {\"S\": list of statements[2] {\"S\": text of statement \"E\": eValue of statement, if chosen} \"D\": display decimal value (1 - 144) \"K\": display base12 value (00 - BB)} records: a list of dic...
2
stack_v2_sparse_classes_30k_train_005878
Implement the Python class `enneagram` described below. Class description: Implement the enneagram class. Method signatures and docstrings: - def __init__(self): loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {"S": list of statements[2] {"S": text of statement "E"...
Implement the Python class `enneagram` described below. Class description: Implement the enneagram class. Method signatures and docstrings: - def __init__(self): loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {"S": list of statements[2] {"S": text of statement "E"...
f2e43365c6f4572a548db4b4a3a17d2ecfe7a522
<|skeleton|> class enneagram: def __init__(self): """loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {"S": list of statements[2] {"S": text of statement "E": eValue of statement, if chosen} "D": display decimal value (1 - 144) "K": display base12 value (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class enneagram: def __init__(self): """loads questions and records and types questions: a list of dicts, one dict for each of 144 questions {"S": list of statements[2] {"S": text of statement "E": eValue of statement, if chosen} "D": display decimal value (1 - 144) "K": display base12 value (00 - BB)} reco...
the_stack_v2_python_sparse
tomar/nine/enneagram.py
tomargames/tomarPython
train
0
06863a6f6407fae482b9968957ade03c7c6dd08e
[ "api_call = {'date': [], 'count': []}\nfor item in AccessLogDAO.select_api_call_count(chart_day):\n api_call['date'].append(item['date'])\n api_call['count'].append(item['count'])\nuser_access = {'date': [], 'count': []}\nfor item in AccessLogDAO.select_user_access_count(chart_day):\n user_access['date'].a...
<|body_start_0|> api_call = {'date': [], 'count': []} for item in AccessLogDAO.select_api_call_count(chart_day): api_call['date'].append(item['date']) api_call['count'].append(item['count']) user_access = {'date': [], 'count': []} for item in AccessLogDAO.select_u...
DashboardSrv
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashboardSrv: def get_chart_data(cls, chart_day: int=15) -> dict: """# 获取仪表板图表数据""" <|body_0|> def get_access_data(cls) -> dict: """# 获取用户访问信息""" <|body_1|> def get_today_login_data(cls) -> dict: """# 获取今日后台及简历访问登陆信息""" <|body_2|> de...
stack_v2_sparse_classes_36k_train_017592
6,673
permissive
[ { "docstring": "# 获取仪表板图表数据", "name": "get_chart_data", "signature": "def get_chart_data(cls, chart_day: int=15) -> dict" }, { "docstring": "# 获取用户访问信息", "name": "get_access_data", "signature": "def get_access_data(cls) -> dict" }, { "docstring": "# 获取今日后台及简历访问登陆信息", "name": ...
4
stack_v2_sparse_classes_30k_train_001481
Implement the Python class `DashboardSrv` described below. Class description: Implement the DashboardSrv class. Method signatures and docstrings: - def get_chart_data(cls, chart_day: int=15) -> dict: # 获取仪表板图表数据 - def get_access_data(cls) -> dict: # 获取用户访问信息 - def get_today_login_data(cls) -> dict: # 获取今日后台及简历访问登陆信息 ...
Implement the Python class `DashboardSrv` described below. Class description: Implement the DashboardSrv class. Method signatures and docstrings: - def get_chart_data(cls, chart_day: int=15) -> dict: # 获取仪表板图表数据 - def get_access_data(cls) -> dict: # 获取用户访问信息 - def get_today_login_data(cls) -> dict: # 获取今日后台及简历访问登陆信息 ...
2a6f44f86469bfbb472dfd1bec4238587d8402bf
<|skeleton|> class DashboardSrv: def get_chart_data(cls, chart_day: int=15) -> dict: """# 获取仪表板图表数据""" <|body_0|> def get_access_data(cls) -> dict: """# 获取用户访问信息""" <|body_1|> def get_today_login_data(cls) -> dict: """# 获取今日后台及简历访问登陆信息""" <|body_2|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DashboardSrv: def get_chart_data(cls, chart_day: int=15) -> dict: """# 获取仪表板图表数据""" api_call = {'date': [], 'count': []} for item in AccessLogDAO.select_api_call_count(chart_day): api_call['date'].append(item['date']) api_call['count'].append(item['count']) ...
the_stack_v2_python_sparse
backend/blog/service/dashboard.py
o8oo8o/blog
train
0
fc4ebee47d7bd1fbd764faf66f5d00573277bb3b
[ "if len(nums) <= 1:\n return len(nums)\ndp = [1] * len(nums)\nfor i in range(len(nums)):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\nreturn max(dp)", "dp = []\nfor num in nums:\n idx = bisect_left(dp, num)\n if idx == len(dp):\n dp.append(num)...
<|body_start_0|> if len(nums) <= 1: return len(nums) dp = [1] * len(nums) for i in range(len(nums)): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) return max(dp) <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。""" <|body_0|> def lengthOfLIS(self, nums: List[int]) -> int: """寻找最长严格递增子序列 思路2:维护一个结果列表,使用二分查找确定新的元素在结果列表中的位置。 1)比结果列表中的值小,替换结果列表中比该...
stack_v2_sparse_classes_36k_train_017593
1,278
no_license
[ { "docstring": "寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums: List[int]) -> int" }, { "docstring": "寻找最长严格递增子序列 思路2:维护一个结果列表,使用二分查找确定新的元素在结果列表中的位置。 1)比结果列表中的值小,替换结果列表中比该元素大的第一个下标元素。 2)比结果列表的值都大,则添加到已有元...
2
stack_v2_sparse_classes_30k_train_007674
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: 寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。 - def lengthOfLIS(self, nums: List[int]) -> int: 寻找最长严格递增...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: 寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。 - def lengthOfLIS(self, nums: List[int]) -> int: 寻找最长严格递增...
7fde3c1dddf8ca6b89924ca13d0aa5ffc03a1545
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。""" <|body_0|> def lengthOfLIS(self, nums: List[int]) -> int: """寻找最长严格递增子序列 思路2:维护一个结果列表,使用二分查找确定新的元素在结果列表中的位置。 1)比结果列表中的值小,替换结果列表中比该...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """寻找最长严格递增子序列 思路1:当前已存在的长子序列集合中的最后一个元素,与最新元素比较。 1)状态定义:dp = 到达第i位时的最长子序列长度。""" if len(nums) <= 1: return len(nums) dp = [1] * len(nums) for i in range(len(nums)): for j in range(i): ...
the_stack_v2_python_sparse
Week_09/300.longest-increasing-subsequence.py
liubio0/algorithm022
train
0
03696f2ef00cdf6bc3e1ef87e129dbbb5cb02939
[ "self.asteroids = []\nfor _ in range(100):\n self.asteroids.append(Asteroid.generate_random_asteroid())", "for _ in range(seconds):\n for asteroid in self.asteroids:\n asteroid.move()\n print(asteroid)\n sleep(1)" ]
<|body_start_0|> self.asteroids = [] for _ in range(100): self.asteroids.append(Asteroid.generate_random_asteroid()) <|end_body_0|> <|body_start_1|> for _ in range(seconds): for asteroid in self.asteroids: asteroid.move() print(asteroid) ...
The driver class which drives the simulation.
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """The driver class which drives the simulation.""" def __init__(self): """Initializes the controller by generating 100 random asteroids.""" <|body_0|> def simulate(self, seconds: int) -> None: """Simulates asteroids moving in a 3D space in a number o...
stack_v2_sparse_classes_36k_train_017594
1,086
no_license
[ { "docstring": "Initializes the controller by generating 100 random asteroids.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Simulates asteroids moving in a 3D space in a number of seconds. :param seconds: an int, number of seconds to run the simulation :return: None...
2
null
Implement the Python class `Controller` described below. Class description: The driver class which drives the simulation. Method signatures and docstrings: - def __init__(self): Initializes the controller by generating 100 random asteroids. - def simulate(self, seconds: int) -> None: Simulates asteroids moving in a 3...
Implement the Python class `Controller` described below. Class description: The driver class which drives the simulation. Method signatures and docstrings: - def __init__(self): Initializes the controller by generating 100 random asteroids. - def simulate(self, seconds: int) -> None: Simulates asteroids moving in a 3...
e86956c69006f96221349fe9bd4925ad2255601e
<|skeleton|> class Controller: """The driver class which drives the simulation.""" def __init__(self): """Initializes the controller by generating 100 random asteroids.""" <|body_0|> def simulate(self, seconds: int) -> None: """Simulates asteroids moving in a 3D space in a number o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """The driver class which drives the simulation.""" def __init__(self): """Initializes the controller by generating 100 random asteroids.""" self.asteroids = [] for _ in range(100): self.asteroids.append(Asteroid.generate_random_asteroid()) def simulat...
the_stack_v2_python_sparse
lab-1-classy-asteroids-lizhiquan/lab1_driver.py
lizhiquan/learning-python
train
0
65c1529dfc5af563aaf849b7a5d7e104b6fa6b99
[ "super(WorkflowGenerator, self).__init__(workload_generator)\nif len(manifest_list) != len(share_list):\n raise ValueError('manifest_list and share_list must have the same length.')\nself._manifest_selector = RandomSelector(workload_generator._random_gen)\nself._manifest_selector.set(share_list, manifest_list)\n...
<|body_start_0|> super(WorkflowGenerator, self).__init__(workload_generator) if len(manifest_list) != len(share_list): raise ValueError('manifest_list and share_list must have the same length.') self._manifest_selector = RandomSelector(workload_generator._random_gen) self._ma...
Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest.
WorkflowGenerator
[ "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowGenerator: """Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest.""" def __init__(self, manifest_list, sha...
stack_v2_sparse_classes_36k_train_017595
17,547
permissive
[ { "docstring": "Constructor Args: - manifest_list: list of file routes pointing to manifests. - share_list: list of floats. they must add 1.0. They represent the chance for a manifest in the same position in manifest_list to be submitted. Must have the length as manifest_list. - workload_generator: orkloadGener...
3
stack_v2_sparse_classes_30k_val_000125
Implement the Python class `WorkflowGenerator` described below. Class description: Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest. Metho...
Implement the Python class `WorkflowGenerator` described below. Class description: Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest. Metho...
2301dacf486df8ed783c0ba33cbbde6e9978c17e
<|skeleton|> class WorkflowGenerator: """Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest.""" def __init__(self, manifest_list, sha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowGenerator: """Class that submits a workflow in manifest format. It receives a list of manifests and probabilities. Every time that it is time to submit it will map a random number over those probabilities and submit the corresponding manifest.""" def __init__(self, manifest_list, share_list, work...
the_stack_v2_python_sparse
generate/pattern.py
gonzalorodrigo/ScSFWorkload
train
1
dfeb9d938b61e0b958f8fd40339b2047db033b5b
[ "profile = {'paymentConfirmationDialog': bool(self.payment_confirmation == 'Y'), 'selectConfirmationDialog': bool(self.search_selection_confirmation == 'Y'), 'defaultDropDowns': bool(self.default_drop_downs == 'Y'), 'defaultTableFilters': bool(self.default_table_filters == 'Y')}\nif self.registrations_table:\n p...
<|body_start_0|> profile = {'paymentConfirmationDialog': bool(self.payment_confirmation == 'Y'), 'selectConfirmationDialog': bool(self.search_selection_confirmation == 'Y'), 'defaultDropDowns': bool(self.default_drop_downs == 'Y'), 'defaultTableFilters': bool(self.default_table_filters == 'Y')} if self....
This class maintains user profile UI settings.
UserProfile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfile: """This class maintains user profile UI settings.""" def json(self) -> dict: """Return the user profile as a json object.""" <|body_0|> def save(self): """Render a user profile to the local cache.""" <|body_1|> def update_profile(self, p...
stack_v2_sparse_classes_36k_train_017596
6,749
permissive
[ { "docstring": "Return the user profile as a json object.", "name": "json", "signature": "def json(self) -> dict" }, { "docstring": "Render a user profile to the local cache.", "name": "save", "signature": "def save(self)" }, { "docstring": "Update one or more user profile settin...
5
null
Implement the Python class `UserProfile` described below. Class description: This class maintains user profile UI settings. Method signatures and docstrings: - def json(self) -> dict: Return the user profile as a json object. - def save(self): Render a user profile to the local cache. - def update_profile(self, profi...
Implement the Python class `UserProfile` described below. Class description: This class maintains user profile UI settings. Method signatures and docstrings: - def json(self) -> dict: Return the user profile as a json object. - def save(self): Render a user profile to the local cache. - def update_profile(self, profi...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class UserProfile: """This class maintains user profile UI settings.""" def json(self) -> dict: """Return the user profile as a json object.""" <|body_0|> def save(self): """Render a user profile to the local cache.""" <|body_1|> def update_profile(self, p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfile: """This class maintains user profile UI settings.""" def json(self) -> dict: """Return the user profile as a json object.""" profile = {'paymentConfirmationDialog': bool(self.payment_confirmation == 'Y'), 'selectConfirmationDialog': bool(self.search_selection_confirmation == ...
the_stack_v2_python_sparse
ppr-api/src/ppr_api/models/user_profile.py
bcgov/ppr
train
4
b8d01ef9c917a4f50163b659102df051f85ec217
[ "self._host = None\nself._port = None\nself._servers = []", "self._servers = await discover(self.hass)\nif self._servers:\n return await self.async_step_link()\nreturn await self.async_step_fallback()", "errors = {}\nif user_input is not None:\n self._host = user_input['host']\n self._port = user_input...
<|body_start_0|> self._host = None self._port = None self._servers = [] <|end_body_0|> <|body_start_1|> self._servers = await discover(self.hass) if self._servers: return await self.async_step_link() return await self.async_step_fallback() <|end_body_1|> <|b...
Handle a config flow for roon.
ConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigFlow: """Handle a config flow for roon.""" def __init__(self): """Initialize the Roon flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Get roon core details via discovery.""" <|body_1|> async def async_step_fallback(self...
stack_v2_sparse_classes_36k_train_017597
5,124
permissive
[ { "docstring": "Initialize the Roon flow.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get roon core details via discovery.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Get host and p...
4
stack_v2_sparse_classes_30k_train_009019
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for roon. Method signatures and docstrings: - def __init__(self): Initialize the Roon flow. - async def async_step_user(self, user_input=None): Get roon core details via discovery. - async def async_step_fallback(self, us...
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for roon. Method signatures and docstrings: - def __init__(self): Initialize the Roon flow. - async def async_step_user(self, user_input=None): Get roon core details via discovery. - async def async_step_fallback(self, us...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ConfigFlow: """Handle a config flow for roon.""" def __init__(self): """Initialize the Roon flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Get roon core details via discovery.""" <|body_1|> async def async_step_fallback(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigFlow: """Handle a config flow for roon.""" def __init__(self): """Initialize the Roon flow.""" self._host = None self._port = None self._servers = [] async def async_step_user(self, user_input=None): """Get roon core details via discovery.""" sel...
the_stack_v2_python_sparse
homeassistant/components/roon/config_flow.py
home-assistant/core
train
35,501
8f6523b0c524a75834cb859bf8ad9ca845e75240
[ "root = self._root\nlevels = {}\nwith open(file_name, 'r') as f:\n lines = f.readlines()\n for line in lines:\n [level, side, question] = line.split(',')\n level = int(level)\n if side == '-':\n root = self._add_root(question)\n levels[level] = root\n elif sid...
<|body_start_0|> root = self._root levels = {} with open(file_name, 'r') as f: lines = f.readlines() for line in lines: [level, side, question] = line.split(',') level = int(level) if side == '-': root = ...
Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below)
DecisionTree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecisionTree: """Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below)""" def create_decision_tree_from_file(self, file_name): ...
stack_v2_sparse_classes_36k_train_017598
3,843
permissive
[ { "docstring": "This function should build a decision tree using a file containing the questions to be asked. In particular, each row the file file (see visa_decision_tree.txt for the example used in the main) contains 3 comma separated elements: <level>,<side>,<question> <level>: is the level in the tree of th...
3
null
Implement the Python class `DecisionTree` described below. Class description: Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below) Method signatures and do...
Implement the Python class `DecisionTree` described below. Class description: Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below) Method signatures and do...
e7a122c910bf12eddf5c0ffc2c666995b4989408
<|skeleton|> class DecisionTree: """Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below)""" def create_decision_tree_from_file(self, file_name): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecisionTree: """Note that this class "extends" the LinkedBinaryTree class. That is, a DecisionTree inherits the behaviour of the LinkedBinaryTree and adds some additional behaviour (= the functions that you have to implement below)""" def create_decision_tree_from_file(self, file_name): """This ...
the_stack_v2_python_sparse
data-science-not/weeks/m04_trees/p2/decision_tree.py
nurseiit/comm-unist
train
6
1f0910ddf6bcdb3d0f5848f15a81cc6e6fe2bb23
[ "tp = time_point.split(':')\ntime_in_minute = int(tp[0]) * 60 + int(tp[1])\nreturn time_in_minute", "tp_min = list()\nfor time_point in timePoints:\n tp_min.append(self.convert_to_minutes(time_point))\ntp_min.sort()\nmin_difference = 1440\nfor i in range(len(tp_min)):\n if i == 0:\n continue\n min...
<|body_start_0|> tp = time_point.split(':') time_in_minute = int(tp[0]) * 60 + int(tp[1]) return time_in_minute <|end_body_0|> <|body_start_1|> tp_min = list() for time_point in timePoints: tp_min.append(self.convert_to_minutes(time_point)) tp_min.sort() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convert_to_minutes(self, time_point): """:type time_point: str :rtype int""" <|body_0|> def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> tp = time_point...
stack_v2_sparse_classes_36k_train_017599
1,301
no_license
[ { "docstring": ":type time_point: str :rtype int", "name": "convert_to_minutes", "signature": "def convert_to_minutes(self, time_point)" }, { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference", "signature": "def findMinDifference(self, timePoints)" } ]
2
stack_v2_sparse_classes_30k_train_003195
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert_to_minutes(self, time_point): :type time_point: str :rtype int - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert_to_minutes(self, time_point): :type time_point: str :rtype int - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int <|skeleton|> class ...
1dec441f1975d402d093031569cfd301eb71d465
<|skeleton|> class Solution: def convert_to_minutes(self, time_point): """:type time_point: str :rtype int""" <|body_0|> def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convert_to_minutes(self, time_point): """:type time_point: str :rtype int""" tp = time_point.split(':') time_in_minute = int(tp[0]) * 60 + int(tp[1]) return time_in_minute def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype:...
the_stack_v2_python_sparse
539-minimum-time-difference.py
franktank/py-practice
train
1