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
87f603b715a1859ca1275bcf28cd6c2565bf93a0
[ "self.initial_date = initial_date\nself.until_date = until_date\nlog.debug('self.initial_date: {}'.format(self.initial_date))\nlog.debug('self.until_date: {}'.format(self.until_date))", "log.debug('Build all')\nprint('Building...')\nlog.debug('Detail')\nprint('\\nAdding to details table for:')\nself.dict_parse('D...
<|body_start_0|> self.initial_date = initial_date self.until_date = until_date log.debug('self.initial_date: {}'.format(self.initial_date)) log.debug('self.until_date: {}'.format(self.until_date)) <|end_body_0|> <|body_start_1|> log.debug('Build all') print('Building...'...
Take structured data and enter into database.
Build
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Build: """Take structured data and enter into database.""" def __init__(self, initial_date=None, until_date=None): """Create class variables for date range and connect to database.""" <|body_0|> def build_all(self): """Run through all of the building methods.""" ...
stack_v2_sparse_classes_36k_train_032400
4,162
no_license
[ { "docstring": "Create class variables for date range and connect to database.", "name": "__init__", "signature": "def __init__(self, initial_date=None, until_date=None)" }, { "docstring": "Run through all of the building methods.", "name": "build_all", "signature": "def build_all(self)"...
5
stack_v2_sparse_classes_30k_train_002075
Implement the Python class `Build` described below. Class description: Take structured data and enter into database. Method signatures and docstrings: - def __init__(self, initial_date=None, until_date=None): Create class variables for date range and connect to database. - def build_all(self): Run through all of the ...
Implement the Python class `Build` described below. Class description: Take structured data and enter into database. Method signatures and docstrings: - def __init__(self, initial_date=None, until_date=None): Create class variables for date range and connect to database. - def build_all(self): Run through all of the ...
4ad7c77ab56681e9ca8e1dd1033a32c21c498d75
<|skeleton|> class Build: """Take structured data and enter into database.""" def __init__(self, initial_date=None, until_date=None): """Create class variables for date range and connect to database.""" <|body_0|> def build_all(self): """Run through all of the building methods.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Build: """Take structured data and enter into database.""" def __init__(self, initial_date=None, until_date=None): """Create class variables for date range and connect to database.""" self.initial_date = initial_date self.until_date = until_date log.debug('self.initial_dat...
the_stack_v2_python_sparse
scripts/build.py
TheLens/realestate
train
1
39b727e43856d43058508816cc79c393404aa2a8
[ "self._max_displacement = kwargs.pop('max_displacement', 0.0)\nself._views_per_segment = kwargs.pop('views_per_segment', 1)\nsuper().__init__(*args, **kwargs)\nif self._phases is not None:\n raise ValueError(f'Layer {self.__class__.__name__} does not support multiple phases.')\nif isinstance(self._max_displaceme...
<|body_start_0|> self._max_displacement = kwargs.pop('max_displacement', 0.0) self._views_per_segment = kwargs.pop('views_per_segment', 1) super().__init__(*args, **kwargs) if self._phases is not None: raise ValueError(f'Layer {self.__class__.__name__} does not support multip...
K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimension. If a scalar is given, the same displacement will be used in all dimensions. Each element ...
KSpaceResamplingWithMotion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KSpaceResamplingWithMotion: """K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimension. If a scalar is given, the same disp...
stack_v2_sparse_classes_36k_train_032401
4,786
permissive
[ { "docstring": "Initializes the layer.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Adds motion to k-space. Args: kspace: The input k-space. Returns: The processed k-space. Raises: ValueError: If `kspace` does not have rank 2.", "name": "process...
3
stack_v2_sparse_classes_30k_test_000731
Implement the Python class `KSpaceResamplingWithMotion` described below. Class description: K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimensi...
Implement the Python class `KSpaceResamplingWithMotion` described below. Class description: K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimensi...
cfd8930ee5281e7f6dceb17c4a5acaf625fd3243
<|skeleton|> class KSpaceResamplingWithMotion: """K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimension. If a scalar is given, the same disp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KSpaceResamplingWithMotion: """K-space resampling layer with motion. Accepts the same arguments as `KSpaceResampling`, plus those defined below. Args: max_displacement: A list of floats defining the maximum displacement (in pixels) along each spatial dimension. If a scalar is given, the same displacement will...
the_stack_v2_python_sparse
tensorflow_mri/python/experimental/layers.py
mrphys/tensorflow-mri
train
29
5428bac5c6596defc999771d5be27ceeb6966afb
[ "if user_id is None or type(user_id) != str:\n return None\nsession_id = str(uuid4())\nself.user_id_by_session_id[session_id] = user_id\nreturn session_id", "if session_id is None or type(session_id) != str:\n return None\nreturn self.user_id_by_session_id.get(session_id)", "sesh_cookie = self.session_coo...
<|body_start_0|> if user_id is None or type(user_id) != str: return None session_id = str(uuid4()) self.user_id_by_session_id[session_id] = user_id return session_id <|end_body_0|> <|body_start_1|> if session_id is None or type(session_id) != str: return ...
inherits from auth
SessionAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionAuth: """inherits from auth""" def create_session(self, user_id: str=None) -> str: """creates a session id""" <|body_0|> def user_id_for_session_id(self, session_id: str=None) -> str: """get a user id from session id""" <|body_1|> def current_...
stack_v2_sparse_classes_36k_train_032402
1,573
no_license
[ { "docstring": "creates a session id", "name": "create_session", "signature": "def create_session(self, user_id: str=None) -> str" }, { "docstring": "get a user id from session id", "name": "user_id_for_session_id", "signature": "def user_id_for_session_id(self, session_id: str=None) -> ...
4
stack_v2_sparse_classes_30k_train_010508
Implement the Python class `SessionAuth` described below. Class description: inherits from auth Method signatures and docstrings: - def create_session(self, user_id: str=None) -> str: creates a session id - def user_id_for_session_id(self, session_id: str=None) -> str: get a user id from session id - def current_user...
Implement the Python class `SessionAuth` described below. Class description: inherits from auth Method signatures and docstrings: - def create_session(self, user_id: str=None) -> str: creates a session id - def user_id_for_session_id(self, session_id: str=None) -> str: get a user id from session id - def current_user...
c0182a227da7a47fd641b3d9e085243b36b626db
<|skeleton|> class SessionAuth: """inherits from auth""" def create_session(self, user_id: str=None) -> str: """creates a session id""" <|body_0|> def user_id_for_session_id(self, session_id: str=None) -> str: """get a user id from session id""" <|body_1|> def current_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SessionAuth: """inherits from auth""" def create_session(self, user_id: str=None) -> str: """creates a session id""" if user_id is None or type(user_id) != str: return None session_id = str(uuid4()) self.user_id_by_session_id[session_id] = user_id retur...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_auth.py
Jilroge7/holbertonschool-web_back_end
train
0
7f3bb12b0768465457da27b44b2ab3cbbea5df9d
[ "super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "seq_len = x.s...
<|body_start_0|> super().__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] self.d...
the decoder for a transformer:
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """the decoder for a transformer:""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidden units in the fully connected layer -target_vocab - the ...
stack_v2_sparse_classes_36k_train_032403
2,490
no_license
[ { "docstring": "Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidden units in the fully connected layer -target_vocab - the size of the target vocabulary -max_seq_len - the maximum sequence length possible -drop_rate - the dropout rate", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_007824
Implement the Python class `Decoder` described below. Class description: the decoder for a transformer: Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidde...
Implement the Python class `Decoder` described below. Class description: the decoder for a transformer: Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidde...
7dafc37d306fcf2ea0f5af5bd97dfd78d388100c
<|skeleton|> class Decoder: """the decoder for a transformer:""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidden units in the fully connected layer -target_vocab - the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """the decoder for a transformer:""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """Args: -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidden units in the fully connected layer -target_vocab - the size of the t...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
AndresSern/holbertonschool-machine_learning-1
train
0
bea455fe7a70fbb28bed089de125be7eedbc3c20
[ "self.__wrapped = wrapped\nself.__retry_if = retry_if\nself.__backoff = backoff\nif self.__backoff <= 0:\n raise ValueError('backoff must be positive')\nself.__multiplier = multiplier\nif self.__multiplier < 1:\n raise ValueError('multiplier must be at least one!')\nself.__max_tries = max_tries\nself.__max_ba...
<|body_start_0|> self.__wrapped = wrapped self.__retry_if = retry_if self.__backoff = backoff if self.__backoff <= 0: raise ValueError('backoff must be positive') self.__multiplier = multiplier if self.__multiplier < 1: raise ValueError('multiplier...
Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain number of seconds and call the function again, until it succeeds or we get a non-...
RetryWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetryWrapper: """Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain number of seconds and call the function a...
stack_v2_sparse_classes_36k_train_032404
4,804
permissive
[ { "docstring": "Wrap the given object. :param wrapped: the object to wrap :param retry_if: a method that takes an exception, and returns whether we should retry :type backoff: float :param backoff: the number of seconds to wait the first time we get a retriable error :type multiplier: float :param multiplier: i...
3
stack_v2_sparse_classes_30k_train_020322
Implement the Python class `RetryWrapper` described below. Class description: Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain nu...
Implement the Python class `RetryWrapper` described below. Class description: Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain nu...
fe21995e0402878437a828c6a4244025eac8c43b
<|skeleton|> class RetryWrapper: """Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain number of seconds and call the function a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetryWrapper: """Handle transient errors, with configurable backoff. This class can wrap any object. The wrapped object will behave like the original one, except that if you call a function and it raises a retriable exception, we'll back off for a certain number of seconds and call the function again, until i...
the_stack_v2_python_sparse
python_modules/libraries/dagster-aws/dagster_aws/utils/mrjob/retry.py
dagster-io/dagster
train
8,565
d412ec8ddcc4a76fcedf9d8f1cb3534559652fbd
[ "g_circuits, g_parameter_values, g_parameters = self._preprocess(circuits, parameter_values, parameters, self.SUPPORTED_GATES)\nresults = self._run_unique(g_circuits, observables, g_parameter_values, g_parameters, **options)\nreturn self._postprocess(results, circuits, parameter_values, parameters)", "job_circuit...
<|body_start_0|> g_circuits, g_parameter_values, g_parameters = self._preprocess(circuits, parameter_values, parameters, self.SUPPORTED_GATES) results = self._run_unique(g_circuits, observables, g_parameter_values, g_parameters, **options) return self._postprocess(results, circuits, parameter_va...
Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.032331>`_
ParamShiftEstimatorGradient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.03233...
stack_v2_sparse_classes_36k_train_032405
4,346
permissive
[ { "docstring": "Compute the gradients of the expectation values by the parameter shift rule.", "name": "_run", "signature": "def _run(self, circuits: Sequence[QuantumCircuit], observables: Sequence[BaseOperator | PauliSumOp], parameter_values: Sequence[Sequence[float]], parameters: Sequence[Sequence[Par...
2
null
Implement the Python class `ParamShiftEstimatorGradient` described below. Class description: Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <ht...
Implement the Python class `ParamShiftEstimatorGradient` described below. Class description: Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <ht...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.03233...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.032331>`_""" ...
the_stack_v2_python_sparse
qiskit/algorithms/gradients/param_shift/param_shift_estimator_gradient.py
1ucian0/qiskit-terra
train
6
e4e134af1fc2cc25a64983c1c94a2ed4c44d1373
[ "self.n_bins = n_bins\nself.bins = np.linspace(0, 255, n_bins + 1)\nself.alpha = alpha", "rgb_image = image.convert('RGB').resize((50, 50), resample=Image.NEAREST)\npixel_array = np.array(rgb_image).reshape(-1, 3)\nrepeated_pixel_array = np.repeat(pixel_array, 10, axis=0)\nnoise = np.random.normal(0, self.alpha, ...
<|body_start_0|> self.n_bins = n_bins self.bins = np.linspace(0, 255, n_bins + 1) self.alpha = alpha <|end_body_0|> <|body_start_1|> rgb_image = image.convert('RGB').resize((50, 50), resample=Image.NEAREST) pixel_array = np.array(rgb_image).reshape(-1, 3) repeated_pixel_...
A class for embedding color information from an image.
ColorEmbedder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorEmbedder: """A class for embedding color information from an image.""" def __init__(self, n_bins: int=8, alpha: float=5): """Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel."...
stack_v2_sparse_classes_36k_train_032406
2,172
permissive
[ { "docstring": "Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel.", "name": "__init__", "signature": "def __init__(self, n_bins: int=8, alpha: float=5)" }, { "docstring": "Embed color informat...
2
stack_v2_sparse_classes_30k_train_011930
Implement the Python class `ColorEmbedder` described below. Class description: A class for embedding color information from an image. Method signatures and docstrings: - def __init__(self, n_bins: int=8, alpha: float=5): Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (floa...
Implement the Python class `ColorEmbedder` described below. Class description: A class for embedding color information from an image. Method signatures and docstrings: - def __init__(self, n_bins: int=8, alpha: float=5): Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (floa...
f5d158de6d4d652e7264093c64420288ecb6a85b
<|skeleton|> class ColorEmbedder: """A class for embedding color information from an image.""" def __init__(self, n_bins: int=8, alpha: float=5): """Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColorEmbedder: """A class for embedding color information from an image.""" def __init__(self, n_bins: int=8, alpha: float=5): """Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel.""" se...
the_stack_v2_python_sparse
knn-colours/pipeline/src/embedder.py
wellcomecollection/data-science
train
7
2a9498ee61aef7e05d13ba8ff8ef989ad3c603ac
[ "basket = Inventory()\ndrsim = SouthAsian()\nhadji = MiddleEastern()\njonny = American()\nfor n in range(2):\n basket.add_coconut(drsim)\nfor n in range(1):\n basket.add_coconut(hadji)\nfor n in range(3):\n basket.add_coconut(jonny)\nexpected = 19.0\nresult = basket.total_weight()\nself.assertEqual(result,...
<|body_start_0|> basket = Inventory() drsim = SouthAsian() hadji = MiddleEastern() jonny = American() for n in range(2): basket.add_coconut(drsim) for n in range(1): basket.add_coconut(hadji) for n in range(3): basket.add_coconu...
Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different
TestCocoNuts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South As...
stack_v2_sparse_classes_36k_train_032407
1,940
no_license
[ { "docstring": "Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South Asian=2, Middle Eastern=1, American=3", "name": "test_weight", "signature": "def test_weight(self)" }, { "docstring": "Ensure that add_coconut() th...
3
null
Implement the Python class `TestCocoNuts` described below. Class description: Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different Method signatures and docstrings: - def test_weight(self): Ensures that given defined weights, the total_weight() method returns the corr...
Implement the Python class `TestCocoNuts` described below. Class description: Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different Method signatures and docstrings: - def test_weight(self): Ensures that given defined weights, the total_weight() method returns the corr...
b32f83aa1b705a5ad384b73c618f04f7d2622753
<|skeleton|> class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South As...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCocoNuts: """Tests add_coconut(), total_weight() methods and tests that weights for each coconut type are different""" def test_weight(self): """Ensures that given defined weights, the total_weight() method returns the correct total weight. Add following coconut numbers: South Asian=2, Middle...
the_stack_v2_python_sparse
ostPython3/test_coconuts.py
deepbsd/OST_Python
train
1
fa3883ec7c3de807cd8583290964219c2cde80ed
[ "np.random.seed(cfg.RNG_SEED)\ntorch.manual_seed(cfg.RNG_SEED)\ntorch.backends.cudnn.deterministic = False\ntorch.backends.cudnn.benchmark = True\nif gpu_id is None:\n self.device = get_device(get_local_rank())\nelse:\n self.device = torch.device(f'cuda:{gpu_id}')\nself.model = build_recognizer(cfg, device=se...
<|body_start_0|> np.random.seed(cfg.RNG_SEED) torch.manual_seed(cfg.RNG_SEED) torch.backends.cudnn.deterministic = False torch.backends.cudnn.benchmark = True if gpu_id is None: self.device = get_device(get_local_rank()) else: self.device = torch.d...
Action Predictor for action recognition.
Predictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: """Action Predictor for action recognition.""" def __init__(self, cfg, gpu_id=None): """Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py.""" <|body_0|> def __call__(self, task): """Returns the prediction results for the...
stack_v2_sparse_classes_36k_train_032408
2,292
permissive
[ { "docstring": "Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py.", "name": "__init__", "signature": "def __init__(self, cfg, gpu_id=None)" }, { "docstring": "Returns the prediction results for the current task. Args: task (TaskInfo object): task object that cont...
2
stack_v2_sparse_classes_30k_train_020307
Implement the Python class `Predictor` described below. Class description: Action Predictor for action recognition. Method signatures and docstrings: - def __init__(self, cfg, gpu_id=None): Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py. - def __call__(self, task): Returns the predi...
Implement the Python class `Predictor` described below. Class description: Action Predictor for action recognition. Method signatures and docstrings: - def __init__(self, cfg, gpu_id=None): Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py. - def __call__(self, task): Returns the predi...
ec6ad668d20f477df44eab7035e2553d95a835f3
<|skeleton|> class Predictor: """Action Predictor for action recognition.""" def __init__(self, cfg, gpu_id=None): """Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py.""" <|body_0|> def __call__(self, task): """Returns the prediction results for the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Predictor: """Action Predictor for action recognition.""" def __init__(self, cfg, gpu_id=None): """Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py.""" np.random.seed(cfg.RNG_SEED) torch.manual_seed(cfg.RNG_SEED) torch.backends.cudnn.determ...
the_stack_v2_python_sparse
demo/slowfast/visualization/predictor/predictor.py
ttykelly/TSN
train
0
e944f9e3128a9961c73d637627ed381829741cc9
[ "from real_time_detection.GUI.EmotivDeviceReader import EmotivDeviceReader\nself.emotiv_reader = EmotivDeviceReader()\nself.input_type = input_type\nif self.input_type == 'file':\n self.raw_EEG_obj = mne.io.read_raw_fif(file_path, preload=True)\n max_time = self.raw_EEG_obj.times.max()\n self.raw_EEG_obj.c...
<|body_start_0|> from real_time_detection.GUI.EmotivDeviceReader import EmotivDeviceReader self.emotiv_reader = EmotivDeviceReader() self.input_type = input_type if self.input_type == 'file': self.raw_EEG_obj = mne.io.read_raw_fif(file_path, preload=True) max_time...
This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.
EEGReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'f...
stack_v2_sparse_classes_36k_train_032409
3,357
permissive
[ { "docstring": "Arguments: input_type: 'file' indicates that the stream is from file. In other case, the stream will from the 'Emotiv insight' device.", "name": "__init__", "signature": "def __init__(self, input_type, file_path=None)" }, { "docstring": "Return: EEG data: the EEG data timestamp: ...
2
stack_v2_sparse_classes_30k_train_000613
Implement the Python class `EEGReader` described below. Class description: This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features. Method signatures and docstrings: - def __init__(sel...
Implement the Python class `EEGReader` described below. Class description: This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features. Method signatures and docstrings: - def __init__(sel...
531f646dcb493dce2575af3b9d77403ebc1f4a35
<|skeleton|> class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'file' indicate...
the_stack_v2_python_sparse
MindLink-Eumpy/real_time_detection/GUI/MLE_tool/EEGReader.py
wozu-dichter/MindLink-Explorer
train
0
b48d59d7b7a056a8b4205d195d05553063970467
[ "global maxArea\nmaxArea = 0\n\ndef dp(height):\n global maxArea\n if len(height) < 2:\n return maxArea\n if height[0] > height[-1]:\n area = (len(height) - 1) * height[-1]\n maxArea = max(maxArea, area)\n height.pop(-1)\n else:\n area = (len(height) - 1) * height[0]\n...
<|body_start_0|> global maxArea maxArea = 0 def dp(height): global maxArea if len(height) < 2: return maxArea if height[0] > height[-1]: area = (len(height) - 1) * height[-1] maxArea = max(maxArea, area) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> global maxArea maxArea = 0 d...
stack_v2_sparse_classes_36k_train_032410
901
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea(sel...
5915e039868527d624ee4f0ad431d23c6ed2d8bd
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" global maxArea maxArea = 0 def dp(height): global maxArea if len(height) < 2: return maxArea if height[0] > height[-1]: area = (le...
the_stack_v2_python_sparse
leetcode/maxArea.py
xy2333/Leetcode
train
1
6a97a5052d78fbfc93b3b862ecde736778d3a3ab
[ "self.name = name\nself.cover_page_setting = cover_page_setting\nself.add_list_of_signatures_on_last_page_of_existing_pdf = add_list_of_signatures_on_last_page_of_existing_pdf\nself.cover_page_html = cover_page_html\nself.details_page_html = details_page_html\nself.verified_template = verified_template\nself.labels...
<|body_start_0|> self.name = name self.cover_page_setting = cover_page_setting self.add_list_of_signatures_on_last_page_of_existing_pdf = add_list_of_signatures_on_last_page_of_existing_pdf self.cover_page_html = cover_page_html self.details_page_html = details_page_html ...
Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or end that show a list of the signers. This settings hides that page or put it first or ...
CreatePdfTemplate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatePdfTemplate: """Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or end that show a list of the signers. This...
stack_v2_sparse_classes_36k_train_032411
5,723
permissive
[ { "docstring": "Constructor for the CreatePdfTemplate class", "name": "__init__", "signature": "def __init__(self, name=None, cover_page_setting=None, add_list_of_signatures_on_last_page_of_existing_pdf=None, cover_page_html=None, details_page_html=None, verified_template=None, labels=None, include_logo...
2
stack_v2_sparse_classes_30k_train_006079
Implement the Python class `CreatePdfTemplate` described below. Class description: Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or en...
Implement the Python class `CreatePdfTemplate` described below. Class description: Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or en...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class CreatePdfTemplate: """Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or end that show a list of the signers. This...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreatePdfTemplate: """Implementation of the 'CreatePdfTemplate' model. Create a new Pdf template Attributes: name (string): The name of the Pdf template cover_page_setting (CoverPageSetting): Coverpage is the page added to the document at the beginning or end that show a list of the signers. This settings hid...
the_stack_v2_python_sparse
idfy_rest_client/models/create_pdf_template.py
dealflowteam/Idfy
train
0
6c6194253acf95e9710beacd24f5cd93b5814b53
[ "import htcondor as HTC\nself._collector = HTC.Collector()\nself._schedd = HTC.Schedd()\nself._security = HTC.SecMan()", "status_counts = {'job_total': 0}\nfor job_status in Job_status:\n status_counts[job_status.name] = 0\nfor job in self._schedd.xquery(projection=['ClusterId', 'ProcId', 'JobStatus']):\n s...
<|body_start_0|> import htcondor as HTC self._collector = HTC.Collector() self._schedd = HTC.Schedd() self._security = HTC.SecMan() <|end_body_0|> <|body_start_1|> status_counts = {'job_total': 0} for job_status in Job_status: status_counts[job_status.name] =...
Condor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Condor: def __init__(self): """Init the htcondor connections on this node Args: None Returns: None Raises: None""" <|body_0|> def job_counts(self): """get the number of active jobs in the queue and group them by status The following are the states a job can be in: id...
stack_v2_sparse_classes_36k_train_032412
7,261
permissive
[ { "docstring": "Init the htcondor connections on this node Args: None Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get the number of active jobs in the queue and group them by status The following are the states a job can be in: idle, runn...
4
stack_v2_sparse_classes_30k_test_001146
Implement the Python class `Condor` described below. Class description: Implement the Condor class. Method signatures and docstrings: - def __init__(self): Init the htcondor connections on this node Args: None Returns: None Raises: None - def job_counts(self): get the number of active jobs in the queue and group them...
Implement the Python class `Condor` described below. Class description: Implement the Condor class. Method signatures and docstrings: - def __init__(self): Init the htcondor connections on this node Args: None Returns: None Raises: None - def job_counts(self): get the number of active jobs in the queue and group them...
bb0f7a539b0962afdcb237fb79d2f046542d8988
<|skeleton|> class Condor: def __init__(self): """Init the htcondor connections on this node Args: None Returns: None Raises: None""" <|body_0|> def job_counts(self): """get the number of active jobs in the queue and group them by status The following are the states a job can be in: id...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Condor: def __init__(self): """Init the htcondor connections on this node Args: None Returns: None Raises: None""" import htcondor as HTC self._collector = HTC.Collector() self._schedd = HTC.Schedd() self._security = HTC.SecMan() def job_counts(self): """ge...
the_stack_v2_python_sparse
ehos/htcondor.py
elixir-no-nels/ehos-python
train
2
95403b243f6285e44a78120a04ea480953f67d5d
[ "sum_1 = 0\nl = len(nums)\nnums = sorted(nums)\nfor i in range(l - 2):\n for j in range(i + 1, l - 1):\n k = nums[i] + nums[j]\n a = bisect.bisect_left(nums[j + 1:], k)\n sum_1 += a\n print(a, nums[i], nums[j], nums[j + 1:])\nreturn sum_1", "sum_1 = 0\nl = len(nums)\nnums = sorted(n...
<|body_start_0|> sum_1 = 0 l = len(nums) nums = sorted(nums) for i in range(l - 2): for j in range(i + 1, l - 1): k = nums[i] + nums[j] a = bisect.bisect_left(nums[j + 1:], k) sum_1 += a print(a, nums[i], nums[j]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def triangleNumber(self, nums): """:type nums: List[int] :rtype: int 2078ms""" <|body_0|> def triangleNumber_1(self, nums): """:type nums: List[int] :rtype: int 315ms""" <|body_1|> def triangleNumber_2(self, nums): """:type nums: List[i...
stack_v2_sparse_classes_36k_train_032413
2,014
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 2078ms", "name": "triangleNumber", "signature": "def triangleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 315ms", "name": "triangleNumber_1", "signature": "def triangleNumber_1(self, nums)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_012420
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def triangleNumber(self, nums): :type nums: List[int] :rtype: int 2078ms - def triangleNumber_1(self, nums): :type nums: List[int] :rtype: int 315ms - def triangleNumber_2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def triangleNumber(self, nums): :type nums: List[int] :rtype: int 2078ms - def triangleNumber_1(self, nums): :type nums: List[int] :rtype: int 315ms - def triangleNumber_2(self, ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def triangleNumber(self, nums): """:type nums: List[int] :rtype: int 2078ms""" <|body_0|> def triangleNumber_1(self, nums): """:type nums: List[int] :rtype: int 315ms""" <|body_1|> def triangleNumber_2(self, nums): """:type nums: List[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def triangleNumber(self, nums): """:type nums: List[int] :rtype: int 2078ms""" sum_1 = 0 l = len(nums) nums = sorted(nums) for i in range(l - 2): for j in range(i + 1, l - 1): k = nums[i] + nums[j] a = bisect.bisect_...
the_stack_v2_python_sparse
ValidTriangleNumber_MID_611.py
953250587/leetcode-python
train
2
915c73b34b15957da4d5299da9e07be1830d48c8
[ "if digestAlgorithm != DigestAlgorithm.SHA256:\n raise SecurityException('FilePrivateKeyStorage.sign: Unsupported digest algorithm')\nder = self.getPrivateKey(keyName)\nprivateKey = RSA.importKey(der.toRawStr())\nif sys.version_info[0] == 2:\n data = Blob(data, False).toRawStr()\nsignature = PKCS1_v1_5.new(pr...
<|body_start_0|> if digestAlgorithm != DigestAlgorithm.SHA256: raise SecurityException('FilePrivateKeyStorage.sign: Unsupported digest algorithm') der = self.getPrivateKey(keyName) privateKey = RSA.importKey(der.toRawStr()) if sys.version_info[0] == 2: data = Blob...
IotPrivateKeyStorage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IotPrivateKeyStorage: def sign(self, data, keyName, digestAlgorithm=DigestAlgorithm.SHA256): """Fetch the private key for keyName and sign the data, returning a signature Blob. :param data: Pointer the input byte buffer to sign. :type data: An array type with int elements :param Name key...
stack_v2_sparse_classes_36k_train_032414
5,142
no_license
[ { "docstring": "Fetch the private key for keyName and sign the data, returning a signature Blob. :param data: Pointer the input byte buffer to sign. :type data: An array type with int elements :param Name keyName: The name of the signing key. :param digestAlgorithm: (optional) the digest algorithm. If omitted, ...
4
stack_v2_sparse_classes_30k_train_016579
Implement the Python class `IotPrivateKeyStorage` described below. Class description: Implement the IotPrivateKeyStorage class. Method signatures and docstrings: - def sign(self, data, keyName, digestAlgorithm=DigestAlgorithm.SHA256): Fetch the private key for keyName and sign the data, returning a signature Blob. :p...
Implement the Python class `IotPrivateKeyStorage` described below. Class description: Implement the IotPrivateKeyStorage class. Method signatures and docstrings: - def sign(self, data, keyName, digestAlgorithm=DigestAlgorithm.SHA256): Fetch the private key for keyName and sign the data, returning a signature Blob. :p...
8236cecc964ebef275e260a790a0e74583940f8f
<|skeleton|> class IotPrivateKeyStorage: def sign(self, data, keyName, digestAlgorithm=DigestAlgorithm.SHA256): """Fetch the private key for keyName and sign the data, returning a signature Blob. :param data: Pointer the input byte buffer to sign. :type data: An array type with int elements :param Name key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IotPrivateKeyStorage: def sign(self, data, keyName, digestAlgorithm=DigestAlgorithm.SHA256): """Fetch the private key for keyName and sign the data, returning a signature Blob. :param data: Pointer the input byte buffer to sign. :type data: An array type with int elements :param Name keyName: The name...
the_stack_v2_python_sparse
ndn_pi/security/iot_private_key_storage.py
remap/ndn-pi
train
15
e67798b7784da6f8b6081634c35519704c46a618
[ "self.name = name\nnet = nef.Network(self, seed=HRLutils.SEED, quick=False)\nself.N = N\nself.learningrate = learningrate\nself.supervision = 1.0\nself.tauPSC = 0.007\nmodterms = []\nlearnterms = []\noutput = net.make('output', 1, len(actions), mode='direct')\noutput.fixMode()\nfor i, action in enumerate(actions):\...
<|body_start_0|> self.name = name net = nef.Network(self, seed=HRLutils.SEED, quick=False) self.N = N self.learningrate = learningrate self.supervision = 1.0 self.tauPSC = 0.007 modterms = [] learnterms = [] output = net.make('output', 1, len(actio...
A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weight learning. :input state: the output of the state population (neural activities...
ActionValues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionValues: """A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weight learning. :input state: the output of...
stack_v2_sparse_classes_36k_train_032415
5,706
no_license
[ { "docstring": "Build ActionValues network. :param name: name of Network :param N: base number of neurons :param stateN: number of neurons in state population :param actions: actions available to the system :type actions: list of tuples (action_name,action_vector) :param learningrate: learning rate for PES rule...
3
stack_v2_sparse_classes_30k_train_020906
Implement the Python class `ActionValues` described below. Class description: A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weigh...
Implement the Python class `ActionValues` described below. Class description: A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weigh...
09668925404454997bac63cf56c176cde381f614
<|skeleton|> class ActionValues: """A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weight learning. :input state: the output of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionValues: """A network that learns/outputs the Q values for a fixed set of actions, given some state input. Note: this has been replaced in practice by the decoder learning mechanism, but keeping this here in case we ever want to return to synaptic weight learning. :input state: the output of the state po...
the_stack_v2_python_sparse
hrlproject/agent/actionvalues.py
amoliu/nhrlmodel
train
0
06266b27143312b718530dcc5db646bd59a37831
[ "self.env_step_time = 0.0\nself.inference_time = 0.0\nself.iters = 0.0", "ret = {'mean_env_step_time_ms': self.env_step_time * 1000 / self.iters, 'mean_inference_time_ms': self.inference_time * 1000 / self.iters, 'iters': self.iters}\nself.reset()\nreturn ret", "self.env_step_time = 0.0\nself.inference_time = 0...
<|body_start_0|> self.env_step_time = 0.0 self.inference_time = 0.0 self.iters = 0.0 <|end_body_0|> <|body_start_1|> ret = {'mean_env_step_time_ms': self.env_step_time * 1000 / self.iters, 'mean_inference_time_ms': self.inference_time * 1000 / self.iters, 'iters': self.iters} se...
Agent status records handle the env.step and inference time of Agent
AgentStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgentStats: """Agent status records handle the env.step and inference time of Agent""" def __init__(self): """init with default value""" <|body_0|> def get(self): """get agent status and clear the buffer""" <|body_1|> def reset(self): """rese...
stack_v2_sparse_classes_36k_train_032416
5,319
permissive
[ { "docstring": "init with default value", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get agent status and clear the buffer", "name": "get", "signature": "def get(self)" }, { "docstring": "reset buffer", "name": "reset", "signature": "def rese...
3
null
Implement the Python class `AgentStats` described below. Class description: Agent status records handle the env.step and inference time of Agent Method signatures and docstrings: - def __init__(self): init with default value - def get(self): get agent status and clear the buffer - def reset(self): reset buffer
Implement the Python class `AgentStats` described below. Class description: Agent status records handle the env.step and inference time of Agent Method signatures and docstrings: - def __init__(self): init with default value - def get(self): get agent status and clear the buffer - def reset(self): reset buffer <|ske...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AgentStats: """Agent status records handle the env.step and inference time of Agent""" def __init__(self): """init with default value""" <|body_0|> def get(self): """get agent status and clear the buffer""" <|body_1|> def reset(self): """rese...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AgentStats: """Agent status records handle the env.step and inference time of Agent""" def __init__(self): """init with default value""" self.env_step_time = 0.0 self.inference_time = 0.0 self.iters = 0.0 def get(self): """get agent status and clear the buffer...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/reinforcement-learning/ModelZoo_QMIX_TensorFlow/xt/util/profile_stats.py
Huawei-Ascend/modelzoo
train
1
45d14b01a6b7ff28047d0a2e5816c7d42e9d67a2
[ "if not id_tar:\n raise ValueError('Invalid ID')\nresponse, _ = self._api.post(path='{}/accept'.format(id_tar))\nreturn self.model_class.deserialize(response)", "if not id_tar:\n raise ValueError('Invalid ID')\nresponse, _ = self._api.post(path='{}/ignore'.format(id_tar), json={'reason': reason})\nreturn se...
<|body_start_0|> if not id_tar: raise ValueError('Invalid ID') response, _ = self._api.post(path='{}/accept'.format(id_tar)) return self.model_class.deserialize(response) <|end_body_0|> <|body_start_1|> if not id_tar: raise ValueError('Invalid ID') respon...
Tier Account Request Resource.
TierAccountRequestResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TierAccountRequestResource: """Tier Account Request Resource.""" def accept(self, id_tar): """Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Account Request object.""" <|body_0|> def ignore(s...
stack_v2_sparse_classes_36k_train_032417
1,523
permissive
[ { "docstring": "Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Account Request object.", "name": "accept", "signature": "def accept(self, id_tar)" }, { "docstring": "Ignore a Tier Configuration Request :param str id_...
2
stack_v2_sparse_classes_30k_train_000023
Implement the Python class `TierAccountRequestResource` described below. Class description: Tier Account Request Resource. Method signatures and docstrings: - def accept(self, id_tar): Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Accoun...
Implement the Python class `TierAccountRequestResource` described below. Class description: Tier Account Request Resource. Method signatures and docstrings: - def accept(self, id_tar): Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Accoun...
656d653e4065637e2cc5768d7d554de17d0120eb
<|skeleton|> class TierAccountRequestResource: """Tier Account Request Resource.""" def accept(self, id_tar): """Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Account Request object.""" <|body_0|> def ignore(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TierAccountRequestResource: """Tier Account Request Resource.""" def accept(self, id_tar): """Accept a Tier Configuration Request. :param str id_tar: Primary key of the tier configuration request to accept. :return: Tier Account Request object.""" if not id_tar: raise ValueErr...
the_stack_v2_python_sparse
connect/resources/tier_account.py
cloudblue/connect-python-sdk
train
13
a0b2db2c0c5c063fca43e25a63136511efdfab2b
[ "data = request.get_json()\nsale_attendant = get_jwt_identity()['email']\nname = InputValidator.valid_string(data['name'].strip())\nquantity_to_sell = InputValidator.valid_number(data['quantity'])\npayload = ['name', 'quantity']\nfor item in data.keys():\n if item not in payload:\n return ({'message': f'T...
<|body_start_0|> data = request.get_json() sale_attendant = get_jwt_identity()['email'] name = InputValidator.valid_string(data['name'].strip()) quantity_to_sell = InputValidator.valid_number(data['quantity']) payload = ['name', 'quantity'] for item in data.keys(): ...
SalesRecordEnpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SalesRecordEnpoint: def post(self): """Post a sale_record""" <|body_0|> def get(self, sale_id): """Retrieve a single sales""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = request.get_json() sale_attendant = get_jwt_identity()['email']...
stack_v2_sparse_classes_36k_train_032418
3,516
no_license
[ { "docstring": "Post a sale_record", "name": "post", "signature": "def post(self)" }, { "docstring": "Retrieve a single sales", "name": "get", "signature": "def get(self, sale_id)" } ]
2
stack_v2_sparse_classes_30k_train_014879
Implement the Python class `SalesRecordEnpoint` described below. Class description: Implement the SalesRecordEnpoint class. Method signatures and docstrings: - def post(self): Post a sale_record - def get(self, sale_id): Retrieve a single sales
Implement the Python class `SalesRecordEnpoint` described below. Class description: Implement the SalesRecordEnpoint class. Method signatures and docstrings: - def post(self): Post a sale_record - def get(self, sale_id): Retrieve a single sales <|skeleton|> class SalesRecordEnpoint: def post(self): """P...
d29dfcb5851e107921d6b1d06bb6ece761e7f2b9
<|skeleton|> class SalesRecordEnpoint: def post(self): """Post a sale_record""" <|body_0|> def get(self, sale_id): """Retrieve a single sales""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SalesRecordEnpoint: def post(self): """Post a sale_record""" data = request.get_json() sale_attendant = get_jwt_identity()['email'] name = InputValidator.valid_string(data['name'].strip()) quantity_to_sell = InputValidator.valid_number(data['quantity']) payload ...
the_stack_v2_python_sparse
app/resources/sales_endpoints.py
JoshuaKodhe/Store-Manager-Api-V2
train
1
d56a6c9ecb270ba3e02b9334a357fe6a1c389831
[ "if isinstance(value, libpydescriptors.Distribution):\n return value\nif value is None or len(value) == 0:\n return None\nelse:\n temp = libpydescriptors.Distribution()\n temp.serialized_data = value.__str__()\n return temp", "if isinstance(value, libpydescriptors.Distribution):\n return value.s...
<|body_start_0|> if isinstance(value, libpydescriptors.Distribution): return value if value is None or len(value) == 0: return None else: temp = libpydescriptors.Distribution() temp.serialized_data = value.__str__() return temp <|end_bo...
Custom field to store a ShapeDistribution object.
DistributionField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionField: """Custom field to store a ShapeDistribution object.""" def to_python(self, value): """Recreate python object from db.""" <|body_0|> def get_prep_value(self, value): """Serialize python object to be stored in db.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_032419
1,587
no_license
[ { "docstring": "Recreate python object from db.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Serialize python object to be stored in db.", "name": "get_prep_value", "signature": "def get_prep_value(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_012029
Implement the Python class `DistributionField` described below. Class description: Custom field to store a ShapeDistribution object. Method signatures and docstrings: - def to_python(self, value): Recreate python object from db. - def get_prep_value(self, value): Serialize python object to be stored in db.
Implement the Python class `DistributionField` described below. Class description: Custom field to store a ShapeDistribution object. Method signatures and docstrings: - def to_python(self, value): Recreate python object from db. - def get_prep_value(self, value): Serialize python object to be stored in db. <|skeleto...
13d58da77ceef6282948e56e83ff7f5fbe22d57f
<|skeleton|> class DistributionField: """Custom field to store a ShapeDistribution object.""" def to_python(self, value): """Recreate python object from db.""" <|body_0|> def get_prep_value(self, value): """Serialize python object to be stored in db.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DistributionField: """Custom field to store a ShapeDistribution object.""" def to_python(self, value): """Recreate python object from db.""" if isinstance(value, libpydescriptors.Distribution): return value if value is None or len(value) == 0: return None ...
the_stack_v2_python_sparse
django_server/shape_distribution/models.py
julfla/master_project
train
0
ef6b73ad4022308c6072298ae6577084698cba77
[ "Component.__init__(self, bot)\nself.bot = bot\nself.logger = logging.getLogger('components.topic')\nself.persistence = self.bot.get_subsystem('local-persistence')", "added_at = date.today()\naddition = TopicAddition(date=added_at, text=text, user=user)\nsession = self.persistence.get_session()\nsession.add(addit...
<|body_start_0|> Component.__init__(self, bot) self.bot = bot self.logger = logging.getLogger('components.topic') self.persistence = self.bot.get_subsystem('local-persistence') <|end_body_0|> <|body_start_1|> added_at = date.today() addition = TopicAddition(date=added_at...
TopicComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopicComponent: def __init__(self, bot): """Initialize all required variables.""" <|body_0|> def insert_addition(self, text, user): """Insert a new addition to database. @param text: the real addition text @param user: the person who likes to add the addition @return...
stack_v2_sparse_classes_36k_train_032420
4,482
permissive
[ { "docstring": "Initialize all required variables.", "name": "__init__", "signature": "def __init__(self, bot)" }, { "docstring": "Insert a new addition to database. @param text: the real addition text @param user: the person who likes to add the addition @return: None", "name": "insert_addi...
6
stack_v2_sparse_classes_30k_train_017747
Implement the Python class `TopicComponent` described below. Class description: Implement the TopicComponent class. Method signatures and docstrings: - def __init__(self, bot): Initialize all required variables. - def insert_addition(self, text, user): Insert a new addition to database. @param text: the real addition...
Implement the Python class `TopicComponent` described below. Class description: Implement the TopicComponent class. Method signatures and docstrings: - def __init__(self, bot): Initialize all required variables. - def insert_addition(self, text, user): Insert a new addition to database. @param text: the real addition...
064164dcd3baa867f276a5791eaf8050d568fc3f
<|skeleton|> class TopicComponent: def __init__(self, bot): """Initialize all required variables.""" <|body_0|> def insert_addition(self, text, user): """Insert a new addition to database. @param text: the real addition text @param user: the person who likes to add the addition @return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopicComponent: def __init__(self, bot): """Initialize all required variables.""" Component.__init__(self, bot) self.bot = bot self.logger = logging.getLogger('components.topic') self.persistence = self.bot.get_subsystem('local-persistence') def insert_addition(sel...
the_stack_v2_python_sparse
src/python/components/topic.py
msteinhoff/foption-bot
train
0
850f6b637d7e61d3ff78db91a8d5399b0597c28b
[ "self.arest = arest\nself._attr_name = f'{location.title()} {name.title()}'\nself._variable = variable\nself._attr_native_unit_of_measurement = unit_of_measurement\nself._renderer = renderer\nif pin is not None:\n request = requests.get(f'{resource}/mode/{pin}/i', timeout=10)\n if request.status_code != HTTPS...
<|body_start_0|> self.arest = arest self._attr_name = f'{location.title()} {name.title()}' self._variable = variable self._attr_native_unit_of_measurement = unit_of_measurement self._renderer = renderer if pin is not None: request = requests.get(f'{resource}/m...
Implementation of an aREST sensor for exposed variables.
ArestSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" <|body_0|> def update(self) -> None: ""...
stack_v2_sparse_classes_36k_train_032421
6,651
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None)" }, { "docstring": "Get the latest data from aREST API.", "name": "update", "signature": "def u...
2
stack_v2_sparse_classes_30k_train_008629
Implement the Python class `ArestSensor` described below. Class description: Implementation of an aREST sensor for exposed variables. Method signatures and docstrings: - def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): Initialize the sensor. - def ...
Implement the Python class `ArestSensor` described below. Class description: Implementation of an aREST sensor for exposed variables. Method signatures and docstrings: - def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): Initialize the sensor. - def ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" <|body_0|> def update(self) -> None: ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" self.arest = arest self._attr_name = f'{location.title()}...
the_stack_v2_python_sparse
homeassistant/components/arest/sensor.py
home-assistant/core
train
35,501
6d071a9a871921152465d1ee0ed046db1f9eb592
[ "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!')", "conte...
<|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...
Missing associated documentation comment in .proto file.
PermissionAppServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionAppServiceServicer: """Missing associated documentation comment in .proto file.""" def permission_by_name(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def permission_by_id(self, request, context): ""...
stack_v2_sparse_classes_36k_train_032422
10,560
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "permission_by_name", "signature": "def permission_by_name(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "permission_by_id", "signature": "d...
5
null
Implement the Python class `PermissionAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def permission_by_name(self, request, context): Missing associated documentation comment in .proto file. - def permission_by_id(sel...
Implement the Python class `PermissionAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def permission_by_name(self, request, context): Missing associated documentation comment in .proto file. - def permission_by_id(sel...
55d36c068e26e13ee5bae5c033e2e17784c63feb
<|skeleton|> class PermissionAppServiceServicer: """Missing associated documentation comment in .proto file.""" def permission_by_name(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def permission_by_id(self, request, context): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermissionAppServiceServicer: """Missing associated documentation comment in .proto file.""" def permission_by_name(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method n...
the_stack_v2_python_sparse
src/resource/proto/_generated/identity/permission_app_service_pb2_grpc.py
arkanmgerges/cafm.identity
train
0
8c59089a4194e700ad0b78eb4f9150753f24d4e4
[ "if type(rho) is type(1):\n self.order = rho\n self.rho = np.zeros(self.order, np.float64)\nelse:\n self.rho = np.squeeze(np.asarray(rho))\n if len(self.rho.shape) not in [0, 1]:\n raise ValueError('AR parameters must be a scalar or a vector')\n if self.rho.shape == ():\n self.rho.shape...
<|body_start_0|> if type(rho) is type(1): self.order = rho self.rho = np.zeros(self.order, np.float64) else: self.rho = np.squeeze(np.asarray(rho)) if len(self.rho.shape) not in [0, 1]: raise ValueError('AR parameters must be a scalar or a ...
A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of order p--AR(p)--is defined as: TODO Ex...
ARModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of ord...
stack_v2_sparse_classes_36k_train_032423
29,072
permissive
[ { "docstring": "Initialize AR model instance Parameters ---------- design : ndarray 2D array with design matrix rho : int or array-like If int, gives order of model, and initializes rho to zeros. If ndarray, gives initial estimate of rho. Be careful as ``ARModel(X, 1) != ARModel(X, 1.0)``.", "name": "__init...
3
stack_v2_sparse_classes_30k_train_009688
Implement the Python class `ARModel` described below. Class description: A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. T...
Implement the Python class `ARModel` described below. Class description: A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. T...
7eede02471567487e454016c1e7cf637d3afac9e
<|skeleton|> class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of ord...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ARModel: """A regression model with an AR(p) covariance structure. In terms of a LikelihoodModel, the parameters are beta, the usual regression parameters, and sigma, a scalar nuisance parameter that shows up as multiplier in front of the AR(p) covariance. The linear autoregressive process of order p--AR(p)--...
the_stack_v2_python_sparse
nipy/algorithms/statistics/models/regression.py
nipy/nipy
train
275
7eacd849af4280a35015325c03f80a54340f8374
[ "cu = Change_Param(username, password, prod)\ngu = cu.get_params()\nself.suffix = self.c.get_value('Member', 'members_collection_goods')\nself.url = self.url_joint(prod) + gu[1]\nlogs.info('test url:%s' % self.url)\nreturn self.get_requests(self.url, gu[0], data)", "cu = Change_Param(username, password, prod)\ngu...
<|body_start_0|> cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'members_collection_goods') self.url = self.url_joint(prod) + gu[1] logs.info('test url:%s' % self.url) return self.get_requests(self.url, gu[0], dat...
Member_Collection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Member_Collection: def get_member_collection_goods(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量""" <|body_0|> def post_member_collection_goods(self, username=None, password=None, data=None, prod=None): """相关参数有: goo...
stack_v2_sparse_classes_36k_train_032424
3,368
no_license
[ { "docstring": "相关参数有: page_no 页码 page_size 每页显示数量", "name": "get_member_collection_goods", "signature": "def get_member_collection_goods(self, username=None, password=None, data=None, prod=None)" }, { "docstring": "相关参数有: goods_id 商品id", "name": "post_member_collection_goods", "signatur...
4
null
Implement the Python class `Member_Collection` described below. Class description: Implement the Member_Collection class. Method signatures and docstrings: - def get_member_collection_goods(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 - def post_member_collection_goods...
Implement the Python class `Member_Collection` described below. Class description: Implement the Member_Collection class. Method signatures and docstrings: - def get_member_collection_goods(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 - def post_member_collection_goods...
235200a67c1fb125f75f9771808f6655a7b14202
<|skeleton|> class Member_Collection: def get_member_collection_goods(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量""" <|body_0|> def post_member_collection_goods(self, username=None, password=None, data=None, prod=None): """相关参数有: goo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Member_Collection: def get_member_collection_goods(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量""" cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'members_collection_g...
the_stack_v2_python_sparse
business/member/member_collection.py
vothin/requsets_test
train
0
038049f3079be001499757f663419da2dfd6faeb
[ "def postorder(node):\n return postorder(node.left) + postorder(node.right) + [node.val] if node else []\nserialize_data = ' '.join(map(str, postorder(root)))\nreturn serialize_data", "def helper(lower=float('-inf'), upper=float('inf')):\n if not data or data[-1] < lower or data[-1] > upper:\n return...
<|body_start_0|> def postorder(node): return postorder(node.left) + postorder(node.right) + [node.val] if node else [] serialize_data = ' '.join(map(str, postorder(root))) return serialize_data <|end_body_0|> <|body_start_1|> def helper(lower=float('-inf'), upper=float('inf'...
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_032425
1,609
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_005079
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:...
f93380721b8383817fe2b0d728deca1321c9ef45
<|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""" def postorder(node): return postorder(node.left) + postorder(node.right) + [node.val] if node else [] serialize_data = ' '.join(map(str, postorder(root))) ret...
the_stack_v2_python_sparse
explore/2020/october/Serialize_and_Deserialize_BST.py
lixiang2017/leetcode
train
5
3b08750108e602ee1a2738e031c57d1854f32304
[ "import collections\ndicts = collections.defaultdict(set)\nfor allow in allowed:\n dicts[allow[0:2]].add(allow[-1])\n\ndef dfs(s, c):\n if len(s) == 1 and s + c in dicts:\n return True\n for i in dicts[s[-1] + c]:\n for j in dicts[s]:\n dicts[s + c].add(j + i)\n for i in dicts[s...
<|body_start_0|> import collections dicts = collections.defaultdict(set) for allow in allowed: dicts[allow[0:2]].add(allow[-1]) def dfs(s, c): if len(s) == 1 and s + c in dicts: return True for i in dicts[s[-1] + c]: fo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def pyramidTransition_1(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans""" <|bod...
stack_v2_sparse_classes_36k_train_032426
4,317
no_license
[ { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool", "name": "pyramidTransition", "signature": "def pyramidTransition(self, bottom, allowed)" }, { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans", "name": "pyramidTransition_1", "s...
2
stack_v2_sparse_classes_30k_train_017404
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def pyramidTransition_1(self, bottom, allowed): :type bottom: str :type al...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def pyramidTransition_1(self, bottom, allowed): :type bottom: str :type al...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def pyramidTransition_1(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" import collections dicts = collections.defaultdict(set) for allow in allowed: dicts[allow[0:2]].add(allow[-1]) def dfs(s, c): i...
the_stack_v2_python_sparse
PyramidTransitionMatrix_MID_757.py
953250587/leetcode-python
train
2
c35f6c3aedd55265c652655f14298b9df65a1a4d
[ "if not root:\n return []\nret = []\nq = [root]\nwhile q:\n tmp = q.pop(0)\n if tmp:\n ret.append(tmp.val)\n q.append(tmp.left)\n q.append(tmp.right)\n else:\n ret.append(None)\nwhile ret[-1] == None:\n ret.pop()\nreturn ret", "if not data:\n return None\nroot = data....
<|body_start_0|> if not root: return [] ret = [] q = [root] while q: tmp = q.pop(0) if tmp: ret.append(tmp.val) q.append(tmp.left) q.append(tmp.right) else: ret.append(None) ...
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_032427
1,530
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_002256
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:...
c343ad45403d5f7f947abc9a82447d593c4938bc
<|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 [] ret = [] q = [root] while q: tmp = q.pop(0) if tmp: ret.append(tmp.val) ...
the_stack_v2_python_sparse
297 Serialize and Deserialize Binary Tree/untitled.py
fangpings/Leetcode
train
0
39685c1099f7c955dc954dd226f6e3ac9bded848
[ "self.buildings = [3, 5, 4, 4, 3, 1, 3, 2]\nself.direction = 'EAST'\nself.output = [1, 3, 6, 7]\nreturn (self.buildings, self.direction, self.output)", "buildings, direction, proper_out = self.setUp()\noutput = sunsetViews(buildings, direction)\nself.assertEqual(output, proper_out)" ]
<|body_start_0|> self.buildings = [3, 5, 4, 4, 3, 1, 3, 2] self.direction = 'EAST' self.output = [1, 3, 6, 7] return (self.buildings, self.direction, self.output) <|end_body_0|> <|body_start_1|> buildings, direction, proper_out = self.setUp() output = sunsetViews(buildin...
Class with unittests for SunsetViews.py
test_SunsetViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_SunsetViews: """Class with unittests for SunsetViews.py""" def setUp(self): """SetUp array for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032428
925
no_license
[ { "docstring": "SetUp array for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if returned output is as expected.", "name": "test_ExpectedOutput", "signature": "def test_ExpectedOutput(self)" } ]
2
stack_v2_sparse_classes_30k_train_005254
Implement the Python class `test_SunsetViews` described below. Class description: Class with unittests for SunsetViews.py Method signatures and docstrings: - def setUp(self): SetUp array for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected.
Implement the Python class `test_SunsetViews` described below. Class description: Class with unittests for SunsetViews.py Method signatures and docstrings: - def setUp(self): SetUp array for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected. <|skeleton|> class test_SunsetViews: """...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_SunsetViews: """Class with unittests for SunsetViews.py""" def setUp(self): """SetUp array for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_SunsetViews: """Class with unittests for SunsetViews.py""" def setUp(self): """SetUp array for tests.""" self.buildings = [3, 5, 4, 4, 3, 1, 3, 2] self.direction = 'EAST' self.output = [1, 3, 6, 7] return (self.buildings, self.direction, self.output) def ...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/SunsetViews/test_SunsetViews.py
JakubKazimierski/PythonPortfolio
train
9
6a4c7d9de2fb4427b9eaa4ddbe0d499158310345
[ "self.size = 0\nself.capacity = capacity\nself.dict = {}\nself.head, self.tail = (Node(-1, -1), Node(-1, -1))\nself.head.next, self.tail.prev = (self.tail, self.head)", "if key in self.dict:\n node = self.dict[key]\n self._remove(node)\n node.value = value\n self._insert(node)\nelse:\n if self.size...
<|body_start_0|> self.size = 0 self.capacity = capacity self.dict = {} self.head, self.tail = (Node(-1, -1), Node(-1, -1)) self.head.next, self.tail.prev = (self.tail, self.head) <|end_body_0|> <|body_start_1|> if key in self.dict: node = self.dict[key] ...
.
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """.""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """:type key: int :rtype: int""" <|body_...
stack_v2_sparse_classes_36k_train_032429
3,156
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "put", "signature": "def put(self, key, value)" }, { "docstring": ":type key: int :rtype: int", "nam...
5
stack_v2_sparse_classes_30k_train_018170
Implement the Python class `LRUCache` described below. Class description: . Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def put(self, key, value): :type key: int :type value: int :rtype: void - def get(self, key): :type key: int :rtype: int - def _insert(self, node): :type ...
Implement the Python class `LRUCache` described below. Class description: . Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def put(self, key, value): :type key: int :type value: int :rtype: void - def get(self, key): :type key: int :rtype: int - def _insert(self, node): :type ...
8f4c7657db81326f186b8fd75c1b5d26e1a654b8
<|skeleton|> class LRUCache: """.""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """:type key: int :rtype: int""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: """.""" def __init__(self, capacity): """:type capacity: int""" self.size = 0 self.capacity = capacity self.dict = {} self.head, self.tail = (Node(-1, -1), Node(-1, -1)) self.head.next, self.tail.prev = (self.tail, self.head) def put(self, ke...
the_stack_v2_python_sparse
dynamic_programming/ds_lrc_lc146.py
han8909227/leetcode
train
2
3288b8ca2a0ad50d62e7def01d025312649510d7
[ "super().add_args(parser)\nfor param in om.computations_params[self.computation_name]:\n add_argument_kwargs = {key: param.get(key) for key in ['action', 'nargs', 'const', 'type', 'choices', 'help', 'metavar', 'dest'] if param.get(key) is not None}\n if 'help' in add_argument_kwargs:\n arg_name = f\"--...
<|body_start_0|> super().add_args(parser) for param in om.computations_params[self.computation_name]: add_argument_kwargs = {key: param.get(key) for key in ['action', 'nargs', 'const', 'type', 'choices', 'help', 'metavar', 'dest'] if param.get(key) is not None} if 'help' in add_a...
Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step
OasisComputationCommand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument p...
stack_v2_sparse_classes_36k_train_032430
5,012
permissive
[ { "docstring": "Adds arguments to the argument parser. :param parser: The argument parser object :type parser: ArgumentParser", "name": "add_args", "signature": "def add_args(self, parser)" }, { "docstring": "Generic method that call the correct manager method from the child class computation_na...
2
null
Implement the Python class `OasisComputationCommand` described below. Class description: Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step Method signatures and docstrings: - def add_args(self, parser): Adds argume...
Implement the Python class `OasisComputationCommand` described below. Class description: Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step Method signatures and docstrings: - def add_args(self, parser): Adds argume...
23e704c335629ccd010969b1090446cfa3f384d5
<|skeleton|> class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument parser object ...
the_stack_v2_python_sparse
oasislmf/cli/command.py
OasisLMF/OasisLMF
train
122
abf103845299e7eb8edd6df81b7b2244f466e5d9
[ "tf.reset_default_graph()\noptim = tf.train.GradientDescentOptimizer(0.001)\nsparse_optim = sparse_optimizers.SparseDNWOptimizer(optim, default_sparsity, mask_init_method, custom_sparsity_map=custom_sparsity_map)\ninp_values = np.arange(1, n_inp + 1)\nscale_vector_values = np.random.uniform(size=(n_out,)) - 0.5\nex...
<|body_start_0|> tf.reset_default_graph() optim = tf.train.GradientDescentOptimizer(0.001) sparse_optim = sparse_optimizers.SparseDNWOptimizer(optim, default_sparsity, mask_init_method, custom_sparsity_map=custom_sparsity_map) inp_values = np.arange(1, n_inp + 1) scale_vector_val...
SparseDNWOptimizerTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseDNWOptimizerTest: def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5): """Setups a trivial training procedure for sparse training.""" <|body_0|> def testDNWSparsity(self, n_inp, n_out, default_sparsity): """Checking...
stack_v2_sparse_classes_36k_train_032431
25,606
permissive
[ { "docstring": "Setups a trivial training procedure for sparse training.", "name": "_setup_graph", "signature": "def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5)" }, { "docstring": "Checking whether masked_grad is calculated after apply_gradients....
6
null
Implement the Python class `SparseDNWOptimizerTest` described below. Class description: Implement the SparseDNWOptimizerTest class. Method signatures and docstrings: - def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5): Setups a trivial training procedure for sparse trai...
Implement the Python class `SparseDNWOptimizerTest` described below. Class description: Implement the SparseDNWOptimizerTest class. Method signatures and docstrings: - def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5): Setups a trivial training procedure for sparse trai...
d39fc7d46505cb3196cb1edeb32ed0b6dd44c0f9
<|skeleton|> class SparseDNWOptimizerTest: def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5): """Setups a trivial training procedure for sparse training.""" <|body_0|> def testDNWSparsity(self, n_inp, n_out, default_sparsity): """Checking...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseDNWOptimizerTest: def _setup_graph(self, default_sparsity, mask_init_method, custom_sparsity_map, n_inp=3, n_out=5): """Setups a trivial training procedure for sparse training.""" tf.reset_default_graph() optim = tf.train.GradientDescentOptimizer(0.001) sparse_optim = spa...
the_stack_v2_python_sparse
rigl/sparse_optimizers_test.py
google-research/rigl
train
324
a3bb547927e59ee7680f566fa921e4173e245150
[ "can_edit_player(player_id)\ntickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None)\nreturn tickets", "args = request.json\nissuer_id = args.get('issuer_id')\nticket_type = args.get('ticket_type')\ndetails = args.get('details')\nexternal_id = args.get('external_id')\nticket_i...
<|body_start_0|> can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) return tickets <|end_body_0|> <|body_start_1|> args = request.json issuer_id = args.get('issuer_id') ticket_type = args.get('ticket_ty...
TicketsEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """List of tickets Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create ticket Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_032432
5,287
permissive
[ { "docstring": "List of tickets Get a list of outstanding tickets for the player", "name": "get", "signature": "def get(self, player_id)" }, { "docstring": "Create ticket Create a ticket for a player. Only available to services", "name": "post", "signature": "def post(self, player_id)" ...
2
stack_v2_sparse_classes_30k_train_019617
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): List of tickets Get a list of outstanding tickets for the player - def post(self, player_id): Create ticket Create a ticket for a player. ...
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): List of tickets Get a list of outstanding tickets for the player - def post(self, player_id): Create ticket Create a ticket for a player. ...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """List of tickets Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create ticket Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TicketsEndpoint: def get(self, player_id): """List of tickets Get a list of outstanding tickets for the player""" can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) return tickets def post(self, player_id...
the_stack_v2_python_sparse
driftbase/api/players/tickets.py
dgnorth/drift-base
train
1
64a05d95283cff7199d76904fb0385ab5412cd25
[ "most = 0\nfor idx, h in enumerate(height):\n for ridx, rh in enumerate(height[idx:]):\n most = max(ridx * min(h, rh), most)\nreturn most", "if not height[1:]:\n return 0\nleft = 0\nright = len(height) - 1\nmost = 0\nwhile left < right:\n most = max(most, min(height[left], height[right]) * (right ...
<|body_start_0|> most = 0 for idx, h in enumerate(height): for ridx, rh in enumerate(height[idx:]): most = max(ridx * min(h, rh), most) return most <|end_body_0|> <|body_start_1|> if not height[1:]: return 0 left = 0 right = len(he...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> most = 0 for idx, h in enumerate(hei...
stack_v2_sparse_classes_36k_train_032433
2,247
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea2", "signature": "def maxArea2(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea2(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea2(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea2(s...
d2e8b2dca40fc955045eb62e576c776bad8ee5f1
<|skeleton|> class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" most = 0 for idx, h in enumerate(height): for ridx, rh in enumerate(height[idx:]): most = max(ridx * min(h, rh), most) return most def maxArea(self, height): ...
the_stack_v2_python_sparse
container-with-most-water/solution.py
childe/leetcode
train
2
0e0e221b9cb29867a5f26effa1eb6d6f5b5c8df9
[ "rest_kwargs = {'use_document_model': False, 'include_user_agent': True}\nif api_key is not None:\n rest_kwargs['api_key'] = api_key\nwith MPRester(**rest_kwargs) as mpr:\n results = mpr.summary.search(chemsys=chemsys, **kwargs, fields=['structure', 'material_id'])\nreturn MPQueryResults(results)", "rest_kw...
<|body_start_0|> rest_kwargs = {'use_document_model': False, 'include_user_agent': True} if api_key is not None: rest_kwargs['api_key'] = api_key with MPRester(**rest_kwargs) as mpr: results = mpr.summary.search(chemsys=chemsys, **kwargs, fields=['structure', 'material_id...
Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-gen.materialsproject.org/api#api-key>`. Once you have a key, either pass it as the `api_key...
MaterialsProjectFactory
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaterialsProjectFactory: """Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-gen.materialsproject.org/api#api-key>`. ...
stack_v2_sparse_classes_36k_train_032434
7,091
permissive
[ { "docstring": "Search the database for all structures matching the given query. Note that `chemsys` takes distint values for unaries, binaries and so! A query with `chemsys=[\"Fe\", \"O\"]` will return iron structures and oxygen structures, but no iron oxide structures. Similarily `chemsys=[\"Fe-O\"]` will not...
2
null
Implement the Python class `MaterialsProjectFactory` described below. Class description: Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-g...
Implement the Python class `MaterialsProjectFactory` described below. Class description: Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-g...
4bebd2dd19df34f94bc043f78d497a890dc47fa7
<|skeleton|> class MaterialsProjectFactory: """Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-gen.materialsproject.org/api#api-key>`. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaterialsProjectFactory: """Convenience interface to the Materials Project Structure Database. Usage is only possible with an API key obtained from the Materials Project. To do this, create an account with them, login and access `this webpage <https://next-gen.materialsproject.org/api#api-key>`. Once you have...
the_stack_v2_python_sparse
pyiron_atomistics/atomistics/structure/factories/materialsproject.py
pyiron/pyiron_atomistics
train
33
6ff64ae7e40eb6b443ab4c56906483e0a4c218de
[ "requests = get_client_pending_requests(current_identity.id)\nrequest_schema = BaseRequestJsonSchema(many=True)\nreturn request_schema.dump(requests).data", "args = priority_parser.parse_args()\nrequests = update_client_priority_list(args.requests_id, current_identity.id)\nrequest_schema = BaseRequestJsonSchema(m...
<|body_start_0|> requests = get_client_pending_requests(current_identity.id) request_schema = BaseRequestJsonSchema(many=True) return request_schema.dump(requests).data <|end_body_0|> <|body_start_1|> args = priority_parser.parse_args() requests = update_client_priority_list(arg...
An API to get all requests pending by a client.
RequestsPendingMeAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestsPendingMeAPI: """An API to get all requests pending by a client.""" def get(self): """HTTP GET. Get all pending requests. :returns: all pendings request.""" <|body_0|> def post(self): """HTTP POST. re order the priority list :returns: One or all available...
stack_v2_sparse_classes_36k_train_032435
7,523
permissive
[ { "docstring": "HTTP GET. Get all pending requests. :returns: all pendings request.", "name": "get", "signature": "def get(self)" }, { "docstring": "HTTP POST. re order the priority list :returns: One or all available requests.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_009021
Implement the Python class `RequestsPendingMeAPI` described below. Class description: An API to get all requests pending by a client. Method signatures and docstrings: - def get(self): HTTP GET. Get all pending requests. :returns: all pendings request. - def post(self): HTTP POST. re order the priority list :returns:...
Implement the Python class `RequestsPendingMeAPI` described below. Class description: An API to get all requests pending by a client. Method signatures and docstrings: - def get(self): HTTP GET. Get all pending requests. :returns: all pendings request. - def post(self): HTTP POST. re order the priority list :returns:...
a8f04991deca85cf615df72db12e082aaa543cfa
<|skeleton|> class RequestsPendingMeAPI: """An API to get all requests pending by a client.""" def get(self): """HTTP GET. Get all pending requests. :returns: all pendings request.""" <|body_0|> def post(self): """HTTP POST. re order the priority list :returns: One or all available...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestsPendingMeAPI: """An API to get all requests pending by a client.""" def get(self): """HTTP GET. Get all pending requests. :returns: all pendings request.""" requests = get_client_pending_requests(current_identity.id) request_schema = BaseRequestJsonSchema(many=True) ...
the_stack_v2_python_sparse
flaskiwsapp/api/v1/views/requestViews.py
rtorresve/EngineeringMidLevel
train
0
d10467e56e508f04b1804b6c9a068dd6f1a5b2de
[ "print('test_login1_normal is start test...')\npo = LoginPage(self.driver)\npo.Login_action(u'鹿太太', 123456)\nsleep(3)\nself.assertEqual(po.type_loginPass_hint(), u'我的空间')\nfunction.insert_img(self.driver, '51zxw_login1_nomal.jpg')\nprint('test_login1_normal test end')", "print('test_login2_passworderror is start ...
<|body_start_0|> print('test_login1_normal is start test...') po = LoginPage(self.driver) po.Login_action(u'鹿太太', 123456) sleep(3) self.assertEqual(po.type_loginPass_hint(), u'我的空间') function.insert_img(self.driver, '51zxw_login1_nomal.jpg') print('test_login1_nor...
LoginTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginTest: def test_login1_normal(self): """username and password is normal""" <|body_0|> def test_login2_PasswordError(self): """username and password is error""" <|body_1|> def test_login3_empty(self): """username and passwd is empty""" ...
stack_v2_sparse_classes_36k_train_032436
1,453
no_license
[ { "docstring": "username and password is normal", "name": "test_login1_normal", "signature": "def test_login1_normal(self)" }, { "docstring": "username and password is error", "name": "test_login2_PasswordError", "signature": "def test_login2_PasswordError(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_015348
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): username and password is normal - def test_login2_PasswordError(self): username and password is error - def test_login3_empty(self): username and ...
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): username and password is normal - def test_login2_PasswordError(self): username and password is error - def test_login3_empty(self): username and ...
8f41650e31f856f944d9c61a9b8e35f7875f6c03
<|skeleton|> class LoginTest: def test_login1_normal(self): """username and password is normal""" <|body_0|> def test_login2_PasswordError(self): """username and password is error""" <|body_1|> def test_login3_empty(self): """username and passwd is empty""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginTest: def test_login1_normal(self): """username and password is normal""" print('test_login1_normal is start test...') po = LoginPage(self.driver) po.Login_action(u'鹿太太', 123456) sleep(3) self.assertEqual(po.type_loginPass_hint(), u'我的空间') function....
the_stack_v2_python_sparse
webdriver/AutoTest_Project/Website/test_case/test_login.py
lutaitai/selenium-python
train
0
89dfca279728b505935a6ce367bdf7e3bdb79c92
[ "try:\n account = account or self._server.myPlexAccount()\nexcept AttributeError:\n account = self._server\nreturn account.onWatchlist(self)", "try:\n account = account or self._server.myPlexAccount()\nexcept AttributeError:\n account = self._server\naccount.addToWatchlist(self)\nreturn self", "try:...
<|body_start_0|> try: account = account or self._server.myPlexAccount() except AttributeError: account = self._server return account.onWatchlist(self) <|end_body_0|> <|body_start_1|> try: account = account or self._server.myPlexAccount() excep...
Mixin for Plex objects that can be added to a user's watchlist.
WatchlistMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WatchlistMixin: """Mixin for Plex objects that can be added to a user's watchlist.""" def onWatchlist(self, account=None): """Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.onWatchlist`. Parameters: account (:class:`~plexapi.myplex....
stack_v2_sparse_classes_36k_train_032437
43,885
permissive
[ { "docstring": "Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.onWatchlist`. Parameters: account (:class:`~plexapi.myplex.MyPlexAccount`, optional): Account to check item on the watchlist. Note: This is required if you are not connected to a Plex server instan...
4
stack_v2_sparse_classes_30k_test_001105
Implement the Python class `WatchlistMixin` described below. Class description: Mixin for Plex objects that can be added to a user's watchlist. Method signatures and docstrings: - def onWatchlist(self, account=None): Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.on...
Implement the Python class `WatchlistMixin` described below. Class description: Mixin for Plex objects that can be added to a user's watchlist. Method signatures and docstrings: - def onWatchlist(self, account=None): Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.on...
7da49eb711663f8b4e2cebcac41298c6324c1427
<|skeleton|> class WatchlistMixin: """Mixin for Plex objects that can be added to a user's watchlist.""" def onWatchlist(self, account=None): """Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.onWatchlist`. Parameters: account (:class:`~plexapi.myplex....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WatchlistMixin: """Mixin for Plex objects that can be added to a user's watchlist.""" def onWatchlist(self, account=None): """Returns True if the item is on the user's watchlist. Also see :func:`~plexapi.myplex.MyPlexAccount.onWatchlist`. Parameters: account (:class:`~plexapi.myplex.MyPlexAccount...
the_stack_v2_python_sparse
plexapi/mixins.py
pkkid/python-plexapi
train
963
0a84b4b2b81fc0a0568cbaae984cdb85159c8a34
[ "if attrs['password'] != attrs['password2']:\n raise serializers.ValidationError('两次密码不一致')\nallow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk'])\nif not allow:\n raise serializers.ValidationError('无效的access token')\nreturn attrs", "instance.set_password(validated_...
<|body_start_0|> if attrs['password'] != attrs['password2']: raise serializers.ValidationError('两次密码不一致') allow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk']) if not allow: raise serializers.ValidationError('无效的access token') ...
重置密码序列化器
CheckPasswordTokenSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" <|body_0|> def update(self, instance, validated_data): """更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_032438
19,382
no_license
[ { "docstring": "校验数据", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_010606
Implement the Python class `CheckPasswordTokenSerializer` described below. Class description: 重置密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 校验数据 - def update(self, instance, validated_data): 更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:
Implement the Python class `CheckPasswordTokenSerializer` described below. Class description: 重置密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 校验数据 - def update(self, instance, validated_data): 更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return: <|skeleton|> class C...
c4d9b124a50e96ce01dfd83073cbe4435cb07266
<|skeleton|> class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" <|body_0|> def update(self, instance, validated_data): """更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" if attrs['password'] != attrs['password2']: raise serializers.ValidationError('两次密码不一致') allow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk']) ...
the_stack_v2_python_sparse
apps/users/serializer/serializers_front.py
wuhaihua1989/magic1
train
0
99c67e91df42f2e8a65bcd192ba5f7915b6609ea
[ "code = request.query_params.get('code')\nif code is None:\n return Response(status=status.HTTP_400_BAD_REQUEST)\nweiboauth = OAuthWeibo(client_id=settings.WEIBO_CLIENT_ID, client_secret=settings.WEIBO_CLIENT_SECRET, redirect_uri=settings.WEIBO_REDIRECT_URI, state=next)\naccess_token = weiboauth.get_access_token...
<|body_start_0|> code = request.query_params.get('code') if code is None: return Response(status=status.HTTP_400_BAD_REQUEST) weiboauth = OAuthWeibo(client_id=settings.WEIBO_CLIENT_ID, client_secret=settings.WEIBO_CLIENT_SECRET, redirect_uri=settings.WEIBO_REDIRECT_URI, state=next) ...
验证微博登录
WeiboOauthView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeiboOauthView: """验证微博登录""" def get(self, request): """第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass""" <|body_0|> def post(self, request): """微博用户未绑定,绑定微博用户 :return:""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_032439
9,593
no_license
[ { "docstring": "第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass", "name": "get", "signature": "def get(self, request)" }, { "docstring": "微博用户未绑定,绑定微博用户 :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_011392
Implement the Python class `WeiboOauthView` described below. Class description: 验证微博登录 Method signatures and docstrings: - def get(self, request): 第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass - def post(self, request): 微博用户未绑定,绑定微博用户 :return:
Implement the Python class `WeiboOauthView` described below. Class description: 验证微博登录 Method signatures and docstrings: - def get(self, request): 第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass - def post(self, request): 微博用户未绑定,绑定微博用户 :return: <|skeleton|> class WeiboO...
93f5c1159de7c2fcb5a4de0cfeee15b19529abf5
<|skeleton|> class WeiboOauthView: """验证微博登录""" def get(self, request): """第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass""" <|body_0|> def post(self, request): """微博用户未绑定,绑定微博用户 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeiboOauthView: """验证微博登录""" def get(self, request): """第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return: pass""" code = request.query_params.get('code') if code is None: return Response(status=status.HTTP_400_BAD_REQUEST) ...
the_stack_v2_python_sparse
mall/apps/oauth/views.py
studygroupfirst/meiduoshangcheng
train
0
e73fb9f7c5c3526de6839da18e5b41b1db754e04
[ "self.cluster_count = cluster_count\nself.cluster_match_string = cluster_match_string\nself.cookie = cookie\nself.end_time_usecs = end_time_usecs\nself.error = error\nself.job_count = job_count\nself.job_match_string = job_match_string\nself.protection_jobs = protection_jobs\nself.search_job_status = search_job_sta...
<|body_start_0|> self.cluster_count = cluster_count self.cluster_match_string = cluster_match_string self.cookie = cookie self.end_time_usecs = end_time_usecs self.error = error self.job_count = job_count self.job_match_string = job_match_string self.prote...
Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault that match the criteria ...
RemoteVaultSearchJobResults
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteVaultSearchJobResults: """Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that hav...
stack_v2_sparse_classes_36k_train_032440
7,245
permissive
[ { "docstring": "Constructor for the RemoteVaultSearchJobResults class", "name": "__init__", "signature": "def __init__(self, cluster_count=None, cluster_match_string=None, cookie=None, end_time_usecs=None, error=None, job_count=None, job_match_string=None, protection_jobs=None, search_job_status=None, s...
2
stack_v2_sparse_classes_30k_train_017813
Implement the Python class `RemoteVaultSearchJobResults` described below. Class description: Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int)...
Implement the Python class `RemoteVaultSearchJobResults` described below. Class description: Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RemoteVaultSearchJobResults: """Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that hav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteVaultSearchJobResults: """Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that have archived to...
the_stack_v2_python_sparse
cohesity_management_sdk/models/remote_vault_search_job_results.py
cohesity/management-sdk-python
train
24
38e93468f35782a73e204ee3e21215108f1be936
[ "if args:\n self.message = args[0]\nelse:\n self.message = None", "print('calling str')\nif self.message:\n return 'MyCustomError, {0} '.format(self.message)\nelse:\n return 'MyCustomError has been raised'" ]
<|body_start_0|> if args: self.message = args[0] else: self.message = None <|end_body_0|> <|body_start_1|> print('calling str') if self.message: return 'MyCustomError, {0} '.format(self.message) else: return 'MyCustomError has been...
Documentation for a class. Herit from Exception @throws Exception
MyCustomError
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyCustomError: """Documentation for a class. Herit from Exception @throws Exception""" def __init__(self, *args): """Documentation for a function. Constructor""" <|body_0|> def __str__(self): """Documentation for a function. @return string that triggers Exception...
stack_v2_sparse_classes_36k_train_032441
2,814
permissive
[ { "docstring": "Documentation for a function. Constructor", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Documentation for a function. @return string that triggers Exception", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_006115
Implement the Python class `MyCustomError` described below. Class description: Documentation for a class. Herit from Exception @throws Exception Method signatures and docstrings: - def __init__(self, *args): Documentation for a function. Constructor - def __str__(self): Documentation for a function. @return string th...
Implement the Python class `MyCustomError` described below. Class description: Documentation for a class. Herit from Exception @throws Exception Method signatures and docstrings: - def __init__(self, *args): Documentation for a function. Constructor - def __str__(self): Documentation for a function. @return string th...
1a20978a29ab285f80a35c7b55fc484c40d20bbb
<|skeleton|> class MyCustomError: """Documentation for a class. Herit from Exception @throws Exception""" def __init__(self, *args): """Documentation for a function. Constructor""" <|body_0|> def __str__(self): """Documentation for a function. @return string that triggers Exception...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyCustomError: """Documentation for a class. Herit from Exception @throws Exception""" def __init__(self, *args): """Documentation for a function. Constructor""" if args: self.message = args[0] else: self.message = None def __str__(self): """Do...
the_stack_v2_python_sparse
Includes/personnal/except.py
WikiLibs/Parser
train
0
ca12abef2b82c34bef6c15b6bf77f568ac0aa3bf
[ "self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree == 1).all()\nmerged_conditions = list(merge(*[json.loads(ct.data)['order'] for ct in self.condition_tissue]))\nself.conditions = list(reversed(list(OrderedDict.fromkeys(reversed(merged_conditions)))))\nself.species_to_condition = {ct.spec...
<|body_start_0|> self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree == 1).all() merged_conditions = list(merge(*[json.loads(ct.data)['order'] for ct in self.condition_tissue])) self.conditions = list(reversed(list(OrderedDict.fromkeys(reversed(merged_conditions))))) ...
CrossSpeciesExpressionProfile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" <|body_0|> def get_data(self, *sequence_ids): """...
stack_v2_sparse_classes_36k_train_032442
5,795
permissive
[ { "docstring": "Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Gets comparative profiles for a set of seque...
3
stack_v2_sparse_classes_30k_train_018569
Implement the Python class `CrossSpeciesExpressionProfile` described below. Class description: Implement the CrossSpeciesExpressionProfile class. Method signatures and docstrings: - def __init__(self): Function that gets required data, checks for which species there is a comparative profile available and stores detai...
Implement the Python class `CrossSpeciesExpressionProfile` described below. Class description: Implement the CrossSpeciesExpressionProfile class. Method signatures and docstrings: - def __init__(self): Function that gets required data, checks for which species there is a comparative profile available and stores detai...
25d0187030bcb85bb99125af4fd0c0c11aa012cb
<|skeleton|> class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" <|body_0|> def get_data(self, *sequence_ids): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree...
the_stack_v2_python_sparse
conekt/models/expression/cross_species_profile.py
sepro/CoNekT
train
23
9872b2fb4032a2095c6cd89f10139dc9200549e5
[ "try:\n license_path = user_info.get('license_path', '')\n id_card_path = user_info.get('id_card_path', '')\n user_company_name = user_info.get('user_company_name', '')\n user_type = user_info.get('user_type', '')\n user_address = user_info.get('user_address', '')\n province = user_info.get('provi...
<|body_start_0|> try: license_path = user_info.get('license_path', '') id_card_path = user_info.get('id_card_path', '') user_company_name = user_info.get('user_company_name', '') user_type = user_info.get('user_type', '') user_address = user_info.get('...
Complete_material
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Complete_material: def completeUserInfo(self, user_id, user_info): """:param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0""" <|body_0|> def editUserInfo(self, user_id, user_info): """:param user_id: :param user_info: :return: 正常更新,返回666;更新失败,返回0""" ...
stack_v2_sparse_classes_36k_train_032443
5,775
no_license
[ { "docstring": ":param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0", "name": "completeUserInfo", "signature": "def completeUserInfo(self, user_id, user_info)" }, { "docstring": ":param user_id: :param user_info: :return: 正常更新,返回666;更新失败,返回0", "name": "editUserInfo", "signatur...
3
stack_v2_sparse_classes_30k_train_006218
Implement the Python class `Complete_material` described below. Class description: Implement the Complete_material class. Method signatures and docstrings: - def completeUserInfo(self, user_id, user_info): :param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0 - def editUserInfo(self, user_id, user_info): :pa...
Implement the Python class `Complete_material` described below. Class description: Implement the Complete_material class. Method signatures and docstrings: - def completeUserInfo(self, user_id, user_info): :param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0 - def editUserInfo(self, user_id, user_info): :pa...
9e47e4eb0e65a0a849cc351c79bc0f2b07ac37ae
<|skeleton|> class Complete_material: def completeUserInfo(self, user_id, user_info): """:param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0""" <|body_0|> def editUserInfo(self, user_id, user_info): """:param user_id: :param user_info: :return: 正常更新,返回666;更新失败,返回0""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Complete_material: def completeUserInfo(self, user_id, user_info): """:param user_id: :param user_info: :return: 正常插入,返回666;更新失败,返回0""" try: license_path = user_info.get('license_path', '') id_card_path = user_info.get('id_card_path', '') user_company_name =...
the_stack_v2_python_sparse
guyj319/B2B_v1/account/my_materials/complete_info.py
songting77/newB2B_v1
train
0
3696505db2cfbda4e2d94e6db7116570b81bdd7f
[ "assert op.node_def.op == 'MatMul'\nself.op = op\nself.colocate_gradients_with_ops = colocate_gradients_with_ops\nself.gate_gradients = gate_gradients", "idx = list(self.op.inputs).index(x)\nassert idx != -1\nassert len(z_grads) == len(self.op.outputs)\nassert idx == 1\nx, _ = self.op.inputs\nz_grads, = z_grads\n...
<|body_start_0|> assert op.node_def.op == 'MatMul' self.op = op self.colocate_gradients_with_ops = colocate_gradients_with_ops self.gate_gradients = gate_gradients <|end_body_0|> <|body_start_1|> idx = list(self.op.inputs).index(x) assert idx != -1 assert len(z_g...
Per-example gradient rule for MatMul op.
MatMulPXG
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatMulPXG: """Per-example gradient rule for MatMul op.""" def __init__(self, op, colocate_gradients_with_ops=False, gate_gradients=False): """Construct an instance of the rule for `op`. Args: op: The Operation to differentiate through. colocate_gradients_with_ops: currently unsupport...
stack_v2_sparse_classes_36k_train_032444
12,247
permissive
[ { "docstring": "Construct an instance of the rule for `op`. Args: op: The Operation to differentiate through. colocate_gradients_with_ops: currently unsupported gate_gradients: currently unsupported", "name": "__init__", "signature": "def __init__(self, op, colocate_gradients_with_ops=False, gate_gradie...
2
stack_v2_sparse_classes_30k_train_016059
Implement the Python class `MatMulPXG` described below. Class description: Per-example gradient rule for MatMul op. Method signatures and docstrings: - def __init__(self, op, colocate_gradients_with_ops=False, gate_gradients=False): Construct an instance of the rule for `op`. Args: op: The Operation to differentiate ...
Implement the Python class `MatMulPXG` described below. Class description: Per-example gradient rule for MatMul op. Method signatures and docstrings: - def __init__(self, op, colocate_gradients_with_ops=False, gate_gradients=False): Construct an instance of the rule for `op`. Args: op: The Operation to differentiate ...
92ec5ec3efeee852aec5c057798298cd3a8e58ae
<|skeleton|> class MatMulPXG: """Per-example gradient rule for MatMul op.""" def __init__(self, op, colocate_gradients_with_ops=False, gate_gradients=False): """Construct an instance of the rule for `op`. Args: op: The Operation to differentiate through. colocate_gradients_with_ops: currently unsupport...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatMulPXG: """Per-example gradient rule for MatMul op.""" def __init__(self, op, colocate_gradients_with_ops=False, gate_gradients=False): """Construct an instance of the rule for `op`. Args: op: The Operation to differentiate through. colocate_gradients_with_ops: currently unsupported gate_gradi...
the_stack_v2_python_sparse
model_zoo/models/differential_privacy/dp_sgd/per_example_gradients/per_example_gradients.py
coderSkyChen/Action_Recognition_Zoo
train
246
0ca18030f0d39e6fba58c4ddb1ac45ccc277e674
[ "if settings.DEBUG:\n return True\nelse:\n return False", "if settings.DEBUG:\n return True\nelse:\n return False" ]
<|body_start_0|> if settings.DEBUG: return True else: return False <|end_body_0|> <|body_start_1|> if settings.DEBUG: return True else: return False <|end_body_1|>
ContactsAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactsAdmin: def has_add_permission(self, *args, **kwargs): """Запрещаем добавлять новые экземпляры Contacts при DEBUG=False""" <|body_0|> def has_delete_permission(self, *args, **kwargs): """Запрещаем удалять экземпляры Contacts при DEBUG=False""" <|body_1...
stack_v2_sparse_classes_36k_train_032445
1,855
no_license
[ { "docstring": "Запрещаем добавлять новые экземпляры Contacts при DEBUG=False", "name": "has_add_permission", "signature": "def has_add_permission(self, *args, **kwargs)" }, { "docstring": "Запрещаем удалять экземпляры Contacts при DEBUG=False", "name": "has_delete_permission", "signatur...
2
stack_v2_sparse_classes_30k_val_001151
Implement the Python class `ContactsAdmin` described below. Class description: Implement the ContactsAdmin class. Method signatures and docstrings: - def has_add_permission(self, *args, **kwargs): Запрещаем добавлять новые экземпляры Contacts при DEBUG=False - def has_delete_permission(self, *args, **kwargs): Запреща...
Implement the Python class `ContactsAdmin` described below. Class description: Implement the ContactsAdmin class. Method signatures and docstrings: - def has_add_permission(self, *args, **kwargs): Запрещаем добавлять новые экземпляры Contacts при DEBUG=False - def has_delete_permission(self, *args, **kwargs): Запреща...
c76996698bbbd88309ed35f47d19e09fec19eb94
<|skeleton|> class ContactsAdmin: def has_add_permission(self, *args, **kwargs): """Запрещаем добавлять новые экземпляры Contacts при DEBUG=False""" <|body_0|> def has_delete_permission(self, *args, **kwargs): """Запрещаем удалять экземпляры Contacts при DEBUG=False""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContactsAdmin: def has_add_permission(self, *args, **kwargs): """Запрещаем добавлять новые экземпляры Contacts при DEBUG=False""" if settings.DEBUG: return True else: return False def has_delete_permission(self, *args, **kwargs): """Запрещаем удалят...
the_stack_v2_python_sparse
www/contacts/admin.py
boogiiieee/Victoria
train
0
cf2abb2da66eb777a9103819f2f2ec2a871a5453
[ "self._validator = None\nself.logger = logger\nif api_spec_path is not None:\n try:\n api_spec_dict = read_yaml_file(api_spec_path)\n if server is not None:\n api_spec_dict['servers'] = [{'url': server}]\n api_spec = create_spec(api_spec_dict)\n self._validator = RequestVal...
<|body_start_0|> self._validator = None self.logger = logger if api_spec_path is not None: try: api_spec_dict = read_yaml_file(api_spec_path) if server is not None: api_spec_dict['servers'] = [{'url': server}] api_sp...
API Spec class to verify a request against an OpenAPI/Swagger spec.
APISpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filen...
stack_v2_sparse_classes_36k_train_032446
21,668
permissive
[ { "docstring": "Initialize the API spec. :param api_spec_path: Directory API path and filename of the API spec YAML source file. :param server: the server url :param logger: the logger", "name": "__init__", "signature": "def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, l...
2
stack_v2_sparse_classes_30k_train_017784
Implement the Python class `APISpec` described below. Class description: API Spec class to verify a request against an OpenAPI/Swagger spec. Method signatures and docstrings: - def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): Initialize the API...
Implement the Python class `APISpec` described below. Class description: API Spec class to verify a request against an OpenAPI/Swagger spec. Method signatures and docstrings: - def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): Initialize the API...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filename of the AP...
the_stack_v2_python_sparse
packages/fetchai/connections/http_server/connection.py
fetchai/agents-aea
train
192
8467dcdd46c26c027ca3888d2f2c2983aa9fe9d6
[ "n = len(A)\nindices = sorted(range(n), key=lambda i: A[i])\nres = 0\npre = n\nfor i in indices:\n if i < pre:\n pre = i\n else:\n res = max(res, i - pre)\nreturn res", "stack = []\nfor i, a in enumerate(A):\n if not stack or (stack and A[stack[-1]] > a):\n stack.append(i)\nres = 0\n...
<|body_start_0|> n = len(A) indices = sorted(range(n), key=lambda i: A[i]) res = 0 pre = n for i in indices: if i < pre: pre = i else: res = max(res, i - pre) return res <|end_body_0|> <|body_start_1|> stack...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxWidthRamp1(self, A: List[int]) -> int: """求一个最长的上坡 索引排序 @param A: @return:""" <|body_0|> def maxWidthRamp2(self, A: List[int]) -> int: """单调栈 @param A: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(A) indi...
stack_v2_sparse_classes_36k_train_032447
1,773
no_license
[ { "docstring": "求一个最长的上坡 索引排序 @param A: @return:", "name": "maxWidthRamp1", "signature": "def maxWidthRamp1(self, A: List[int]) -> int" }, { "docstring": "单调栈 @param A: @return:", "name": "maxWidthRamp2", "signature": "def maxWidthRamp2(self, A: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_009657
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxWidthRamp1(self, A: List[int]) -> int: 求一个最长的上坡 索引排序 @param A: @return: - def maxWidthRamp2(self, A: List[int]) -> int: 单调栈 @param A: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxWidthRamp1(self, A: List[int]) -> int: 求一个最长的上坡 索引排序 @param A: @return: - def maxWidthRamp2(self, A: List[int]) -> int: 单调栈 @param A: @return: <|skeleton|> class Solution...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def maxWidthRamp1(self, A: List[int]) -> int: """求一个最长的上坡 索引排序 @param A: @return:""" <|body_0|> def maxWidthRamp2(self, A: List[int]) -> int: """单调栈 @param A: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxWidthRamp1(self, A: List[int]) -> int: """求一个最长的上坡 索引排序 @param A: @return:""" n = len(A) indices = sorted(range(n), key=lambda i: A[i]) res = 0 pre = n for i in indices: if i < pre: pre = i else: ...
the_stack_v2_python_sparse
LeetCode/栈/单调栈(Monotone Stack)/962. 最大宽度坡.py
yiming1012/MyLeetCode
train
2
ad381d7110cf0b80a9a83f67b9019fab7d3fabbb
[ "super(AttentionModule, self).__init__()\nself.encoder_att = nn.Linear(encoder_dim, attention_dim)\nself.decoder_att = nn.Linear(decoder_dim, attention_dim)\nself.full_att = nn.Linear(attention_dim, 1)\nself.relu = nn.ReLU()\nself.softmax = nn.Softmax(dim=1)", "att1 = self.encoder_att(encoder_out)\natt2 = self.de...
<|body_start_0|> super(AttentionModule, self).__init__() self.encoder_att = nn.Linear(encoder_dim, attention_dim) self.decoder_att = nn.Linear(decoder_dim, attention_dim) self.full_att = nn.Linear(attention_dim, 1) self.relu = nn.ReLU() self.softmax = nn.Softmax(dim=1) <|...
AttentionModule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionModule: def __init__(self, encoder_dim, decoder_dim, attention_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" <|body_0|> def forward(self, encoder_out, deco...
stack_v2_sparse_classes_36k_train_032448
8,057
permissive
[ { "docstring": ":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network", "name": "__init__", "signature": "def __init__(self, encoder_dim, decoder_dim, attention_dim)" }, { "docstring": "Forward propagation...
2
stack_v2_sparse_classes_30k_train_018318
Implement the Python class `AttentionModule` described below. Class description: Implement the AttentionModule class. Method signatures and docstrings: - def __init__(self, encoder_dim, decoder_dim, attention_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param att...
Implement the Python class `AttentionModule` described below. Class description: Implement the AttentionModule class. Method signatures and docstrings: - def __init__(self, encoder_dim, decoder_dim, attention_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param att...
355c68597545dbd7d01de4ea19263d09ddb644d3
<|skeleton|> class AttentionModule: def __init__(self, encoder_dim, decoder_dim, attention_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" <|body_0|> def forward(self, encoder_out, deco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttentionModule: def __init__(self, encoder_dim, decoder_dim, attention_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" super(AttentionModule, self).__init__() self.encoder_att ...
the_stack_v2_python_sparse
models/show_attend_tell.py
mitjanikolaus/compositional-image-captioning
train
25
3b555cb625e7e6671615bd9aac69edac0239edb4
[ "if request.args.get('number'):\n data = db.session.query(Room).filter(Room.number == request.args.get('number')).first()\n return marshal(data, r_struct) if data else 'No such room!'\nif request.args.get('status'):\n data = db.session.query(Room).filter(Room.status == request.args.get('status')).all()\n ...
<|body_start_0|> if request.args.get('number'): data = db.session.query(Room).filter(Room.number == request.args.get('number')).first() return marshal(data, r_struct) if data else 'No such room!' if request.args.get('status'): data = db.session.query(Room).filter(Room...
RoomsRes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoomsRes: def get(self): """Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if '?status=' added :return:""" <|body_0|> def post(self): """Add a new room. ...
stack_v2_sparse_classes_36k_train_032449
2,397
no_license
[ { "docstring": "Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if '?status=' added :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Add a new room. :return:"...
4
stack_v2_sparse_classes_30k_train_014336
Implement the Python class `RoomsRes` described below. Class description: Implement the RoomsRes class. Method signatures and docstrings: - def get(self): Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if...
Implement the Python class `RoomsRes` described below. Class description: Implement the RoomsRes class. Method signatures and docstrings: - def get(self): Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if...
d3759f773f9abc0e917e75c174c28feb7d4a0692
<|skeleton|> class RoomsRes: def get(self): """Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if '?status=' added :return:""" <|body_0|> def post(self): """Add a new room. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoomsRes: def get(self): """Get info about all rooms if no query string parameters added. Get info about particular rooms if '?number=' added Get info about all rooms with specified status if '?status=' added :return:""" if request.args.get('number'): data = db.session.query(Room)....
the_stack_v2_python_sparse
rest_alchemy/rooms/routes.py
serhiihoriaiev/common
train
0
2ec8540eac3048cc7295d9923e719fc08970a3b2
[ "cnt = {}\nn = len(nums)\nfor i in nums:\n if cnt.get(i, 0) == 0:\n cnt[i] = 1\n else:\n cnt[i] += 1\n if cnt[i] > n // 2:\n return i\nif n == 1:\n return nums[0]", "count = 0\ncandidate = None\nfor i in nums:\n if count == 0:\n candidate = i\n count += 1 if i...
<|body_start_0|> cnt = {} n = len(nums) for i in nums: if cnt.get(i, 0) == 0: cnt[i] = 1 else: cnt[i] += 1 if cnt[i] > n // 2: return i if n == 1: return nums[0] <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt = {} n = len(nums) ...
stack_v2_sparse_classes_36k_train_032450
776
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "majorityElement", "signature": "def majorityElement(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "majorityElement", "signature": "def majorityElement(self, nums)" } ]
2
stack_v2_sparse_classes_30k_test_000260
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int - def majorityElement(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int - def majorityElement(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maj...
b7d9238d692b1b2f5ab8f73a76d02228a71a4d15
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" cnt = {} n = len(nums) for i in nums: if cnt.get(i, 0) == 0: cnt[i] = 1 else: cnt[i] += 1 if cnt[i] > n // 2: ...
the_stack_v2_python_sparse
169-Majority-Element.py
liuspencersjtu/MyLeetCode
train
0
0fdc22174c851eae455e155342136a58e8714159
[ "try:\n if altura == '':\n raise custom_exceptions.ErrorDeNegocio(origen='neogocio_direccion.alta_pd()', msj_adicional='Error al validar una dirección. La altura no puede quedar vacía.')\n elif not isinstance(int(altura), int):\n raise custom_exceptions.ErrorDeNegocio(origen='neogocio_direccion....
<|body_start_0|> try: if altura == '': raise custom_exceptions.ErrorDeNegocio(origen='neogocio_direccion.alta_pd()', msj_adicional='Error al validar una dirección. La altura no puede quedar vacía.') elif not isinstance(int(altura), int): raise custom_excep...
NegocioDireccion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NegocioDireccion: def valida_direccion(cls, calle, altura, ciudad, provincia, pais): """Realiza las validaciones de negocio de una direccion.""" <|body_0|> def alta_direccion(cls, calle, altura, ciudad, provincia, pais, validar=False): """Añade una dirección a la BD....
stack_v2_sparse_classes_36k_train_032451
4,578
no_license
[ { "docstring": "Realiza las validaciones de negocio de una direccion.", "name": "valida_direccion", "signature": "def valida_direccion(cls, calle, altura, ciudad, provincia, pais)" }, { "docstring": "Añade una dirección a la BD.", "name": "alta_direccion", "signature": "def alta_direccio...
3
stack_v2_sparse_classes_30k_train_015902
Implement the Python class `NegocioDireccion` described below. Class description: Implement the NegocioDireccion class. Method signatures and docstrings: - def valida_direccion(cls, calle, altura, ciudad, provincia, pais): Realiza las validaciones de negocio de una direccion. - def alta_direccion(cls, calle, altura, ...
Implement the Python class `NegocioDireccion` described below. Class description: Implement the NegocioDireccion class. Method signatures and docstrings: - def valida_direccion(cls, calle, altura, ciudad, provincia, pais): Realiza las validaciones de negocio de una direccion. - def alta_direccion(cls, calle, altura, ...
57ca674dba4dabd2526c450ba7210933240f19c5
<|skeleton|> class NegocioDireccion: def valida_direccion(cls, calle, altura, ciudad, provincia, pais): """Realiza las validaciones de negocio de una direccion.""" <|body_0|> def alta_direccion(cls, calle, altura, ciudad, provincia, pais, validar=False): """Añade una dirección a la BD....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NegocioDireccion: def valida_direccion(cls, calle, altura, ciudad, provincia, pais): """Realiza las validaciones de negocio de una direccion.""" try: if altura == '': raise custom_exceptions.ErrorDeNegocio(origen='neogocio_direccion.alta_pd()', msj_adicional='Error ...
the_stack_v2_python_sparse
negocio/negocio_direccion.py
JoaquinCardonaRuiz/proyecto-final
train
0
2bd18ed86d723b8d85d26c87a9aa5a664d7d3498
[ "if not features.has(READ_FEATURE, organization, actor=request.user):\n return Response(status=404)\nif isinstance(dashboard, dict):\n return self.respond(dashboard)\nreturn self.respond(serialize(dashboard, request.user))", "if not features.has(EDIT_FEATURE, organization, actor=request.user):\n return R...
<|body_start_0|> if not features.has(READ_FEATURE, organization, actor=request.user): return Response(status=404) if isinstance(dashboard, dict): return self.respond(dashboard) return self.respond(serialize(dashboard, request.user)) <|end_body_0|> <|body_start_1|> ...
OrganizationDashboardDetailsEndpoint
[ "BUSL-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationDashboardDetailsEndpoint: def get(self, request, organization, dashboard): """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam string organization_slug: the slug of the organization the...
stack_v2_sparse_classes_36k_train_032452
4,100
permissive
[ { "docstring": "Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam string organization_slug: the slug of the organization the dashboard belongs to. :pparam int dashboard_id: the id of the dashboard. :auth: required", "n...
3
null
Implement the Python class `OrganizationDashboardDetailsEndpoint` described below. Class description: Implement the OrganizationDashboardDetailsEndpoint class. Method signatures and docstrings: - def get(self, request, organization, dashboard): Retrieve an Organization's Dashboard ````````````````````````````````````...
Implement the Python class `OrganizationDashboardDetailsEndpoint` described below. Class description: Implement the OrganizationDashboardDetailsEndpoint class. Method signatures and docstrings: - def get(self, request, organization, dashboard): Retrieve an Organization's Dashboard ````````````````````````````````````...
63d698f5294f64a8c206b4c741e2a11be1f9a9be
<|skeleton|> class OrganizationDashboardDetailsEndpoint: def get(self, request, organization, dashboard): """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam string organization_slug: the slug of the organization the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationDashboardDetailsEndpoint: def get(self, request, organization, dashboard): """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam string organization_slug: the slug of the organization the dashboard bel...
the_stack_v2_python_sparse
src/sentry/api/endpoints/organization_dashboard_details.py
kaozdl/sentry
train
0
8f3980fbee59969dccd76ce8972a9f44a6d6e07e
[ "self.cloud_deploy_entity_vec = cloud_deploy_entity_vec\nself.is_incremental = is_incremental\nself.restore_info = restore_info\nself.target_type = target_type\nself.total_bytes_transferred_to_source = total_bytes_transferred_to_source\nself.mtype = mtype\nself.warnings = warnings", "if dictionary is None:\n r...
<|body_start_0|> self.cloud_deploy_entity_vec = cloud_deploy_entity_vec self.is_incremental = is_incremental self.restore_info = restore_info self.target_type = target_type self.total_bytes_transferred_to_source = total_bytes_transferred_to_source self.mtype = mtype ...
Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInfoProto as well as CloudDeployEntity. CloudDeployInfoProto extension Location Extension ...
CloudDeployInfoProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudDeployInfoProto: """Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInfoProto as well as CloudDeployEntity. Cl...
stack_v2_sparse_classes_36k_train_032453
6,086
permissive
[ { "docstring": "Constructor for the CloudDeployInfoProto class", "name": "__init__", "signature": "def __init__(self, cloud_deploy_entity_vec=None, is_incremental=None, restore_info=None, target_type=None, total_bytes_transferred_to_source=None, mtype=None, warnings=None)" }, { "docstring": "Cre...
2
null
Implement the Python class `CloudDeployInfoProto` described below. Class description: Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInf...
Implement the Python class `CloudDeployInfoProto` described below. Class description: Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInf...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CloudDeployInfoProto: """Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInfoProto as well as CloudDeployEntity. Cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudDeployInfoProto: """Implementation of the 'CloudDeployInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both CloudDeployInfoProto as well as CloudDeployEntity. CloudDeployInfo...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cloud_deploy_info_proto.py
cohesity/management-sdk-python
train
24
6bdf2d645cedbc94e6663e4c736aa60bc558bb8c
[ "self.checkpoint_dir = os.getcwd()\nif checkpoint_dir is not None:\n self.checkpoint_dir = checkpoint_dir\nself.name = '{}.pth.tar'\nself.latest = 'last'\nself.best = 'best'\nself.logger = Logger.get()", "if not os.path.isdir(self.checkpoint_dir):\n msg = 'Checkpoint Directory does not exist! Making directo...
<|body_start_0|> self.checkpoint_dir = os.getcwd() if checkpoint_dir is not None: self.checkpoint_dir = checkpoint_dir self.name = '{}.pth.tar' self.latest = 'last' self.best = 'best' self.logger = Logger.get() <|end_body_0|> <|body_start_1|> if not o...
Save/load the model and optimizer parameters.
Serialization
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Serialization: """Save/load the model and optimizer parameters.""" def __init__(self, checkpoint_dir=None): """Args: checkpoint_dir (path): the directory of checkpoint files.""" <|body_0|> def serialize(self, model, epoch, optimizer=None, checkpoint='last', is_best=False...
stack_v2_sparse_classes_36k_train_032454
16,358
no_license
[ { "docstring": "Args: checkpoint_dir (path): the directory of checkpoint files.", "name": "__init__", "signature": "def __init__(self, checkpoint_dir=None)" }, { "docstring": "Save model, optimizer and other parameters to file. Args: epoch (int): the epoch of training. checkpoint (str): the name...
3
stack_v2_sparse_classes_30k_train_008214
Implement the Python class `Serialization` described below. Class description: Save/load the model and optimizer parameters. Method signatures and docstrings: - def __init__(self, checkpoint_dir=None): Args: checkpoint_dir (path): the directory of checkpoint files. - def serialize(self, model, epoch, optimizer=None, ...
Implement the Python class `Serialization` described below. Class description: Save/load the model and optimizer parameters. Method signatures and docstrings: - def __init__(self, checkpoint_dir=None): Args: checkpoint_dir (path): the directory of checkpoint files. - def serialize(self, model, epoch, optimizer=None, ...
e953a54cd4599cfbfad11f88de7b354239cb558c
<|skeleton|> class Serialization: """Save/load the model and optimizer parameters.""" def __init__(self, checkpoint_dir=None): """Args: checkpoint_dir (path): the directory of checkpoint files.""" <|body_0|> def serialize(self, model, epoch, optimizer=None, checkpoint='last', is_best=False...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Serialization: """Save/load the model and optimizer parameters.""" def __init__(self, checkpoint_dir=None): """Args: checkpoint_dir (path): the directory of checkpoint files.""" self.checkpoint_dir = os.getcwd() if checkpoint_dir is not None: self.checkpoint_dir = chec...
the_stack_v2_python_sparse
pytorch_startup/utils.py
wikty/MachineLearningExamples
train
0
9f2f7bdbe644fc84c68066666508221cd7e6e9bc
[ "super().__init__(**kwargs)\nself.conv1 = keras.layers.Conv2D(16, 3, padding='same', activation='relu')\nself.maxpool1 = keras.layers.MaxPool2D(pool_size=(2, 2), strides=2)\nself.conv2 = keras.layers.Conv2D(8, 3, padding='same', activation='relu')\nself.maxpool2 = keras.layers.MaxPool2D(pool_size=(2, 2), strides=2)...
<|body_start_0|> super().__init__(**kwargs) self.conv1 = keras.layers.Conv2D(16, 3, padding='same', activation='relu') self.maxpool1 = keras.layers.MaxPool2D(pool_size=(2, 2), strides=2) self.conv2 = keras.layers.Conv2D(8, 3, padding='same', activation='relu') self.maxpool2 = ker...
MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is followed by a maxpooling layer of size 2. Finally, a fully connected layer foll...
MNISTEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MNISTEncoder: """MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is followed by a maxpooling layer of size ...
stack_v2_sparse_classes_36k_train_032455
8,692
permissive
[ { "docstring": "Constructor. Parameters ---------- latent_dim Latent dimension.", "name": "__init__", "signature": "def __init__(self, latent_dim: int, **kwargs) -> None" }, { "docstring": "Forward pass. Parameters ---------- x Input tensor. **kwargs Other arguments. Not used. Returns ------- En...
2
null
Implement the Python class `MNISTEncoder` described below. Class description: MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is ...
Implement the Python class `MNISTEncoder` described below. Class description: MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is ...
54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718
<|skeleton|> class MNISTEncoder: """MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is followed by a maxpooling layer of size ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MNISTEncoder: """MNIST encoder used in the experiments for the Counterfactual with Reinforcement Learning. The model consists of 3 convolutional layers having 16, 8 and 8 channels and a kernel size of 3, with ReLU nonlinearities. Each convolutional layer is followed by a maxpooling layer of size 2. Finally, a...
the_stack_v2_python_sparse
alibi/models/tensorflow/cfrl_models.py
SeldonIO/alibi
train
2,143
59d39fdcc2b24b90dceb996c889af5de25eb65da
[ "\"\"\"\n Thoughts:\n 这个方法没有left和right子树为None的情况进行对比会出现问题.\n \"\"\"\nif not self.isEqualNode(root1, root2):\n return False\nif not self.isEqualNode(root1.left, root2.left):\n root1.left, root1.right = (root1.right, root1.left)\nreturn self.flipEquiv(root1.left, root2.left) and self.flipEq...
<|body_start_0|> """ Thoughts: 这个方法没有left和right子树为None的情况进行对比会出现问题. """ if not self.isEqualNode(root1, root2): return False if not self.isEqualNode(root1.left, root2.left): root1.left, root1.right = (root1.right, root1.left)...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def isEqualNode(self, root1, root2): """return True if root1.val == root2.val""" <|body_1|> <|end_skeleton|> <|body_start_0|> ""...
stack_v2_sparse_classes_36k_train_032456
3,565
no_license
[ { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "flipEquiv", "signature": "def flipEquiv(self, root1, root2)" }, { "docstring": "return True if root1.val == root2.val", "name": "isEqualNode", "signature": "def isEqualNode(self, root1, root2)" } ]
2
stack_v2_sparse_classes_30k_test_000843
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def isEqualNode(self, root1, root2): return True if root1.val == root2.val
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def isEqualNode(self, root1, root2): return True if root1.val == root2.val <|sk...
f96a2273c6831a8035e1adacfa452f73c599ae16
<|skeleton|> class Solution_1: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def isEqualNode(self, root1, root2): """return True if root1.val == root2.val""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_1: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" """ Thoughts: 这个方法没有left和right子树为None的情况进行对比会出现问题. """ if not self.isEqualNode(root1, root2): return False i...
the_stack_v2_python_sparse
Python/FlipEquivalentBinaryTrees.py
here0009/LeetCode
train
1
d44b0d52e4cfa37e936664595b8a13b265f96a6a
[ "queue = deque([(n, 0)])\nvisited = set()\nwhile queue:\n num, step = queue.popleft()\n remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)]\n for i in remains:\n if i == 0:\n return step + 1\n if i not in visited:\n queue.append((i, step + 1))\n vis...
<|body_start_0|> queue = deque([(n, 0)]) visited = set() while queue: num, step = queue.popleft() remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)] for i in remains: if i == 0: return step + 1 if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def num_squares(self, n): """:type n: int :rtype: int""" <|body_0|> def num_squares_2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> queue = deque([(n, 0)]) visited = set() while queue...
stack_v2_sparse_classes_36k_train_032457
1,571
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "num_squares", "signature": "def num_squares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "num_squares_2", "signature": "def num_squares_2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_011736
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def num_squares(self, n): :type n: int :rtype: int - def num_squares_2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def num_squares(self, n): :type n: int :rtype: int - def num_squares_2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def num_squares(self, n): """...
cc7740026c3774be21ab924b99ae7596ef20d0e4
<|skeleton|> class Solution: def num_squares(self, n): """:type n: int :rtype: int""" <|body_0|> def num_squares_2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def num_squares(self, n): """:type n: int :rtype: int""" queue = deque([(n, 0)]) visited = set() while queue: num, step = queue.popleft() remains = [num - n * n for n in range(1, int(num ** 0.5) + 1)] for i in remains: ...
the_stack_v2_python_sparse
data_structure/queues_and_stacks/279_num_squares.py
yangtao0304/hands-on-programming-exercise
train
0
c6e1b2e3f9b1b14f4881ee9baa0e1999835e5ac2
[ "units = Unit('hour')\nwidth = 5\nweights_instance = ChooseDefaultWeightsTriangular(width, units=units)\nexpected_width = 5\nexpected_unit = units\nself.assertEqual(weights_instance.width, expected_width)\nself.assertEqual(weights_instance.parameters_units, expected_unit)", "units = 'hour'\nwidth = 5\nweights_ins...
<|body_start_0|> units = Unit('hour') width = 5 weights_instance = ChooseDefaultWeightsTriangular(width, units=units) expected_width = 5 expected_unit = units self.assertEqual(weights_instance.width, expected_width) self.assertEqual(weights_instance.parameters_uni...
Tests for the __init__ method in ChooseDefaultWeightsTriangular class
Test___init__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test___init__: """Tests for the __init__ method in ChooseDefaultWeightsTriangular class""" def test_cf_unit_input(self): """Test the case where an instance of cf_units.Unit is passed in""" <|body_0|> def test_string_input(self): """Test the case where a string is...
stack_v2_sparse_classes_36k_train_032458
13,166
permissive
[ { "docstring": "Test the case where an instance of cf_units.Unit is passed in", "name": "test_cf_unit_input", "signature": "def test_cf_unit_input(self)" }, { "docstring": "Test the case where a string is passed and gets converted to a Unit instance", "name": "test_string_input", "signat...
2
stack_v2_sparse_classes_30k_train_012378
Implement the Python class `Test___init__` described below. Class description: Tests for the __init__ method in ChooseDefaultWeightsTriangular class Method signatures and docstrings: - def test_cf_unit_input(self): Test the case where an instance of cf_units.Unit is passed in - def test_string_input(self): Test the c...
Implement the Python class `Test___init__` described below. Class description: Tests for the __init__ method in ChooseDefaultWeightsTriangular class Method signatures and docstrings: - def test_cf_unit_input(self): Test the case where an instance of cf_units.Unit is passed in - def test_string_input(self): Test the c...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test___init__: """Tests for the __init__ method in ChooseDefaultWeightsTriangular class""" def test_cf_unit_input(self): """Test the case where an instance of cf_units.Unit is passed in""" <|body_0|> def test_string_input(self): """Test the case where a string is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test___init__: """Tests for the __init__ method in ChooseDefaultWeightsTriangular class""" def test_cf_unit_input(self): """Test the case where an instance of cf_units.Unit is passed in""" units = Unit('hour') width = 5 weights_instance = ChooseDefaultWeightsTriangular(wid...
the_stack_v2_python_sparse
improver_tests/blending/weights/test_ChooseDefaultWeightsTriangular.py
metoppv/improver
train
101
57c8d89c5fe7d7cc1b22dfa42621f5973c49d526
[ "if len(input) == 0:\n return input\nrecord = []\nfor i in range(len(input)):\n record.append([(0, '')] * len(input))\nfor i in range(len(input)):\n record[i][i] = (1, input[i])\nfor c in range(2, len(input) + 1):\n for i in range(len(input) - c + 1):\n j = i + c - 1\n if input[i] == input...
<|body_start_0|> if len(input) == 0: return input record = [] for i in range(len(input)): record.append([(0, '')] * len(input)) for i in range(len(input)): record[i][i] = (1, input[i]) for c in range(2, len(input) + 1): for i in ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, input): """input: string input return: string""" <|body_0|> def longestPalindrome_1(self, input): """input: string input return: string""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(input) == 0: ...
stack_v2_sparse_classes_36k_train_032459
3,919
no_license
[ { "docstring": "input: string input return: string", "name": "longestPalindrome", "signature": "def longestPalindrome(self, input)" }, { "docstring": "input: string input return: string", "name": "longestPalindrome_1", "signature": "def longestPalindrome_1(self, input)" } ]
2
stack_v2_sparse_classes_30k_val_000896
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, input): input: string input return: string - def longestPalindrome_1(self, input): input: string input return: string
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, input): input: string input return: string - def longestPalindrome_1(self, input): input: string input return: string <|skeleton|> class Solution: ...
8d9eb98fa5e897602eae9c37b47fd8abae72b1dc
<|skeleton|> class Solution: def longestPalindrome(self, input): """input: string input return: string""" <|body_0|> def longestPalindrome_1(self, input): """input: string input return: string""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, input): """input: string input return: string""" if len(input) == 0: return input record = [] for i in range(len(input)): record.append([(0, '')] * len(input)) for i in range(len(input)): record[i...
the_stack_v2_python_sparse
dynamic_programming/word_matching/longest_palindromic_subsequence.py
wanlipu/coding-python
train
0
0253a1abeaa438a51e1fdcc8141b1615475d9bd1
[ "if isinstance(models, dict):\n included_models = {model: val for model, val in models.items() if model in included_model_types}\n missing_models = set(included_model_types) - set(included_models.keys())\nelif isinstance(models, list):\n included_models = [model for model in models if model in included_mod...
<|body_start_0|> if isinstance(models, dict): included_models = {model: val for model, val in models.items() if model in included_model_types} missing_models = set(included_model_types) - set(included_models.keys()) elif isinstance(models, list): included_models = [mo...
Class to filter models given user requirements
ModelFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be remove...
stack_v2_sparse_classes_36k_train_032460
4,609
permissive
[ { "docstring": "Only include models specified in `included_model_types`, other models will be removed If model specified in `included_model_types` doesn't present in `models`, will warn users and ignore Parameters ---------- models: Union[Dict[str, Any], List[str]] A dictionary containing models and their hyper...
3
stack_v2_sparse_classes_30k_train_000699
Implement the Python class `ModelFilter` described below. Class description: Class to filter models given user requirements Method signatures and docstrings: - def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: Only include models specifi...
Implement the Python class `ModelFilter` described below. Class description: Class to filter models given user requirements Method signatures and docstrings: - def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: Only include models specifi...
6af92e149491f6e5062495d87306b3625d12d992
<|skeleton|> class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be remove...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be removed If model sp...
the_stack_v2_python_sparse
common/src/autogluon/common/model_filter/_model_filter.py
stjordanis/autogluon
train
0
dd8314ef381c9e1a8bb5c306ce3602338178e0f0
[ "context = super(CollectorCreateView, self).get_context_data(**kwargs)\ncontext['page_title'] = u'Создание нового коллекционера'\nreturn context", "message = super(CollectorCreateView, self).form_valid(form)\nmes = u'Коллекционер {} {} успешно добавлен.'.format(self.object.name, self.object.surname)\nmessages.suc...
<|body_start_0|> context = super(CollectorCreateView, self).get_context_data(**kwargs) context['page_title'] = u'Создание нового коллекционера' return context <|end_body_0|> <|body_start_1|> message = super(CollectorCreateView, self).form_valid(form) mes = u'Коллекционер {} {} у...
Add new collector
CollectorCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectorCreateView: """Add new collector""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" <|body_0|> def form_valid(self, form): """The successful addition of new collector :param form: :return: message""" ...
stack_v2_sparse_classes_36k_train_032461
4,445
no_license
[ { "docstring": "Extends context data :param kwargs: :return: context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "The successful addition of new collector :param form: :return: message", "name": "form_valid", "signature": "def form_...
2
stack_v2_sparse_classes_30k_train_006323
Implement the Python class `CollectorCreateView` described below. Class description: Add new collector Method signatures and docstrings: - def get_context_data(self, **kwargs): Extends context data :param kwargs: :return: context - def form_valid(self, form): The successful addition of new collector :param form: :ret...
Implement the Python class `CollectorCreateView` described below. Class description: Add new collector Method signatures and docstrings: - def get_context_data(self, **kwargs): Extends context data :param kwargs: :return: context - def form_valid(self, form): The successful addition of new collector :param form: :ret...
8eb18b831e034302f90585a179110336bb18af45
<|skeleton|> class CollectorCreateView: """Add new collector""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" <|body_0|> def form_valid(self, form): """The successful addition of new collector :param form: :return: message""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectorCreateView: """Add new collector""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" context = super(CollectorCreateView, self).get_context_data(**kwargs) context['page_title'] = u'Создание нового коллекционера' retu...
the_stack_v2_python_sparse
collector/views.py
YevheniiaSmyrnova/butterflies
train
0
fb6f485fb920eaac93d34bfdccb8ecab1a99840f
[ "logger.debug('---------- workbench application ----------')\ngui = self.gui\nif self.start():\n window = self.workbench.create_window(position=self.window_position, size=self.window_size)\n window.open()\n self.workbench.on_trait_change(self._on_workbench_exited, 'exited')\n if self.start_gui_event_loo...
<|body_start_0|> logger.debug('---------- workbench application ----------') gui = self.gui if self.start(): window = self.workbench.create_window(position=self.window_position, size=self.window_size) window.open() self.workbench.on_trait_change(self._on_workb...
The mayavi application.
MayaviWorkbenchApplication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MayaviWorkbenchApplication: """The mayavi application.""" def run(self): """Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if start_gui_event_loop is True) 4) When the event loop termi...
stack_v2_sparse_classes_36k_train_032462
4,424
no_license
[ { "docstring": "Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if start_gui_event_loop is True) 4) When the event loop terminates, stops the application This particular method is overridden from the parent class ...
3
stack_v2_sparse_classes_30k_test_001131
Implement the Python class `MayaviWorkbenchApplication` described below. Class description: The mayavi application. Method signatures and docstrings: - def run(self): Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if s...
Implement the Python class `MayaviWorkbenchApplication` described below. Class description: The mayavi application. Method signatures and docstrings: - def run(self): Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if s...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class MayaviWorkbenchApplication: """The mayavi application.""" def run(self): """Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if start_gui_event_loop is True) 4) When the event loop termi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MayaviWorkbenchApplication: """The mayavi application.""" def run(self): """Run the application. This does the following: 1) Starts the application 2) Creates and opens a workbench window 3) Starts the GUI event loop (only if start_gui_event_loop is True) 4) When the event loop terminates, stops ...
the_stack_v2_python_sparse
maps/build/mayavi/enthought/mayavi/plugins/mayavi_workbench_application.py
m-elhussieny/code
train
0
91ff036f6c97b605a72a9b5abf1bbfc31a53e774
[ "self.em = EventManager('wikidata', url='https://www.wikidata.org/wiki/Wikidata:Main_Page', title='Wikidata', config=config)\nself.debug = self.em.config.debug\nself.profile = self.em.config.profile\npath = os.path.dirname(__file__)\nself.sampledir = path + '/../sampledata/'\nself.sampleFilePath = self.sampledir + ...
<|body_start_0|> self.em = EventManager('wikidata', url='https://www.wikidata.org/wiki/Wikidata:Main_Page', title='Wikidata', config=config) self.debug = self.em.config.debug self.profile = self.em.config.profile path = os.path.dirname(__file__) self.sampledir = path + '/../sampl...
WikiData proceedings titles event source
WikiData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikiData: """WikiData proceedings titles event source""" def __init__(self, config=None): """Constructor Args: config(StorageConfig): the storage configuration to use""" <|body_0|> def cacheEvents(self, limit=1000000, batchSize=500): """initialize me from my samp...
stack_v2_sparse_classes_36k_train_032463
2,035
permissive
[ { "docstring": "Constructor Args: config(StorageConfig): the storage configuration to use", "name": "__init__", "signature": "def __init__(self, config=None)" }, { "docstring": "initialize me from my sample file Args: limit(int): the maximum number of events to cache batchSize(int): the batchSiz...
3
stack_v2_sparse_classes_30k_train_014375
Implement the Python class `WikiData` described below. Class description: WikiData proceedings titles event source Method signatures and docstrings: - def __init__(self, config=None): Constructor Args: config(StorageConfig): the storage configuration to use - def cacheEvents(self, limit=1000000, batchSize=500): initi...
Implement the Python class `WikiData` described below. Class description: WikiData proceedings titles event source Method signatures and docstrings: - def __init__(self, config=None): Constructor Args: config(StorageConfig): the storage configuration to use - def cacheEvents(self, limit=1000000, batchSize=500): initi...
b48832e9032e41785f61338f6ff2f5cac91aba0e
<|skeleton|> class WikiData: """WikiData proceedings titles event source""" def __init__(self, config=None): """Constructor Args: config(StorageConfig): the storage configuration to use""" <|body_0|> def cacheEvents(self, limit=1000000, batchSize=500): """initialize me from my samp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WikiData: """WikiData proceedings titles event source""" def __init__(self, config=None): """Constructor Args: config(StorageConfig): the storage configuration to use""" self.em = EventManager('wikidata', url='https://www.wikidata.org/wiki/Wikidata:Main_Page', title='Wikidata', config=con...
the_stack_v2_python_sparse
ptp/wikidata.py
MusaabKh/ProceedingsTitleParser
train
0
c1852e0693ae823da489641071957d58601de86a
[ "if 'item' not in orderby_item:\n return 0\nval = orderby_item['item']\nif val is None:\n return 1\nif isinstance(val, bool):\n return 2\nif isinstance(val, numbers.Number):\n return 4\nif isinstance(val, str):\n return 5\nraise TypeError('unknown type' + str(val))", "if 'item' not in orderby_item:...
<|body_start_0|> if 'item' not in orderby_item: return 0 val = orderby_item['item'] if val is None: return 1 if isinstance(val, bool): return 2 if isinstance(val, numbers.Number): return 4 if isinstance(val, str): ...
_OrderByHelper
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _OrderByHelper: def getTypeOrd(orderby_item): """Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have any 'item' key 1 if the value is undefined 2 if the value is a boolean 4 if the value is a number 5 if ...
stack_v2_sparse_classes_36k_train_032464
9,259
permissive
[ { "docstring": "Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have any 'item' key 1 if the value is undefined 2 if the value is a boolean 4 if the value is a number 5 if the value is a str or a unicode :rtype: int", "name":...
3
null
Implement the Python class `_OrderByHelper` described below. Class description: Implement the _OrderByHelper class. Method signatures and docstrings: - def getTypeOrd(orderby_item): Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have ...
Implement the Python class `_OrderByHelper` described below. Class description: Implement the _OrderByHelper class. Method signatures and docstrings: - def getTypeOrd(orderby_item): Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have ...
c2ca191e736bb06bfbbbc9493e8325763ba990bb
<|skeleton|> class _OrderByHelper: def getTypeOrd(orderby_item): """Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have any 'item' key 1 if the value is undefined 2 if the value is a boolean 4 if the value is a number 5 if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _OrderByHelper: def getTypeOrd(orderby_item): """Returns the ordinal of the value of the item pair in the dictionary. :param dict orderby_item: :return: 0 if the item_pair doesn't have any 'item' key 1 if the value is undefined 2 if the value is a boolean 4 if the value is a number 5 if the value is a...
the_stack_v2_python_sparse
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/document_producer.py
Azure/azure-sdk-for-python
train
4,046
aa2ef6e8768916126ed2582c667b7a46e6f53866
[ "@mb.program(input_specs=[mb.TensorSpec(shape=(1, 3, 20))])\ndef prog(x):\n y1 = mb.relu(x=x, name='var_1!')\n y2 = mb.relu(x=x, name='1')\n z = mb.add(x=y1, y=y2, name='3')\n return z\nPASS_REGISTRY['mil_backend::sanitize_name_strings'](prog)\nblock = prog.functions['main']\nassert block.find_ops(op_ty...
<|body_start_0|> @mb.program(input_specs=[mb.TensorSpec(shape=(1, 3, 20))]) def prog(x): y1 = mb.relu(x=x, name='var_1!') y2 = mb.relu(x=x, name='1') z = mb.add(x=y1, y=y2, name='3') return z PASS_REGISTRY['mil_backend::sanitize_name_strings'](prog...
TestSanitizerPass
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSanitizerPass: def test_sanitize_numeric_var_names(self): """Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!") %1: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="1") %3: (1, 3, 20, fp32)(Tensor) = add(x=%Var_1!, y=%1, na...
stack_v2_sparse_classes_36k_train_032465
39,733
permissive
[ { "docstring": "Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name=\"var_1!\") %1: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name=\"1\") %3: (1, 3, 20, fp32)(Tensor) = add(x=%Var_1!, y=%1, name=\"3\") } -> (%3) } Output: main(%x: (1, 3, 20, fp32)(Tensor)) { bl...
2
null
Implement the Python class `TestSanitizerPass` described below. Class description: Implement the TestSanitizerPass class. Method signatures and docstrings: - def test_sanitize_numeric_var_names(self): Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!") ...
Implement the Python class `TestSanitizerPass` described below. Class description: Implement the TestSanitizerPass class. Method signatures and docstrings: - def test_sanitize_numeric_var_names(self): Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!") ...
feed174188f7773631a3d574e1ff9889a135c986
<|skeleton|> class TestSanitizerPass: def test_sanitize_numeric_var_names(self): """Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!") %1: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="1") %3: (1, 3, 20, fp32)(Tensor) = add(x=%Var_1!, y=%1, na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSanitizerPass: def test_sanitize_numeric_var_names(self): """Input: main(%x: (1, 3, 20, fp32)(Tensor)) { block0() { %var_1!: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="var_1!") %1: (1, 3, 20, fp32)(Tensor) = relu(x=%x, name="1") %3: (1, 3, 20, fp32)(Tensor) = add(x=%Var_1!, y=%1, name="3") } -> (...
the_stack_v2_python_sparse
coremltools/converters/mil/backend/mil/passes/test_passes.py
apple/coremltools
train
3,742
31062ba2f3aa096bc585542d03bf620894f72ab7
[ "self.first_name = first_name\nself.last_name = last_name\nself.salary = salary", "if bonus:\n self.salary += bonus\nelse:\n self.salary += 5000" ]
<|body_start_0|> self.first_name = first_name self.last_name = last_name self.salary = salary <|end_body_0|> <|body_start_1|> if bonus: self.salary += bonus else: self.salary += 5000 <|end_body_1|>
Object representing an employee and salary
Employee
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Employee: """Object representing an employee and salary""" def __init__(self, first_name, last_name, salary): """Initialize employee attributes""" <|body_0|> def give_raise(self, bonus=''): """Method to give raise (bonus) to employee. $5000 is the default amount....
stack_v2_sparse_classes_36k_train_032466
698
no_license
[ { "docstring": "Initialize employee attributes", "name": "__init__", "signature": "def __init__(self, first_name, last_name, salary)" }, { "docstring": "Method to give raise (bonus) to employee. $5000 is the default amount.", "name": "give_raise", "signature": "def give_raise(self, bonus...
2
null
Implement the Python class `Employee` described below. Class description: Object representing an employee and salary Method signatures and docstrings: - def __init__(self, first_name, last_name, salary): Initialize employee attributes - def give_raise(self, bonus=''): Method to give raise (bonus) to employee. $5000 i...
Implement the Python class `Employee` described below. Class description: Object representing an employee and salary Method signatures and docstrings: - def __init__(self, first_name, last_name, salary): Initialize employee attributes - def give_raise(self, bonus=''): Method to give raise (bonus) to employee. $5000 i...
b93c3cd5e1c1b91079db2281137a8451f2566885
<|skeleton|> class Employee: """Object representing an employee and salary""" def __init__(self, first_name, last_name, salary): """Initialize employee attributes""" <|body_0|> def give_raise(self, bonus=''): """Method to give raise (bonus) to employee. $5000 is the default amount....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Employee: """Object representing an employee and salary""" def __init__(self, first_name, last_name, salary): """Initialize employee attributes""" self.first_name = first_name self.last_name = last_name self.salary = salary def give_raise(self, bonus=''): """M...
the_stack_v2_python_sparse
Crash Course/ch11-Testing/employee.py
jpc0016/Python-Examples
train
1
188fc91b52a6cdb507ba49a92c0f02a82571c728
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Session()", "from ..entity import Entity\nfrom .endpoint import Endpoint\nfrom .failure_info import FailureInfo\nfrom .modality import Modality\nfrom .segment import Segment\nfrom ..entity import Entity\nfrom .endpoint import Endpoint\...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Session() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .endpoint import Endpoint from .failure_info import FailureInfo from .modality import Modality ...
Session
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Session: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Session: """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: Session"""...
stack_v2_sparse_classes_36k_train_032467
4,761
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: Session", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
null
Implement the Python class `Session` described below. Class description: Implement the Session class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Session: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Session` described below. Class description: Implement the Session class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Session: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Session: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Session: """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: Session"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Session: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Session: """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: Session""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/call_records/session.py
microsoftgraph/msgraph-sdk-python
train
135
ac61d3b27baf2259e82640fc1992ec1f645d82be
[ "self.cache = {}\nself.capacity = capacity\nself.i = 0", "if key not in self.cache:\n return -1\nself.i += 1\nself.cache[key] = (self.cache[key][0], self.i)\nreturn self.cache[key][0]", "if key not in self.cache and len(self.cache) >= self.capacity:\n minValue = sys.maxint\n for i in self.cache:\n ...
<|body_start_0|> self.cache = {} self.capacity = capacity self.i = 0 <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 self.i += 1 self.cache[key] = (self.cache[key][0], self.i) return self.cache[key][0] <|end_body_1|> <|body_start_...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: 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: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_032468
1,532
no_license
[ { "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: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache 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: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache 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: void <|sk...
5f4bde4c1799b0c2c29e9d790fe720d5ba691c75
<|skeleton|> class LRUCache: 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: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.cache = {} self.capacity = capacity self.i = 0 def get(self, key): """:type key: int :rtype: int""" if key not in self.cache: return -1 self.i += 1 self.cache...
the_stack_v2_python_sparse
Interview-Questions.py
Darthpwner/Tech-Company-Interviews
train
1
1222c2257264acc5977f5b45d0e10973917a5c8b
[ "m = len(word1)\nn = len(word2)\nif m == 0:\n return n\nif n == 0:\n return m\nif word1 == word2:\n return 0\ndp = []\nfor i in range(m + 1):\n dp.append([0] * (n + 1))\ndp[0][0] = 0\nfor i in range(m + 1):\n dp[i][0] = i\nfor j in range(n + 1):\n dp[0][j] = j\nfor i in range(1, m + 1):\n for j...
<|body_start_0|> m = len(word1) n = len(word2) if m == 0: return n if n == 0: return m if word1 == word2: return 0 dp = [] for i in range(m + 1): dp.append([0] * (n + 1)) dp[0][0] = 0 for i in range(m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance_3op(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> def minimumDeleteSum(self, word1, word2)...
stack_v2_sparse_classes_36k_train_032469
2,559
no_license
[ { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance_3op", "signature": "def minDistance_3op(self, word1, word2)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance", "signature": "def minDistance(self, word1, word2)" ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance_3op(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance_3op(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def ...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution: def minDistance_3op(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> def minimumDeleteSum(self, word1, word2)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance_3op(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" m = len(word1) n = len(word2) if m == 0: return n if n == 0: return m if word1 == word2: return 0 dp = [] f...
the_stack_v2_python_sparse
2019/dynamic_programming/edit_distance_72.py
yehongyu/acode
train
0
fb63a824c4bf5f1ab1b465f2c9269fa7ccd1568c
[ "need, missing = (collections.Counter(t), len(t))\ncur_left = res_left = res_right = 0\nfor cur_right, c in enumerate(s, 1):\n missing -= need[c] > 0\n need[c] -= 1\n if not missing:\n while cur_left < cur_right and need[s[cur_left]] < 0:\n need[s[cur_left]] += 1\n cur_left += ...
<|body_start_0|> need, missing = (collections.Counter(t), len(t)) cur_left = res_left = res_right = 0 for cur_right, c in enumerate(s, 1): missing -= need[c] > 0 need[c] -= 1 if not missing: while cur_left < cur_right and need[s[cur_left]] < 0:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how many times I need character c (can be negative) and missing tells how many characters are still mis...
stack_v2_sparse_classes_36k_train_032470
2,478
no_license
[ { "docstring": ":type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how many times I need character c (can be negative) and missing tells how many characters are still missing. In the loop, first add the new character t...
2
stack_v2_sparse_classes_30k_train_018296
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow(self, s, t): :type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how ma...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minWindow(self, s, t): :type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how ma...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how many times I need character c (can be negative) and missing tells how many characters are still mis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minWindow(self, s, t): """:type s: str :type t: str :rtype: str current window is s[cur_left:cur_right] and the result window is s[res_left:res_right]. In need[c] I store how many times I need character c (can be negative) and missing tells how many characters are still missing. In the l...
the_stack_v2_python_sparse
LeetCode/076_minimum_window_substring.py
yao23/Machine_Learning_Playground
train
12
e40dfe8842447f0b300d65d0d3bba224bc86ff73
[ "from collections import defaultdict\nd = defaultdict(list)\n\ndef f(r, i):\n if r:\n d[i].append(r.val)\n f(r.left, i + 1)\n f(r.right, i + 1)\nf(root, 0)\nreturn [i for i in d.values()]", "if not root:\n return []\nfrom collections import deque\nres = []\nq = deque()\nq.append(root)\n...
<|body_start_0|> from collections import defaultdict d = defaultdict(list) def f(r, i): if r: d[i].append(r.val) f(r.left, i + 1) f(r.right, i + 1) f(root, 0) return [i for i in d.values()] <|end_body_0|> <|body_start_...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" <|body_0|> def levelOrder1(self, root): """:param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collectio...
stack_v2_sparse_classes_36k_train_032471
1,556
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":param root: :return:", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" } ]
2
null
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历 - def levelOrder1(self, root): :param root: :return:
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历 - def levelOrder1(self, root): :param root: :return: <|skeleton|> clas...
a3a1556abc5adb9325de54d64f9814e64b96db0f
<|skeleton|> class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" <|body_0|> def levelOrder1(self, root): """:param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" from collections import defaultdict d = defaultdict(list) def f(r, i): if r: d[i].append(r.val) f(r.left, i + 1...
the_stack_v2_python_sparse
leetcode/tree/*levelOrder.py
BigerWANG/geek_algorithm
train
0
2d2338edd7a7fa8e2c78baf903a06864fb9ab742
[ "self.serie = Series(serie_path)\nself.serie.get_instances_ordered()\nself.serie_data = self.serie.get_series_details()\nself.instance_uid_serie = self.serie.get_all_SOPInstanceIUD()\nself.matrix_size = self.serie.get_size_matrix()\nself.instances = self.serie.get_instances_ordered()\nself.image_position = self.ins...
<|body_start_0|> self.serie = Series(serie_path) self.serie.get_instances_ordered() self.serie_data = self.serie.get_series_details() self.instance_uid_serie = self.serie.get_all_SOPInstanceIUD() self.matrix_size = self.serie.get_size_matrix() self.instances = self.serie....
a class to build an ndarray mask from a RTSS File
MaskBuilder_RTSS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_032472
5,496
permissive
[ { "docstring": "constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]", "name": "__init__", "signature": "def __init__(self, rtss_path: str, serie_path: str)" }, { "docstring": "check if every SOPInstanceUID from RTSTRUCT cor...
6
stack_v2_sparse_classes_30k_train_010378
Implement the Python class `MaskBuilder_RTSS` described below. Class description: a class to build an ndarray mask from a RTSS File Method signatures and docstrings: - def __init__(self, rtss_path: str, serie_path: str): constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [director...
Implement the Python class `MaskBuilder_RTSS` described below. Class description: a class to build an ndarray mask from a RTSS File Method signatures and docstrings: - def __init__(self, rtss_path: str, serie_path: str): constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [director...
56619b47877ad912d7fe33616d6596ce542705bb
<|skeleton|> class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" self.serie = Series(serie_path)...
the_stack_v2_python_sparse
dicom_to_cnn/model/segmentation/MaskBuilder_RTSS.py
wendyrvllr/Dicom-To-CNN
train
0
1e4f57fd43102995def013c4e353cc922058582b
[ "super(BIM, self).__init__(model, device)\nself.device = device\nself.eps = eps\nself.loss = CrossEntropyLoss()\nself.itr_numbers = itr_numbers", "xs = xs.to(self.device)\nperturbtion = torch.zeros(xs.shape).to(self.device)\nxs.requires_grad = True\nfor i in range(self.itr_numbers):\n output = self.model_forwa...
<|body_start_0|> super(BIM, self).__init__(model, device) self.device = device self.eps = eps self.loss = CrossEntropyLoss() self.itr_numbers = itr_numbers <|end_body_0|> <|body_start_1|> xs = xs.to(self.device) perturbtion = torch.zeros(xs.shape).to(self.device)...
BIM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BIM: def __init__(self, model, device, eps=0.001, itr_numbers=20): """Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration number""" <|body_0|> def attack(self, xs: torch.tensor, ys: torch.tensor): ...
stack_v2_sparse_classes_36k_train_032473
2,821
permissive
[ { "docstring": "Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration number", "name": "__init__", "signature": "def __init__(self, model, device, eps=0.001, itr_numbers=20)" }, { "docstring": "Attacking the victim model by add...
2
stack_v2_sparse_classes_30k_train_007624
Implement the Python class `BIM` described below. Class description: Implement the BIM class. Method signatures and docstrings: - def __init__(self, model, device, eps=0.001, itr_numbers=20): Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration num...
Implement the Python class `BIM` described below. Class description: Implement the BIM class. Method signatures and docstrings: - def __init__(self, model, device, eps=0.001, itr_numbers=20): Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration num...
3230044473614d2dd931d96cbd6a3bc974eff926
<|skeleton|> class BIM: def __init__(self, model, device, eps=0.001, itr_numbers=20): """Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration number""" <|body_0|> def attack(self, xs: torch.tensor, ys: torch.tensor): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BIM: def __init__(self, model, device, eps=0.001, itr_numbers=20): """Initializing the BIM class. Args: model: victim model device: torch.device eps: float, epsilon itr_numbers: int, iteration number""" super(BIM, self).__init__(model, device) self.device = device self.eps = ep...
the_stack_v2_python_sparse
advt/attack/bim.py
WindFantasy98/ADVT
train
0
27fd62b1419ea6cbed06f69608b3a50473f808aa
[ "for func in reversed(self.mime_func):\n codename = func(mime)\n if codename is not None:\n return codename", "assert mime is not None or cls is not None\nif mime is not None:\n cls = self.factories[self.get_type(mime)]\nreturn super(MIMETemplateLoader, self).load(path, cls=cls, relative_to=relati...
<|body_start_0|> for func in reversed(self.mime_func): codename = func(mime) if codename is not None: return codename <|end_body_0|> <|body_start_1|> assert mime is not None or cls is not None if mime is not None: cls = self.factories[self.get...
This subclass of TemplateLoader use mimetypes to search and find templates to load.
MIMETemplateLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MIMETemplateLoader: """This subclass of TemplateLoader use mimetypes to search and find templates to load.""" def get_type(self, mime): """finds the codename used by relatorio to work on a mimetype""" <|body_0|> def load(self, path, mime=None, relative_to=None, cls=None)...
stack_v2_sparse_classes_36k_train_032474
5,592
no_license
[ { "docstring": "finds the codename used by relatorio to work on a mimetype", "name": "get_type", "signature": "def get_type(self, mime)" }, { "docstring": "returns a template object based on path", "name": "load", "signature": "def load(self, path, mime=None, relative_to=None, cls=None)"...
3
null
Implement the Python class `MIMETemplateLoader` described below. Class description: This subclass of TemplateLoader use mimetypes to search and find templates to load. Method signatures and docstrings: - def get_type(self, mime): finds the codename used by relatorio to work on a mimetype - def load(self, path, mime=N...
Implement the Python class `MIMETemplateLoader` described below. Class description: This subclass of TemplateLoader use mimetypes to search and find templates to load. Method signatures and docstrings: - def get_type(self, mime): finds the codename used by relatorio to work on a mimetype - def load(self, path, mime=N...
8d1ec4f2b623f7ca48f38bfda2ac15c01ded35a7
<|skeleton|> class MIMETemplateLoader: """This subclass of TemplateLoader use mimetypes to search and find templates to load.""" def get_type(self, mime): """finds the codename used by relatorio to work on a mimetype""" <|body_0|> def load(self, path, mime=None, relative_to=None, cls=None)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MIMETemplateLoader: """This subclass of TemplateLoader use mimetypes to search and find templates to load.""" def get_type(self, mime): """finds the codename used by relatorio to work on a mimetype""" for func in reversed(self.mime_func): codename = func(mime) if c...
the_stack_v2_python_sparse
lib/python3.8/site-packages/relatorio/reporting.py
Davidoff2103/tryton-training
train
0
21f000f7acfefa0825b51beab94c8f125ac32994
[ "parser = argparse.ArgumentParser(description='momilp instance generator app')\nparser.add_argument('-c', '--configuration', help='sets the path to the configuration json file')\nparser.add_argument('-s', '--solver-package', choices=[SolverPackage.GUROBI.value], help='sets the solver package to use')\nparser.add_ar...
<|body_start_0|> parser = argparse.ArgumentParser(description='momilp instance generator app') parser.add_argument('-c', '--configuration', help='sets the path to the configuration json file') parser.add_argument('-s', '--solver-package', choices=[SolverPackage.GUROBI.value], help='sets the solv...
Implements the command line application for the momilp instance generation
InstanceGeneratorApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceGeneratorApp: """Implements the command line application for the momilp instance generation""" def _parse_args(self): """Parses and returns the arguments""" <|body_0|> def run(self): """Runs the command line application NOTE: Instance generation supports ...
stack_v2_sparse_classes_36k_train_032475
2,101
permissive
[ { "docstring": "Parses and returns the arguments", "name": "_parse_args", "signature": "def _parse_args(self)" }, { "docstring": "Runs the command line application NOTE: Instance generation supports only Gurobi solver currently.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_004123
Implement the Python class `InstanceGeneratorApp` described below. Class description: Implements the command line application for the momilp instance generation Method signatures and docstrings: - def _parse_args(self): Parses and returns the arguments - def run(self): Runs the command line application NOTE: Instance...
Implement the Python class `InstanceGeneratorApp` described below. Class description: Implements the command line application for the momilp instance generation Method signatures and docstrings: - def _parse_args(self): Parses and returns the arguments - def run(self): Runs the command line application NOTE: Instance...
465ea7aaa62157411f9f181b994f4d7e6b8a2e33
<|skeleton|> class InstanceGeneratorApp: """Implements the command line application for the momilp instance generation""" def _parse_args(self): """Parses and returns the arguments""" <|body_0|> def run(self): """Runs the command line application NOTE: Instance generation supports ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstanceGeneratorApp: """Implements the command line application for the momilp instance generation""" def _parse_args(self): """Parses and returns the arguments""" parser = argparse.ArgumentParser(description='momilp instance generator app') parser.add_argument('-c', '--configura...
the_stack_v2_python_sparse
src/instance_generator/executor.py
gokhanceyhan/momilp
train
2
cd492b56420513be826ae2ecc5b739ba9a262bc3
[ "re = cloudparking_service(centerMonitorLogin).mockCarInOut(send_data['carNum'], 0, send_data['inClientID'])\nresult = re\nAssertions().assert_in_text(result, expect['mockCarInMsg'])", "re = CarInOutHandle(centerMonitorLogin).adjustCarNum(send_data['carNum'], send_data['correctCarNum'])\nresult = re\nAssertions()...
<|body_start_0|> re = cloudparking_service(centerMonitorLogin).mockCarInOut(send_data['carNum'], 0, send_data['inClientID']) result = re Assertions().assert_in_text(result, expect['mockCarInMsg']) <|end_body_0|> <|body_start_1|> re = CarInOutHandle(centerMonitorLogin).adjustCarNum(send_...
TestDutyRoomAdjustCarNum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDutyRoomAdjustCarNum: def test_mockCarIn(self, centerMonitorLogin, send_data, expect): """模拟车辆进场""" <|body_0|> def test_dutyRoomAdjustCarNum(self, centerMonitorLogin, send_data, expect): """校正车牌""" <|body_1|> def test_dutyRoomCheckCarIn(self, centerM...
stack_v2_sparse_classes_36k_train_032476
2,059
no_license
[ { "docstring": "模拟车辆进场", "name": "test_mockCarIn", "signature": "def test_mockCarIn(self, centerMonitorLogin, send_data, expect)" }, { "docstring": "校正车牌", "name": "test_dutyRoomAdjustCarNum", "signature": "def test_dutyRoomAdjustCarNum(self, centerMonitorLogin, send_data, expect)" }, ...
4
null
Implement the Python class `TestDutyRoomAdjustCarNum` described below. Class description: Implement the TestDutyRoomAdjustCarNum class. Method signatures and docstrings: - def test_mockCarIn(self, centerMonitorLogin, send_data, expect): 模拟车辆进场 - def test_dutyRoomAdjustCarNum(self, centerMonitorLogin, send_data, expec...
Implement the Python class `TestDutyRoomAdjustCarNum` described below. Class description: Implement the TestDutyRoomAdjustCarNum class. Method signatures and docstrings: - def test_mockCarIn(self, centerMonitorLogin, send_data, expect): 模拟车辆进场 - def test_dutyRoomAdjustCarNum(self, centerMonitorLogin, send_data, expec...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class TestDutyRoomAdjustCarNum: def test_mockCarIn(self, centerMonitorLogin, send_data, expect): """模拟车辆进场""" <|body_0|> def test_dutyRoomAdjustCarNum(self, centerMonitorLogin, send_data, expect): """校正车牌""" <|body_1|> def test_dutyRoomCheckCarIn(self, centerM...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDutyRoomAdjustCarNum: def test_mockCarIn(self, centerMonitorLogin, send_data, expect): """模拟车辆进场""" re = cloudparking_service(centerMonitorLogin).mockCarInOut(send_data['carNum'], 0, send_data['inClientID']) result = re Assertions().assert_in_text(result, expect['mockCarInM...
the_stack_v2_python_sparse
test_suite/centerMonitorRoom/carInOutHandle/test_dutyRoomAdjustCarNum.py
oyebino/pomp_api
train
1
11b033f2ebdcae13a257011d04eed5461f13c4be
[ "connection.use_debug_cursor = True\nself.start = time()\nreturn None", "self.queries = len(connection.queries)\nself.elapsed = time() - self.start\nself.db_time = reduce(add, [float(q['time']) for q in connection.queries]) if connection.queries else 0.0\nself.py_time = self.elapsed - self.db_time\nstats = {'elap...
<|body_start_0|> connection.use_debug_cursor = True self.start = time() return None <|end_body_0|> <|body_start_1|> self.queries = len(connection.queries) self.elapsed = time() - self.start self.db_time = reduce(add, [float(q['time']) for q in connection.queries]) if con...
Middleware de statistiques de performance de la page
PageStatsMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageStatsMiddleware: """Middleware de statistiques de performance de la page""" def process_request(self, request): """Traiter la requête""" <|body_0|> def process_response(self, request, response): """Traiter la réponse""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_032477
6,111
no_license
[ { "docstring": "Traiter la requête", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Traiter la réponse", "name": "process_response", "signature": "def process_response(self, request, response)" } ]
2
null
Implement the Python class `PageStatsMiddleware` described below. Class description: Middleware de statistiques de performance de la page Method signatures and docstrings: - def process_request(self, request): Traiter la requête - def process_response(self, request, response): Traiter la réponse
Implement the Python class `PageStatsMiddleware` described below. Class description: Middleware de statistiques de performance de la page Method signatures and docstrings: - def process_request(self, request): Traiter la requête - def process_response(self, request, response): Traiter la réponse <|skeleton|> class P...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class PageStatsMiddleware: """Middleware de statistiques de performance de la page""" def process_request(self, request): """Traiter la requête""" <|body_0|> def process_response(self, request, response): """Traiter la réponse""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageStatsMiddleware: """Middleware de statistiques de performance de la page""" def process_request(self, request): """Traiter la requête""" connection.use_debug_cursor = True self.start = time() return None def process_response(self, request, response): """Tr...
the_stack_v2_python_sparse
scoop/core/middleware/profiling.py
artscoop/scoop
train
0
18e19da44ef0e582dbc8b515f87ad6baac224937
[ "qs = Q()\nfilter_params = self.get_filter()\nif 'q' in filter_params:\n qs.add(Q(log__contains=filter_params['q']), Q.OR)\n ps.add(Q(params__contains=filter_params['q']), Q.OR)\nreturn Batch.objects.filter(qs).distinct().order_by(self.get_sort())", "serializer.save()\nbatch_id = serializer['id'].value\nif ...
<|body_start_0|> qs = Q() filter_params = self.get_filter() if 'q' in filter_params: qs.add(Q(log__contains=filter_params['q']), Q.OR) ps.add(Q(params__contains=filter_params['q']), Q.OR) return Batch.objects.filter(qs).distinct().order_by(self.get_sort()) <|end_b...
BatchViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchViewSet: def get_queryset(self): """define queryset""" <|body_0|> def perform_create(self, serializer): """save queue""" <|body_1|> <|end_skeleton|> <|body_start_0|> qs = Q() filter_params = self.get_filter() if 'q' in filter_pa...
stack_v2_sparse_classes_36k_train_032478
1,629
no_license
[ { "docstring": "define queryset", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "save queue", "name": "perform_create", "signature": "def perform_create(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_017575
Implement the Python class `BatchViewSet` described below. Class description: Implement the BatchViewSet class. Method signatures and docstrings: - def get_queryset(self): define queryset - def perform_create(self, serializer): save queue
Implement the Python class `BatchViewSet` described below. Class description: Implement the BatchViewSet class. Method signatures and docstrings: - def get_queryset(self): define queryset - def perform_create(self, serializer): save queue <|skeleton|> class BatchViewSet: def get_queryset(self): """defin...
db7b1c75183d8dd9f5e8ee6751b1c44641413c6c
<|skeleton|> class BatchViewSet: def get_queryset(self): """define queryset""" <|body_0|> def perform_create(self, serializer): """save queue""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchViewSet: def get_queryset(self): """define queryset""" qs = Q() filter_params = self.get_filter() if 'q' in filter_params: qs.add(Q(log__contains=filter_params['q']), Q.OR) ps.add(Q(params__contains=filter_params['q']), Q.OR) return Batch.ob...
the_stack_v2_python_sparse
dashboard/tools/api/batches.py
fuxlab/datafrontend
train
0
7cdf23278627b02ade640e880f7d7d53818f3bed
[ "self._fixed_length_left = fixed_length_left\nself._fixed_length_right = fixed_length_right\nself._pad_word_value = pad_word_value\nself._pad_word_mode = pad_word_mode\nself._with_ngram = with_ngram\nself._fixed_ngram_length = fixed_ngram_length\nself._pad_ngram_value = pad_ngram_value\nself._pad_ngram_mode = pad_n...
<|body_start_0|> self._fixed_length_left = fixed_length_left self._fixed_length_right = fixed_length_right self._pad_word_value = pad_word_value self._pad_word_mode = pad_word_mode self._with_ngram = with_ngram self._fixed_ngram_length = fixed_ngram_length self._p...
Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value to fill text. :param pad_word_mode: String, `pre` or `post`: pad either before o...
BasicPadding
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicPadding: """Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value to fill text. :param pad_word_mode: Stri...
stack_v2_sparse_classes_36k_train_032479
10,301
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, fixed_length_left: int=None, fixed_length_right: int=None, pad_word_value: typing.Union[int, str]=0, pad_word_mode: str='pre', with_ngram: bool=False, fixed_ngram_length: int=None, pad_ngram_value: typing.Union[int, str]=0, pad...
2
stack_v2_sparse_classes_30k_test_000087
Implement the Python class `BasicPadding` described below. Class description: Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value t...
Implement the Python class `BasicPadding` described below. Class description: Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value t...
4198ebce942f4afe7ddca6a96ab6f4464ade4518
<|skeleton|> class BasicPadding: """Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value to fill text. :param pad_word_mode: Stri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicPadding: """Pad data for basic preprocessor. :param fixed_length_left: Integer. If set, `text_left` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_word_value: the value to fill text. :param pad_word_mode: String, `pre` or ...
the_stack_v2_python_sparse
poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/callbacks/padding.py
microsoft/ContextualSP
train
332
e359c8709e051819e0c74870248b4176aee02446
[ "self.http_headers = http_headers\nself.request_id = request_id\nself.arguments = arguments\nself.errors = errors\nself.request_processing_time = request_processing_time", "if dictionary is None:\n return None\nhttp_headers = awsecommerceservice.models.http_headers.HTTPHeaders.from_dictionary(dictionary.get('H...
<|body_start_0|> self.http_headers = http_headers self.request_id = request_id self.arguments = arguments self.errors = errors self.request_processing_time = request_processing_time <|end_body_0|> <|body_start_1|> if dictionary is None: return None ht...
Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type description here. errors (Errors): TODO: type description here. request_processing_t...
OperationRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationRequest: """Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type description here. errors (Errors): TODO:...
stack_v2_sparse_classes_36k_train_032480
2,898
permissive
[ { "docstring": "Constructor for the OperationRequest class", "name": "__init__", "signature": "def __init__(self, http_headers=None, request_id=None, arguments=None, errors=None, request_processing_time=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionar...
2
stack_v2_sparse_classes_30k_train_005043
Implement the Python class `OperationRequest` described below. Class description: Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type d...
Implement the Python class `OperationRequest` described below. Class description: Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type d...
26ea1019115a1de3b1b37a4b830525e164ac55ce
<|skeleton|> class OperationRequest: """Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type description here. errors (Errors): TODO:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OperationRequest: """Implementation of the 'OperationRequest' model. TODO: type model description here. Attributes: http_headers (HTTPHeaders): TODO: type description here. request_id (string): TODO: type description here. arguments (Arguments): TODO: type description here. errors (Errors): TODO: type descrip...
the_stack_v2_python_sparse
awsecommerceservice/models/operation_request.py
nidaizamir/Test-PY
train
0
b453a731f1d44a7e4ab25f462a729959e6262f6a
[ "pool = Pool()\namount = 0\ncomputerloan = pool.get('computer.loan')\ncomputer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', employee.salary_code), ('state', '=', 'approve')])\nprint(computer_loan, 'computer_loan')\nif computer_loan:\n for loan in computer_loan:\n mydate = ...
<|body_start_0|> pool = Pool() amount = 0 computerloan = pool.get('computer.loan') computer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', employee.salary_code), ('state', '=', 'approve')]) print(computer_loan, 'computer_loan') if computer_l...
SalaryRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" <|body_0|> def calculate_HBA_Loan(self, payslip, employee, contract): """Calcualte this method for HBA Loan""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_032481
4,077
no_license
[ { "docstring": "Calcualte this method for computer loan", "name": "calculate_COM_Loan", "signature": "def calculate_COM_Loan(self, payslip, employee, contract)" }, { "docstring": "Calcualte this method for HBA Loan", "name": "calculate_HBA_Loan", "signature": "def calculate_HBA_Loan(self...
2
stack_v2_sparse_classes_30k_train_021121
Implement the Python class `SalaryRule` described below. Class description: Implement the SalaryRule class. Method signatures and docstrings: - def calculate_COM_Loan(self, payslip, employee, contract): Calcualte this method for computer loan - def calculate_HBA_Loan(self, payslip, employee, contract): Calcualte this...
Implement the Python class `SalaryRule` described below. Class description: Implement the SalaryRule class. Method signatures and docstrings: - def calculate_COM_Loan(self, payslip, employee, contract): Calcualte this method for computer loan - def calculate_HBA_Loan(self, payslip, employee, contract): Calcualte this...
cd392bf0e80d71c4742568e9c1dd5e5211da56a9
<|skeleton|> class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" <|body_0|> def calculate_HBA_Loan(self, payslip, employee, contract): """Calcualte this method for HBA Loan""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SalaryRule: def calculate_COM_Loan(self, payslip, employee, contract): """Calcualte this method for computer loan""" pool = Pool() amount = 0 computerloan = pool.get('computer.loan') computer_loan = computerloan.search([('employee', '=', employee), ('salary_code', '=', ...
the_stack_v2_python_sparse
src/modules/customised/payroll_test_2/payroll_copy/hr_payroll_loan/hr_payroll_loan.py
kakamble-aiims/work
train
0
e56b1cf13574e362df8cd5785b9816c1507793f6
[ "log_as_info('\\nToggleNoteDirective.run')\nif len(self.arguments) > 0:\n toggle_start = self.arguments[0]\nelse:\n toggle_start = 'expanded'\nif len(self.arguments) > 1:\n extra_title_text = self.arguments[1]\nelse:\n extra_title_text = ''\nself.assert_has_content()\ntext = '\\n'.join(self.content)\nno...
<|body_start_0|> log_as_info('\nToggleNoteDirective.run') if len(self.arguments) > 0: toggle_start = self.arguments[0] else: toggle_start = 'expanded' if len(self.arguments) > 1: extra_title_text = self.arguments[1] else: extra_titl...
Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If extra_title_text is to be provided, the author...
ToggleNoteDirective
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToggleNoteDirective: """Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If...
stack_v2_sparse_classes_36k_train_032482
16,710
permissive
[ { "docstring": "Parses the directive when encountered in a \\\\*.rst file. At the time this method is called, the arguments, options, and content for the directive have been store in initializing the directive object. This method returns a list containing any nodes to be inserted into the Docutils document. For...
2
stack_v2_sparse_classes_30k_train_011649
Implement the Python class `ToggleNoteDirective` described below. Class description: Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument ...
Implement the Python class `ToggleNoteDirective` described below. Class description: Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument ...
46a11295394093de3a23cb8dec1e2e76eac752e8
<|skeleton|> class ToggleNoteDirective: """Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToggleNoteDirective: """Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If extra_title_...
the_stack_v2_python_sparse
src/astutus/sphinx/dyn_pages.py
rich-dobbs-13440/astutus
train
0
c76fba554f512659a11a840dc3882b22a4bd8eef
[ "sizes = list(input.size())\nsizes[0] = total_batch_size\noutput = input.new_zeros(*sizes)\noutput.index_copy_(0, non_pad_indices, input)\nctx.save_for_backward(non_pad_indices)\nreturn output", "non_pad_indices, = ctx.saved_tensors\ngrad_input = output_grads.index_select(0, non_pad_indices)\nreturn (grad_input, ...
<|body_start_0|> sizes = list(input.size()) sizes[0] = total_batch_size output = input.new_zeros(*sizes) output.index_copy_(0, non_pad_indices, input) ctx.save_for_backward(non_pad_indices) return output <|end_body_0|> <|body_start_1|> non_pad_indices, = ctx.save...
This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor
IndexCopy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements ...
stack_v2_sparse_classes_36k_train_032483
45,662
permissive
[ { "docstring": ":param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements after unpadding :param non_pad_indices: bsz * seq_len :param total_batch_size: (int) bsz * seq_len (before unpadding) > bsz :return: In the forward pass we create a new zero tensor and copy the inputs into it based on ...
2
stack_v2_sparse_classes_30k_train_001958
Implement the Python class `IndexCopy` described below. Class description: This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor Method signatures and docstrings: - def forward(ctx, input, non_pad_indices, total_batch_size): :param ctx: :param in...
Implement the Python class `IndexCopy` described below. Class description: This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor Method signatures and docstrings: - def forward(ctx, input, non_pad_indices, total_batch_size): :param ctx: :param in...
5e1e424d0d9c2135a456e372a2ea9ee49de5bd2c
<|skeleton|> class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements after unpaddi...
the_stack_v2_python_sparse
pretrain_module/modeling_deltalm.py
quanpn90/NMTGMinor
train
92
0dc33bcbe4149fa732d77d90a76e1ace8da2540c
[ "n = len(A)\nans = 0\nlast_of = -1\nlast_leader = -1\nfor i in xrange(n):\n if A[i] > R:\n if last_leader != -1:\n ans += i - max(last_of, last_leader) - 1\n last_of = i\n elif A[i] >= L:\n last_leader = i\n ans += i - last_of\nreturn ans", "n = len(A)\nans = 0\nlast_o...
<|body_start_0|> n = len(A) ans = 0 last_of = -1 last_leader = -1 for i in xrange(n): if A[i] > R: if last_leader != -1: ans += i - max(last_of, last_leader) - 1 last_of = i elif A[i] >= L: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayBoundedMaxWA(self, A, L, R): """:type A: List[int] :type L: int :type R: int :rtype: int""" <|body_0|> def numSubarrayBoundedMaxWA2(self, A, L, R): """:type A: List[int] :type L: int :type R: int :rtype: int""" <|body_1|> def num...
stack_v2_sparse_classes_36k_train_032484
3,047
no_license
[ { "docstring": ":type A: List[int] :type L: int :type R: int :rtype: int", "name": "numSubarrayBoundedMaxWA", "signature": "def numSubarrayBoundedMaxWA(self, A, L, R)" }, { "docstring": ":type A: List[int] :type L: int :type R: int :rtype: int", "name": "numSubarrayBoundedMaxWA2", "signa...
3
stack_v2_sparse_classes_30k_train_001967
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMaxWA(self, A, L, R): :type A: List[int] :type L: int :type R: int :rtype: int - def numSubarrayBoundedMaxWA2(self, A, L, R): :type A: List[int] :type L: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMaxWA(self, A, L, R): :type A: List[int] :type L: int :type R: int :rtype: int - def numSubarrayBoundedMaxWA2(self, A, L, R): :type A: List[int] :type L: in...
02ebe56cd92b9f4baeee132c5077892590018650
<|skeleton|> class Solution: def numSubarrayBoundedMaxWA(self, A, L, R): """:type A: List[int] :type L: int :type R: int :rtype: int""" <|body_0|> def numSubarrayBoundedMaxWA2(self, A, L, R): """:type A: List[int] :type L: int :type R: int :rtype: int""" <|body_1|> def num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayBoundedMaxWA(self, A, L, R): """:type A: List[int] :type L: int :type R: int :rtype: int""" n = len(A) ans = 0 last_of = -1 last_leader = -1 for i in xrange(n): if A[i] > R: if last_leader != -1: ...
the_stack_v2_python_sparse
python/leetcode.795.py
CalvinNeo/LeetCode
train
3
e661e1b6676516bd4732d842f6b1c93295cf2fac
[ "if self.from_version:\n if LooseVersion(self.from_version) >= LooseVersion(FROM_VERSION_LAYOUTS_CONTAINER):\n error_message, error_code = Errors.invalid_version_in_layout('fromVersion')\n if self.handle_error(error_message, error_code, file_path=self.file_path):\n return False\nreturn T...
<|body_start_0|> if self.from_version: if LooseVersion(self.from_version) >= LooseVersion(FROM_VERSION_LAYOUTS_CONTAINER): error_message, error_code = Errors.invalid_version_in_layout('fromVersion') if self.handle_error(error_message, error_code, file_path=self.file_p...
LayoutValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayoutValidator: def is_valid_from_version(self) -> bool: """Checks if from version field is valid. Returns: bool. True if from version field is valid, else False.""" <|body_0|> def is_valid_to_version(self) -> bool: """Checks if to version field is valid. Returns: b...
stack_v2_sparse_classes_36k_train_032485
4,349
permissive
[ { "docstring": "Checks if from version field is valid. Returns: bool. True if from version field is valid, else False.", "name": "is_valid_from_version", "signature": "def is_valid_from_version(self) -> bool" }, { "docstring": "Checks if to version field is valid. Returns: bool. True if to versi...
2
stack_v2_sparse_classes_30k_train_020484
Implement the Python class `LayoutValidator` described below. Class description: Implement the LayoutValidator class. Method signatures and docstrings: - def is_valid_from_version(self) -> bool: Checks if from version field is valid. Returns: bool. True if from version field is valid, else False. - def is_valid_to_ve...
Implement the Python class `LayoutValidator` described below. Class description: Implement the LayoutValidator class. Method signatures and docstrings: - def is_valid_from_version(self) -> bool: Checks if from version field is valid. Returns: bool. True if from version field is valid, else False. - def is_valid_to_ve...
a17e868e6fc5153f09e7a329801de85aa60cc752
<|skeleton|> class LayoutValidator: def is_valid_from_version(self) -> bool: """Checks if from version field is valid. Returns: bool. True if from version field is valid, else False.""" <|body_0|> def is_valid_to_version(self) -> bool: """Checks if to version field is valid. Returns: b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayoutValidator: def is_valid_from_version(self) -> bool: """Checks if from version field is valid. Returns: bool. True if from version field is valid, else False.""" if self.from_version: if LooseVersion(self.from_version) >= LooseVersion(FROM_VERSION_LAYOUTS_CONTAINER): ...
the_stack_v2_python_sparse
demisto_sdk/commands/common/hook_validations/layout.py
SukhnandanMalhotra/demisto-sdk
train
0
ef55ad3316a3e1696397337f832decfe66cee82b
[ "self.k_min = k_min\nself.k_max = k_max\nself.s0 = canonical_scale\nself.lvl0 = canonical_level\nself.eps = eps", "s = torch.sqrt(cat([boxlist.area() for boxlist in boxlists]))\ntarget_lvls = torch.floor(self.lvl0 + torch.log2(s / self.s0 + self.eps))\ntarget_lvls = torch.clamp(target_lvls, min=self.k_min, max=se...
<|body_start_0|> self.k_min = k_min self.k_max = k_max self.s0 = canonical_scale self.lvl0 = canonical_level self.eps = eps <|end_body_0|> <|body_start_1|> s = torch.sqrt(cat([boxlist.area() for boxlist in boxlists])) target_lvls = torch.floor(self.lvl0 + torch.l...
Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper.
LevelMapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LevelMapper: """Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper.""" def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06): """Arguments: k_min (int) k_max (int) canonical_scale (int) canonical_lev...
stack_v2_sparse_classes_36k_train_032486
4,534
permissive
[ { "docstring": "Arguments: k_min (int) k_max (int) canonical_scale (int) canonical_level (int) eps (float)", "name": "__init__", "signature": "def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06)" }, { "docstring": "Arguments: boxlists (list[BoxList])", "name":...
2
null
Implement the Python class `LevelMapper` described below. Class description: Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper. Method signatures and docstrings: - def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06): Arguments: k_...
Implement the Python class `LevelMapper` described below. Class description: Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper. Method signatures and docstrings: - def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06): Arguments: k_...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class LevelMapper: """Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper.""" def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06): """Arguments: k_min (int) k_max (int) canonical_scale (int) canonical_lev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LevelMapper: """Determine which FPN level each RoI in a set of RoIs should map to based on the heuristic in the FPN paper.""" def __init__(self, k_min, k_max, canonical_scale=224, canonical_level=4, eps=1e-06): """Arguments: k_min (int) k_max (int) canonical_scale (int) canonical_level (int) eps ...
the_stack_v2_python_sparse
PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/poolers.py
NVIDIA/DeepLearningExamples
train
11,838
7890bd6608237e7cb033978ab263bd06e899f1ba
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('sbrz_nedg', 'sbrz_nedg')\ndb = client.repo\ncollege_coords_collection = db['sbrz_nedg.college_coords']\nhubway_coords_collection = db['sbrz_nedg.hubway']\ncollege_coords = college_coords_collection.find(...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('sbrz_nedg', 'sbrz_nedg') db = client.repo college_coords_collection = db['sbrz_nedg.college_coords'] hubway_coords_collection = db['sbrz_n...
unionCollegesHubway
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unionCollegesHubway: def execute(trial=False): """Retrieve Boston property assessment data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this script...
stack_v2_sparse_classes_36k_train_032487
4,029
no_license
[ { "docstring": "Retrieve Boston property assessment data set.", "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 document describing that invocat...
2
null
Implement the Python class `unionCollegesHubway` described below. Class description: Implement the unionCollegesHubway class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston property assessment data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Creat...
Implement the Python class `unionCollegesHubway` described below. Class description: Implement the unionCollegesHubway class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston property assessment data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Creat...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class unionCollegesHubway: def execute(trial=False): """Retrieve Boston property assessment data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this script...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class unionCollegesHubway: def execute(trial=False): """Retrieve Boston property assessment data set.""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('sbrz_nedg', 'sbrz_nedg') db = client.repo coll...
the_stack_v2_python_sparse
sbrz_nedg/unionCollegesHubway.py
ROODAY/course-2017-fal-proj
train
3
8dc73142435714548eed0166c7a53a590dd575e0
[ "used = set()\n\ndef dfs(room_i):\n used.add(room_i)\n for key in rooms[room_i]:\n if key not in used:\n dfs(key)\nl = len(rooms)\ndfs(0)\ns = sum(used)\nif s == l * (l - 1) // 2:\n return True\nreturn False", "dfs = [0]\nseen = set(dfs)\nwhile dfs:\n i = dfs.pop()\n for j in room...
<|body_start_0|> used = set() def dfs(room_i): used.add(room_i) for key in rooms[room_i]: if key not in used: dfs(key) l = len(rooms) dfs(0) s = sum(used) if s == l * (l - 1) // 2: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canVisitAllRooms(self, rooms): """:type rooms: List[List[int]] :rtype: bool 39 ms""" <|body_0|> def canVisitAllRooms_1(self, rooms): """37ms :param rooms: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> used = set() d...
stack_v2_sparse_classes_36k_train_032488
2,037
no_license
[ { "docstring": ":type rooms: List[List[int]] :rtype: bool 39 ms", "name": "canVisitAllRooms", "signature": "def canVisitAllRooms(self, rooms)" }, { "docstring": "37ms :param rooms: :return:", "name": "canVisitAllRooms_1", "signature": "def canVisitAllRooms_1(self, rooms)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canVisitAllRooms(self, rooms): :type rooms: List[List[int]] :rtype: bool 39 ms - def canVisitAllRooms_1(self, rooms): 37ms :param rooms: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canVisitAllRooms(self, rooms): :type rooms: List[List[int]] :rtype: bool 39 ms - def canVisitAllRooms_1(self, rooms): 37ms :param rooms: :return: <|skeleton|> class Solution...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def canVisitAllRooms(self, rooms): """:type rooms: List[List[int]] :rtype: bool 39 ms""" <|body_0|> def canVisitAllRooms_1(self, rooms): """37ms :param rooms: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canVisitAllRooms(self, rooms): """:type rooms: List[List[int]] :rtype: bool 39 ms""" used = set() def dfs(room_i): used.add(room_i) for key in rooms[room_i]: if key not in used: dfs(key) l = len(rooms) ...
the_stack_v2_python_sparse
KeysAndRooms_MID_841.py
953250587/leetcode-python
train
2
fca2409a7c596de6c5b4471c7e68430660d1ef7f
[ "super(ConvQNet, self).__init__()\ninput_shape = (3, 7, 7)\nconv_output_dim = 16 * 2 * 2\nvect_state_size = vect_state_size\nself.conv_modules = nn.Sequential(nn.Conv2d(channel_dim, 32, kernel_size=5, stride=1, padding=0), nn.ReLU(), nn.MaxPool2d(kernel_size=5), nn.Conv2d(32, 32, kernel_size=2, stride=1, padding=0)...
<|body_start_0|> super(ConvQNet, self).__init__() input_shape = (3, 7, 7) conv_output_dim = 16 * 2 * 2 vect_state_size = vect_state_size self.conv_modules = nn.Sequential(nn.Conv2d(channel_dim, 32, kernel_size=5, stride=1, padding=0), nn.ReLU(), nn.MaxPool2d(kernel_size=5), nn.Co...
ConvQNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvQNet: def __init__(self, channel_dim, action_dim, vect_state_size): """Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :param channel_dim: The number of channel of input. i.e The number of most recent frames stacked toge...
stack_v2_sparse_classes_36k_train_032489
2,457
no_license
[ { "docstring": "Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :param channel_dim: The number of channel of input. i.e The number of most recent frames stacked together. :param action_dim: Number of action-values to output, one-to-one corresponden...
2
stack_v2_sparse_classes_30k_train_011089
Implement the Python class `ConvQNet` described below. Class description: Implement the ConvQNet class. Method signatures and docstrings: - def __init__(self, channel_dim, action_dim, vect_state_size): Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :par...
Implement the Python class `ConvQNet` described below. Class description: Implement the ConvQNet class. Method signatures and docstrings: - def __init__(self, channel_dim, action_dim, vect_state_size): Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :par...
8296c40c004f908d792ea8a496bcd16227ac81c1
<|skeleton|> class ConvQNet: def __init__(self, channel_dim, action_dim, vect_state_size): """Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :param channel_dim: The number of channel of input. i.e The number of most recent frames stacked toge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvQNet: def __init__(self, channel_dim, action_dim, vect_state_size): """Init the Q-Network: Q(s) = r_a. The Q-Net returns the expected reward for all actions at the current time step. :param channel_dim: The number of channel of input. i.e The number of most recent frames stacked together. :param a...
the_stack_v2_python_sparse
src/agents/agent_smith_beta/qnet_conv.py
leorychly/SC2-Game-AI
train
0
268519c40c5ddca2f9bd17416f6b86f28316806a
[ "self.name = name\nself.env = None\nself.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning)\nself.history = []", "assert self.env.prev_obs_data is not None\nassert self.env.obs_data is not None\nreward, termination = self.reward_fn(self.env.prev_obs_data, self.env.obs_dat...
<|body_start_0|> self.name = name self.env = None self.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning) self.history = [] <|end_body_0|> <|body_start_1|> assert self.env.prev_obs_data is not None assert self.env.obs_data is not...
Reward function of the pushing tasks.
PushReward
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" <|body_0|> def get_reward(self): """Returns the reward value of the current step.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_032490
13,137
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, name, task_name, layout_id, is_planning=False)" }, { "docstring": "Returns the reward value of the current step.", "name": "get_reward", "signature": "def get_reward(self)" } ]
2
stack_v2_sparse_classes_30k_train_020271
Implement the Python class `PushReward` described below. Class description: Reward function of the pushing tasks. Method signatures and docstrings: - def __init__(self, name, task_name, layout_id, is_planning=False): Initialize. - def get_reward(self): Returns the reward value of the current step.
Implement the Python class `PushReward` described below. Class description: Reward function of the pushing tasks. Method signatures and docstrings: - def __init__(self, name, task_name, layout_id, is_planning=False): Initialize. - def get_reward(self): Returns the reward value of the current step. <|skeleton|> class...
c333ce7f1d7b156bedf28c3b09793f5487b6690a
<|skeleton|> class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" <|body_0|> def get_reward(self): """Returns the reward value of the current step.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" self.name = name self.env = None self.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning) ...
the_stack_v2_python_sparse
robovat/reward_fns/push_reward.py
UT-Austin-RPL/robovat
train
7
93dfb7f205faacc4290127bb99d058ee0f466153
[ "gst_data = mongoUtils.index('gst')\nreturn_data = []\nfor gst in gst_data:\n return_data.append(dict(_id=gst['_id']))\nreturn (dumps(return_data), 200)", "data = mongoUtils.get('gst', uuid)\nif data:\n return (dumps(data), 200)\nelse:\n return ('Not Found', 404)" ]
<|body_start_0|> gst_data = mongoUtils.index('gst') return_data = [] for gst in gst_data: return_data.append(dict(_id=gst['_id'])) return (dumps(return_data), 200) <|end_body_0|> <|body_start_1|> data = mongoUtils.get('gst', uuid) if data: return ...
GstView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GstView: def index(self): """Returns a list of GST and their details, used by: `katana gst ls`""" <|body_0|> def get(self, uuid): """Returns the details of specific GST, used by: `katana gst inspect [uuid]`""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_032491
1,388
permissive
[ { "docstring": "Returns a list of GST and their details, used by: `katana gst ls`", "name": "index", "signature": "def index(self)" }, { "docstring": "Returns the details of specific GST, used by: `katana gst inspect [uuid]`", "name": "get", "signature": "def get(self, uuid)" } ]
2
stack_v2_sparse_classes_30k_val_000788
Implement the Python class `GstView` described below. Class description: Implement the GstView class. Method signatures and docstrings: - def index(self): Returns a list of GST and their details, used by: `katana gst ls` - def get(self, uuid): Returns the details of specific GST, used by: `katana gst inspect [uuid]`
Implement the Python class `GstView` described below. Class description: Implement the GstView class. Method signatures and docstrings: - def index(self): Returns a list of GST and their details, used by: `katana gst ls` - def get(self, uuid): Returns the details of specific GST, used by: `katana gst inspect [uuid]` ...
2e7a14a41fc85bd7188d71ef9beaf51acc94015c
<|skeleton|> class GstView: def index(self): """Returns a list of GST and their details, used by: `katana gst ls`""" <|body_0|> def get(self, uuid): """Returns the details of specific GST, used by: `katana gst inspect [uuid]`""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GstView: def index(self): """Returns a list of GST and their details, used by: `katana gst ls`""" gst_data = mongoUtils.index('gst') return_data = [] for gst in gst_data: return_data.append(dict(_id=gst['_id'])) return (dumps(return_data), 200) def get(...
the_stack_v2_python_sparse
katana-nbi/katana/api/gst.py
tgogos/katana-slice_manager
train
0
2ee2a923bcc8c4ec179eacb10bea1f2a437c4314
[ "args = image_all.parse_args()\nsize = args['size']\npage = args['page']\ncategory = args['category']\npath = os.path.join(Config.STYLE_DIRECTORY, category)\nif not os.path.exists(path):\n style_ids = []\nelse:\n style_ids = os.listdir(path)\ntotal = len(style_ids)\npages = int(total / size)\npage_style_ids =...
<|body_start_0|> args = image_all.parse_args() size = args['size'] page = args['page'] category = args['category'] path = os.path.join(Config.STYLE_DIRECTORY, category) if not os.path.exists(path): style_ids = [] else: style_ids = os.listdi...
Styles
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Styles: def get(self): """Returns pageable content image""" <|body_0|> def post(self): """Creates an image""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = image_all.parse_args() size = args['size'] page = args['page'] ...
stack_v2_sparse_classes_36k_train_032492
4,352
permissive
[ { "docstring": "Returns pageable content image", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates an image", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_002995
Implement the Python class `Styles` described below. Class description: Implement the Styles class. Method signatures and docstrings: - def get(self): Returns pageable content image - def post(self): Creates an image
Implement the Python class `Styles` described below. Class description: Implement the Styles class. Method signatures and docstrings: - def get(self): Returns pageable content image - def post(self): Creates an image <|skeleton|> class Styles: def get(self): """Returns pageable content image""" ...
f3da89887420b4a3907e15f266442048029d36b4
<|skeleton|> class Styles: def get(self): """Returns pageable content image""" <|body_0|> def post(self): """Creates an image""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Styles: def get(self): """Returns pageable content image""" args = image_all.parse_args() size = args['size'] page = args['page'] category = args['category'] path = os.path.join(Config.STYLE_DIRECTORY, category) if not os.path.exists(path): s...
the_stack_v2_python_sparse
api/styles.py
LuletterSoul/sast_backend
train
0
68a6ada51916da01cfa504b14c7168c4209b108a
[ "s = Selector(response)\njobs = s.css(self.job_selector)\nfor job in jobs:\n joblink = job.xpath('h2/a/@href').extract_first()\n if not joblink:\n continue\n item = JobItem()\n item['url'] = urljoin(self.root, joblink)\n item['title'] = job.xpath('h2/a/@title').extract_first()\n item['text'...
<|body_start_0|> s = Selector(response) jobs = s.css(self.job_selector) for job in jobs: joblink = job.xpath('h2/a/@href').extract_first() if not joblink: continue item = JobItem() item['url'] = urljoin(self.root, joblink) ...
Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.
IndeedSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" <|body_0|> def parse_job(self, response): """Parse a joblink into a JobItem."""...
stack_v2_sparse_classes_36k_train_032493
1,990
no_license
[ { "docstring": "Get the joblinks and hand them off.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse a joblink into a JobItem.", "name": "parse_job", "signature": "def parse_job(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_016381
Implement the Python class `IndeedSpider` described below. Class description: Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads. Method signatures and docstrings: - def parse(self, response): Get the joblinks and hand them off. - def parse_job(self, response): Parse a jobli...
Implement the Python class `IndeedSpider` described below. Class description: Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads. Method signatures and docstrings: - def parse(self, response): Get the joblinks and hand them off. - def parse_job(self, response): Parse a jobli...
f6a8415d4812d7e52760bff5002b14a748f496ca
<|skeleton|> class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" <|body_0|> def parse_job(self, response): """Parse a joblink into a JobItem."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" s = Selector(response) jobs = s.css(self.job_selector) for job in jobs: jobli...
the_stack_v2_python_sparse
remotor/spiders/indeed.py
rongyj/remotor
train
0
9c9b7fd6797f4b3c2983da347ecf42400b01ef90
[ "super().__init__()\nself.beta = beta\nself.threshold_input = threshold_input\nself.threshold_target = threshold_target\nself.reduce_fn = reduce_fn\nself.recall = Recall(threshold_input=None, threshold_target=None, dim=dim, reduce_fn=None)\nself.precision = Precision(threshold_input=None, threshold_target=None, dim...
<|body_start_0|> super().__init__() self.beta = beta self.threshold_input = threshold_input self.threshold_target = threshold_target self.reduce_fn = reduce_fn self.recall = Recall(threshold_input=None, threshold_target=None, dim=dim, reduce_fn=None) self.precisio...
FScore
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FScore: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, beta: float=1.0, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """FScore metric. (micro). >>> 'FScore = 2 * precision * recall / (recall + precision)' :param thresh...
stack_v2_sparse_classes_36k_train_032494
2,150
permissive
[ { "docstring": "FScore metric. (micro). >>> 'FScore = 2 * precision * recall / (recall + precision)' :param threshold_input: The threshold value for binarize input vectors. (default: 0.5) :param threshold_target: The threshold value for binarize target vectors. (default: 0.5) :param beta: The beta fscore parame...
2
stack_v2_sparse_classes_30k_train_005167
Implement the Python class `FScore` described below. Class description: Implement the FScore class. Method signatures and docstrings: - def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, beta: float=1.0, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): FSc...
Implement the Python class `FScore` described below. Class description: Implement the FScore class. Method signatures and docstrings: - def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, beta: float=1.0, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): FSc...
91aa907a3f820e53902578c3d0110fe9a01c88e7
<|skeleton|> class FScore: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, beta: float=1.0, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """FScore metric. (micro). >>> 'FScore = 2 * precision * recall / (recall + precision)' :param thresh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FScore: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, beta: float=1.0, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """FScore metric. (micro). >>> 'FScore = 2 * precision * recall / (recall + precision)' :param threshold_input: The...
the_stack_v2_python_sparse
mlu/metrics/classification/fscore.py
Labbeti/MLU
train
2
8901fcce99cdfd94525b3892d9f5d2948c0e33ca
[ "results_per_page = min(max(results_per_page, 1), 50)\nquery = models.Event.query\nif since_id:\n after = first_or_abort(models.Event.query.filter(models.Event.id == since_id), 409)\n query = query.filter(models.Event.cursor > after.cursor)\nelif max_id:\n before = first_or_abort(models.Event.query.filter(...
<|body_start_0|> results_per_page = min(max(results_per_page, 1), 50) query = models.Event.query if since_id: after = first_or_abort(models.Event.query.filter(models.Event.id == since_id), 409) query = query.filter(models.Event.cursor > after.cursor) elif max_id: ...
Events
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event c...
stack_v2_sparse_classes_36k_train_032495
15,999
no_license
[ { "docstring": "--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event conforms to. - in: query name: since_id type: string format: uuid description: get all events since this e...
2
stack_v2_sparse_classes_30k_train_008150
Implement the Python class `Events` described below. Class description: Implement the Events class. Method signatures and docstrings: - def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): --- description: Retrieve a collection of event types. parameters: - api_version - results_per_p...
Implement the Python class `Events` described below. Class description: Implement the Events class. Method signatures and docstrings: - def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): --- description: Retrieve a collection of event types. parameters: - api_version - results_per_p...
dbba9f3b292ffef6ea924608fa54237171f0aaeb
<|skeleton|> class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event conforms to. - ...
the_stack_v2_python_sparse
apis/event/directorofme_event/resources.py
DirectorOfMe/directorof.me
train
0
07a7f26fcabc5488a5f3907a550fc92af83078ae
[ "with io.open(filename, 'r', encoding='ascii') as file_handle:\n tokens = []\n version = 1\n count = 0\n for count, line in enumerate(file_handle):\n line_tokens = line.split()\n if count == 0:\n if len(line_tokens) > 0 and line_tokens[0] == 'XPARM.XDS':\n version...
<|body_start_0|> with io.open(filename, 'r', encoding='ascii') as file_handle: tokens = [] version = 1 count = 0 for count, line in enumerate(file_handle): line_tokens = line.split() if count == 0: if len(line_to...
A class to read the XPARM.XDS/GXPARM.XDS file used in XDS
reader
[ "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class reader: """A class to read the XPARM.XDS/GXPARM.XDS file used in XDS""" def find_version(filename): """Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the old style version 1 file. If the file starts with XPARM.XD...
stack_v2_sparse_classes_36k_train_032496
11,104
permissive
[ { "docstring": "Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the old style version 1 file. If the file starts with XPARM.XDS it is the new style version 2 file. If the file contains segment definitions then it is a version 3 file. Params:...
5
stack_v2_sparse_classes_30k_train_002932
Implement the Python class `reader` described below. Class description: A class to read the XPARM.XDS/GXPARM.XDS file used in XDS Method signatures and docstrings: - def find_version(filename): Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the o...
Implement the Python class `reader` described below. Class description: A class to read the XPARM.XDS/GXPARM.XDS file used in XDS Method signatures and docstrings: - def find_version(filename): Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the o...
7f4dfb6c873fd560920f697cbfd8a5ff6eed82fa
<|skeleton|> class reader: """A class to read the XPARM.XDS/GXPARM.XDS file used in XDS""" def find_version(filename): """Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the old style version 1 file. If the file starts with XPARM.XD...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class reader: """A class to read the XPARM.XDS/GXPARM.XDS file used in XDS""" def find_version(filename): """Check the version if the given file is a (G)XPARM.XDS file. If the file contains exactly 11 lines and 42 tokens, it is the old style version 1 file. If the file starts with XPARM.XDS it is the n...
the_stack_v2_python_sparse
iotbx/xds/xparm.py
cctbx/cctbx_project
train
206
03552df16e08dcec3d6d64c3af186a7a63215ab1
[ "def helper(left, right):\n if left > right:\n return None\n mid = (left + right) // 2\n root = TreeNode(nums[mid])\n root.left = helper(left, mid - 1)\n root.right = helper(mid + 1, right)\n return root\nreturn helper(0, len(nums) - 1)", "def helper(left, right):\n if left > right:\n ...
<|body_start_0|> def helper(left, right): if left > right: return None mid = (left + right) // 2 root = TreeNode(nums[mid]) root.left = helper(left, mid - 1) root.right = helper(mid + 1, right) return root return hel...
ListToBST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListToBST: def converter_(self, nums: List) -> TreeNode: """In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def converter_2(self, nums: List[int]) -> TreeNode: """In-order traversal with mid element to be always rig...
stack_v2_sparse_classes_36k_train_032497
2,159
no_license
[ { "docstring": "In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:", "name": "converter_", "signature": "def converter_(self, nums: List) -> TreeNode" }, { "docstring": "In-order traversal with mid element to be always right. Time Complexity: O(N) Space Complex...
3
null
Implement the Python class `ListToBST` described below. Class description: Implement the ListToBST class. Method signatures and docstrings: - def converter_(self, nums: List) -> TreeNode: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return: - def converter_2(self, nums: List[int]) -> ...
Implement the Python class `ListToBST` described below. Class description: Implement the ListToBST class. Method signatures and docstrings: - def converter_(self, nums: List) -> TreeNode: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return: - def converter_2(self, nums: List[int]) -> ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ListToBST: def converter_(self, nums: List) -> TreeNode: """In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def converter_2(self, nums: List[int]) -> TreeNode: """In-order traversal with mid element to be always rig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListToBST: def converter_(self, nums: List) -> TreeNode: """In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" def helper(left, right): if left > right: return None mid = (left + right) // 2 root = TreeNo...
the_stack_v2_python_sparse
data_structures/tree_node/sorted_array_to_bst.py
Shiv2157k/leet_code
train
1
1e6d33b3d2b4bdf7607f156c538ec5bca16e5041
[ "content_type = ContentType.objects.get_for_model(obj)\nsql = 'SELECT SUM(amount * %s) FROM %s WHERE target_id = %s AND target_ct_id = %s' % (RATINGS_COEFICIENT, connection.ops.quote_name(Rating._meta.db_table), obj.id, content_type.id)\ncursor = connection.cursor()\ncursor.execute(sql, ())\nresult = cursor.fetchon...
<|body_start_0|> content_type = ContentType.objects.get_for_model(obj) sql = 'SELECT SUM(amount * %s) FROM %s WHERE target_id = %s AND target_ct_id = %s' % (RATINGS_COEFICIENT, connection.ops.quote_name(Rating._meta.db_table), obj.id, content_type.id) cursor = connection.cursor() cursor....
RatingManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RatingManager: def get_for_object(self, obj): """Return the rating for a given object. Params: obj: object to work with""" <|body_0|> def copy_rate_to_agg(self, time_limit, time_format, time_period): """Coppy aggregated Rating to table Agg time_limit: limit for time ...
stack_v2_sparse_classes_36k_train_032498
15,410
no_license
[ { "docstring": "Return the rating for a given object. Params: obj: object to work with", "name": "get_for_object", "signature": "def get_for_object(self, obj)" }, { "docstring": "Coppy aggregated Rating to table Agg time_limit: limit for time of transfering data time_format: format for destiny D...
2
null
Implement the Python class `RatingManager` described below. Class description: Implement the RatingManager class. Method signatures and docstrings: - def get_for_object(self, obj): Return the rating for a given object. Params: obj: object to work with - def copy_rate_to_agg(self, time_limit, time_format, time_period)...
Implement the Python class `RatingManager` described below. Class description: Implement the RatingManager class. Method signatures and docstrings: - def get_for_object(self, obj): Return the rating for a given object. Params: obj: object to work with - def copy_rate_to_agg(self, time_limit, time_format, time_period)...
edcae8ac03816631cf8fbae98b7730479f4c41b6
<|skeleton|> class RatingManager: def get_for_object(self, obj): """Return the rating for a given object. Params: obj: object to work with""" <|body_0|> def copy_rate_to_agg(self, time_limit, time_format, time_period): """Coppy aggregated Rating to table Agg time_limit: limit for time ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RatingManager: def get_for_object(self, obj): """Return the rating for a given object. Params: obj: object to work with""" content_type = ContentType.objects.get_for_model(obj) sql = 'SELECT SUM(amount * %s) FROM %s WHERE target_id = %s AND target_ct_id = %s' % (RATINGS_COEFICIENT, con...
the_stack_v2_python_sparse
ella/ratings/models.py
majerm/ella
train
1
a0375a14808ca2ec406e1aacfc95c2b68d9e19d8
[ "self.seed = 33\nreset(self.seed)\nself.testing = testing\nself.layer = layer\nself.case = case\nself.model_dtype = self.testing.get('model_dtype')\npaddle.set_default_dtype(self.model_dtype)\nself.layer_name = self.layer.get('Layer').get('layer_name')\nself.layer_param = self.layer.get('Layer').get('params')\nself...
<|body_start_0|> self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_default_dtype(self.model_dtype) self.layer_name = self.layer.get('Layer').get('layer_n...
构建Layer训练的通用类
LayerTrain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def dy_train(self): """dygraph train""" <|body_1|> def dy_train_dl(self): """dygraph train with dataloader""" <|body_2|> def dy2st_tra...
stack_v2_sparse_classes_36k_train_032499
6,570
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, testing, case, layer)" }, { "docstring": "dygraph train", "name": "dy_train", "signature": "def dy_train(self)" }, { "docstring": "dygraph train with dataloader", "name": "dy_train_dl", "signature"...
6
stack_v2_sparse_classes_30k_train_005078
Implement the Python class `LayerTrain` described below. Class description: 构建Layer训练的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def dy_train(self): dygraph train - def dy_train_dl(self): dygraph train with dataloader - def dy2st_train(self): dy2st train - def dy2st_train_...
Implement the Python class `LayerTrain` described below. Class description: 构建Layer训练的通用类 Method signatures and docstrings: - def __init__(self, testing, case, layer): 初始化 - def dy_train(self): dygraph train - def dy_train_dl(self): dygraph train with dataloader - def dy2st_train(self): dy2st train - def dy2st_train_...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" <|body_0|> def dy_train(self): """dygraph train""" <|body_1|> def dy_train_dl(self): """dygraph train with dataloader""" <|body_2|> def dy2st_tra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerTrain: """构建Layer训练的通用类""" def __init__(self, testing, case, layer): """初始化""" self.seed = 33 reset(self.seed) self.testing = testing self.layer = layer self.case = case self.model_dtype = self.testing.get('model_dtype') paddle.set_defa...
the_stack_v2_python_sparse
framework/e2e/paddleLT/engine/train.py
PaddlePaddle/PaddleTest
train
42