blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
4919799fe8d39ff040812edc53f90913a320e728
[ "if isinstance(layer, (tf.keras.layers.Conv2DTranspose, tf.keras.layers.DepthwiseConv2D)):\n transposed_tensor = tensor.transpose((2, 3, 0, 1))\nelif isinstance(layer, tf.keras.layers.Conv2D):\n transposed_tensor = tensor.transpose((2, 3, 1, 0))\nelse:\n raise ValueError(\"Only Conv2D or it's subclass is c...
<|body_start_0|> if isinstance(layer, (tf.keras.layers.Conv2DTranspose, tf.keras.layers.DepthwiseConv2D)): transposed_tensor = tensor.transpose((2, 3, 0, 1)) elif isinstance(layer, tf.keras.layers.Conv2D): transposed_tensor = tensor.transpose((2, 3, 1, 0)) else: ...
Utility class to handle weight tensor
WeightTensorUtils
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightTensorUtils: """Utility class to handle weight tensor""" def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray: """Transpose the weight tensor shape from libpymo format to TensorFlow format""" <|body_0|> def transpo...
stack_v2_sparse_classes_10k_train_006800
6,180
permissive
[ { "docstring": "Transpose the weight tensor shape from libpymo format to TensorFlow format", "name": "transpose_from_libpymo_to_tf_format", "signature": "def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray" }, { "docstring": "Transpose the weig...
4
stack_v2_sparse_classes_30k_val_000348
Implement the Python class `WeightTensorUtils` described below. Class description: Utility class to handle weight tensor Method signatures and docstrings: - def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray: Transpose the weight tensor shape from libpymo format to...
Implement the Python class `WeightTensorUtils` described below. Class description: Utility class to handle weight tensor Method signatures and docstrings: - def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray: Transpose the weight tensor shape from libpymo format to...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class WeightTensorUtils: """Utility class to handle weight tensor""" def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray: """Transpose the weight tensor shape from libpymo format to TensorFlow format""" <|body_0|> def transpo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WeightTensorUtils: """Utility class to handle weight tensor""" def transpose_from_libpymo_to_tf_format(tensor: np.ndarray, layer: tf.keras.layers.Layer) -> np.ndarray: """Transpose the weight tensor shape from libpymo format to TensorFlow format""" if isinstance(layer, (tf.keras.layers.Co...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/utils/weight_tensor_utils.py
quic/aimet
train
1,676
2592d9fdce78a4314e2c8cef8c791e4ddee155bc
[ "logger.info('initializing RBF kernel')\nself.d = int(d)\nself.n_rffs = int(n_rffs)\nself.n_features = 2 * n_rffs\nself.dtype = dtype\nself.freq_weights = np.asarray(np.random.normal(size=(self.d, self.n_rffs), loc=0, scale=1.0), dtype=self.dtype)\nself.bf_scale = 1.0 / np.sqrt(self.n_rffs)\nif np.size(log_lengthsc...
<|body_start_0|> logger.info('initializing RBF kernel') self.d = int(d) self.n_rffs = int(n_rffs) self.n_features = 2 * n_rffs self.dtype = dtype self.freq_weights = np.asarray(np.random.normal(size=(self.d, self.n_rffs), loc=0, scale=1.0), dtype=self.dtype) self....
random fourier features for an RBF kernel
RBF_RFF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RBF_RFF: """random fourier features for an RBF kernel""" def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True): """squared exponential kernel Input: d : number of input dims n_rffs : number of random features (will actually used twice this value)""" ...
stack_v2_sparse_classes_10k_train_006801
1,789
no_license
[ { "docstring": "squared exponential kernel Input: d : number of input dims n_rffs : number of random features (will actually used twice this value)", "name": "__init__", "signature": "def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True)" }, { "docstring": "Get t...
2
stack_v2_sparse_classes_30k_train_004196
Implement the Python class `RBF_RFF` described below. Class description: random fourier features for an RBF kernel Method signatures and docstrings: - def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True): squared exponential kernel Input: d : number of input dims n_rffs : number of r...
Implement the Python class `RBF_RFF` described below. Class description: random fourier features for an RBF kernel Method signatures and docstrings: - def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True): squared exponential kernel Input: d : number of input dims n_rffs : number of r...
1bed882b8a94ee58fd0bde6920ee85f81ffb77bb
<|skeleton|> class RBF_RFF: """random fourier features for an RBF kernel""" def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True): """squared exponential kernel Input: d : number of input dims n_rffs : number of random features (will actually used twice this value)""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RBF_RFF: """random fourier features for an RBF kernel""" def __init__(self, d, log_lengthscale=0, n_rffs=1000, dtype=np.float64, tune_len=True): """squared exponential kernel Input: d : number of input dims n_rffs : number of random features (will actually used twice this value)""" logger...
the_stack_v2_python_sparse
gp_grief/kern/rbf_rff.py
scwolof/gp_grief
train
2
592d0bfeb755e797480a1d13cbb17972eeb9b97d
[ "logger.info('Overriding class: JS -> NBJS.')\nsuper(NBJS, self).__init__(params)\nlogger.info('Class overrided.')", "r1 = r.generate_uniform_random_number()\nmotion = self.gamma * r1\nreturn motion" ]
<|body_start_0|> logger.info('Overriding class: JS -> NBJS.') super(NBJS, self).__init__(params) logger.info('Class overrided.') <|end_body_0|> <|body_start_1|> r1 = r.generate_uniform_random_number() motion = self.gamma * r1 return motion <|end_body_1|>
An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.
NBJS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parame...
stack_v2_sparse_classes_10k_train_006802
7,453
permissive
[ { "docstring": "Initialization method. Args: params: Contains key-value parameters to the meta-heuristics.", "name": "__init__", "signature": "def __init__(self, params: Optional[Dict[str, Any]]=None) -> None" }, { "docstring": "Calculates type A motion. Args: lb: Array of lower bounds. ub: Arra...
2
stack_v2_sparse_classes_30k_train_006131
Implement the Python class `NBJS` described below. Class description: An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending. Method signatures and docstrings: - def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: Initi...
Implement the Python class `NBJS` described below. Class description: An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending. Method signatures and docstrings: - def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: Initi...
7326a887ed8e3858bc99c8815048d56d02edf88c
<|skeleton|> class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parame...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parameters to the m...
the_stack_v2_python_sparse
opytimizer/optimizers/swarm/js.py
gugarosa/opytimizer
train
602
d6b0951d56090710b977a15731c4a71573c82f0d
[ "if result is None:\n return {'code': code, 'error': error}\nelse:\n return {'code': code, 'error': error, 'result': result}", "if api_code is None:\n return {'code': code, 'error': error, 'api_response': api_response}\nelse:\n return {'code': code, 'error': error, 'api_code': api_code, 'api_error': a...
<|body_start_0|> if result is None: return {'code': code, 'error': error} else: return {'code': code, 'error': error, 'result': result} <|end_body_0|> <|body_start_1|> if api_code is None: return {'code': code, 'error': error, 'api_response': api_response} ...
HttpResponse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpResponse: def normal(code, error='', result=None): """通用的相应格式""" <|body_0|> def third_party(code, error='', api_code=None, api_error=None, api_response=None): """第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_e...
stack_v2_sparse_classes_10k_train_006803
5,683
no_license
[ { "docstring": "通用的相应格式", "name": "normal", "signature": "def normal(code, error='', result=None)" }, { "docstring": "第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_error: api返回的错误消息 api_response: api返回的原始消息", "name": "third_party", "s...
2
stack_v2_sparse_classes_30k_train_005734
Implement the Python class `HttpResponse` described below. Class description: Implement the HttpResponse class. Method signatures and docstrings: - def normal(code, error='', result=None): 通用的相应格式 - def third_party(code, error='', api_code=None, api_error=None, api_response=None): 第三方API响应格式 Args: code: 0代表正常返回,消息合法。...
Implement the Python class `HttpResponse` described below. Class description: Implement the HttpResponse class. Method signatures and docstrings: - def normal(code, error='', result=None): 通用的相应格式 - def third_party(code, error='', api_code=None, api_error=None, api_response=None): 第三方API响应格式 Args: code: 0代表正常返回,消息合法。...
59df7e469009aca346b292f63cf466fb58caa7d2
<|skeleton|> class HttpResponse: def normal(code, error='', result=None): """通用的相应格式""" <|body_0|> def third_party(code, error='', api_code=None, api_error=None, api_response=None): """第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HttpResponse: def normal(code, error='', result=None): """通用的相应格式""" if result is None: return {'code': code, 'error': error} else: return {'code': code, 'error': error, 'result': result} def third_party(code, error='', api_code=None, api_error=None, api_re...
the_stack_v2_python_sparse
src/app/common/utils/http_util.py
eckoq/gold-digger-server
train
1
db5981bcb87979b8820c2aa6db9e410cf59f8cd3
[ "rating_value = 7\nrating_meaning = 'Indecisive'\nfestival = create_festival('IDFA', '2022-07-17', '2022-07-27')\nfilm = Film(festival_id=festival.id, film_id=-1, seq_nr=-1, title='A Test Movie', duration=timedelta(minutes=666))\nfilm.save()\nfan = me()\nrating = FilmFanFilmRating(film=film, film_fan=fan, rating=ra...
<|body_start_0|> rating_value = 7 rating_meaning = 'Indecisive' festival = create_festival('IDFA', '2022-07-17', '2022-07-27') film = Film(festival_id=festival.id, film_id=-1, seq_nr=-1, title='A Test Movie', duration=timedelta(minutes=666)) film.save() fan = me() ...
RatingModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RatingModelTests: def test_rating_has_correct_meaning(self): """Rating 7 has meaning INDECISIVE.""" <|body_0|> def test_ratings_can_have_same_film_id_but_not_same_festival_id(self): """Two ratings can only have films with identical film_id if festivals are different....
stack_v2_sparse_classes_10k_train_006804
17,658
no_license
[ { "docstring": "Rating 7 has meaning INDECISIVE.", "name": "test_rating_has_correct_meaning", "signature": "def test_rating_has_correct_meaning(self)" }, { "docstring": "Two ratings can only have films with identical film_id if festivals are different.", "name": "test_ratings_can_have_same_f...
2
stack_v2_sparse_classes_30k_train_004935
Implement the Python class `RatingModelTests` described below. Class description: Implement the RatingModelTests class. Method signatures and docstrings: - def test_rating_has_correct_meaning(self): Rating 7 has meaning INDECISIVE. - def test_ratings_can_have_same_film_id_but_not_same_festival_id(self): Two ratings c...
Implement the Python class `RatingModelTests` described below. Class description: Implement the RatingModelTests class. Method signatures and docstrings: - def test_rating_has_correct_meaning(self): Rating 7 has meaning INDECISIVE. - def test_ratings_can_have_same_film_id_but_not_same_festival_id(self): Two ratings c...
4ebc9b43a07bbc627b5e21cae368ae31828d3d2e
<|skeleton|> class RatingModelTests: def test_rating_has_correct_meaning(self): """Rating 7 has meaning INDECISIVE.""" <|body_0|> def test_ratings_can_have_same_film_id_but_not_same_festival_id(self): """Two ratings can only have films with identical film_id if festivals are different....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RatingModelTests: def test_rating_has_correct_meaning(self): """Rating 7 has meaning INDECISIVE.""" rating_value = 7 rating_meaning = 'Indecisive' festival = create_festival('IDFA', '2022-07-17', '2022-07-27') film = Film(festival_id=festival.id, film_id=-1, seq_nr=-1, ...
the_stack_v2_python_sparse
FilmRatings/film_list/tests.py
maar35/film-festival-planner
train
0
cf2c02595365efd00b1628a9c11ab5e178f75920
[ "if getattr(spec, 'project_id', None) and getattr(spec, 'labels', None):\n raise exceptions.ApiValueError(\"Can't set labels to a task inside a project. Tasks inside a project use project's labels.\", ['labels'])\ntask = self.create(spec=spec)\nself._client.logger.info('Created task ID: %s NAME: %s', task.id, ta...
<|body_start_0|> if getattr(spec, 'project_id', None) and getattr(spec, 'labels', None): raise exceptions.ApiValueError("Can't set labels to a task inside a project. Tasks inside a project use project's labels.", ['labels']) task = self.create(spec=spec) self._client.logger.info('Cre...
TasksRepo
[ "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TasksRepo: def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType.LOCAL, data_params: Optional[Dict[str, Any]]=None, annotation_path: str='', annotation_format: str='CVAT XML 1.1', status_check_period: int=None, datase...
stack_v2_sparse_classes_10k_train_006805
14,269
permissive
[ { "docstring": "Create a new task with the given name and labels JSON and add the files to it. Returns: id of the created task", "name": "create_from_data", "signature": "def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType....
3
stack_v2_sparse_classes_30k_train_003381
Implement the Python class `TasksRepo` described below. Class description: Implement the TasksRepo class. Method signatures and docstrings: - def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType.LOCAL, data_params: Optional[Dict[str, Any]...
Implement the Python class `TasksRepo` described below. Class description: Implement the TasksRepo class. Method signatures and docstrings: - def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType.LOCAL, data_params: Optional[Dict[str, Any]...
899c9fd75146744def061efd7ab1b1c6c9f6942f
<|skeleton|> class TasksRepo: def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType.LOCAL, data_params: Optional[Dict[str, Any]]=None, annotation_path: str='', annotation_format: str='CVAT XML 1.1', status_check_period: int=None, datase...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TasksRepo: def create_from_data(self, spec: models.ITaskWriteRequest, resources: Sequence[StrPath], *, resource_type: ResourceType=ResourceType.LOCAL, data_params: Optional[Dict[str, Any]]=None, annotation_path: str='', annotation_format: str='CVAT XML 1.1', status_check_period: int=None, dataset_repository_u...
the_stack_v2_python_sparse
cvat-sdk/cvat_sdk/core/proxies/tasks.py
opencv/cvat
train
6,558
e5cb7e9827d9baa3b5468665610161d64aec31a8
[ "self.model_dir = os.path.join(self.directory, 'webpage')\nself.conf_file = 'slda.conf'\nself.__engine = InferenceEngine(self.model_dir, self.conf_file)\nself.vocab_path = os.path.join(self.model_dir, 'vocab_info.txt')\nlac = hub.Module(name='lac')\nself.__tokenizer = LACTokenizer(self.vocab_path, lac)\nself.vocabu...
<|body_start_0|> self.model_dir = os.path.join(self.directory, 'webpage') self.conf_file = 'slda.conf' self.__engine = InferenceEngine(self.model_dir, self.conf_file) self.vocab_path = os.path.join(self.model_dir, 'vocab_info.txt') lac = hub.Module(name='lac') self.__toke...
TopicModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" <|body_0|> def infer_doc_topic_distribution(self, document): """This interface infers the topic distribution of document. Args: document(str): the input document text. Returns: results(l...
stack_v2_sparse_classes_10k_train_006806
3,571
permissive
[ { "docstring": "Initialize with the necessary elements.", "name": "_initialize", "signature": "def _initialize(self)" }, { "docstring": "This interface infers the topic distribution of document. Args: document(str): the input document text. Returns: results(list): returns the topic distribution ...
3
stack_v2_sparse_classes_30k_train_001131
Implement the Python class `TopicModel` described below. Class description: Implement the TopicModel class. Method signatures and docstrings: - def _initialize(self): Initialize with the necessary elements. - def infer_doc_topic_distribution(self, document): This interface infers the topic distribution of document. A...
Implement the Python class `TopicModel` described below. Class description: Implement the TopicModel class. Method signatures and docstrings: - def _initialize(self): Initialize with the necessary elements. - def infer_doc_topic_distribution(self, document): This interface infers the topic distribution of document. A...
b402610a6f0b382a978e82473b541ea1fc6cf09a
<|skeleton|> class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" <|body_0|> def infer_doc_topic_distribution(self, document): """This interface infers the topic distribution of document. Args: document(str): the input document text. Returns: results(l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TopicModel: def _initialize(self): """Initialize with the necessary elements.""" self.model_dir = os.path.join(self.directory, 'webpage') self.conf_file = 'slda.conf' self.__engine = InferenceEngine(self.model_dir, self.conf_file) self.vocab_path = os.path.join(self.mod...
the_stack_v2_python_sparse
modules/text/language_model/slda_webpage/module.py
PaddlePaddle/PaddleHub
train
12,914
e0de74640c8a2f55e739fb3e847216fc118d0330
[ "r, c = left_filter.shape\nassert left_filter.shape == right_filter.shape\nself.left_filter = left_filter\nself.right_filter = right_filter\nself.left_filter_dft = cv2.dft(left_filter)\nself.right_filter_dft = cv2.dft(right_filter)\nself.image = np.zeros((r, c), dtype=np.float32)\nself.image = np.zeros((r, c), dtyp...
<|body_start_0|> r, c = left_filter.shape assert left_filter.shape == right_filter.shape self.left_filter = left_filter self.right_filter = right_filter self.left_filter_dft = cv2.dft(left_filter) self.right_filter_dft = cv2.dft(right_filter) self.image = np.zeros...
This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only using OpenCV and is much faster than the ASEF class. For details see the paper: David S. ...
OpenCVFilterEyeLocator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenCVFilterEyeLocator: """This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only using OpenCV and is much faster than th...
stack_v2_sparse_classes_10k_train_006807
14,116
permissive
[ { "docstring": "@param left_filter: is in the Fourier domain where the left eye corresponds to the real output and the right eye corresponds to the imaginary output", "name": "__init__", "signature": "def __init__(self, left_filter, right_filter, left_rect, right_rect)" }, { "docstring": "@param...
4
stack_v2_sparse_classes_30k_train_001092
Implement the Python class `OpenCVFilterEyeLocator` described below. Class description: This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only ...
Implement the Python class `OpenCVFilterEyeLocator` described below. Class description: This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only ...
caa4e0254f55c5c8f3464807556b9414ea731293
<|skeleton|> class OpenCVFilterEyeLocator: """This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only using OpenCV and is much faster than th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OpenCVFilterEyeLocator: """This class is used for someone only interested in locating the eyes in an image using correlation filters. This class does not include any support for training correlation filters. For training see ASEF. This class is written only using OpenCV and is much faster than the ASEF class....
the_stack_v2_python_sparse
src/pyvision/face/FilterEyeLocator.py
bolme/pyvision
train
47
df559ebb20da446d3e89da980481ae63899edc62
[ "if n == 3 or n == 2:\n return 2\nelif n == 1:\n return 1\nelse:\n base = 4 * self.lastRemaining_(n / 4)\n if n % 4 == 0 or n % 4 == 1:\n return base - 2\n else:\n return base", "a = p = 1\ncnt = 0\nwhile n > 1:\n n /= 2\n cnt += 1\n p *= 2\n if cnt % 2:\n a += p / ...
<|body_start_0|> if n == 3 or n == 2: return 2 elif n == 1: return 1 else: base = 4 * self.lastRemaining_(n / 4) if n % 4 == 0 or n % 4 == 1: return base - 2 else: return base <|end_body_0|> <|body_start...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastRemaining_(self, n): """:type n: int :rtype: int""" <|body_0|> def lastRemaining(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 3 or n == 2: return 2 elif n == 1: ...
stack_v2_sparse_classes_10k_train_006808
1,529
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "lastRemaining_", "signature": "def lastRemaining_(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "lastRemaining", "signature": "def lastRemaining(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastRemaining_(self, n): :type n: int :rtype: int - def lastRemaining(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 lastRemaining_(self, n): :type n: int :rtype: int - def lastRemaining(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def lastRemaining_(self, n): ...
1520e1e9bb0c428797a3e5234e5b328110472c20
<|skeleton|> class Solution: def lastRemaining_(self, n): """:type n: int :rtype: int""" <|body_0|> def lastRemaining(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lastRemaining_(self, n): """:type n: int :rtype: int""" if n == 3 or n == 2: return 2 elif n == 1: return 1 else: base = 4 * self.lastRemaining_(n / 4) if n % 4 == 0 or n % 4 == 1: return base - 2 ...
the_stack_v2_python_sparse
simulation/390. Elimination Game.py
tinkle1129/Leetcode_Solution
train
0
85945abf96e9e65965011588448b15a8942286ea
[ "self._data_access = data_access\nself._scenario_info = scenario_info\nself.backup_config = server_setup.PathConfig(server_setup.BACKUP_DATA_ROOT_DIR)\nself.server_config = server_setup.PathConfig(server_setup.DATA_ROOT_DIR)", "print('--> Moving scenario input data to backup disk')\nsource = posixpath.join(self.s...
<|body_start_0|> self._data_access = data_access self._scenario_info = scenario_info self.backup_config = server_setup.PathConfig(server_setup.BACKUP_DATA_ROOT_DIR) self.server_config = server_setup.PathConfig(server_setup.DATA_ROOT_DIR) <|end_body_0|> <|body_start_1|> print('--...
Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information.
BackUpDisk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackUpDisk: """Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information.""" def __init__(self, data_access, scenario_info): """Constructor.""" <|b...
stack_v2_sparse_classes_10k_train_006809
4,029
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, data_access, scenario_info)" }, { "docstring": "Moves input data.", "name": "move_input_data", "signature": "def move_input_data(self)" }, { "docstring": "Copies base profile", "name": "copy_b...
5
stack_v2_sparse_classes_30k_train_003709
Implement the Python class `BackUpDisk` described below. Class description: Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `BackUpDisk` described below. Class description: Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information. Method signatures and docstrings: - def __init__(self,...
59f10383eca9f89be6ca606a4eed5bcc9a00a9be
<|skeleton|> class BackUpDisk: """Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information.""" def __init__(self, data_access, scenario_info): """Constructor.""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BackUpDisk: """Back up scenario data to backup disk mounted on server. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario: scenario information.""" def __init__(self, data_access, scenario_info): """Constructor.""" self._data_acces...
the_stack_v2_python_sparse
powersimdata/scenario/move.py
eliasidanimas/PowerSimData
train
0
e0fe56975cc73becdc5b8364b51699dd7c60ce9c
[ "if self.request.user.is_superuser:\n return models.Workflow.objects.all()\nreturn models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct()", "if self.request.user.is_superuser:\n serializer.save()\nelse:\n serializer.save(user=self.request.user)" ]
<|body_start_0|> if self.request.user.is_superuser: return models.Workflow.objects.all() return models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct() <|end_body_0|> <|body_start_1|> if self.request.user.is_superuser: serialize...
Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes
WorkflowAPIListCreate
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" <|body_0|> def perform_create(self, serializer): ...
stack_v2_sparse_classes_10k_train_006810
4,435
permissive
[ { "docstring": "Access the required workflow.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create the new workflow.", "name": "perform_create", "signature": "def perform_create(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_002409
Implement the Python class `WorkflowAPIListCreate` described below. Class description: Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes Method signatures and docstrings: - def get_queryset(self): Access the required workflow. - def perfo...
Implement the Python class `WorkflowAPIListCreate` described below. Class description: Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes Method signatures and docstrings: - def get_queryset(self): Access the required workflow. - def perfo...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" <|body_0|> def perform_create(self, serializer): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" if self.request.user.is_superuser: return models.Workflow....
the_stack_v2_python_sparse
ontask/workflow/api.py
abelardopardo/ontask_b
train
43
fd05645598835592fb1e9c22e8857f6c99964232
[ "self.path = self.__default_filepath if filepath is None else filepath\nself.parser = configparser.ConfigParser()\nif self.__section_default not in self.parser.sections():\n self.parser.add_section(self.__section_default)\nself.parser.read(self.path)", "if self.parser.has_option(section, name):\n return sel...
<|body_start_0|> self.path = self.__default_filepath if filepath is None else filepath self.parser = configparser.ConfigParser() if self.__section_default not in self.parser.sections(): self.parser.add_section(self.__section_default) self.parser.read(self.path) <|end_body_0|>...
A controller class for getting and setting key/value pairs in the config file
Controller
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" <|body_0|> def get(self, name, section=__section_default...
stack_v2_sparse_classes_10k_train_006811
2,040
permissive
[ { "docstring": "Create an instance of a config controller for getting and setting information", "name": "__init__", "signature": "def __init__(self, filepath=None)" }, { "docstring": "Returns a value with a given name from the configuration file.", "name": "get", "signature": "def get(se...
4
stack_v2_sparse_classes_30k_train_002808
Implement the Python class `Controller` described below. Class description: A controller class for getting and setting key/value pairs in the config file Method signatures and docstrings: - def __init__(self, filepath=None): Create an instance of a config controller for getting and setting information - def get(self,...
Implement the Python class `Controller` described below. Class description: A controller class for getting and setting key/value pairs in the config file Method signatures and docstrings: - def __init__(self, filepath=None): Create an instance of a config controller for getting and setting information - def get(self,...
25bc6118427f3b369fb61ba0bd38c977be05644f
<|skeleton|> class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" <|body_0|> def get(self, name, section=__section_default...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" self.path = self.__default_filepath if filepath is None else filepath ...
the_stack_v2_python_sparse
apiwrapper/config/controller.py
OGKevin/ComBunqWebApp
train
31
dcad37a8101e1054ceb0404e5dcec42041a1f2a3
[ "BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)\nself.veh_id = veh_id\nself.v_max = v_max\nself.adaptation = adaptation\nself.h_st = h_st", "this_vel = env.k.vehicle.get_speed(self.veh_id)\nh = env.k.vehicle.get_headway(self.veh_id)\nalpha = 1.689\n...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.v_max = v_max self.adaptation = adaptation self.h_st = h_st <|end_body_0|> <|body_start_1|> this_vel = env.k.vehicle...
Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max velocity (default: 30) adaptation : float adaptation constant (default: 0.65) h...
LinearOVM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearOVM: """Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max velocity (default: 30) adaptation : float ...
stack_v2_sparse_classes_10k_train_006812
17,548
permissive
[ { "docstring": "Instantiate a Linear OVM controller.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params, v_max=30, adaptation=0.65, h_st=5, time_delay=0.0, noise=0, fail_safe=None)" }, { "docstring": "See parent class.", "name": "get_accel", "signature": ...
2
stack_v2_sparse_classes_30k_train_003259
Implement the Python class `LinearOVM` described below. Class description: Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max vel...
Implement the Python class `LinearOVM` described below. Class description: Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max vel...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class LinearOVM: """Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max velocity (default: 30) adaptation : float ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinearOVM: """Linear OVM controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class v_max : float max velocity (default: 30) adaptation : float adaptation co...
the_stack_v2_python_sparse
flow/controllers/car_following_models.py
parthjaggi/flow
train
6
989875b13851df27bc8654709f1cf23c065a5cd3
[ "print('before init')\nsuper().__init__()\nprint('before get')\nresnet = get_visn_arch(arch)(pretrained=pretrained)\nprint('after get')\nfor param in resnet.parameters():\n param.requires_grad = False\nresnet.fc = nn.Identity()\nself.backbone = resnet", "x = self.backbone(img)\nx = x.detach()\nreturn x" ]
<|body_start_0|> print('before init') super().__init__() print('before get') resnet = get_visn_arch(arch)(pretrained=pretrained) print('after get') for param in resnet.parameters(): param.requires_grad = False resnet.fc = nn.Identity() self.bac...
VisnModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" <|body_0|> def forward(self, img): ...
stack_v2_sparse_classes_10k_train_006813
11,557
permissive
[ { "docstring": ":param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model", "name": "__init__", "signature": "def __init__(self, arch='resnet50', pretrained=True)" }, { "docstring": ":para...
2
stack_v2_sparse_classes_30k_train_002241
Implement the Python class `VisnModel` described below. Class description: Implement the VisnModel class. Method signatures and docstrings: - def __init__(self, arch='resnet50', pretrained=True): :param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained v...
Implement the Python class `VisnModel` described below. Class description: Implement the VisnModel class. Method signatures and docstrings: - def __init__(self, arch='resnet50', pretrained=True): :param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained v...
51ac07d1de564c26fbf038b07031a55660bbcb27
<|skeleton|> class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" <|body_0|> def forward(self, img): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" print('before init') super().__init__() p...
the_stack_v2_python_sparse
retrieval_model/vokenization/tmp_extract_vision_keys.py
CJJ2923/Maria
train
0
2d1f12bafaf2f46d5a0e394435f9da2eefa1eaa6
[ "search = data.get('search', None)\noffset = int(data.get('offset', 0))\nlimit = int(data.get('limit', 0))\ntime_from = int(data.get('from', 0))\ntime_until = int(data.get('until', 0))\nstatus = data.get('status', None)\ntitle = data.get('title', None)\ndevice_id = data.get('device_id', None)\nalert_id = data.get('...
<|body_start_0|> search = data.get('search', None) offset = int(data.get('offset', 0)) limit = int(data.get('limit', 0)) time_from = int(data.get('from', 0)) time_until = int(data.get('until', 0)) status = data.get('status', None) title = data.get('title', None) ...
AlertsHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertsHandler: def do_get(self, data): """获取告警""" <|body_0|> def do_put(self, data): """确认告警""" <|body_1|> def do_delete(self, data): """关闭告警""" <|body_2|> <|end_skeleton|> <|body_start_0|> search = data.get('search', None) ...
stack_v2_sparse_classes_10k_train_006814
6,220
no_license
[ { "docstring": "获取告警", "name": "do_get", "signature": "def do_get(self, data)" }, { "docstring": "确认告警", "name": "do_put", "signature": "def do_put(self, data)" }, { "docstring": "关闭告警", "name": "do_delete", "signature": "def do_delete(self, data)" } ]
3
stack_v2_sparse_classes_30k_train_002033
Implement the Python class `AlertsHandler` described below. Class description: Implement the AlertsHandler class. Method signatures and docstrings: - def do_get(self, data): 获取告警 - def do_put(self, data): 确认告警 - def do_delete(self, data): 关闭告警
Implement the Python class `AlertsHandler` described below. Class description: Implement the AlertsHandler class. Method signatures and docstrings: - def do_get(self, data): 获取告警 - def do_put(self, data): 确认告警 - def do_delete(self, data): 关闭告警 <|skeleton|> class AlertsHandler: def do_get(self, data): ""...
94dc54ddbacc0282a6339b06e76ed6bf646bcd2b
<|skeleton|> class AlertsHandler: def do_get(self, data): """获取告警""" <|body_0|> def do_put(self, data): """确认告警""" <|body_1|> def do_delete(self, data): """关闭告警""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlertsHandler: def do_get(self, data): """获取告警""" search = data.get('search', None) offset = int(data.get('offset', 0)) limit = int(data.get('limit', 0)) time_from = int(data.get('from', 0)) time_until = int(data.get('until', 0)) status = data.get('statu...
the_stack_v2_python_sparse
backend/handlers/alerts.py
alabizz/w2s
train
0
f33dd088b2f7f3fe2b3635e3733ea0f8fe2572dd
[ "geo_api = GeoNamesAPI()\nresults = geo_api.search(self.q, max_rows=50)\nreturn JsonResponse({'results': [dict(id=geo_api.uri_from_id(item['geonameId']), text=self.get_label(item), name=item['name'], lat=item['lat'], lng=item['lng']) for item in results]})", "if 'countryName' in item:\n return '%(name)s, %(cou...
<|body_start_0|> geo_api = GeoNamesAPI() results = geo_api.search(self.q, max_rows=50) return JsonResponse({'results': [dict(id=geo_api.uri_from_id(item['geonameId']), text=self.get_label(item), name=item['name'], lat=item['lat'], lng=item['lng']) for item in results]}) <|end_body_0|> <|body_st...
GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.
GeonamesLookup
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" <|body_0|> def get_label(self, item): """Display country name as part of label...
stack_v2_sparse_classes_10k_train_006815
1,477
permissive
[ { "docstring": "Return option list json response.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Display country name as part of label for context.", "name": "get_label", "signature": "def get_label(self, item)" } ]
2
stack_v2_sparse_classes_30k_train_006245
Implement the Python class `GeonamesLookup` described below. Class description: GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return option list json response. - def get_label(self, item): Display country ...
Implement the Python class `GeonamesLookup` described below. Class description: GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return option list json response. - def get_label(self, item): Display country ...
6371bb1266d7751af59aeaa3426ef7ac02a1fe17
<|skeleton|> class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" <|body_0|> def get_label(self, item): """Display country name as part of label...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" geo_api = GeoNamesAPI() results = geo_api.search(self.q, max_rows=50) return JsonRespons...
the_stack_v2_python_sparse
derrida/places/views.py
Princeton-CDH/derrida-django
train
13
f5ea304ad1602160cf832cf52fcc9ad701f3fc09
[ "super(EmBLeafMerge, self).__init__()\nsuper(EmBLeafScenario, self).__init__()\nself.service = GlobalModule.SERVICE_B_LEAF\nself._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]\nself._scenario_name = 'B-LeafMerge'\nself.device_type = 'device'", "xml_elm = etree.fromstring(device_message)\nGlobalModul...
<|body_start_0|> super(EmBLeafMerge, self).__init__() super(EmBLeafScenario, self).__init__() self.service = GlobalModule.SERVICE_B_LEAF self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service] self._scenario_name = 'B-LeafMerge' self.device_type = 'device' <|end...
B-Leaf expansion class (take-over from Leaf expansion scenario)
EmBLeafMerge
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmBLeafMerge: """B-Leaf expansion class (take-over from Leaf expansion scenario)""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """Convert EC message (XML) divided for each device into JSON. Explanation about paramet...
stack_v2_sparse_classes_10k_train_006816
2,172
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Convert EC message (XML) divided for each device into JSON. Explanation about parameter: device_message: Message for each device Explanation about return value device_json_message: JSON message...
2
stack_v2_sparse_classes_30k_train_005673
Implement the Python class `EmBLeafMerge` described below. Class description: B-Leaf expansion class (take-over from Leaf expansion scenario) Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): Convert EC message (XML) divided for each device into JSON. Expl...
Implement the Python class `EmBLeafMerge` described below. Class description: B-Leaf expansion class (take-over from Leaf expansion scenario) Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): Convert EC message (XML) divided for each device into JSON. Expl...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class EmBLeafMerge: """B-Leaf expansion class (take-over from Leaf expansion scenario)""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """Convert EC message (XML) divided for each device into JSON. Explanation about paramet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EmBLeafMerge: """B-Leaf expansion class (take-over from Leaf expansion scenario)""" def __init__(self): """Constructor""" super(EmBLeafMerge, self).__init__() super(EmBLeafScenario, self).__init__() self.service = GlobalModule.SERVICE_B_LEAF self._xml_ns = '{%s}' %...
the_stack_v2_python_sparse
lib/Scenario/EmBLeafMerge.py
lixiaochun/element-manager
train
0
e1f4be9e5cd9c0f2196045d9eae82e270c395ef3
[ "opening, count = (0, 0)\nfor ch in S:\n if ch == '(':\n opening += 1\n elif opening > 0:\n opening -= 1\n else:\n count += 1\nreturn count + opening", "dq = collections.deque()\nl = []\nstackEmpty = True\nfor ch in S:\n if ch == ')':\n if len(dq) == 0:\n l.appen...
<|body_start_0|> opening, count = (0, 0) for ch in S: if ch == '(': opening += 1 elif opening > 0: opening -= 1 else: count += 1 return count + opening <|end_body_0|> <|body_start_1|> dq = collections.de...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" <|body_0|> def minAddToMakeValid2(self, S): """:type S: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> opening, count = (0, 0) for ch in S: ...
stack_v2_sparse_classes_10k_train_006817
1,042
no_license
[ { "docstring": ":type S: str :rtype: int", "name": "minAddToMakeValid", "signature": "def minAddToMakeValid(self, S)" }, { "docstring": ":type S: str :rtype: int", "name": "minAddToMakeValid2", "signature": "def minAddToMakeValid2(self, S)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAddToMakeValid(self, S): :type S: str :rtype: int - def minAddToMakeValid2(self, S): :type S: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAddToMakeValid(self, S): :type S: str :rtype: int - def minAddToMakeValid2(self, S): :type S: str :rtype: int <|skeleton|> class Solution: def minAddToMakeValid(self...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" <|body_0|> def minAddToMakeValid2(self, S): """:type S: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" opening, count = (0, 0) for ch in S: if ch == '(': opening += 1 elif opening > 0: opening -= 1 else: count += 1 return co...
the_stack_v2_python_sparse
11. STRING MANIP/921_Minimum Add to Make Parentheses Valid/solution.py
kimmyoo/python_leetcode
train
1
9bc991fe583a01460701d2176a8083bcf2b5f7ab
[ "left = 0\nright = len(nums)\nwhile left < right:\n mid = (left + right) // 2\n if mid - 1 < 0:\n l_value = -2 ** 31\n else:\n l_value = nums[mid - 1]\n if mid + 1 >= len(nums):\n r_value = -2 ** 31\n else:\n r_value = nums[mid + 1]\n if nums[mid] > l_value and nums[mid...
<|body_start_0|> left = 0 right = len(nums) while left < right: mid = (left + right) // 2 if mid - 1 < 0: l_value = -2 ** 31 else: l_value = nums[mid - 1] if mid + 1 >= len(nums): r_value = -2 ** 31 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findPeakElement(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_10k_train_006818
5,191
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement_myself", "signature": "def findPeakElement_myself(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement_v2", "signature": "def findPeakElement_v2(self, nums)" }, { ...
3
stack_v2_sparse_classes_30k_val_000358
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement_myself(self, nums): :type nums: List[int] :rtype: int - def findPeakElement_v2(self, nums): :type nums: List[int] :rtype: int - def findPeakElement(self, nums...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement_myself(self, nums): :type nums: List[int] :rtype: int - def findPeakElement_v2(self, nums): :type nums: List[int] :rtype: int - def findPeakElement(self, nums...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findPeakElement(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findPeakElement_myself(self, nums): """:type nums: List[int] :rtype: int""" left = 0 right = len(nums) while left < right: mid = (left + right) // 2 if mid - 1 < 0: l_value = -2 ** 31 else: l_valu...
the_stack_v2_python_sparse
findPeakElement.py
shivangi-prog/leetcode
train
0
777f59068da91a2689ace0b31b53a77b956cd0ca
[ "password1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif password1 and password2 and (password1 != password2):\n raise forms.ValidationError('Passwords do not match')\nreturn password2", "user = super(UserCreationForm, self).save(commit=False)\nuser.set_password(self....
<|body_start_0|> password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if password1 and password2 and (password1 != password2): raise forms.ValidationError('Passwords do not match') return password2 <|end_body_0|> <|body_start_1|> ...
A form for creating new users with a password confirmation field.
UserCreationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" <|body_0|> def save(self, commit=True): """Save...
stack_v2_sparse_classes_10k_train_006819
4,010
no_license
[ { "docstring": "Checks that both of the passwords match :return: String - Password or Boolean False otherwise", "name": "clean_password", "signature": "def clean_password(self)" }, { "docstring": "Save data, mostly the password, in a hashed form :param commit: Whether or not to commit the change...
2
stack_v2_sparse_classes_30k_train_003151
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users with a password confirmation field. Method signatures and docstrings: - def clean_password(self): Checks that both of the passwords match :return: String - Password or Boolean False otherwise - def save(sel...
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users with a password confirmation field. Method signatures and docstrings: - def clean_password(self): Checks that both of the passwords match :return: String - Password or Boolean False otherwise - def save(sel...
167a39307fe3d978d3eee4b3fcd53c27143f5924
<|skeleton|> class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" <|body_0|> def save(self, commit=True): """Save...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" password1 = self.cleaned_data.get('password1') password2 = self.c...
the_stack_v2_python_sparse
summit/libs/auth/admin.py
NAU-CCL/cpcesu-summit
train
0
3823ba7e4e5dd3cebbb0c86c4be674cfdbd4cc70
[ "if location is None:\n self.location = [0, 0]\nelse:\n self.location = double_gis_util.validate_location(location)\nself.radius = int(radius)\nself.popup = popup.replace(\"'\", '^') if isinstance(popup, str) else popup\nself.tooltip = tooltip.replace(\"'\", '^') if isinstance(tooltip, str) else tooltip\nself...
<|body_start_0|> if location is None: self.location = [0, 0] else: self.location = double_gis_util.validate_location(location) self.radius = int(radius) self.popup = popup.replace("'", '^') if isinstance(popup, str) else popup self.tooltip = tooltip.replac...
Circle marker.
iq2GISCircleMarker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iq2GISCircleMarker: """Circle marker.""" def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): """Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :par...
stack_v2_sparse_classes_10k_train_006820
2,846
no_license
[ { "docstring": "Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :param fill: Fill the inner area of the circle? :param fill_color: The fill color of the circle. :param popup: Marker pop-up text. A tooltip appears by clicking on the marker. :para...
3
stack_v2_sparse_classes_30k_train_004129
Implement the Python class `iq2GISCircleMarker` described below. Class description: Circle marker. Method signatures and docstrings: - def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): Constructor. :param location: Marker geolocation. :param radiu...
Implement the Python class `iq2GISCircleMarker` described below. Class description: Circle marker. Method signatures and docstrings: - def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): Constructor. :param location: Marker geolocation. :param radiu...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iq2GISCircleMarker: """Circle marker.""" def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): """Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :par...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class iq2GISCircleMarker: """Circle marker.""" def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): """Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :param fill: Fill...
the_stack_v2_python_sparse
iq/components/doublegis_indicator_manager/circle_marker.py
XHermitOne/iq_framework
train
1
6b3264ea2fa1f419a4a2667f54cd1af1a5707c20
[ "current_app.logger.debug('Create chat message from DTO')\nnew_message = cls()\nnew_message.project_id = dto.project_id\nnew_message.user_id = dto.user_id\nallowed_tags = ['a', 'b', 'blockquote', 'br', 'code', 'em', 'h1', 'h2', 'h3', 'img', 'i', 'li', 'ol', 'p', 'pre', 'strong', 'ul']\nallowed_atrributes = {'a': ['...
<|body_start_0|> current_app.logger.debug('Create chat message from DTO') new_message = cls() new_message.project_id = dto.project_id new_message.user_id = dto.user_id allowed_tags = ['a', 'b', 'blockquote', 'br', 'code', 'em', 'h1', 'h2', 'h3', 'img', 'i', 'li', 'ol', 'p', 'pre'...
Contains all project info localized into supported languages
ProjectChat
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectChat: """Contains all project info localized into supported languages""" def create_from_dto(cls, dto: ChatMessageDTO): """Creates a new ProjectInfo class from dto, used from project edit""" <|body_0|> def get_messages(project_id: int, page: int, per_page: int=20)...
stack_v2_sparse_classes_10k_train_006821
2,959
permissive
[ { "docstring": "Creates a new ProjectInfo class from dto, used from project edit", "name": "create_from_dto", "signature": "def create_from_dto(cls, dto: ChatMessageDTO)" }, { "docstring": "Get all messages on the project", "name": "get_messages", "signature": "def get_messages(project_i...
2
stack_v2_sparse_classes_30k_train_002636
Implement the Python class `ProjectChat` described below. Class description: Contains all project info localized into supported languages Method signatures and docstrings: - def create_from_dto(cls, dto: ChatMessageDTO): Creates a new ProjectInfo class from dto, used from project edit - def get_messages(project_id: i...
Implement the Python class `ProjectChat` described below. Class description: Contains all project info localized into supported languages Method signatures and docstrings: - def create_from_dto(cls, dto: ChatMessageDTO): Creates a new ProjectInfo class from dto, used from project edit - def get_messages(project_id: i...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class ProjectChat: """Contains all project info localized into supported languages""" def create_from_dto(cls, dto: ChatMessageDTO): """Creates a new ProjectInfo class from dto, used from project edit""" <|body_0|> def get_messages(project_id: int, page: int, per_page: int=20)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectChat: """Contains all project info localized into supported languages""" def create_from_dto(cls, dto: ChatMessageDTO): """Creates a new ProjectInfo class from dto, used from project edit""" current_app.logger.debug('Create chat message from DTO') new_message = cls() ...
the_stack_v2_python_sparse
backend/models/postgis/project_chat.py
hotosm/tasking-manager
train
526
8cf24450fcb25e40dcbb6a833c45cccde901a6ee
[ "if not s or k == 0:\n return 0\nmaxheap = []\ninwindow = {}\nj, maxlen = (0, 1)\nfor i in xrange(len(s)):\n ch = s[i]\n if len(inwindow) == k and ch not in inwindow:\n idx, first = heapq.heappop(maxheap)\n del inwindow[first]\n j = idx + 1\n if ch in inwindow:\n for idx in x...
<|body_start_0|> if not s or k == 0: return 0 maxheap = [] inwindow = {} j, maxlen = (0, 1) for i in xrange(len(s)): ch = s[i] if len(inwindow) == k and ch not in inwindow: idx, first = heapq.heappop(maxheap) del...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def followup(self, s, k): """the question follow up is data char, only can read one char""" <|body_0|> def lengthOfLongestSubstringKDistinct(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_006822
1,759
permissive
[ { "docstring": "the question follow up is data char, only can read one char", "name": "followup", "signature": "def followup(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "lengthOfLongestSubstringKDistinct", "signature": "def lengthOfLongestSubstringKDis...
2
stack_v2_sparse_classes_30k_train_004965
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def followup(self, s, k): the question follow up is data char, only can read one char - def lengthOfLongestSubstringKDistinct(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def followup(self, s, k): the question follow up is data char, only can read one char - def lengthOfLongestSubstringKDistinct(self, s, k): :type s: str :type k: int :rtype: int ...
86f1cb98de801f58c39d9a48ce9de12df7303d20
<|skeleton|> class Solution: def followup(self, s, k): """the question follow up is data char, only can read one char""" <|body_0|> def lengthOfLongestSubstringKDistinct(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def followup(self, s, k): """the question follow up is data char, only can read one char""" if not s or k == 0: return 0 maxheap = [] inwindow = {} j, maxlen = (0, 1) for i in xrange(len(s)): ch = s[i] if len(inwindo...
the_stack_v2_python_sparse
340-Longest-Substring-with-At-Most-K-Distinct-Characters/solution.py
Tanych/CodeTracking
train
0
79bbafce1f0cc501924a33fd47d599bfc9859d0f
[ "self.id = id\nself.server_relativeurl = server_relativeurl\nself.title = title\nself.url = url\nself.webid = webid", "if dictionary is None:\n return None\nid = dictionary.get('id')\nserver_relativeurl = dictionary.get('serverRelativeurl')\ntitle = dictionary.get('title')\nurl = dictionary.get('url')\nwebid =...
<|body_start_0|> self.id = id self.server_relativeurl = server_relativeurl self.title = title self.url = url self.webid = webid <|end_body_0|> <|body_start_1|> if dictionary is None: return None id = dictionary.get('id') server_relativeurl = d...
Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue identifier that can be used to compare sites. server_relativeurl (string): Opt...
SiteIdentity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiteIdentity: """Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue identifier that can be used to compare...
stack_v2_sparse_classes_10k_train_006823
2,543
permissive
[ { "docstring": "Constructor for the SiteIdentity class", "name": "__init__", "signature": "def __init__(self, id=None, server_relativeurl=None, title=None, url=None, webid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary re...
2
null
Implement the Python class `SiteIdentity` described below. Class description: Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue...
Implement the Python class `SiteIdentity` described below. Class description: Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SiteIdentity: """Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue identifier that can be used to compare...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SiteIdentity: """Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue identifier that can be used to compare sites. serve...
the_stack_v2_python_sparse
cohesity_management_sdk/models/site_identity.py
cohesity/management-sdk-python
train
24
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_10k_train_006824
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_005386
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_10k
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
6de916fb17caf7136b22033461b2ececfa2bfcdf
[ "if key == 'is_verified' and value is False and (self.is_primary is True):\n raise PrimaryElementViolation(\"Can't remove verified status of primary element\")\nsuper().__setattr__(key, value)", "data = super()._from_dict_transform(data)\nif 'primary' in data:\n data['is_primary'] = data.pop('primary')\nret...
<|body_start_0|> if key == 'is_verified' and value is False and (self.is_primary is True): raise PrimaryElementViolation("Can't remove verified status of primary element") super().__setattr__(key, value) <|end_body_0|> <|body_start_1|> data = super()._from_dict_transform(data) ...
Elements that can be either primary or not.
PrimaryElement
[ "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrimaryElement: """Elements that can be either primary or not.""" def __setattr__(self, key: str, value: Any): """raise PrimaryElementViolation when trying to set a primary element as unverified""" <|body_0|> def _from_dict_transform(cls: Type[TPrimaryElementSubclass], d...
stack_v2_sparse_classes_10k_train_006825
18,109
permissive
[ { "docstring": "raise PrimaryElementViolation when trying to set a primary element as unverified", "name": "__setattr__", "signature": "def __setattr__(self, key: str, value: Any)" }, { "docstring": "Transform data received in eduid format into pythonic format.", "name": "_from_dict_transfor...
3
stack_v2_sparse_classes_30k_train_003173
Implement the Python class `PrimaryElement` described below. Class description: Elements that can be either primary or not. Method signatures and docstrings: - def __setattr__(self, key: str, value: Any): raise PrimaryElementViolation when trying to set a primary element as unverified - def _from_dict_transform(cls: ...
Implement the Python class `PrimaryElement` described below. Class description: Elements that can be either primary or not. Method signatures and docstrings: - def __setattr__(self, key: str, value: Any): raise PrimaryElementViolation when trying to set a primary element as unverified - def _from_dict_transform(cls: ...
5970880caf0b0e2bdee6c23869ef287acc87af2a
<|skeleton|> class PrimaryElement: """Elements that can be either primary or not.""" def __setattr__(self, key: str, value: Any): """raise PrimaryElementViolation when trying to set a primary element as unverified""" <|body_0|> def _from_dict_transform(cls: Type[TPrimaryElementSubclass], d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrimaryElement: """Elements that can be either primary or not.""" def __setattr__(self, key: str, value: Any): """raise PrimaryElementViolation when trying to set a primary element as unverified""" if key == 'is_verified' and value is False and (self.is_primary is True): raise...
the_stack_v2_python_sparse
src/eduid_userdb/element.py
SUNET/eduid-userdb
train
0
c34a9956a5c34457a5a84eb44044219751221ea4
[ "graph_def = sess.graph_def\ntoco_flags = toco_flags_pb2.TocoFlags()\ntoco_flags.input_format = toco_flags_pb2.TENSORFLOW_GRAPHDEF\ntoco_flags.output_format = toco_flags_pb2.TFLITE\ntoco_flags.inference_input_type = types_pb2.FLOAT\ntoco_flags.inference_type = types_pb2.FLOAT\ntoco_flags.allow_custom_ops = True\nmo...
<|body_start_0|> graph_def = sess.graph_def toco_flags = toco_flags_pb2.TocoFlags() toco_flags.input_format = toco_flags_pb2.TENSORFLOW_GRAPHDEF toco_flags.output_format = toco_flags_pb2.TFLITE toco_flags.inference_input_type = types_pb2.FLOAT toco_flags.inference_type = ...
TocoFromProtosTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as o...
stack_v2_sparse_classes_10k_train_006826
3,767
permissive
[ { "docstring": "Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as output. should_succeed: Whether this is a valid conversion.", "name": "_run", "signat...
2
null
Implement the Python class `TocoFromProtosTest` described below. Class description: Implement the TocoFromProtosTest class. Method signatures and docstrings: - def _run(self, sess, in_tensor, out_tensor, should_succeed): Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow sessio...
Implement the Python class `TocoFromProtosTest` described below. Class description: Implement the TocoFromProtosTest class. Method signatures and docstrings: - def _run(self, sess, in_tensor, out_tensor, should_succeed): Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow sessio...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TocoFromProtosTest: def _run(self, sess, in_tensor, out_tensor, should_succeed): """Use toco binary to check conversion from graphdef to tflite. Args: sess: Active TensorFlow session containing graph. in_tensor: TensorFlow tensor to use as input. out_tensor: TensorFlow tensor to use as output. should_...
the_stack_v2_python_sparse
tensorflow/lite/toco/python/toco_from_protos_test.py
tensorflow/tensorflow
train
208,740
9f114b834ef9b9bc326e68b4d85caa4296b60cdb
[ "dims = (wrapper.num_people, wrapper.num_people, wrapper.num_samples)\nsuper().__init__(wrapper, dims)\nself.embedder = embedder\nself.transformer = transformer", "style_pid, source_pid, source_sid = coords_from_index(index, self.dims)\nsource_audio = self.wrapper.mel_from_ids(source_pid, source_sid)[None, :]\nst...
<|body_start_0|> dims = (wrapper.num_people, wrapper.num_people, wrapper.num_samples) super().__init__(wrapper, dims) self.embedder = embedder self.transformer = transformer <|end_body_0|> <|body_start_1|> style_pid, source_pid, source_sid = coords_from_index(index, self.dims) ...
A class for training the isvoice discriminator with negative (generated) examples
Isvoice_Dataset_Fake
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" ...
stack_v2_sparse_classes_10k_train_006827
12,382
no_license
[ { "docstring": "There are (people * samples) original \"real\" files, and (people) possible transformations of each of files.", "name": "__init__", "signature": "def __init__(self, wrapper, embedder, transformer)" }, { "docstring": "# TODO Work on some sort of caching if there are speed/memory i...
2
stack_v2_sparse_classes_30k_train_001051
Implement the Python class `Isvoice_Dataset_Fake` described below. Class description: A class for training the isvoice discriminator with negative (generated) examples Method signatures and docstrings: - def __init__(self, wrapper, embedder, transformer): There are (people * samples) original "real" files, and (peopl...
Implement the Python class `Isvoice_Dataset_Fake` described below. Class description: A class for training the isvoice discriminator with negative (generated) examples Method signatures and docstrings: - def __init__(self, wrapper, embedder, transformer): There are (people * samples) original "real" files, and (peopl...
ceb1b9580f515df744f7c7bfb94e6a2ae6a18c87
<|skeleton|> class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" dims = (wrapp...
the_stack_v2_python_sparse
vocal-mimicry/dataset.py
anlsh/cs4803
train
0
0950c0a24497879c17bc72802b627d0fffe2d15e
[ "if n < 2:\n return 1\ndp = [0] * (n + 1)\ndp[0], dp[1] = (1, 1)\nfor i in range(2, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]", "if n < 2:\n return n\na, b, sum = (1, 1, 0)\nfor _ in range(2, n + 1):\n sum = a + b\n a = b\n b = sum\nreturn sum" ]
<|body_start_0|> if n < 2: return 1 dp = [0] * (n + 1) dp[0], dp[1] = (1, 1) for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] <|end_body_0|> <|body_start_1|> if n < 2: return n a, b, sum = (1, 1, 0) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" <|body_0|> def climbStairs1(self, n: int) -> int: """空间复杂度:O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: return 1 dp = [0] ...
stack_v2_sparse_classes_10k_train_006828
1,471
permissive
[ { "docstring": "递归方程:f(n) = f(n-1) + f(n-2),n >= 2", "name": "climbStairs", "signature": "def climbStairs(self, n: int) -> int" }, { "docstring": "空间复杂度:O(1)", "name": "climbStairs1", "signature": "def climbStairs1(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 递归方程:f(n) = f(n-1) + f(n-2),n >= 2 - def climbStairs1(self, n: int) -> int: 空间复杂度:O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 递归方程:f(n) = f(n-1) + f(n-2),n >= 2 - def climbStairs1(self, n: int) -> int: 空间复杂度:O(1) <|skeleton|> class Solution: def climbStairs(se...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" <|body_0|> def climbStairs1(self, n: int) -> int: """空间复杂度:O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" if n < 2: return 1 dp = [0] * (n + 1) dp[0], dp[1] = (1, 1) for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] def climbStairs...
the_stack_v2_python_sparse
70-climbing-stairs.py
yuenliou/leetcode
train
0
580714254fe1d9f3d61703dd554aa4920926446f
[ "self.text_field_key = text_field_key\nself.data = data\nself.cv = None\nself.ngrams_df = pd.DataFrame(['blank'], columns=['Index'])\nself.filtered_ngrams_df = pd.DataFrame(['blank'], columns=['Index'])\nself.ngram_word = None\nself.word_frequency_matrix = pd.DataFrame(['blank'], columns=['Index'])", "if preproce...
<|body_start_0|> self.text_field_key = text_field_key self.data = data self.cv = None self.ngrams_df = pd.DataFrame(['blank'], columns=['Index']) self.filtered_ngrams_df = pd.DataFrame(['blank'], columns=['Index']) self.ngram_word = None self.word_frequency_matrix...
The parent class for managing n-gram analysis
NGrams
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NGrams: """The parent class for managing n-gram analysis""" def __init__(self, data, text_field_key='Snippet'): """:param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name of the text field (by default Snippet)""" <|body...
stack_v2_sparse_classes_10k_train_006829
4,267
permissive
[ { "docstring": ":param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name of the text field (by default Snippet)", "name": "__init__", "signature": "def __init__(self, data, text_field_key='Snippet')" }, { "docstring": "The primary function ...
3
stack_v2_sparse_classes_30k_train_005984
Implement the Python class `NGrams` described below. Class description: The parent class for managing n-gram analysis Method signatures and docstrings: - def __init__(self, data, text_field_key='Snippet'): :param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name...
Implement the Python class `NGrams` described below. Class description: The parent class for managing n-gram analysis Method signatures and docstrings: - def __init__(self, data, text_field_key='Snippet'): :param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name...
b810c6e1a93a2ecaa9d6351449239d0a1833f971
<|skeleton|> class NGrams: """The parent class for managing n-gram analysis""" def __init__(self, data, text_field_key='Snippet'): """:param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name of the text field (by default Snippet)""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NGrams: """The parent class for managing n-gram analysis""" def __init__(self, data, text_field_key='Snippet'): """:param data: Pandas dataframe containing a text Snippet field and other metadata :param text_field_key: The name of the text field (by default Snippet)""" self.text_field_key...
the_stack_v2_python_sparse
usherwood_ds/nlp/n_grams/main.py
Usherwood/usherwood_ds
train
2
5aba69e32bace2512f6077f56d4679e82f7c1586
[ "self.mailbox_vec = mailbox_vec\nself.pst_params = pst_params\nself.skip_mbx_permit_for_pst = skip_mbx_permit_for_pst\nself.target_folder_path = target_folder_path\nself.target_mailbox = target_mailbox", "if dictionary is None:\n return None\nmailbox_vec = None\nif dictionary.get('mailboxVec') != None:\n ma...
<|body_start_0|> self.mailbox_vec = mailbox_vec self.pst_params = pst_params self.skip_mbx_permit_for_pst = skip_mbx_permit_for_pst self.target_folder_path = target_folder_path self.target_mailbox = target_mailbox <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mailbox recovery. pst_params (EwsToPstConversionPar...
RestoreOutlookParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreOutlookParams: """Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mai...
stack_v2_sparse_classes_10k_train_006830
4,261
permissive
[ { "docstring": "Constructor for the RestoreOutlookParams class", "name": "__init__", "signature": "def __init__(self, mailbox_vec=None, pst_params=None, skip_mbx_permit_for_pst=None, target_folder_path=None, target_mailbox=None)" }, { "docstring": "Creates an instance of this model from a dictio...
2
stack_v2_sparse_classes_30k_train_001422
Implement the Python class `RestoreOutlookParams` described below. Class description: Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is t...
Implement the Python class `RestoreOutlookParams` described below. Class description: Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is t...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreOutlookParams: """Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mai...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RestoreOutlookParams: """Implementation of the 'RestoreOutlookParams' model. TODO: type description here. Attributes: mailbox_vec (list of RestoreOutlookParams_Mailbox): In a RestoreJob , user will provide the list of mailboxes to be restored. Provision is there for restoring full AND partial mailbox recovery...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_outlook_params.py
cohesity/management-sdk-python
train
24
e7c06cc84f7c385ed0ad2e842cb762455e0c8214
[ "res = ''\nfor i in range(len(strs)):\n new_str = ','.join([str(ord(c)) for c in strs[i]])\n res = res + ':' + new_str\nreturn res", "if len(s) == 0:\n return []\nif s == ':':\n return ['']\nenc_strs = s.split(':')\nres = []\nfor i in range(1, len(enc_strs)):\n if len(enc_strs[i]) == 0:\n re...
<|body_start_0|> res = '' for i in range(len(strs)): new_str = ','.join([str(ord(c)) for c in strs[i]]) res = res + ':' + new_str return res <|end_body_0|> <|body_start_1|> if len(s) == 0: return [] if s == ':': return [''] ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = '' ...
stack_v2_sparse_classes_10k_train_006831
1,491
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
9cef9b11e16412449a46312d766f7eafcf162724
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" res = '' for i in range(len(strs)): new_str = ','.join([str(ord(c)) for c in strs[i]]) res = res + ':' + new_str return res def decode(self, s: str) -> ...
the_stack_v2_python_sparse
271-Encode-and-Decode-Strings.py
zuqqhi2/my-leetcode-answers
train
0
45a2b73b5b66b0059ee6dcbfeac393737c946a39
[ "super().__init__(pos_enc_class)\nself.out = nn.Sequential(Linear(idim, odim), LayerNorm(odim, epsilon=1e-12), nn.Dropout(dropout_rate), nn.ReLU())\nself.right_context = 0\nself.subsampling_rate = 1", "x = self.out(x)\nx, pos_emb = self.pos_enc(x, offset)\nreturn (x, pos_emb, x_mask)" ]
<|body_start_0|> super().__init__(pos_enc_class) self.out = nn.Sequential(Linear(idim, odim), LayerNorm(odim, epsilon=1e-12), nn.Dropout(dropout_rate), nn.ReLU()) self.right_context = 0 self.subsampling_rate = 1 <|end_body_0|> <|body_start_1|> x = self.out(x) x, pos_emb ...
Linear transform the input without subsampling.
LinearNoSubsampling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearNoSubsampling: """Linear transform the input without subsampling.""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an linear object. Args: idim (int): Input dimension. odim (int): Output dimension. dropou...
stack_v2_sparse_classes_10k_train_006832
11,942
permissive
[ { "docstring": "Construct an linear object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc_class (PositionalEncoding): position encoding class", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, dropout_rate: float, p...
2
stack_v2_sparse_classes_30k_train_005667
Implement the Python class `LinearNoSubsampling` described below. Class description: Linear transform the input without subsampling. Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an linear object. Args: idim (in...
Implement the Python class `LinearNoSubsampling` described below. Class description: Linear transform the input without subsampling. Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an linear object. Args: idim (in...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class LinearNoSubsampling: """Linear transform the input without subsampling.""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an linear object. Args: idim (int): Input dimension. odim (int): Output dimension. dropou...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinearNoSubsampling: """Linear transform the input without subsampling.""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an linear object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float...
the_stack_v2_python_sparse
paddlespeech/s2t/modules/subsampling.py
anniyanvr/DeepSpeech-1
train
0
62e60d22a69fdf46dd89ae54de6d03d550b1e42e
[ "ret = []\n\ndef helper(left_nums, k):\n if k <= 1:\n return [[num] for num in left_nums]\n left_ret = []\n for i in range(len(left_nums)):\n now_num = left_nums[i]\n nums_backup = [num for num in left_nums]\n left_nums.remove(now_num)\n for nums in helper(left_nums, k - ...
<|body_start_0|> ret = [] def helper(left_nums, k): if k <= 1: return [[num] for num in left_nums] left_ret = [] for i in range(len(left_nums)): now_num = left_nums[i] nums_backup = [num for num in left_nums] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combine1(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [] de...
stack_v2_sparse_classes_10k_train_006833
1,369
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[List[int]]", "name": "combine1", "signature": "def combine1(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: List[List[int]]", "name": "combine", "signature": "def combine(self, n, k)" } ]
2
stack_v2_sparse_classes_30k_train_001451
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine1(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine1(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]] <|skeleton|> class Solut...
22f208400cd7e13fcf2ebf189e61ccad7e22b098
<|skeleton|> class Solution: def combine1(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def combine1(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" ret = [] def helper(left_nums, k): if k <= 1: return [[num] for num in left_nums] left_ret = [] for i in range(len(left_nums)): ...
the_stack_v2_python_sparse
previously_completed/77-Combinations.py
learnerjiahao/leetcode-solve
train
0
8d47c43dde1380a19c72a1a2863d1d9f05b255d1
[ "A = sum(machines)\nl = len(machines)\nif A % l != 0:\n return -1\nneed = A // l\ntoLeft = 0\nres = 0\nfor i in range(len(machines)):\n toRight = machines[i] - need - toLeft\n res = max(res, toLeft, toRight, toLeft + toRight)\n toLeft = -toRight\nreturn res", "s = 0\nl = len(machines)\nfor i in machin...
<|body_start_0|> A = sum(machines) l = len(machines) if A % l != 0: return -1 need = A // l toLeft = 0 res = 0 for i in range(len(machines)): toRight = machines[i] - need - toLeft res = max(res, toLeft, toRight, toLeft + toRight...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinMoves(self, machines): """:type machines: List[int] :rtype: int 51ms""" <|body_0|> def findMinMoves_1(self, machines): """:type machines: List[int] :rtype: int 47ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> A = sum(machine...
stack_v2_sparse_classes_10k_train_006834
2,247
no_license
[ { "docstring": ":type machines: List[int] :rtype: int 51ms", "name": "findMinMoves", "signature": "def findMinMoves(self, machines)" }, { "docstring": ":type machines: List[int] :rtype: int 47ms", "name": "findMinMoves_1", "signature": "def findMinMoves_1(self, machines)" } ]
2
stack_v2_sparse_classes_30k_train_006398
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinMoves(self, machines): :type machines: List[int] :rtype: int 51ms - def findMinMoves_1(self, machines): :type machines: List[int] :rtype: int 47ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinMoves(self, machines): :type machines: List[int] :rtype: int 51ms - def findMinMoves_1(self, machines): :type machines: List[int] :rtype: int 47ms <|skeleton|> class ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def findMinMoves(self, machines): """:type machines: List[int] :rtype: int 51ms""" <|body_0|> def findMinMoves_1(self, machines): """:type machines: List[int] :rtype: int 47ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMinMoves(self, machines): """:type machines: List[int] :rtype: int 51ms""" A = sum(machines) l = len(machines) if A % l != 0: return -1 need = A // l toLeft = 0 res = 0 for i in range(len(machines)): toRi...
the_stack_v2_python_sparse
SuperWashingMachines_HARD_517.py
953250587/leetcode-python
train
2
2a9868e6d79a8d00663e85a595dee930ff76314e
[ "online_minions = list()\noffline_minions = list()\nexpired_minions = list()\nfor minion_obj in minions:\n current_datetime = datetime.datetime.utcnow()\n current_datetime = current_datetime.replace(tzinfo=pytz.utc)\n last_seen = minion_obj.last_seen\n try:\n delta_diff = current_datetime - last_...
<|body_start_0|> online_minions = list() offline_minions = list() expired_minions = list() for minion_obj in minions: current_datetime = datetime.datetime.utcnow() current_datetime = current_datetime.replace(tzinfo=pytz.utc) last_seen = minion_obj.last...
API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format
AllMinionReport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllMinionReport: """API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format""" def minion_connection_stats(self, minions): """To get a list of online, offline and expired minions""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_006835
6,377
no_license
[ { "docstring": "To get a list of online, offline and expired minions", "name": "minion_connection_stats", "signature": "def minion_connection_stats(self, minions)" }, { "docstring": "To show the key stats for the minions", "name": "minion_key_stats", "signature": "def minion_key_stats(se...
5
stack_v2_sparse_classes_30k_train_006923
Implement the Python class `AllMinionReport` described below. Class description: API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format Method signatures and docstrings: - def minion_connection_stats(self, minions): To get a list of onl...
Implement the Python class `AllMinionReport` described below. Class description: API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format Method signatures and docstrings: - def minion_connection_stats(self, minions): To get a list of onl...
122a172caea82ef660e81a9dfc6377afd731f9cb
<|skeleton|> class AllMinionReport: """API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format""" def minion_connection_stats(self, minions): """To get a list of online, offline and expired minions""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AllMinionReport: """API to list online, office and expired minions URL http://<hostname>/report/minion/all/ Method: GET Returns data in the following format""" def minion_connection_stats(self, minions): """To get a list of online, offline and expired minions""" online_minions = list() ...
the_stack_v2_python_sparse
sso/files/gui/sse/report/views.py
nofxrok/headless
train
1
c22b8a188c46185ce9d9ed85466fabeb59a45d2b
[ "if ax is None:\n fig, ax = plt.subplots()\nlines, markers = plt.triplot(self.tri, **kwargs)", "vertices = self.node_map(self.tri.triangles)\nget_level = lambda node_id: self.data[label_by].loc[node_id]\nlevels = np.apply_along_axis(get_level, axis=1, arr=vertices)\nget_mode = lambda x: Counter(x).most_common(...
<|body_start_0|> if ax is None: fig, ax = plt.subplots() lines, markers = plt.triplot(self.tri, **kwargs) <|end_body_0|> <|body_start_1|> vertices = self.node_map(self.tri.triangles) get_level = lambda node_id: self.data[label_by].loc[node_id] levels = np.apply_along...
Methods for visualizing a Graph instance.
GraphVisualizationMethods
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" <|body_0|> def label_triangl...
stack_v2_sparse_classes_10k_train_006836
23,136
permissive
[ { "docstring": "Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot", "name": "plot_edges", "signature": "def plot_edges(self, ax=None, **kwargs)" }, { "docstring": "Label each triangle with most common node attribute value. Ar...
4
stack_v2_sparse_classes_30k_train_003956
Implement the Python class `GraphVisualizationMethods` described below. Class description: Methods for visualizing a Graph instance. Method signatures and docstrings: - def plot_edges(self, ax=None, **kwargs): Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.py...
Implement the Python class `GraphVisualizationMethods` described below. Class description: Methods for visualizing a Graph instance. Method signatures and docstrings: - def plot_edges(self, ax=None, **kwargs): Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.py...
4a622c3f5fed4456c3b9240f5a96428789fde9bd
<|skeleton|> class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" <|body_0|> def label_triangl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GraphVisualizationMethods: """Methods for visualizing a Graph instance.""" def plot_edges(self, ax=None, **kwargs): """Plot triangulation edges. Args: ax (matplotlib.axes.AxesSubplot) kwargs: keyword arguments for matplotlib.pyplot.triplot""" if ax is None: fig, ax = plt.subpl...
the_stack_v2_python_sparse
flyqma/annotation/spatial/graphs.py
sbernasek/flyqma
train
1
05a152f09390369a6d9d02a0febe6cec74d508b7
[ "response = {'success': False, 'message': 'Something bad happened', 'data': []}\nuser = request.user\ntry:\n requestBody = json.loads(request.body)\n label_name = requestBody['name']\n label_updated = Label.objects.get(id=label_id, user_id=user.id)\n label_updated.name = label_name\n label_updated.sa...
<|body_start_0|> response = {'success': False, 'message': 'Something bad happened', 'data': []} user = request.user try: requestBody = json.loads(request.body) label_name = requestBody['name'] label_updated = Label.objects.get(id=label_id, user_id=user.id) ...
Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels.
LabelsUpdate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelsUpdate: """Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels.""" def put(self, request, label_id): """Summary: -------- label wil...
stack_v2_sparse_classes_10k_train_006837
30,711
no_license
[ { "docstring": "Summary: -------- label will be updated by the User. Exception: ---------- Exception: if anything goes wrong. Returns: -------- response: User will able to updated label or error msg if something goes wrong", "name": "put", "signature": "def put(self, request, label_id)" }, { "do...
2
stack_v2_sparse_classes_30k_train_004793
Implement the Python class `LabelsUpdate` described below. Class description: Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels. Method signatures and docstrings: - def ...
Implement the Python class `LabelsUpdate` described below. Class description: Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels. Method signatures and docstrings: - def ...
f4035742d959f493f93a593f49e2fcacb721f85d
<|skeleton|> class LabelsUpdate: """Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels.""" def put(self, request, label_id): """Summary: -------- label wil...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabelsUpdate: """Summary: -------- Label update class will let authorized user to update or delete label. Methods: -------- put: User will be able to update label. delete: User will able to delete one or more labels.""" def put(self, request, label_id): """Summary: -------- label will be updated ...
the_stack_v2_python_sparse
note/views.py
nk900600/fundooapp
train
3
07c82af68cd6d99cd537bc4a97438556e37c861c
[ "str = ''\nif root is None:\n return str\nnodes = [root]\nwhile nodes.__len__():\n temp = []\n count = 0\n for node in nodes:\n if node:\n str += '{} '.format(node.val)\n temp.append(node.left)\n temp.append(node.right)\n if node.left:\n ...
<|body_start_0|> str = '' if root is None: return str nodes = [root] while nodes.__len__(): temp = [] count = 0 for node in nodes: if node: str += '{} '.format(node.val) temp.append(no...
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_10k_train_006838
2,736
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
null
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:...
055ace9f0ca4fb09326da77ae39e33173b3bde15
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" str = '' if root is None: return str nodes = [root] while nodes.__len__(): temp = [] count = 0 for node in nodes: ...
the_stack_v2_python_sparse
leetcode/0297_H_二叉树的序列化与反序列化.py
CrzRabbit/Python
train
2
73d6876ab2f4c693c3d9b527025b745ef7541097
[ "self._nodes = []\nself._edges = []\nself._num_nodes = 0", "self._num_nodes += 1\nname = 'node{number}'.format(number=self._num_nodes)\ncode = '{name} [label=\"{label}\"];'.format(name=name, label=label)\nself._nodes.append(code)\nreturn name", "template = '{from_node} -- {to_node};'\ncode = template.format(fro...
<|body_start_0|> self._nodes = [] self._edges = [] self._num_nodes = 0 <|end_body_0|> <|body_start_1|> self._num_nodes += 1 name = 'node{number}'.format(number=self._num_nodes) code = '{name} [label="{label}"];'.format(name=name, label=label) self._nodes.append(c...
Clase utilizada para la generación de grafos en formato Graphviz DOT.
DotGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DotGenerator: """Clase utilizada para la generación de grafos en formato Graphviz DOT.""" def __init__(self): """Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un programa Tiger.""" <|body_0|> def add_node(se...
stack_v2_sparse_classes_10k_train_006839
2,786
permissive
[ { "docstring": "Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un programa Tiger.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Añade un nuevo nodo al grafo actualmente en creación. @type label: C{str} @p...
4
stack_v2_sparse_classes_30k_train_004532
Implement the Python class `DotGenerator` described below. Class description: Clase utilizada para la generación de grafos en formato Graphviz DOT. Method signatures and docstrings: - def __init__(self): Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un p...
Implement the Python class `DotGenerator` described below. Class description: Clase utilizada para la generación de grafos en formato Graphviz DOT. Method signatures and docstrings: - def __init__(self): Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un p...
35c44d14775bf69ed6689b708b98d6d1ca533ba0
<|skeleton|> class DotGenerator: """Clase utilizada para la generación de grafos en formato Graphviz DOT.""" def __init__(self): """Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un programa Tiger.""" <|body_0|> def add_node(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DotGenerator: """Clase utilizada para la generación de grafos en formato Graphviz DOT.""" def __init__(self): """Esta clase es utilizada en la generación de código Graphivz DOT a partir de un árbol de sintáxis abstracta de un programa Tiger.""" self._nodes = [] self._edges = [] ...
the_stack_v2_python_sparse
packages/pytiger2c/dot.py
yasserglez/pytiger2c
train
2
74ba213d4fab33b0a7cfabe35671d93818512ca4
[ "self.mu_g = mu_g\nself.s_g = s_g\nself.s_s = s_s\nself.h = h", "assert len(f1.shape) == 1, 'input must be 1d ndarray'\nassert len(f2.shape) == 1, 'input must be 1d ndarray'\nassert f1.shape == f2.shape\nn_trial = len(f1)\nf1_ = np.tile(f1, (n_samp, 1)) + self.s_s * np.random.randn(n_samp, n_trial)\ns = (1.0 / se...
<|body_start_0|> self.mu_g = mu_g self.s_g = s_g self.s_s = s_s self.h = h <|end_body_0|> <|body_start_1|> assert len(f1.shape) == 1, 'input must be 1d ndarray' assert len(f2.shape) == 1, 'input must be 1d ndarray' assert f1.shape == f2.shape n_trial = le...
A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss""" def __init__(self, mu_g, s_g, h, s_s): """Constructor :param mu_g: mean of gaussian part of unigauss :par...
stack_v2_sparse_classes_10k_train_006840
11,426
no_license
[ { "docstring": "Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussian p(x) 1/Z*( h + exp((x-mu)/2/s^2) ) :param s_s: std of likelihood", "name": "__init__", "signature": "d...
3
stack_v2_sparse_classes_30k_train_000397
Implement the Python class `Model` described below. Class description: A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss Method signatures and docstrings: - def __init__(self, mu_g, s_g, h, s_s): Constr...
Implement the Python class `Model` described below. Class description: A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss Method signatures and docstrings: - def __init__(self, mu_g, s_g, h, s_s): Constr...
2a05aa98b501c8633e1fe2baf611d137740709de
<|skeleton|> class Model: """A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss""" def __init__(self, mu_g, s_g, h, s_s): """Constructor :param mu_g: mean of gaussian part of unigauss :par...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Model: """A model of tone discrimination where - the value of the first tone is inferred from noisy observation - the value of the second tone is noiseless - prior is unigauss""" def __init__(self, mu_g, s_g, h, s_s): """Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std o...
the_stack_v2_python_sparse
model/simple_model.py
ItayLieder/GMM_simulations
train
0
6ebf328484aad8dd6c9f53dc8cdcf9f09b39f53c
[ "cameraDTO = request.json\ncameraManager.postCamera(**cameraDTO)\nreturn make_response({'operation': 'success'}, 200)", "cameraPath = os.path.join(cfg.UPLOAD_FOLDER, cameraId)\nif not os.path.exists(cameraPath):\n return make_response({'images': [], 'id': cameraId}, 200)\nlastImageDate = os.listdir(cameraPath)...
<|body_start_0|> cameraDTO = request.json cameraManager.postCamera(**cameraDTO) return make_response({'operation': 'success'}, 200) <|end_body_0|> <|body_start_1|> cameraPath = os.path.join(cfg.UPLOAD_FOLDER, cameraId) if not os.path.exists(cameraPath): return make_r...
Camera
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Camera: def post(self, cameraId): """Добавить новую камеру""" <|body_0|> def get(self, cameraId): """Получить информацию о камере""" <|body_1|> <|end_skeleton|> <|body_start_0|> cameraDTO = request.json cameraManager.postCamera(**cameraDTO) ...
stack_v2_sparse_classes_10k_train_006841
3,745
permissive
[ { "docstring": "Добавить новую камеру", "name": "post", "signature": "def post(self, cameraId)" }, { "docstring": "Получить информацию о камере", "name": "get", "signature": "def get(self, cameraId)" } ]
2
stack_v2_sparse_classes_30k_train_006031
Implement the Python class `Camera` described below. Class description: Implement the Camera class. Method signatures and docstrings: - def post(self, cameraId): Добавить новую камеру - def get(self, cameraId): Получить информацию о камере
Implement the Python class `Camera` described below. Class description: Implement the Camera class. Method signatures and docstrings: - def post(self, cameraId): Добавить новую камеру - def get(self, cameraId): Получить информацию о камере <|skeleton|> class Camera: def post(self, cameraId): """Добавить...
ac6d90da101a5c2f2c305ba21f67369a0f3b786f
<|skeleton|> class Camera: def post(self, cameraId): """Добавить новую камеру""" <|body_0|> def get(self, cameraId): """Получить информацию о камере""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Camera: def post(self, cameraId): """Добавить новую камеру""" cameraDTO = request.json cameraManager.postCamera(**cameraDTO) return make_response({'operation': 'success'}, 200) def get(self, cameraId): """Получить информацию о камере""" cameraPath = os.path...
the_stack_v2_python_sparse
Premier-eye.API/controllers/camera/camera.py
Sapfir0/premier-eye
train
18
913ea239d7661fce8c90160a40c5b908bf6fe273
[ "super(CreateBackupTests, cls).setUpClass()\nkey_resp = cls.keypairs_client.create_keypair(rand_name('key'))\nassert key_resp.status_code is 200, 'Create keypair failed with response code {0}'.format(key_resp.status_code)\ncls.key = key_resp.entity\ncls.resources.add(cls.key.name, cls.keypairs_client.delete_keypair...
<|body_start_0|> super(CreateBackupTests, cls).setUpClass() key_resp = cls.keypairs_client.create_keypair(rand_name('key')) assert key_resp.status_code is 200, 'Create keypair failed with response code {0}'.format(key_resp.status_code) cls.key = key_resp.entity cls.resources.add(...
CreateBackupTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateBackupTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defaults defined in server behaviors.""" <|body_0|> def test_create_backup_for_server(self): ...
stack_v2_sparse_classes_10k_train_006842
2,408
permissive
[ { "docstring": "Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defaults defined in server behaviors.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Verify that a backup can be c...
2
stack_v2_sparse_classes_30k_train_004344
Implement the Python class `CreateBackupTests` described below. Class description: Implement the CreateBackupTests class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defa...
Implement the Python class `CreateBackupTests` described below. Class description: Implement the CreateBackupTests class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defa...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class CreateBackupTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defaults defined in server behaviors.""" <|body_0|> def test_create_backup_for_server(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateBackupTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during this setup: - A server with defaults defined in server behaviors.""" super(CreateBackupTests, cls).setUpClass() key_resp = cls.keypairs_...
the_stack_v2_python_sparse
cloudroast/compute/instance_actions/admin_api/test_create_backup.py
RULCSoft/cloudroast
train
1
35f10023a22bfdc7236cf747a45c183339c9831b
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jgrishey', 'jgrishey')\nstations = list(repo['jgrishey.redlineStations'].find(None, ['_id', 'lat', 'lon']))\nfor station in stations:\n url = 'http://api.geonames.org/findNearbyStreetsJSON?lat=%s&lng=...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') stations = list(repo['jgrishey.redlineStations'].find(None, ['_id', 'lat', 'lon'])) for station in stations: ur...
redlineStreets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class redlineStreets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k_train_006843
4,285
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `redlineStreets` described below. Class description: Implement the redlineStreets class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
Implement the Python class `redlineStreets` described below. Class description: Implement the redlineStreets class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class redlineStreets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class redlineStreets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') stati...
the_stack_v2_python_sparse
jgrishey/redlineStreets.py
lingyigu/course-2017-spr-proj
train
0
b3142e8642d2a6f5aa3657bc549a46a7b6aab754
[ "collection: Final[str] = 'profile_armor_map'\nquery = Query(collection, service_id=self._client.service_id)\nquery.add_term(field=self.id_field, value=self.id)\nquery.limit(20)\njoin = query.create_join(ArmourInfo.collection)\njoin.set_fields(ArmourInfo.id_field)\nreturn SequenceProxy(ArmourInfo, query, client=sel...
<|body_start_0|> collection: Final[str] = 'profile_armor_map' query = Query(collection, service_id=self._client.service_id) query.add_term(field=self.id_field, value=self.id) query.limit(20) join = query.create_join(ArmourInfo.collection) join.set_fields(ArmourInfo.id_fie...
An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium nodes or pumpkins. .. attribute:: id...
Profile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium n...
stack_v2_sparse_classes_10k_train_006844
5,971
permissive
[ { "docstring": "Return the armour info of the profile. This returns a :class:`auraxium.SequenceProxy`.", "name": "armour_info", "signature": "def armour_info(self) -> SequenceProxy[ArmourInfo]" }, { "docstring": "Return the resist info of the profile. This returns a :class:`auraxium.SequenceProx...
2
stack_v2_sparse_classes_30k_test_000358
Implement the Python class `Profile` described below. Class description: An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as othe...
Implement the Python class `Profile` described below. Class description: An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as othe...
23dcf927a199c8d7c917d89fe96b470a34cf4bba
<|skeleton|> class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Profile: """An entity in the game world. This is used to specify the resistance and armour values to apply to a given object. Profiles include faction-specific classes, vehicles, facility infrastructure such as turrets, generators or shields, as well as other non-static entities such as Cortium nodes or pumpk...
the_stack_v2_python_sparse
auraxium/ps2/_profile.py
leonhard-s/auraxium
train
29
d9e65f2deae8aa58a79aa81f6582ca953949d7e2
[ "os.makedirs(os.path.dirname(cls.path_token), exist_ok=True)\nwith open(cls.path_token, 'w+') as f:\n f.write(token)", "try:\n with open(cls.path_token, 'r') as f:\n return f.read()\nexcept FileNotFoundError:\n pass", "try:\n os.remove(cls.path_token)\nexcept FileNotFoundError:\n pass" ]
<|body_start_0|> os.makedirs(os.path.dirname(cls.path_token), exist_ok=True) with open(cls.path_token, 'w+') as f: f.write(token) <|end_body_0|> <|body_start_1|> try: with open(cls.path_token, 'r') as f: return f.read() except FileNotFoundError: ...
HfFolder
[ "LGPL-2.1-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HfFolder: def save_token(cls, token): """Save token, creating folder as needed.""" <|body_0|> def get_token(cls): """Get token or None if not existent.""" <|body_1|> def delete_token(cls): """Delete token. Do not fail if token does not exist.""" ...
stack_v2_sparse_classes_10k_train_006845
5,878
permissive
[ { "docstring": "Save token, creating folder as needed.", "name": "save_token", "signature": "def save_token(cls, token)" }, { "docstring": "Get token or None if not existent.", "name": "get_token", "signature": "def get_token(cls)" }, { "docstring": "Delete token. Do not fail if ...
3
null
Implement the Python class `HfFolder` described below. Class description: Implement the HfFolder class. Method signatures and docstrings: - def save_token(cls, token): Save token, creating folder as needed. - def get_token(cls): Get token or None if not existent. - def delete_token(cls): Delete token. Do not fail if ...
Implement the Python class `HfFolder` described below. Class description: Implement the HfFolder class. Method signatures and docstrings: - def save_token(cls, token): Save token, creating folder as needed. - def get_token(cls): Get token or None if not existent. - def delete_token(cls): Delete token. Do not fail if ...
b60c741f746877293bb85eed6806736fc8fa0ffd
<|skeleton|> class HfFolder: def save_token(cls, token): """Save token, creating folder as needed.""" <|body_0|> def get_token(cls): """Get token or None if not existent.""" <|body_1|> def delete_token(cls): """Delete token. Do not fail if token does not exist.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HfFolder: def save_token(cls, token): """Save token, creating folder as needed.""" os.makedirs(os.path.dirname(cls.path_token), exist_ok=True) with open(cls.path_token, 'w+') as f: f.write(token) def get_token(cls): """Get token or None if not existent.""" ...
the_stack_v2_python_sparse
xtune/src/transformers/hf_api.py
microsoft/unilm
train
15,313
bc948902a4877fcb219627d213bc93d6063e7b5f
[ "self.model_conf = model_conf\nself.inputs = inputs\nself.utils = utils\nself.layer = None", "with tf.keras.backend.name_scope('GRU'):\n mask = tf.keras.layers.Masking()(self.inputs)\n self.layer = tf.keras.layers.GRU(units=self.model_conf.units_num * 2, return_sequences=True, input_shape=mask.shape)\n o...
<|body_start_0|> self.model_conf = model_conf self.inputs = inputs self.utils = utils self.layer = None <|end_body_0|> <|body_start_1|> with tf.keras.backend.name_scope('GRU'): mask = tf.keras.layers.Masking()(self.inputs) self.layer = tf.keras.layers.GRU...
GRU
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRU: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类""" <|body_0|> def build(self): """循环层构建参数 :return: 返回循环层的输出层""" <|bo...
stack_v2_sparse_classes_10k_train_006846
2,557
permissive
[ { "docstring": ":param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类", "name": "__init__", "signature": "def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils)" }, { "docstring": "循环层构建参数 :return: 返回循环层的输出层", "name": "...
2
stack_v2_sparse_classes_30k_train_004130
Implement the Python class `GRU` described below. Class description: Implement the GRU class. Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): :param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类 - def...
Implement the Python class `GRU` described below. Class description: Implement the GRU class. Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): :param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类 - def...
6fd35c0c789aaa43130de46d4c04622ec2948052
<|skeleton|> class GRU: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类""" <|body_0|> def build(self): """循环层构建参数 :return: 返回循环层的输出层""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GRU: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入tf.keras.layers.Input/tf.Tensor类型 :param utils: 网络工具类""" self.model_conf = model_conf self.inputs = inputs self.utils = utils self.la...
the_stack_v2_python_sparse
network/GRU.py
kerlomz/captcha_trainer
train
2,977
0fec9cb4b8d86dfaea25aec8c1361f09dd7e1b5d
[ "super(NeRF_albedo, self).__init__()\nself.W = W\nself.in_channels_dir = in_channels_dir\nself.xyz_encoding_final = nn.Linear(W, W)\nself.dir_encoding = nn.Sequential(nn.Linear(W + in_channels_dir, W // 2), nn.ReLU(True))\nself.rgb = nn.Sequential(nn.Linear(W // 2, 3), nn.Sigmoid())", "xyz_encoding_final = self.x...
<|body_start_0|> super(NeRF_albedo, self).__init__() self.W = W self.in_channels_dir = in_channels_dir self.xyz_encoding_final = nn.Linear(W, W) self.dir_encoding = nn.Sequential(nn.Linear(W + in_channels_dir, W // 2), nn.ReLU(True)) self.rgb = nn.Sequential(nn.Linear(W /...
NeRF_albedo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeRF_albedo: def __init__(self, W=256, in_channels_dir=27): """D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) in_channels_dir: number of input channels for direction (3+3*4...
stack_v2_sparse_classes_10k_train_006847
18,983
no_license
[ { "docstring": "D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in the Dth layer", "na...
2
stack_v2_sparse_classes_30k_train_004827
Implement the Python class `NeRF_albedo` described below. Class description: Implement the NeRF_albedo class. Method signatures and docstrings: - def __init__(self, W=256, in_channels_dir=27): D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input chan...
Implement the Python class `NeRF_albedo` described below. Class description: Implement the NeRF_albedo class. Method signatures and docstrings: - def __init__(self, W=256, in_channels_dir=27): D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input chan...
3b6e9d85e77077d1ad3b669fe88799d6a19e6d99
<|skeleton|> class NeRF_albedo: def __init__(self, W=256, in_channels_dir=27): """D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) in_channels_dir: number of input channels for direction (3+3*4...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NeRF_albedo: def __init__(self, W=256, in_channels_dir=27): """D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) in_channels_dir: number of input channels for direction (3+3*4*2=27 by defau...
the_stack_v2_python_sparse
models/nert.py
jcn16/nert
train
0
0df171673b8338464d988aacc90d42ec6dc03b02
[ "policy = policy_fn(ACT_SPACE_SIZE, **policy_fn_arguments)\nobs = fake_observations(BATCH_SIZE)\ndata = policy(obs)\nself.assertIsNotNone(data)\nself.assertEqual(len(data), 3)\naction, log_prob, entropy = data\nself.assertEqual(log_prob.shape, (BATCH_SIZE,))\nself.assertEqual(entropy.shape, (BATCH_SIZE,))\nif polic...
<|body_start_0|> policy = policy_fn(ACT_SPACE_SIZE, **policy_fn_arguments) obs = fake_observations(BATCH_SIZE) data = policy(obs) self.assertIsNotNone(data) self.assertEqual(len(data), 3) action, log_prob, entropy = data self.assertEqual(log_prob.shape, (BATCH_SIZ...
Common class to run tests for policies.
PoliciesTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PoliciesTest: """Common class to run tests for policies.""" def test_policy(self, policy_fn, policy_fn_arguments, policy_type): """Test if policy return types are good.""" <|body_0|> def test_normal_policies_learnable_variables(self): """Make sure that fixed_std ...
stack_v2_sparse_classes_10k_train_006848
3,873
permissive
[ { "docstring": "Test if policy return types are good.", "name": "test_policy", "signature": "def test_policy(self, policy_fn, policy_fn_arguments, policy_type)" }, { "docstring": "Make sure that fixed_std will not learn the standard deviation.", "name": "test_normal_policies_learnable_variab...
2
stack_v2_sparse_classes_30k_train_005394
Implement the Python class `PoliciesTest` described below. Class description: Common class to run tests for policies. Method signatures and docstrings: - def test_policy(self, policy_fn, policy_fn_arguments, policy_type): Test if policy return types are good. - def test_normal_policies_learnable_variables(self): Make...
Implement the Python class `PoliciesTest` described below. Class description: Common class to run tests for policies. Method signatures and docstrings: - def test_policy(self, policy_fn, policy_fn_arguments, policy_type): Test if policy return types are good. - def test_normal_policies_learnable_variables(self): Make...
96c99bc67ce40559c61bdb6110f625671fc96055
<|skeleton|> class PoliciesTest: """Common class to run tests for policies.""" def test_policy(self, policy_fn, policy_fn_arguments, policy_type): """Test if policy return types are good.""" <|body_0|> def test_normal_policies_learnable_variables(self): """Make sure that fixed_std ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PoliciesTest: """Common class to run tests for policies.""" def test_policy(self, policy_fn, policy_fn_arguments, policy_type): """Test if policy return types are good.""" policy = policy_fn(ACT_SPACE_SIZE, **policy_fn_arguments) obs = fake_observations(BATCH_SIZE) data = ...
the_stack_v2_python_sparse
eager_pg/policies_test.py
muskanmahajan37/policy-learning-landscape
train
0
665eee76936ab9e8590109589fb58e8fcc553d62
[ "always_excluded_fields = ('cache',)\nexcluded_fields = list(super().get_exclude(request, obj=obj) or [])\nif obj:\n for excluded_field in always_excluded_fields:\n if hasattr(obj, excluded_field):\n excluded_fields.append(excluded_field)\nreturn list(set(excluded_fields))", "search_term = se...
<|body_start_0|> always_excluded_fields = ('cache',) excluded_fields = list(super().get_exclude(request, obj=obj) or []) if obj: for excluded_field in always_excluded_fields: if hasattr(obj, excluded_field): excluded_fields.append(excluded_field) ...
Base admin class for ModularHistory's models.
ExtendedModelAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtendedModelAdmin: """Base admin class for ModularHistory's models.""" def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: """Return the fields to exclude from admin forms.""" <|body_0|> def get_search_results(self, request: HttpReques...
stack_v2_sparse_classes_10k_train_006849
5,673
no_license
[ { "docstring": "Return the fields to exclude from admin forms.", "name": "get_exclude", "signature": "def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]" }, { "docstring": "Return model instances matching the supplied search term.", "name": "get_search_resu...
2
stack_v2_sparse_classes_30k_train_003746
Implement the Python class `ExtendedModelAdmin` described below. Class description: Base admin class for ModularHistory's models. Method signatures and docstrings: - def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: Return the fields to exclude from admin forms. - def get_search_r...
Implement the Python class `ExtendedModelAdmin` described below. Class description: Base admin class for ModularHistory's models. Method signatures and docstrings: - def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: Return the fields to exclude from admin forms. - def get_search_r...
8bbdc8eec3622af22c17214051c34e36bea8e05a
<|skeleton|> class ExtendedModelAdmin: """Base admin class for ModularHistory's models.""" def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: """Return the fields to exclude from admin forms.""" <|body_0|> def get_search_results(self, request: HttpReques...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtendedModelAdmin: """Base admin class for ModularHistory's models.""" def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: """Return the fields to exclude from admin forms.""" always_excluded_fields = ('cache',) excluded_fields = list(super().ge...
the_stack_v2_python_sparse
apps/admin/model_admin.py
abdulwahed-mansour/modularhistory
train
1
2bb48278d4b7da9ea4dd7e94511308f4c56cf7e4
[ "now = pendulum.now('utc')\nschedules = await models.Schedule.where({'active': {'_eq': True}, 'flow': {'archived': {'_eq': False}}, '_and': [{'_or': [{'schedule_start': {'_lte': str(now.add(days=1))}}, {'schedule_start': {'_is_null': True}}]}, {'_or': [{'schedule_end': {'_gte': str(now)}}, {'schedule_end': {'_is_nu...
<|body_start_0|> now = pendulum.now('utc') schedules = await models.Schedule.where({'active': {'_eq': True}, 'flow': {'archived': {'_eq': False}}, '_and': [{'_or': [{'schedule_start': {'_lte': str(now.add(days=1))}}, {'schedule_start': {'_is_null': True}}]}, {'_or': [{'schedule_end': {'_gte': str(now)}}...
The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is active - the schedule's flow is not archi...
Scheduler
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is acti...
stack_v2_sparse_classes_10k_train_006850
3,674
permissive
[ { "docstring": "Args: - n_flows (int): the maximum number of flows to schedule Returns: - int: The number of scheduled runs", "name": "schedule_flows", "signature": "async def schedule_flows(self, n_flows=100) -> int" }, { "docstring": "Run the scheduler loop one time. As long as `schedule_flows...
2
stack_v2_sparse_classes_30k_train_003690
Implement the Python class `Scheduler` described below. Class description: The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedu...
Implement the Python class `Scheduler` described below. Class description: The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedu...
f2ae050df8258aebfc0a97ffcd3e38344180f53e
<|skeleton|> class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is acti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is active - the sche...
the_stack_v2_python_sparse
server/src/prefect_server/services/scheduler/scheduler.py
manesioz/prefect
train
0
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Output Tray {number}'\nself._number = number\nself._id_suffix = f'_output_tray_{number}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.output_tray_status().get(self._number, {})\n self._state = self._attributes.get('status')\n ...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Output Tray {number}' self._number = number self._id_suffix = f'_output_tray_{number}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attributes = self.syncthru.output_tray_s...
Implementation of a Samsung Printer input tray sensor platform.
SyncThruOutputTraySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_10k_train_006851
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, number)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SyncThruOutputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upd...
Implement the Python class `SyncThruOutputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upd...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Output Tray {number}' self._number = number ...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
f406b36ad1b669abdba349279daccc8d4db6cc35
[ "self.enabled = enabled\nself.last_updated_timestamp_secs = last_updated_timestamp_secs\nself.pinned_time_secs = pinned_time_secs", "if dictionary is None:\n return None\nenabled = dictionary.get('enabled')\nlast_updated_timestamp_secs = dictionary.get('lastUpdatedTimestampSecs')\npinned_time_secs = dictionary...
<|body_start_0|> self.enabled = enabled self.last_updated_timestamp_secs = last_updated_timestamp_secs self.pinned_time_secs = pinned_time_secs <|end_body_0|> <|body_start_1|> if dictionary is None: return None enabled = dictionary.get('enabled') last_updated...
Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pinning config is last updated. pinned_time_secs...
ViewPinningConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pin...
stack_v2_sparse_classes_10k_train_006852
2,126
permissive
[ { "docstring": "Constructor for the ViewPinningConfig class", "name": "__init__", "signature": "def __init__(self, enabled=None, last_updated_timestamp_secs=None, pinned_time_secs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dicti...
2
stack_v2_sparse_classes_30k_train_001009
Implement the Python class `ViewPinningConfig` described below. Class description: Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int)...
Implement the Python class `ViewPinningConfig` described below. Class description: Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pinning config i...
the_stack_v2_python_sparse
cohesity_management_sdk/models/view_pinning_config.py
cohesity/management-sdk-python
train
24
b39795708d4d5963a24f4d4d564ecaca3d3cfd45
[ "is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS_FLAG.is_enabled(self.course_key)\nis_course_outline_publicly_visible = full_course_outline.course_visibility in [CourseVisibility.PUBLIC, CourseVisibility.PUBLIC_OUTLINE]\nif is_unenrolled_access_enabled and is_course_outline_publicly_visible:\n ret...
<|body_start_0|> is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS_FLAG.is_enabled(self.course_key) is_course_outline_publicly_visible = full_course_outline.course_visibility in [CourseVisibility.PUBLIC, CourseVisibility.PUBLIC_OUTLINE] if is_unenrolled_access_enabled and is_course_...
Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.
EnrollmentOutlineProcessor
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" <|body_0|> def inaccessible_sequences(self, ...
stack_v2_sparse_classes_10k_train_006853
1,997
permissive
[ { "docstring": "Return sequences/sections to be removed", "name": "usage_keys_to_remove", "signature": "def usage_keys_to_remove(self, full_course_outline)" }, { "docstring": "Return a set/frozenset of Sequence UsageKeys that are not accessible.", "name": "inaccessible_sequences", "signa...
2
stack_v2_sparse_classes_30k_train_004823
Implement the Python class `EnrollmentOutlineProcessor` described below. Class description: Simple OutlineProcessor that removes items based on Enrollment and course visibility setting. Method signatures and docstrings: - def usage_keys_to_remove(self, full_course_outline): Return sequences/sections to be removed - d...
Implement the Python class `EnrollmentOutlineProcessor` described below. Class description: Simple OutlineProcessor that removes items based on Enrollment and course visibility setting. Method signatures and docstrings: - def usage_keys_to_remove(self, full_course_outline): Return sequences/sections to be removed - d...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" <|body_0|> def inaccessible_sequences(self, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/learning_sequences/api/processors/enrollment.py
luque/better-ways-of-thinking-about-software
train
3
37eb6532ab3d33eaa04cc80491e77a523f1140b9
[ "if fit_data is None and (a is None or b is None or c is None):\n raise ValueError('Either all the fit parameters or fit_data must be specified.')\nif not (fit_data is None or a is None or b is None or (c is None)):\n raise ValueError('Cannot specify fit parameters when fit_data is specified.')\nself.a = a\ns...
<|body_start_0|> if fit_data is None and (a is None or b is None or c is None): raise ValueError('Either all the fit parameters or fit_data must be specified.') if not (fit_data is None or a is None or b is None or (c is None)): raise ValueError('Cannot specify fit parameters whe...
Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form.
FundamentalPlane
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FundamentalPlane: """Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form.""" def __init__(self, a=None, b=None, c=None, intrinsic_scatter=0.0, fit_d...
stack_v2_sparse_classes_10k_train_006854
19,262
permissive
[ { "docstring": "Parameters ---------- a : float linear slope on the log velocity dispersion, log(vel_disp/(km/s)) b : float linear slope on the V-band apparent magnitude, or m_V/mag c : float intercept, i.e. the log effective radius, or log(R_eff/kpc), when vel_disp = m_V = 0 fit_data : str sample on which a, b...
3
stack_v2_sparse_classes_30k_train_005506
Implement the Python class `FundamentalPlane` described below. Class description: Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form. Method signatures and docstrings: - def...
Implement the Python class `FundamentalPlane` described below. Class description: Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form. Method signatures and docstrings: - def...
2a9a1b3eafbafef925bedab4b3137a3505a9b750
<|skeleton|> class FundamentalPlane: """Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form.""" def __init__(self, a=None, b=None, c=None, intrinsic_scatter=0.0, fit_d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FundamentalPlane: """Represents the Fundamental Plane (FP) relation between the velocity dispersion, luminosity, and effective radius for elliptical galaxies Luminosity is expressed as apparent magnitude in this form.""" def __init__(self, a=None, b=None, c=None, intrinsic_scatter=0.0, fit_data=None): ...
the_stack_v2_python_sparse
baobab/bnn_priors/parameter_models.py
jiwoncpark/baobab
train
9
6ab402c694104d97453357e34ca5a7d75228dcf8
[ "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...
The MruV offers service.
MruVOffersServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MruVOffersServiceServicer: """The MruV offers service.""" def CreateOffer(self, request, context): """Create an offer.""" <|body_0|> def GetOffer(self, request, context): """Get an offer.""" <|body_1|> def UpdateOffer(self, request, context): ...
stack_v2_sparse_classes_10k_train_006855
8,788
permissive
[ { "docstring": "Create an offer.", "name": "CreateOffer", "signature": "def CreateOffer(self, request, context)" }, { "docstring": "Get an offer.", "name": "GetOffer", "signature": "def GetOffer(self, request, context)" }, { "docstring": "Update an offer.", "name": "UpdateOff...
5
stack_v2_sparse_classes_30k_train_005187
Implement the Python class `MruVOffersServiceServicer` described below. Class description: The MruV offers service. Method signatures and docstrings: - def CreateOffer(self, request, context): Create an offer. - def GetOffer(self, request, context): Get an offer. - def UpdateOffer(self, request, context): Update an o...
Implement the Python class `MruVOffersServiceServicer` described below. Class description: The MruV offers service. Method signatures and docstrings: - def CreateOffer(self, request, context): Create an offer. - def GetOffer(self, request, context): Get an offer. - def UpdateOffer(self, request, context): Update an o...
2a640f7667d23f39e50ccc9ba73c98138c6839b5
<|skeleton|> class MruVOffersServiceServicer: """The MruV offers service.""" def CreateOffer(self, request, context): """Create an offer.""" <|body_0|> def GetOffer(self, request, context): """Get an offer.""" <|body_1|> def UpdateOffer(self, request, context): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MruVOffersServiceServicer: """The MruV offers service.""" def CreateOffer(self, request, context): """Create an offer.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') ...
the_stack_v2_python_sparse
offers/offers_pb2_grpc.py
MruV-RP/mruv-pb_python
train
0
e53fa32c6f7514d55befe19faf7765d0c2746ca9
[ "first, last = (0, len(nums) - 1)\nwhile first < last:\n if nums[first] % 2 == 1:\n first += 1\n continue\n if nums[last] % 2 == 0:\n last -= 1\n continue\n nums[first], nums[last] = (nums[last], nums[first])\nreturn nums", "low = fast = 0\nwhile fast < len(nums):\n if nums...
<|body_start_0|> first, last = (0, len(nums) - 1) while first < last: if nums[first] % 2 == 1: first += 1 continue if nums[last] % 2 == 0: last -= 1 continue nums[first], nums[last] = (nums[last], nums[fi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n)...
stack_v2_sparse_classes_10k_train_006856
2,049
no_license
[ { "docstring": "前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)", "name": "exchange", "signature": "def exchange(self, nums: List[int]) -> List[int]" }, { "docstring": "快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n) 空间复杂度:O(1)", "name": "exchange_2", ...
2
stack_v2_sparse_classes_30k_train_000380
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums: List[int]) -> List[int]: 前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1) - def exchange_2(self, nums: List[int]) -> List[int]: 快慢双指针法 low与fa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums: List[int]) -> List[int]: 前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1) - def exchange_2(self, nums: List[int]) -> List[int]: 快慢双指针法 low与fa...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" <|body_0|> def exchange_2(self, nums: List[int]) -> List[int]: """快慢双指针法 low与fast同时从首位移动,fast 的作用是向前搜索奇数位置,low 的作用是指向下一个奇数应当存放的位置 时间复杂度:O(n)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def exchange(self, nums: List[int]) -> List[int]: """前后双指针法 first指向第一个,last指向最后一个,两个指针向中间靠拢 时间复杂度:O(n) 空间复杂度:O(1)""" first, last = (0, len(nums) - 1) while first < last: if nums[first] % 2 == 1: first += 1 continue if nu...
the_stack_v2_python_sparse
SwordOffer/SwordOffer_21.py
EachenKuang/LeetCode
train
28
8d8fffdc351023aa2ebd3667b1db3d381da4a3a2
[ "encoded_str = []\nfor word in strs:\n encoded_str.append(str(len(word)))\n encoded_str.append('/')\n encoded_str.append(word)\nreturn ''.join(encoded_str)", "words = []\ni = 0\nwhile i < len(s):\n slash_index = s.find('/', i)\n size = int(s[i:slash_index])\n words.append(s[slash_index + 1:slash...
<|body_start_0|> encoded_str = [] for word in strs: encoded_str.append(str(len(word))) encoded_str.append('/') encoded_str.append(word) return ''.join(encoded_str) <|end_body_0|> <|body_start_1|> words = [] i = 0 while i < len(s): ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_006857
1,009
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_val_000284
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
9d0ff0f8705451947a6605ab5ef92bb3e27a7147
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" encoded_str = [] for word in strs: encoded_str.append(str(len(word))) encoded_str.append('/') encoded_str.append(word) return...
the_stack_v2_python_sparse
string/encode_and_decode_strings.py
rayt579/leetcode
train
0
c4fab6e502614afd2570fdaa365faea9999fc206
[ "ForwardingRulesMutator.Args(parser)\ntarget = parser.add_mutually_exclusive_group(required=True)\ntarget_instance = target.add_argument('--target-instance', help='The target instance that will receive the traffic.')\ntarget_instance.detailed_help = textwrap.dedent(\" The name of the target instance that wil...
<|body_start_0|> ForwardingRulesMutator.Args(parser) target = parser.add_mutually_exclusive_group(required=True) target_instance = target.add_argument('--target-instance', help='The target instance that will receive the traffic.') target_instance.detailed_help = textwrap.dedent(" ...
Base class for modifying forwarding rule targets.
ForwardingRulesTargetMutator
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardingRulesTargetMutator: """Base class for modifying forwarding rule targets.""" def Args(parser, include_beta_targets): """Adds common flags for mutating forwarding rule targets.""" <|body_0|> def GetGlobalTarget(self, args): """Return the forwarding target...
stack_v2_sparse_classes_10k_train_006858
5,788
permissive
[ { "docstring": "Adds common flags for mutating forwarding rule targets.", "name": "Args", "signature": "def Args(parser, include_beta_targets)" }, { "docstring": "Return the forwarding target for a globally scoped request.", "name": "GetGlobalTarget", "signature": "def GetGlobalTarget(se...
3
null
Implement the Python class `ForwardingRulesTargetMutator` described below. Class description: Base class for modifying forwarding rule targets. Method signatures and docstrings: - def Args(parser, include_beta_targets): Adds common flags for mutating forwarding rule targets. - def GetGlobalTarget(self, args): Return ...
Implement the Python class `ForwardingRulesTargetMutator` described below. Class description: Base class for modifying forwarding rule targets. Method signatures and docstrings: - def Args(parser, include_beta_targets): Adds common flags for mutating forwarding rule targets. - def GetGlobalTarget(self, args): Return ...
d379afa2db3582d5c3be652165f0e9e2e0c154c6
<|skeleton|> class ForwardingRulesTargetMutator: """Base class for modifying forwarding rule targets.""" def Args(parser, include_beta_targets): """Adds common flags for mutating forwarding rule targets.""" <|body_0|> def GetGlobalTarget(self, args): """Return the forwarding target...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ForwardingRulesTargetMutator: """Base class for modifying forwarding rule targets.""" def Args(parser, include_beta_targets): """Adds common flags for mutating forwarding rule targets.""" ForwardingRulesMutator.Args(parser) target = parser.add_mutually_exclusive_group(required=Tru...
the_stack_v2_python_sparse
y/google-cloud-sdk/lib/googlecloudsdk/compute/lib/forwarding_rules_utils.py
ychen820/microblog
train
0
7d696327500cc75771d42822ae7a22e282acbbe8
[ "try:\n assert init_ad_manage.get_title() == '广告管理'\n assert '广告管理' in init_ad_manage.get_info_title()\nexcept Exception as e:\n raise e", "init_search_ad[0].search_ad(ad.api_ad_name)\ntry:\n assert ad.api_ad_name in init_search_ad[0].get_ad_name()\n assert init_search_ad[0].get_status() == 'el-swi...
<|body_start_0|> try: assert init_ad_manage.get_title() == '广告管理' assert '广告管理' in init_ad_manage.get_info_title() except Exception as e: raise e <|end_body_0|> <|body_start_1|> init_search_ad[0].search_ad(ad.api_ad_name) try: assert ad.ap...
广告管理
TestAd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" <|body_0|> def test02_search_ad(self, init_search_ad): """广告名称搜索 :return:""" <|body_1|> def test03_add_ad(self, init_ad_manage): """新增广告 :return:""" ...
stack_v2_sparse_classes_10k_train_006859
1,641
no_license
[ { "docstring": "网页标题校验 :return:", "name": "test01_title_name", "signature": "def test01_title_name(self, init_ad_manage)" }, { "docstring": "广告名称搜索 :return:", "name": "test02_search_ad", "signature": "def test02_search_ad(self, init_search_ad)" }, { "docstring": "新增广告 :return:", ...
4
stack_v2_sparse_classes_30k_train_000882
Implement the Python class `TestAd` described below. Class description: 广告管理 Method signatures and docstrings: - def test01_title_name(self, init_ad_manage): 网页标题校验 :return: - def test02_search_ad(self, init_search_ad): 广告名称搜索 :return: - def test03_add_ad(self, init_ad_manage): 新增广告 :return: - def test04_del_ad(self,...
Implement the Python class `TestAd` described below. Class description: 广告管理 Method signatures and docstrings: - def test01_title_name(self, init_ad_manage): 网页标题校验 :return: - def test02_search_ad(self, init_search_ad): 广告名称搜索 :return: - def test03_add_ad(self, init_ad_manage): 新增广告 :return: - def test04_del_ad(self,...
b6905b765d84263439e459d6281cd2440e634cef
<|skeleton|> class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" <|body_0|> def test02_search_ad(self, init_search_ad): """广告名称搜索 :return:""" <|body_1|> def test03_add_ad(self, init_ad_manage): """新增广告 :return:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" try: assert init_ad_manage.get_title() == '广告管理' assert '广告管理' in init_ad_manage.get_info_title() except Exception as e: raise e def test02_search_ad(self...
the_stack_v2_python_sparse
TestCases/test_05_ad_page.py
Dake-M/boss_web_framework
train
0
aad0bf99b79d76a1c8563c40a4dd035058c8ae4f
[ "add_failed = kwargs.get('add_failed', False)\nadd_succeeded = kwargs.get('add_succeeded', False)\nbook_list = get_object_or_404(models.List, id=list_id)\nbook_list.raise_visible_to_user(request.user)\nif is_api_request(request):\n return ActivitypubResponse(book_list.to_activity(**request.GET))\nif (redirect_op...
<|body_start_0|> add_failed = kwargs.get('add_failed', False) add_succeeded = kwargs.get('add_succeeded', False) book_list = get_object_or_404(models.List, id=list_id) book_list.raise_visible_to_user(request.user) if is_api_request(request): return ActivitypubResponse...
book list page
List
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" <|body_0|> def post(self, request, list_id): """edit a list""" <|body_1|> <|end_skeleton|> <|body_start_0|> add_failed = kwargs.get('add_failed', Fal...
stack_v2_sparse_classes_10k_train_006860
11,267
no_license
[ { "docstring": "display a book list", "name": "get", "signature": "def get(self, request, list_id, **kwargs)" }, { "docstring": "edit a list", "name": "post", "signature": "def post(self, request, list_id)" } ]
2
null
Implement the Python class `List` described below. Class description: book list page Method signatures and docstrings: - def get(self, request, list_id, **kwargs): display a book list - def post(self, request, list_id): edit a list
Implement the Python class `List` described below. Class description: book list page Method signatures and docstrings: - def get(self, request, list_id, **kwargs): display a book list - def post(self, request, list_id): edit a list <|skeleton|> class List: """book list page""" def get(self, request, list_id...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" <|body_0|> def post(self, request, list_id): """edit a list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" add_failed = kwargs.get('add_failed', False) add_succeeded = kwargs.get('add_succeeded', False) book_list = get_object_or_404(models.List, id=list_id) book_list.raise_vi...
the_stack_v2_python_sparse
bookwyrm/views/list/list.py
bookwyrm-social/bookwyrm
train
1,398
362de0a7a2e1ac1a68f0152e50cdf6d41c3b7598
[ "self.host = host\nself.username = username\nself.password = password\nself.to_emails = to_emails\nself.subject = subject\nself.content = content", "msgRoot = MIMEMultipart('related')\nmsgRoot['Subject'] = self.subject\nmsgRoot['From'] = self.username\nmsgRoot['To'] = ','.join(self.to_emails)\nmsgRoot['Date'] = e...
<|body_start_0|> self.host = host self.username = username self.password = password self.to_emails = to_emails self.subject = subject self.content = content <|end_body_0|> <|body_start_1|> msgRoot = MIMEMultipart('related') msgRoot['Subject'] = self.subje...
MailSender
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailSender: def __init__(self, host, username, password, to_emails, subject, content): """初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param title 标题 @param content 内容""" <|body_0|> def send_mail(self): """发送邮件""" ...
stack_v2_sparse_classes_10k_train_006861
2,042
permissive
[ { "docstring": "初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param title 标题 @param content 内容", "name": "__init__", "signature": "def __init__(self, host, username, password, to_emails, subject, content)" }, { "docstring": "发送邮件", "name": "send_m...
2
stack_v2_sparse_classes_30k_train_005871
Implement the Python class `MailSender` described below. Class description: Implement the MailSender class. Method signatures and docstrings: - def __init__(self, host, username, password, to_emails, subject, content): 初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param ti...
Implement the Python class `MailSender` described below. Class description: Implement the MailSender class. Method signatures and docstrings: - def __init__(self, host, username, password, to_emails, subject, content): 初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param ti...
931fca8fab9d7397c52cf9e76a76b1c60e190403
<|skeleton|> class MailSender: def __init__(self, host, username, password, to_emails, subject, content): """初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param title 标题 @param content 内容""" <|body_0|> def send_mail(self): """发送邮件""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MailSender: def __init__(self, host, username, password, to_emails, subject, content): """初始化 @param host 邮件服务端host @param username 用户名 @param password 密码 @param to_emails 发送到邮箱列表 @param title 标题 @param content 内容""" self.host = host self.username = username self.password = pas...
the_stack_v2_python_sparse
src/utils/send_email.py
Karmenzind/fp-server
train
180
820fbc8c0f80aef66fee06ac927ec4a4e7525741
[ "supported_hashes = ', '.join(cls._SUPPORTED_HASHES)\nargument_group.add_argument('--viper-hash', '--viper_hash', dest='viper_hash', type=str, action='store', choices=cls._SUPPORTED_HASHES, default=cls._DEFAULT_HASH, metavar='HASH', help=f'Type of hash to use to query the Viper server, the default is: {cls._DEFAULT...
<|body_start_0|> supported_hashes = ', '.join(cls._SUPPORTED_HASHES) argument_group.add_argument('--viper-hash', '--viper_hash', dest='viper_hash', type=str, action='store', choices=cls._SUPPORTED_HASHES, default=cls._DEFAULT_HASH, metavar='HASH', help=f'Type of hash to use to query the Viper server, th...
Viper analysis plugin CLI arguments helper.
ViperAnalysisArgumentsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the co...
stack_v2_sparse_classes_10k_train_006862
4,018
permissive
[ { "docstring": "Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.", ...
2
stack_v2_sparse_classes_30k_train_007254
Implement the Python class `ViperAnalysisArgumentsHelper` described below. Class description: Viper analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an argument par...
Implement the Python class `ViperAnalysisArgumentsHelper` described below. Class description: Viper analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an argument par...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line ar...
the_stack_v2_python_sparse
plaso/cli/helpers/viper_analysis.py
log2timeline/plaso
train
1,506
019acd180f9ea97c0406f9698e498a47565b3660
[ "super().__init__()\nself.beta = nn.Parameter(torch.tensor(0.0, dtype=torch.float))\nself.score_no_click = nn.Parameter(torch.tensor(0.0, dtype=torch.float))", "batch_size = user.shape[0]\ns = torch.einsum('be,bde->bd', user, doc)\ns = s * self.beta\ns = torch.cat([s, self.score_no_click.expand((batch_size, 1))],...
<|body_start_0|> super().__init__() self.beta = nn.Parameter(torch.tensor(0.0, dtype=torch.float)) self.score_no_click = nn.Parameter(torch.tensor(0.0, dtype=torch.float)) <|end_body_0|> <|body_start_1|> batch_size = user.shape[0] s = torch.einsum('be,bde->bd', user, doc) ...
The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ext{score_no_click})
UserChoiceModel
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserChoiceModel: """The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ext{score_no_click})""" def __init...
stack_v2_sparse_classes_10k_train_006863
6,840
permissive
[ { "docstring": "Initializes a UserChoiceModel instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Evaluate the user choice model. This function outputs user click scores for candidate documents. The exponentials of these scores are proportional user click probabi...
2
stack_v2_sparse_classes_30k_test_000329
Implement the Python class `UserChoiceModel` described below. Class description: The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ...
Implement the Python class `UserChoiceModel` described below. Class description: The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class UserChoiceModel: """The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ext{score_no_click})""" def __init...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserChoiceModel: """The user choice model for SlateQ. This class implements a multinomial logit model for predicting user clicks. Under this model, the click probability of a document is proportional to: .. math:: \\exp( ext{beta} * ext{doc_user_affinity} + ext{score_no_click})""" def __init__(self): ...
the_stack_v2_python_sparse
rllib/algorithms/slateq/slateq_torch_model.py
ray-project/ray
train
29,482
403b4b9ba23ba10354f7848c7a985f2d35c59b54
[ "summaries = []\nselector = '#ae-content tr'\nrows = self.doc.cssselect(selector)\nassert len(rows)\nfor row in rows:\n children = list(row)\n assert len(children) == 5, [child.text for child in children]\n summaries.append({'appengine_release': Value.from_str(text(children[0])), 'total_instances': Value.f...
<|body_start_0|> summaries = [] selector = '#ae-content tr' rows = self.doc.cssselect(selector) assert len(rows) for row in rows: children = list(row) assert len(children) == 5, [child.text for child in children] summaries.append({'appengine_re...
An API for the contents of /instance_summary as structured data.
InstanceSummary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceSummary: """An API for the contents of /instance_summary as structured data.""" def summaries(self): """Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like these, where value is a Value instance whose .text() is shown...
stack_v2_sparse_classes_10k_train_006864
15,505
no_license
[ { "docstring": "Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like these, where value is a Value instance whose .text() is shown as an example: [{'appengine_release': '1.9.2', 'total_instances': '100 total', 'average_qps': '2.243', 'average_latency': '...
2
stack_v2_sparse_classes_30k_train_006754
Implement the Python class `InstanceSummary` described below. Class description: An API for the contents of /instance_summary as structured data. Method signatures and docstrings: - def summaries(self): Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like thes...
Implement the Python class `InstanceSummary` described below. Class description: An API for the contents of /instance_summary as structured data. Method signatures and docstrings: - def summaries(self): Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like thes...
c4ad2ad67b497ce411a9e5d6d6db407ee304491f
<|skeleton|> class InstanceSummary: """An API for the contents of /instance_summary as structured data.""" def summaries(self): """Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like these, where value is a Value instance whose .text() is shown...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceSummary: """An API for the contents of /instance_summary as structured data.""" def summaries(self): """Performance statistics summarized by App Engine release. Returns: A list of one or more dicts with fields like these, where value is a Value instance whose .text() is shown as an exampl...
the_stack_v2_python_sparse
src/gae_dashboard/parsers.py
summer-liu/analytics
train
1
061a058fffce77b9c6c92eaa0c6bce66261fcb2e
[ "self.sent_id_map = {str_i.lower(): i + 1 for i, str_i in enumerate(sentence_ids)}\nself.EOD_index = len(self.sent_id_map)\nself.max_doc_length = max_doc_length + 1\nself.max_sent_length = None\nself.PAD_index = 0", "numeric_context_docs = []\nfor doc in documents:\n doc = doc.split(' ')\n doc = [self.sent_...
<|body_start_0|> self.sent_id_map = {str_i.lower(): i + 1 for i, str_i in enumerate(sentence_ids)} self.EOD_index = len(self.sent_id_map) self.max_doc_length = max_doc_length + 1 self.max_sent_length = None self.PAD_index = 0 <|end_body_0|> <|body_start_1|> numeric_conte...
Creates numerical representations as input for the CIM model
Processor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" <|body_0|> def to_numeric_docume...
stack_v2_sparse_classes_10k_train_006865
21,540
no_license
[ { "docstring": "Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.", "name": "__init__", "signature": "def __init__(self, sentence_ids, max_doc_length)" }, { "docstring": "Creates numerical representations (sentence ids) for documents (= arti...
3
stack_v2_sparse_classes_30k_train_003744
Implement the Python class `Processor` described below. Class description: Creates numerical representations as input for the CIM model Method signatures and docstrings: - def __init__(self, sentence_ids, max_doc_length): Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pa...
Implement the Python class `Processor` described below. Class description: Creates numerical representations as input for the CIM model Method signatures and docstrings: - def __init__(self, sentence_ids, max_doc_length): Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pa...
400bfa885ddbbc5f1d7c40d3a9e9df37ecc81dc9
<|skeleton|> class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" <|body_0|> def to_numeric_docume...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" self.sent_id_map = {str_i.lower(): i + 1 for i, st...
the_stack_v2_python_sparse
experiments/context_inclusive_model.py
vdenberg/context-in-informational-bias-detection
train
3
1cbd42a9439d8a0ae321d906befc6e48993ecb12
[ "im = cv2.imread('sample_images/exam_1.jpg')\nis_success, im_buf_arr = cv2.imencode('.jpg', im)\nbyte_im = im_buf_arr.tobytes()\nresult = conn.insert_values_test(age=20, gender=1, handedness=1, image=byte_im)\nself.assertEqual(type(result), int, 'Checking output type.')\nself.assertNotEqual(result, 0, 'Incorrect da...
<|body_start_0|> im = cv2.imread('sample_images/exam_1.jpg') is_success, im_buf_arr = cv2.imencode('.jpg', im) byte_im = im_buf_arr.tobytes() result = conn.insert_values_test(age=20, gender=1, handedness=1, image=byte_im) self.assertEqual(type(result), int, 'Checking output type....
Class to test mysql_connection.
MysqlConnectionTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MysqlConnectionTest: """Class to test mysql_connection.""" def test_insert_values_test(self): """Method to test insert_values_test method in mysql_connection.""" <|body_0|> def test_insert_result_test_image(self): """Method to test insert_values_test_image method...
stack_v2_sparse_classes_10k_train_006866
5,327
no_license
[ { "docstring": "Method to test insert_values_test method in mysql_connection.", "name": "test_insert_values_test", "signature": "def test_insert_values_test(self)" }, { "docstring": "Method to test insert_values_test_image method in mysql_connection.", "name": "test_insert_result_test_image"...
4
stack_v2_sparse_classes_30k_train_001766
Implement the Python class `MysqlConnectionTest` described below. Class description: Class to test mysql_connection. Method signatures and docstrings: - def test_insert_values_test(self): Method to test insert_values_test method in mysql_connection. - def test_insert_result_test_image(self): Method to test insert_val...
Implement the Python class `MysqlConnectionTest` described below. Class description: Class to test mysql_connection. Method signatures and docstrings: - def test_insert_values_test(self): Method to test insert_values_test method in mysql_connection. - def test_insert_result_test_image(self): Method to test insert_val...
b4943fea82483c6910694d7c4c40e3715f65c3b5
<|skeleton|> class MysqlConnectionTest: """Class to test mysql_connection.""" def test_insert_values_test(self): """Method to test insert_values_test method in mysql_connection.""" <|body_0|> def test_insert_result_test_image(self): """Method to test insert_values_test_image method...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MysqlConnectionTest: """Class to test mysql_connection.""" def test_insert_values_test(self): """Method to test insert_values_test method in mysql_connection.""" im = cv2.imread('sample_images/exam_1.jpg') is_success, im_buf_arr = cv2.imencode('.jpg', im) byte_im = im_buf_...
the_stack_v2_python_sparse
Backend/DetectPD/test_mysql_connection.py
RadhikaRanasinghe/Meraki
train
5
31c7d54cb2ebf974366c31050cedde8cf2113d27
[ "super(Funnel, self).__init__()\nself.conv_funnel = nn.Conv2d(in_channels, in_channels, 3, 1, 1, groups=in_channels)\nself.bn_funnel = nn.BatchNorm2d(in_channels)", "tau = self.conv_funnel(input)\ntau = self.bn_funnel(tau)\noutput = torch.max(input, tau)\nreturn output" ]
<|body_start_0|> super(Funnel, self).__init__() self.conv_funnel = nn.Conv2d(in_channels, in_channels, 3, 1, 1, groups=in_channels) self.bn_funnel = nn.BatchNorm2d(in_channels) <|end_body_0|> <|body_start_1|> tau = self.conv_funnel(input) tau = self.bn_funnel(tau) output...
Funnel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Funnel: def __init__(self, in_channels): """Init method.""" <|body_0|> def forward(self, input): """Forward pass of the function""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Funnel, self).__init__() self.conv_funnel = nn.Conv2d(in_c...
stack_v2_sparse_classes_10k_train_006867
32,265
no_license
[ { "docstring": "Init method.", "name": "__init__", "signature": "def __init__(self, in_channels)" }, { "docstring": "Forward pass of the function", "name": "forward", "signature": "def forward(self, input)" } ]
2
stack_v2_sparse_classes_30k_test_000025
Implement the Python class `Funnel` described below. Class description: Implement the Funnel class. Method signatures and docstrings: - def __init__(self, in_channels): Init method. - def forward(self, input): Forward pass of the function
Implement the Python class `Funnel` described below. Class description: Implement the Funnel class. Method signatures and docstrings: - def __init__(self, in_channels): Init method. - def forward(self, input): Forward pass of the function <|skeleton|> class Funnel: def __init__(self, in_channels): """In...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Funnel: def __init__(self, in_channels): """Init method.""" <|body_0|> def forward(self, input): """Forward pass of the function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Funnel: def __init__(self, in_channels): """Init method.""" super(Funnel, self).__init__() self.conv_funnel = nn.Conv2d(in_channels, in_channels, 3, 1, 1, groups=in_channels) self.bn_funnel = nn.BatchNorm2d(in_channels) def forward(self, input): """Forward pass of ...
the_stack_v2_python_sparse
generated/test_digantamisra98_Echo.py
jansel/pytorch-jit-paritybench
train
35
69d16ae20e4310f10b9ae804afebc7875377f2a9
[ "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('.desc h5').text\nlogger.info('Novel title: %s', self.novel_title)\nself.novel_cover = self.absolute_url(soup.select_one('.about-author .row img')['src'])\nlogger.info('Novel cover: %s', self.novel...
<|body_start_0|> logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.desc h5').text logger.info('Novel title: %s', self.novel_title) self.novel_cover = self.absolute_url(soup.select_one('.about-author .row img')['s...
MachineNovelTrans
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> def format_text(self, text): ...
stack_v2_sparse_classes_10k_train_006868
2,664
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format.", "name": "download_chapter_body", "signature": "def download_chapter_body(self, c...
3
stack_v2_sparse_classes_30k_train_000989
Implement the Python class `MachineNovelTrans` described below. Class description: Implement the MachineNovelTrans class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean h...
Implement the Python class `MachineNovelTrans` described below. Class description: Implement the MachineNovelTrans class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as clean h...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> def format_text(self, text): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MachineNovelTrans: def read_novel_info(self): """Get novel title, autor, cover etc""" logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.desc h5').text logger.info('Novel title: %s', self.novel_title) ...
the_stack_v2_python_sparse
lncrawl/sources/machinetrans.py
NNTin/lightnovel-crawler
train
2
dfb6dffb0f177d15b329a7ec41cdbdf6521be772
[ "try:\n serializer = RadiologistPmtSerializers(RadiologistPmt.objects.all(), many=True)\n return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)\nexcept Exception as e:\n info_message = 'Internal Server Error'\n logger.error(info_message, e)\n return JsonResponse({'error'...
<|body_start_0|> try: serializer = RadiologistPmtSerializers(RadiologistPmt.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exception as e: info_message = 'Internal Server Error' logger.e...
RadiologistPmtView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadiologistPmtView: def get(self, request): """Get all Radiologist_Payment""" <|body_0|> def post(self, request): """Save Radiologist data""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: serializer = RadiologistPmtSerializers(Radiol...
stack_v2_sparse_classes_10k_train_006869
31,833
no_license
[ { "docstring": "Get all Radiologist_Payment", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Save Radiologist data", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_001536
Implement the Python class `RadiologistPmtView` described below. Class description: Implement the RadiologistPmtView class. Method signatures and docstrings: - def get(self, request): Get all Radiologist_Payment - def post(self, request): Save Radiologist data
Implement the Python class `RadiologistPmtView` described below. Class description: Implement the RadiologistPmtView class. Method signatures and docstrings: - def get(self, request): Get all Radiologist_Payment - def post(self, request): Save Radiologist data <|skeleton|> class RadiologistPmtView: def get(self...
b63849983a592fd6a1f654191020fd86aa0787ae
<|skeleton|> class RadiologistPmtView: def get(self, request): """Get all Radiologist_Payment""" <|body_0|> def post(self, request): """Save Radiologist data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RadiologistPmtView: def get(self, request): """Get all Radiologist_Payment""" try: serializer = RadiologistPmtSerializers(RadiologistPmt.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exceptio...
the_stack_v2_python_sparse
radiologist/views.py
RupeshKurlekar/biocare
train
1
84afd4eb2a6ea027dde53cc27aedbde599f8c9b8
[ "aicpu_file_path = os.path.join(self._profiling_dir, self._file_name_aicpu_time.format(self._device_id))\naicpu_file_path = validate_and_normalize_path(aicpu_file_path, raise_key='Invalid aicpu file path.')\nif not os.path.isfile(aicpu_file_path):\n logger.warning('The file <%s> does not exist.', aicpu_file_path...
<|body_start_0|> aicpu_file_path = os.path.join(self._profiling_dir, self._file_name_aicpu_time.format(self._device_id)) aicpu_file_path = validate_and_normalize_path(aicpu_file_path, raise_key='Invalid aicpu file path.') if not os.path.isfile(aicpu_file_path): logger.warning('The fi...
The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is invalid.
AicpuDetailAnalyser
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AicpuDetailAnalyser: """The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is invalid.""" def _load(self): ...
stack_v2_sparse_classes_10k_train_006870
25,551
permissive
[ { "docstring": "Load data according to the parsed AICPU operator file.", "name": "_load", "signature": "def _load(self)" }, { "docstring": "Filter the profiling data according to the filter condition. Args: filter_condition (dict): The filter condition.", "name": "_filter", "signature": ...
3
null
Implement the Python class `AicpuDetailAnalyser` described below. Class description: The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is inv...
Implement the Python class `AicpuDetailAnalyser` described below. Class description: The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is inv...
a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1
<|skeleton|> class AicpuDetailAnalyser: """The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is invalid.""" def _load(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AicpuDetailAnalyser: """The analyser for analyzing all the AICPU operators. Args: profiling_dir (str): The directory where the parsed profiling files are located. device_id (str): The device ID. Raises: ProfilerPathErrorException: If the profiling dir is invalid.""" def _load(self): """Load data ...
the_stack_v2_python_sparse
mindinsight/profiler/analyser/analyser.py
mindspore-ai/mindinsight
train
224
796586866a0924c6e2aae0f964067f7e2af7c499
[ "kwargs = {}\nkwargs['status'] = 1\ntday = datetime.utcnow().replace(tzinfo=utc)\nkwargs['startingdate__lte'] = datetime(tday.year, tday.month, tday.day, tday.hour, tday.minute, tday.second, tday.microsecond).replace(tzinfo=utc)\nkwargs['expirationdate__gte'] = datetime(tday.year, tday.month, tday.day, tday.hour, t...
<|body_start_0|> kwargs = {} kwargs['status'] = 1 tday = datetime.utcnow().replace(tzinfo=utc) kwargs['startingdate__lte'] = datetime(tday.year, tday.month, tday.day, tday.hour, tday.minute, tday.second, tday.microsecond).replace(tzinfo=utc) kwargs['expirationdate__gte'] = dateti...
Campaign Manager
CampaignManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignManager: """Campaign Manager""" def get_running_campaign(self): """Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week""" <|body_0|> def get_expired_campaign(self): """Return all t...
stack_v2_sparse_classes_10k_train_006871
27,513
no_license
[ { "docstring": "Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week", "name": "get_running_campaign", "signature": "def get_running_campaign(self)" }, { "docstring": "Return all the campaigns which are expired or going to...
2
stack_v2_sparse_classes_30k_train_005004
Implement the Python class `CampaignManager` described below. Class description: Campaign Manager Method signatures and docstrings: - def get_running_campaign(self): Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week - def get_expired_campaig...
Implement the Python class `CampaignManager` described below. Class description: Campaign Manager Method signatures and docstrings: - def get_running_campaign(self): Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week - def get_expired_campaig...
2923a7d974f362af91b7c7c8f2e208cb2353c921
<|skeleton|> class CampaignManager: """Campaign Manager""" def get_running_campaign(self): """Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week""" <|body_0|> def get_expired_campaign(self): """Return all t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CampaignManager: """Campaign Manager""" def get_running_campaign(self): """Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week""" kwargs = {} kwargs['status'] = 1 tday = datetime.utcnow().replace(tz...
the_stack_v2_python_sparse
dialer_campaign/models.py
goksie/TheFies
train
0
4dd6533dc0634bca5c0166663869350d57b79e9b
[ "self._arr = arr\nself._n = len(arr)\nself._row = 0\nself._col = 0", "while self._row < self._n and (not self._arr[self._row]):\n self._row += 1\n self._col = 0\nif self._row >= self._n:\n raise ValueError('No element left')\nanswer = self._arr[self._row][self._col]\nif self._col == len(self._arr[self._r...
<|body_start_0|> self._arr = arr self._n = len(arr) self._row = 0 self._col = 0 <|end_body_0|> <|body_start_1|> while self._row < self._n and (not self._arr[self._row]): self._row += 1 self._col = 0 if self._row >= self._n: raise Value...
Iterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Iterator: def __init__(self, arr): """initialize Iterator object with an array of arrays""" <|body_0|> def next(self): """returns the next element in the array of arrays""" <|body_1|> def has_next(self): """returns whether or not the iterator sti...
stack_v2_sparse_classes_10k_train_006872
2,888
no_license
[ { "docstring": "initialize Iterator object with an array of arrays", "name": "__init__", "signature": "def __init__(self, arr)" }, { "docstring": "returns the next element in the array of arrays", "name": "next", "signature": "def next(self)" }, { "docstring": "returns whether or...
3
stack_v2_sparse_classes_30k_train_002083
Implement the Python class `Iterator` described below. Class description: Implement the Iterator class. Method signatures and docstrings: - def __init__(self, arr): initialize Iterator object with an array of arrays - def next(self): returns the next element in the array of arrays - def has_next(self): returns whethe...
Implement the Python class `Iterator` described below. Class description: Implement the Iterator class. Method signatures and docstrings: - def __init__(self, arr): initialize Iterator object with an array of arrays - def next(self): returns the next element in the array of arrays - def has_next(self): returns whethe...
4ad9063188e07e27a539d42140dabfdcaca608af
<|skeleton|> class Iterator: def __init__(self, arr): """initialize Iterator object with an array of arrays""" <|body_0|> def next(self): """returns the next element in the array of arrays""" <|body_1|> def has_next(self): """returns whether or not the iterator sti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Iterator: def __init__(self, arr): """initialize Iterator object with an array of arrays""" self._arr = arr self._n = len(arr) self._row = 0 self._col = 0 def next(self): """returns the next element in the array of arrays""" while self._row < self._...
the_stack_v2_python_sparse
python/166.py
lakshyatyagi24/daily-coding-problems
train
1
82588d123227f13c92810d0e1840fcb1234044b1
[ "self.user = user or current_user()\nself.spec = sorted_dict(spec)\nself.created = datetime.now().astimezone()", "new_spec = ContainerSpec(spec, user)\nexisting = session.query(ContainerSpec)\nexisting = existing.filter(ContainerSpec.user == new_spec.user, ContainerSpec.spec.cast(String) == json.dumps(new_spec.sp...
<|body_start_0|> self.user = user or current_user() self.spec = sorted_dict(spec) self.created = datetime.now().astimezone() <|end_body_0|> <|body_start_1|> new_spec = ContainerSpec(spec, user) existing = session.query(ContainerSpec) existing = existing.filter(ContainerS...
caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() method, or query the database using a session.query() call. The get_or_create() m...
ContainerSpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainerSpec: """caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() method, or query the database using a se...
stack_v2_sparse_classes_10k_train_006873
18,576
permissive
[ { "docstring": "ContainerSpec Args: spec: dictionary containing docker container creation parameters user: username, if None then user is automatically detected", "name": "__init__", "signature": "def __init__(self, spec: Dict[str, Any], user: Optional[str]=None)" }, { "docstring": "gets an exis...
2
stack_v2_sparse_classes_30k_train_000876
Implement the Python class `ContainerSpec` described below. Class description: caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() m...
Implement the Python class `ContainerSpec` described below. Class description: caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() m...
d0e792a8e72fe5cbc186c47a2541e94d5b94c319
<|skeleton|> class ContainerSpec: """caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() method, or query the database using a se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContainerSpec: """caliban container spec This class contains the information specifying how to generate a docker container for use in caliban. Please do not instantiate this class directly via its constructor. Instead, use the ContainerSpec.get_or_create() method, or query the database using a session.query()...
the_stack_v2_python_sparse
caliban/history/types.py
google/caliban
train
499
e21a20afbea56534d5163025dc7f9af39c5520cd
[ "assert len(observation_space.shape) == 1, 'Only flat spaces supported by MLP model'\nassert len(action_space.shape) == 1, 'Only flat action spaces supported by MLP model'\nsuper().__init__(observation_space, action_space, signal_space)\nself.policy_weight = policy_weight\nself.reward_scale = signal_space.span\nsel...
<|body_start_0|> assert len(observation_space.shape) == 1, 'Only flat spaces supported by MLP model' assert len(action_space.shape) == 1, 'Only flat action spaces supported by MLP model' super().__init__(observation_space, action_space, signal_space) self.policy_weight = policy_weight ...
Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model that given the encoded state and encoded action computes predicts the encode...
MLPICM
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLPICM: """Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model that given the encoded state and encoded a...
stack_v2_sparse_classes_10k_train_006874
8,668
permissive
[ { "docstring": ":param policy_weight: weight to be applied to the ``policy_loss`` in the ``loss`` method. Allows to control how important optimizing policy to optimizing the curiosity module :param signal_space: used for scaling the intrinsic reward returned by this module. Can be used to control how the fluctu...
4
stack_v2_sparse_classes_30k_train_007306
Implement the Python class `MLPICM` described below. Class description: Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model tha...
Implement the Python class `MLPICM` described below. Class description: Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model tha...
21e3564696062b67151b013fd5e47df46cf44aa5
<|skeleton|> class MLPICM: """Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model that given the encoded state and encoded a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MLPICM: """Implements the Intrinsic Curiosity Module described in paper: https://arxiv.org/pdf/1705.05363.pdf The overview of the idea is to reward the agent for exploring unseen states. It is achieved by implementing two models. One called forward model that given the encoded state and encoded action compute...
the_stack_v2_python_sparse
neodroidagent/utilities/exploration/intrinsic_signals/torch_isp/curiosity/icm.py
sintefneodroid/agent
train
9
28082e881cd4a9ea3e32d5330da77882be12ba43
[ "super(CloseButton, self).__init__()\nclose_button_style = \" \\n style 'close_button' {\\n xthickness = 0\\n ythickness = 0\\n }\\n widget '*.close_button' style 'close_button'\\n \"\ngtk.rc_parse_string(close_button_style)\nself.set_name('widge...
<|body_start_0|> super(CloseButton, self).__init__() close_button_style = " \n style 'close_button' {\n xthickness = 0\n ythickness = 0\n }\n widget '*.close_button' style 'close_button'\n " gtk.rc_parse_string(close_button_st...
CloseButton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloseButton: def __init__(self): """Constructor.""" <|body_0|> def __add_icon_to_button(self): """Add the close image to this button.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(CloseButton, self).__init__() close_button_style = " ...
stack_v2_sparse_classes_10k_train_006875
2,000
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add the close image to this button.", "name": "__add_icon_to_button", "signature": "def __add_icon_to_button(self)" } ]
2
stack_v2_sparse_classes_30k_train_005911
Implement the Python class `CloseButton` described below. Class description: Implement the CloseButton class. Method signatures and docstrings: - def __init__(self): Constructor. - def __add_icon_to_button(self): Add the close image to this button.
Implement the Python class `CloseButton` described below. Class description: Implement the CloseButton class. Method signatures and docstrings: - def __init__(self): Constructor. - def __add_icon_to_button(self): Add the close image to this button. <|skeleton|> class CloseButton: def __init__(self): """...
c21ddf8aba58dc83d58a8db960d58d91ee2e5c74
<|skeleton|> class CloseButton: def __init__(self): """Constructor.""" <|body_0|> def __add_icon_to_button(self): """Add the close image to this button.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CloseButton: def __init__(self): """Constructor.""" super(CloseButton, self).__init__() close_button_style = " \n style 'close_button' {\n xthickness = 0\n ythickness = 0\n }\n widget '*.close_button' style 'close_button'\n...
the_stack_v2_python_sparse
tf/widgets/closebutton.py
yurimalheiros/textflow
train
1
ec2de037caa934fae26890a823a4795a64c0cc2f
[ "try:\n sh.zfs('list', '-t', 'filesystem', self.name)\nexcept sh.ErrorReturnCode_1:\n return False\nreturn True", "try:\n sh.zfs('create', self.name)\nexcept sh.ErrorReturnCode_1:\n raise\nreturn True", "if not confirm:\n raise LoggedException('Destroy of storage filesystem requires confirm=True'...
<|body_start_0|> try: sh.zfs('list', '-t', 'filesystem', self.name) except sh.ErrorReturnCode_1: return False return True <|end_body_0|> <|body_start_1|> try: sh.zfs('create', self.name) except sh.ErrorReturnCode_1: raise r...
Filesystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filesystem: def exists(self): """Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists()""" <|body_0|> def create(self): """Creates storage filesystem. filesystem = Filesystem('dpool/tmp/test0') filesystem.create()""" <|bod...
stack_v2_sparse_classes_10k_train_006876
13,193
no_license
[ { "docstring": "Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists()", "name": "exists", "signature": "def exists(self)" }, { "docstring": "Creates storage filesystem. filesystem = Filesystem('dpool/tmp/test0') filesystem.create()", "name": "create", ...
4
stack_v2_sparse_classes_30k_train_006082
Implement the Python class `Filesystem` described below. Class description: Implement the Filesystem class. Method signatures and docstrings: - def exists(self): Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists() - def create(self): Creates storage filesystem. filesystem = Fil...
Implement the Python class `Filesystem` described below. Class description: Implement the Filesystem class. Method signatures and docstrings: - def exists(self): Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists() - def create(self): Creates storage filesystem. filesystem = Fil...
9bc47e6eeff2944f98a0db4fcab32c5dd95fd025
<|skeleton|> class Filesystem: def exists(self): """Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists()""" <|body_0|> def create(self): """Creates storage filesystem. filesystem = Filesystem('dpool/tmp/test0') filesystem.create()""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Filesystem: def exists(self): """Checks if filesystem exists. filesystem = Filesystem('dpool/tmp/test0') filesystem.exists()""" try: sh.zfs('list', '-t', 'filesystem', self.name) except sh.ErrorReturnCode_1: return False return True def create(self)...
the_stack_v2_python_sparse
solarsanweb/storage/dataset.py
akatrevorjay/solarsanweb
train
1
114a946be963339ce6fb775790365727f836c884
[ "super().__init__()\nself.length = len(inputs[0])\nif not all((len(inp) == self.length for inp in inputs)):\n raise ValueError('Lengths of inputs, i.e. number of fields or embedding size, must be equal.')\nself.inputs = inputs\ninputs = []\nfor idx, inp in enumerate(self.inputs):\n self.add_module(f'Input_{id...
<|body_start_0|> super().__init__() self.length = len(inputs[0]) if not all((len(inp) == self.length for inp in inputs)): raise ValueError('Lengths of inputs, i.e. number of fields or embedding size, must be equal.') self.inputs = inputs inputs = [] for idx, i...
Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i.
StackedInput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackedInput: """Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i.""" def __init__(self, inputs: List[BaseInput]): """Initialize StackedInput...
stack_v2_sparse_classes_10k_train_006877
4,892
permissive
[ { "docstring": "Initialize StackedInputs Args: inputs (List[BaseInput]): list of input's layers (trs.inputs.Inputs). e.g. .. code-block:: python import torecsys as trs # initialize embedding layers used in StackedInputs single_index_emb_0 = trs.inputs.base.SingleIndexEmbedding(2, 8) single_index_emb_1 = trs.inp...
3
stack_v2_sparse_classes_30k_train_005872
Implement the Python class `StackedInput` described below. Class description: Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i. Method signatures and docstrings: - def __init_...
Implement the Python class `StackedInput` described below. Class description: Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i. Method signatures and docstrings: - def __init_...
751a43b9cd35e951d81c0d9cf46507b1777bb7ff
<|skeleton|> class StackedInput: """Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i.""" def __init__(self, inputs: List[BaseInput]): """Initialize StackedInput...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StackedInput: """Base Input class for stacking of list of Base Input class in column-wise. The shape of output is :math:`(B, N_{1} + ... + N_{k}, E)`, where :math:`N_{i}` is number of fields of inputs class i.""" def __init__(self, inputs: List[BaseInput]): """Initialize StackedInputs Args: input...
the_stack_v2_python_sparse
torecsys/inputs/base/stacked_inp.py
p768lwy3/torecsys
train
98
df1d79e837958e3fdd1db3db4202e775a9a5fabf
[ "super(CWS, self).__init__()\nif model_path is None:\n model_path = model_urls['cws']\nself.load(model_path, device)", "if not hasattr(self, 'pipeline'):\n raise ValueError('You have to load model first.')\nsentence_list = []\nif isinstance(content, str):\n sentence_list.append(content)\nelif isinstance(...
<|body_start_0|> super(CWS, self).__init__() if model_path is None: model_path = model_urls['cws'] self.load(model_path, device) <|end_body_0|> <|body_start_1|> if not hasattr(self, 'pipeline'): raise ValueError('You have to load model first.') sentence_l...
CWS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CWS: def __init__(self, model_path=None, device='cpu'): """中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应device进行推断。""" <|body_0|> def predict(self, content): """分词接口。 :param cont...
stack_v2_sparse_classes_10k_train_006878
11,931
permissive
[ { "docstring": "中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应device进行推断。", "name": "__init__", "signature": "def __init__(self, model_path=None, device='cpu')" }, { "docstring": "分词接口。 :param content: str或Li...
3
stack_v2_sparse_classes_30k_train_006732
Implement the Python class `CWS` described below. Class description: Implement the CWS class. Method signatures and docstrings: - def __init__(self, model_path=None, device='cpu'): 中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应dev...
Implement the Python class `CWS` described below. Class description: Implement the CWS class. Method signatures and docstrings: - def __init__(self, model_path=None, device='cpu'): 中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应dev...
209e0aec44eb100ad5c30c75b84d28711e2968f5
<|skeleton|> class CWS: def __init__(self, model_path=None, device='cpu'): """中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应device进行推断。""" <|body_0|> def predict(self, content): """分词接口。 :param cont...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CWS: def __init__(self, model_path=None, device='cpu'): """中文分词高级接口。 :param model_path: 当model_path为None,使用默认位置的model。如果默认位置不存在,则自动下载模型 :param device: str,可以为'cpu', 'cuda'或'cuda:0'等。会将模型load到相应device进行推断。""" super(CWS, self).__init__() if model_path is None: model_path = mo...
the_stack_v2_python_sparse
fastNLP/api/api.py
huziye/fastNLP_fork
train
4
0d29a47cff4aa8c9d70176e614d8fa386ab03461
[ "gym.Wrapper.__init__(self, env)\nself.noop_max = noop_max\nself.noop_action = 0\nassert env.unwrapped.get_action_meanings()[0] == 'NOOP'", "self.env.reset()\nnoops = random.randrange(1, self.noop_max + 1)\nassert noops > 0\nobs = None\nfor _ in range(noops):\n obs, _, done, _ = self.env.step(self.noop_action)...
<|body_start_0|> gym.Wrapper.__init__(self, env) self.noop_max = noop_max self.noop_action = 0 assert env.unwrapped.get_action_meanings()[0] == 'NOOP' <|end_body_0|> <|body_start_1|> self.env.reset() noops = random.randrange(1, self.noop_max + 1) assert noops > 0...
NoopResetEnv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoopResetEnv: def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.""" <|body_0|> def _reset(self): """Do no-op action for a number of steps in [1, noop_max].""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_006879
16,880
permissive
[ { "docstring": "Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.", "name": "__init__", "signature": "def __init__(self, env, noop_max=30)" }, { "docstring": "Do no-op action for a number of steps in [1, noop_max].", "name": "_reset", "sig...
2
stack_v2_sparse_classes_30k_train_001150
Implement the Python class `NoopResetEnv` described below. Class description: Implement the NoopResetEnv class. Method signatures and docstrings: - def __init__(self, env, noop_max=30): Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. - def _reset(self): Do no-op acti...
Implement the Python class `NoopResetEnv` described below. Class description: Implement the NoopResetEnv class. Method signatures and docstrings: - def __init__(self, env, noop_max=30): Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. - def _reset(self): Do no-op acti...
9eb833f1f5a144f49849d2bc9ab90450b3c8a6dd
<|skeleton|> class NoopResetEnv: def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.""" <|body_0|> def _reset(self): """Do no-op action for a number of steps in [1, noop_max].""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoopResetEnv: def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.""" gym.Wrapper.__init__(self, env) self.noop_max = noop_max self.noop_action = 0 assert env.unwrapped.get_action_mea...
the_stack_v2_python_sparse
rl_a3c_pytorch/environment_for_render.py
doronsobol/Visual_analogies_for_RL_transfer_Learning
train
2
a905071c08010b848a2f724a92b6d66768ff291e
[ "self.dq = collections.deque([])\nself.size = size\nself.sumval = 0", "if len(self.dq) < self.size:\n self.sumval += val\n self.dq.append(val)\n return float(self.sumval) / float(len(self.dq))\nelse:\n v = self.dq.popleft()\n self.sumval -= v\n self.sumval += val\n self.dq.append(val)\n re...
<|body_start_0|> self.dq = collections.deque([]) self.size = size self.sumval = 0 <|end_body_0|> <|body_start_1|> if len(self.dq) < self.size: self.sumval += val self.dq.append(val) return float(self.sumval) / float(len(self.dq)) else: ...
MovingAverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dq = collections.deque([]) ...
stack_v2_sparse_classes_10k_train_006880
816
permissive
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
null
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
86f1cb98de801f58c39d9a48ce9de12df7303d20
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.dq = collections.deque([]) self.size = size self.sumval = 0 def next(self, val): """:type val: int :rtype: float""" if len(self.dq) < self.size: ...
the_stack_v2_python_sparse
346-Moving-Average-from-Data-Stream/solution.py
Tanych/CodeTracking
train
0
21fbbfcad9794510e944e7cdd41421592ceb719d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EducationAssignmentResource()", "from .education_resource import EducationResource\nfrom .entity import Entity\nfrom .education_resource import EducationResource\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return EducationAssignmentResource() <|end_body_0|> <|body_start_1|> from .education_resource import EducationResource from .entity import Entity from .education_resource import Educati...
EducationAssignmentResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationAssignmentResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationAssignmentResource: """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 a...
stack_v2_sparse_classes_10k_train_006881
2,633
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: EducationAssignmentResource", "name": "create_from_discriminator_value", "signature": "def create_from_discr...
3
null
Implement the Python class `EducationAssignmentResource` described below. Class description: Implement the EducationAssignmentResource class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationAssignmentResource: Creates a new instance of the appr...
Implement the Python class `EducationAssignmentResource` described below. Class description: Implement the EducationAssignmentResource class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationAssignmentResource: Creates a new instance of the appr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EducationAssignmentResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationAssignmentResource: """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 a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EducationAssignmentResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationAssignmentResource: """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 ...
the_stack_v2_python_sparse
msgraph/generated/models/education_assignment_resource.py
microsoftgraph/msgraph-sdk-python
train
135
ec0b4f55127dd62f571acb7541b3adabe5bbad49
[ "super().__init__(name=name)\nself._embedding_dim = embedding_dim\nif number_of_dom_encoder_layers < 0:\n raise ValueError('Number of DOM encoder layers should be > 0 but got %d' % number_of_dom_encoder_layers)\nif number_of_profile_encoder_layers < 0:\n raise ValueError('Number of profile encoder layers shou...
<|body_start_0|> super().__init__(name=name) self._embedding_dim = embedding_dim if number_of_dom_encoder_layers < 0: raise ValueError('Number of DOM encoder layers should be > 0 but got %d' % number_of_dom_encoder_layers) if number_of_profile_encoder_layers < 0: ...
Feed forward DQN for web navigation.
DQNWebFF
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQNWebFF: """Feed forward DQN for web navigation.""" def __init__(self, vocab_size, embedding_dim, latent_dim, number_of_dom_encoder_layers=1, number_of_profile_encoder_layers=1, embedding_initializer=None, profile_value_dropout=0.0, use_select_option_dim=False, name=None, return_state_value...
stack_v2_sparse_classes_10k_train_006882
21,865
permissive
[ { "docstring": "DQN with feed forward DOM encoder. Profile and DOM are independently encoded into tensors where profile tensor represents field encodings while DOM tensor represents element encodings. These two tensors are used score every element and field pairs. Scores correspond to Q values in DQN or logits ...
2
stack_v2_sparse_classes_30k_train_007079
Implement the Python class `DQNWebFF` described below. Class description: Feed forward DQN for web navigation. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, latent_dim, number_of_dom_encoder_layers=1, number_of_profile_encoder_layers=1, embedding_initializer=None, profile_value_dro...
Implement the Python class `DQNWebFF` described below. Class description: Feed forward DQN for web navigation. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, latent_dim, number_of_dom_encoder_layers=1, number_of_profile_encoder_layers=1, embedding_initializer=None, profile_value_dro...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class DQNWebFF: """Feed forward DQN for web navigation.""" def __init__(self, vocab_size, embedding_dim, latent_dim, number_of_dom_encoder_layers=1, number_of_profile_encoder_layers=1, embedding_initializer=None, profile_value_dropout=0.0, use_select_option_dim=False, name=None, return_state_value...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DQNWebFF: """Feed forward DQN for web navigation.""" def __init__(self, vocab_size, embedding_dim, latent_dim, number_of_dom_encoder_layers=1, number_of_profile_encoder_layers=1, embedding_initializer=None, profile_value_dropout=0.0, use_select_option_dim=False, name=None, return_state_value=False): ...
the_stack_v2_python_sparse
compositional_rl/gwob/CoDE/q_networks.py
Jimmy-INL/google-research
train
1
8f6a372869a9445f5b037d4a036eea48007fc3dd
[ "username = self.cleaned_data['username']\ntry:\n User.objects.get(username=username)\nexcept User.DoesNotExist:\n return username\nraise ValidationError(_('A user with that username already exists.'))", "password1 = self.cleaned_data.get('password1', '')\npassword2 = self.cleaned_data['password2']\nif pass...
<|body_start_0|> username = self.cleaned_data['username'] try: User.objects.get(username=username) except User.DoesNotExist: return username raise ValidationError(_('A user with that username already exists.')) <|end_body_0|> <|body_start_1|> password1 = ...
Form for registering a new user account
RegistrationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationForm: """Form for registering a new user account""" def clean_username(self): """Verify username not existed in database""" <|body_0|> def clean_password2(self): """Verify password2 is the same as password1""" <|body_1|> def save(self, co...
stack_v2_sparse_classes_10k_train_006883
3,293
no_license
[ { "docstring": "Verify username not existed in database", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Verify password2 is the same as password1", "name": "clean_password2", "signature": "def clean_password2(self)" }, { "docstring": "Save U...
3
stack_v2_sparse_classes_30k_train_007143
Implement the Python class `RegistrationForm` described below. Class description: Form for registering a new user account Method signatures and docstrings: - def clean_username(self): Verify username not existed in database - def clean_password2(self): Verify password2 is the same as password1 - def save(self, commit...
Implement the Python class `RegistrationForm` described below. Class description: Form for registering a new user account Method signatures and docstrings: - def clean_username(self): Verify username not existed in database - def clean_password2(self): Verify password2 is the same as password1 - def save(self, commit...
04541d41bb2fe3d7217b43202ff0d999c82d1e9e
<|skeleton|> class RegistrationForm: """Form for registering a new user account""" def clean_username(self): """Verify username not existed in database""" <|body_0|> def clean_password2(self): """Verify password2 is the same as password1""" <|body_1|> def save(self, co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegistrationForm: """Form for registering a new user account""" def clean_username(self): """Verify username not existed in database""" username = self.cleaned_data['username'] try: User.objects.get(username=username) except User.DoesNotExist: retur...
the_stack_v2_python_sparse
apps/account/forms.py
lifepy/myway
train
2
6a0a0783428edc8dca7a1a5f1b7346a6c8d1cfe9
[ "self.sums = []\nfor weight in w:\n if not self.sums:\n self.sums.append(weight)\n else:\n self.sums.append(weight + self.sums[-1])", "import bisect\npick = random.uniform(0, self.sums[-1])\nreturn bisect.bisect_left(self.sums, pick)" ]
<|body_start_0|> self.sums = [] for weight in w: if not self.sums: self.sums.append(weight) else: self.sums.append(weight + self.sums[-1]) <|end_body_0|> <|body_start_1|> import bisect pick = random.uniform(0, self.sums[-1]) ...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sums = [] for weight in w: if not self.sums: se...
stack_v2_sparse_classes_10k_train_006884
1,901
no_license
[ { "docstring": ":type w: List[int] 176ms", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] 176ms - def pickIndex(self): :rtype: int
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] 176ms - def pickIndex(self): :rtype: int <|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 1...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution_1: def __init__(self, w): """:type w: List[int] 176ms""" self.sums = [] for weight in w: if not self.sums: self.sums.append(weight) else: self.sums.append(weight + self.sums[-1]) def pickIndex(self): """:rtyp...
the_stack_v2_python_sparse
RandomPickWithWeight_MID_880.py
953250587/leetcode-python
train
2
0bc98fe7a9549d9484b78732968681cdd35807d8
[ "if not matrix or not matrix[0]:\n return 0\nm, n = (len(matrix), len(matrix[0]))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n if matrix[i - 1][j - 1] == '1':\n dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1])\nreturn ma...
<|body_start_0|> if not matrix or not matrix[0]: return 0 m, n = (len(matrix), len(matrix[0])) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): if matrix[i - 1][j - 1] == '1': dp[i][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximalSquare(self, matrix): """dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return:""" <|body_0|> def maximalSquare2(self, matrix): """逻辑写复杂了。 dp[i][j]:i,j能构成的最大正方形边长 遍历矩阵 当[i][...
stack_v2_sparse_classes_10k_train_006885
2,223
no_license
[ { "docstring": "dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return:", "name": "maximalSquare", "signature": "def maximalSquare(self, matrix)" }, { "docstring": "逻辑写复杂了。 dp[i][j]:i,j能构成的最大正方形边长 遍历矩阵 当[i][j]是1的时候,看[i-k,j-k...
2
stack_v2_sparse_classes_30k_train_003062
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix): dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return: - def maximalSqua...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix): dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return: - def maximalSqua...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def maximalSquare(self, matrix): """dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return:""" <|body_0|> def maximalSquare2(self, matrix): """逻辑写复杂了。 dp[i][j]:i,j能构成的最大正方形边长 遍历矩阵 当[i][...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maximalSquare(self, matrix): """dp[i][j] i,j为正方形右下角能构成的最大正方形边长 状态转移方程: dp[i][j] = 1 + min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) :param matrix: :return:""" if not matrix or not matrix[0]: return 0 m, n = (len(matrix), len(matrix[0])) dp = [[0] *...
the_stack_v2_python_sparse
221_最大正方形.py
lovehhf/LeetCode
train
0
184397e1208d1ff6d2b9eadb44702e7b44781524
[ "self.api = None\nself._base_url = None\nself._username = None\nself._password = None\nself._existing_entry = None\nself._description_placeholders = None", "errors = {}\nif user_input is None:\n return self._show_setup_form(user_input, errors)\nreturn await self._validate_and_create_entry(user_input, 'user')",...
<|body_start_0|> self.api = None self._base_url = None self._username = None self._password = None self._existing_entry = None self._description_placeholders = None <|end_body_0|> <|body_start_1|> errors = {} if user_input is None: return self...
Handle a FireServiceRota config flow.
FireServiceRotaFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FireServiceRotaFlowHandler: """Handle a FireServiceRota config flow.""" def __init__(self): """Initialize config flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" <|body_1|> async def _va...
stack_v2_sparse_classes_10k_train_006886
4,479
permissive
[ { "docstring": "Initialize config flow.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Handle a flow initiated by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Check if config ...
6
null
Implement the Python class `FireServiceRotaFlowHandler` described below. Class description: Handle a FireServiceRota config flow. Method signatures and docstrings: - def __init__(self): Initialize config flow. - async def async_step_user(self, user_input=None): Handle a flow initiated by the user. - async def _valida...
Implement the Python class `FireServiceRotaFlowHandler` described below. Class description: Handle a FireServiceRota config flow. Method signatures and docstrings: - def __init__(self): Initialize config flow. - async def async_step_user(self, user_input=None): Handle a flow initiated by the user. - async def _valida...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class FireServiceRotaFlowHandler: """Handle a FireServiceRota config flow.""" def __init__(self): """Initialize config flow.""" <|body_0|> async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" <|body_1|> async def _va...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FireServiceRotaFlowHandler: """Handle a FireServiceRota config flow.""" def __init__(self): """Initialize config flow.""" self.api = None self._base_url = None self._username = None self._password = None self._existing_entry = None self._description...
the_stack_v2_python_sparse
homeassistant/components/fireservicerota/config_flow.py
home-assistant/core
train
35,501
337b79b58615d2f18d864d7a01cb1dfa0641c68a
[ "self.middleman = middleman\nself.items = items\nself.keys = items\nself.data = {}\nself.tick = 0\nself.data['tick'] = 0\nfor i, key in enumerate(self.keys):\n self.data[key] = 0", "for key, val in self.data.items():\n self.data[key] = val + 0.2 * (random() - 0.5)\n if key == 'tick':\n self.data[k...
<|body_start_0|> self.middleman = middleman self.items = items self.keys = items self.data = {} self.tick = 0 self.data['tick'] = 0 for i, key in enumerate(self.keys): self.data[key] = 0 <|end_body_0|> <|body_start_1|> for key, val in self.dat...
Market
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Market: def __init__(self, items, middleman): """Dummy market emulator Args: items : List of item keys middleman : A Middleman object""" <|body_0|> def update(self): """Updates market data and propagates to Bokeh server Note: best to update all at once. Current versi...
stack_v2_sparse_classes_10k_train_006887
6,993
permissive
[ { "docstring": "Dummy market emulator Args: items : List of item keys middleman : A Middleman object", "name": "__init__", "signature": "def __init__(self, items, middleman)" }, { "docstring": "Updates market data and propagates to Bokeh server Note: best to update all at once. Current version m...
2
stack_v2_sparse_classes_30k_train_004486
Implement the Python class `Market` described below. Class description: Implement the Market class. Method signatures and docstrings: - def __init__(self, items, middleman): Dummy market emulator Args: items : List of item keys middleman : A Middleman object - def update(self): Updates market data and propagates to B...
Implement the Python class `Market` described below. Class description: Implement the Market class. Method signatures and docstrings: - def __init__(self, items, middleman): Dummy market emulator Args: items : List of item keys middleman : A Middleman object - def update(self): Updates market data and propagates to B...
42a5e8b20591f0e4789201b02cbbaf3837352881
<|skeleton|> class Market: def __init__(self, items, middleman): """Dummy market emulator Args: items : List of item keys middleman : A Middleman object""" <|body_0|> def update(self): """Updates market data and propagates to Bokeh server Note: best to update all at once. Current versi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Market: def __init__(self, items, middleman): """Dummy market emulator Args: items : List of item keys middleman : A Middleman object""" self.middleman = middleman self.items = items self.keys = items self.data = {} self.tick = 0 self.data['tick'] = 0 ...
the_stack_v2_python_sparse
neural_mmo/forge/blade/core/market/new_visualizer.py
alirezanobakht13/neural-mmo
train
0
5b2de20438b8f1835ceb6d563893c1643416b2d6
[ "it = iter(test_inputs.split('\\n')) if test_inputs else None\n\ndef uinput():\n return next(it) if it else sys.stdin.readline().rstrip()\n[self.n, self.d] = map(int, uinput().split())\nl, s = (self.n, 2)\ninp = ' '.join((uinput() for i in range(l))).split()\nself.numm = [[int(inp[i]) for i in range(j, l * s, s)...
<|body_start_0|> it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.n, self.d] = map(int, uinput().split()) l, s = (self.n, 2) inp = ' '.join((uinput() for i in range(l))).split() ...
Company representation
Company
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Company: """Company representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|> <|body_start_0|> it = iter(test_inputs...
stack_v2_sparse_classes_10k_train_006888
3,763
permissive
[ { "docstring": "Default constructor", "name": "__init__", "signature": "def __init__(self, test_inputs=None)" }, { "docstring": "Main calcualtion function of the class", "name": "calculate", "signature": "def calculate(self)" } ]
2
stack_v2_sparse_classes_30k_train_002391
Implement the Python class `Company` described below. Class description: Company representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class
Implement the Python class `Company` described below. Class description: Company representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class <|skeleton|> class Company: """Company representation""" ...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class Company: """Company representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Company: """Company representation""" def __init__(self, test_inputs=None): """Default constructor""" it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.n, self.d] = map(int,...
the_stack_v2_python_sparse
codeforces/580B_company.py
snsokolov/contests
train
1
6d8964c999013cf9977488687b806acf9a02c107
[ "shots = 100\ncircuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(final_measure=True)\ntargets = ref_diagonal_gate.diagonal_gate_counts_deterministic(shots)\nresult = execute(circuits, self.SIMULATOR, shots=shots).result()\nself.assertTrue(getattr(result, 'success', False))\nself.compare_counts(result...
<|body_start_0|> shots = 100 circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(final_measure=True) targets = ref_diagonal_gate.diagonal_gate_counts_deterministic(shots) result = execute(circuits, self.SIMULATOR, shots=shots).result() self.assertTrue(getattr(result...
QasmSimulator additional tests.
QasmDiagonalGateTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QasmDiagonalGateTests: """QasmSimulator additional tests.""" def test_diagonal_gate(self): """Test simulation with unitary gate circuit instructions.""" <|body_0|> def test_diagonal_gate_wrapper(self): """Test simulation with unitary gate circuit instructions."""...
stack_v2_sparse_classes_10k_train_006889
3,511
permissive
[ { "docstring": "Test simulation with unitary gate circuit instructions.", "name": "test_diagonal_gate", "signature": "def test_diagonal_gate(self)" }, { "docstring": "Test simulation with unitary gate circuit instructions.", "name": "test_diagonal_gate_wrapper", "signature": "def test_di...
2
stack_v2_sparse_classes_30k_train_007051
Implement the Python class `QasmDiagonalGateTests` described below. Class description: QasmSimulator additional tests. Method signatures and docstrings: - def test_diagonal_gate(self): Test simulation with unitary gate circuit instructions. - def test_diagonal_gate_wrapper(self): Test simulation with unitary gate cir...
Implement the Python class `QasmDiagonalGateTests` described below. Class description: QasmSimulator additional tests. Method signatures and docstrings: - def test_diagonal_gate(self): Test simulation with unitary gate circuit instructions. - def test_diagonal_gate_wrapper(self): Test simulation with unitary gate cir...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class QasmDiagonalGateTests: """QasmSimulator additional tests.""" def test_diagonal_gate(self): """Test simulation with unitary gate circuit instructions.""" <|body_0|> def test_diagonal_gate_wrapper(self): """Test simulation with unitary gate circuit instructions."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QasmDiagonalGateTests: """QasmSimulator additional tests.""" def test_diagonal_gate(self): """Test simulation with unitary gate circuit instructions.""" shots = 100 circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(final_measure=True) targets = ref_diagonal...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits/qiskit-aer/qiskit-aer#707/before/qasm_unitary_gate.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
a9043c5406f62bb442227188d58b204dfe1f4493
[ "if not hasattr(self, '__config_class__'):\n raise NotImplementedError('The subclass extending NotNullSchema must define its own custom __config_class__')\nreturn self.__config_class__(**data)", "for key in original.keys():\n if key not in output and (not key.startswith('_')):\n output[key] = origina...
<|body_start_0|> if not hasattr(self, '__config_class__'): raise NotImplementedError('The subclass extending NotNullSchema must define its own custom __config_class__') return self.__config_class__(**data) <|end_body_0|> <|body_start_1|> for key in original.keys(): if ke...
Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its own __config_class__ to ensure proper serialization/deserialization. Reference: h...
NotNullSchema
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotNullSchema: """Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its own __config_class__ to ensure proper se...
stack_v2_sparse_classes_10k_train_006890
28,002
permissive
[ { "docstring": "Hook to convert the schema object into its respective config type. Args: data: The dictionary representation of the configuration object kwargs: Marshmallow-specific kwargs required to maintain hook signature (unused herein) Returns: An instance of configuration class, which subclasses the DictD...
2
stack_v2_sparse_classes_30k_train_005190
Implement the Python class `NotNullSchema` described below. Class description: Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its o...
Implement the Python class `NotNullSchema` described below. Class description: Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its o...
b0290e2fd2aa05aec6d7d8871b91cb4478e9501d
<|skeleton|> class NotNullSchema: """Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its own __config_class__ to ensure proper se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NotNullSchema: """Extension of Marshmallow Schema to facilitate implicit removal of null values before serialization. The __config_class__ attribute is utilized to point a Schema to a configuration. It is the responsibility of the child class to define its own __config_class__ to ensure proper serialization/d...
the_stack_v2_python_sparse
great_expectations/rule_based_profiler/config/base.py
great-expectations/great_expectations
train
8,931
35ebaf649bc0b5900856d6582efda4851f59517c
[ "with tempfile.TemporaryDirectory() as tmp_dir:\n test_repo = test_repos.TEST_REPOS[1]\n self.assertTrue(helper.build_image_impl(test_repo.project_name))\n host_src_dir = build_specified_commit.copy_src_from_docker(test_repo.project_name, tmp_dir)\n test_repo_manager = repo_manager.clone_repo_and_get_ma...
<|body_start_0|> with tempfile.TemporaryDirectory() as tmp_dir: test_repo = test_repos.TEST_REPOS[1] self.assertTrue(helper.build_image_impl(test_repo.project_name)) host_src_dir = build_specified_commit.copy_src_from_docker(test_repo.project_name, tmp_dir) test_r...
Tests if an image can be built from different states e.g. a commit.
BuildImageIntegrationTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_10k_train_006891
5,754
permissive
[ { "docstring": "Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old commit should show the error when its fuzzers run and the new one should not.", "name": "test_build_fuzzers_from_commit", "signature": "def test_build_fu...
3
null
Implement the Python class `BuildImageIntegrationTest` described below. Class description: Tests if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a specified commit. This is done by using a kno...
Implement the Python class `BuildImageIntegrationTest` described below. Class description: Tests if an image can be built from different states e.g. a commit. Method signatures and docstrings: - def test_build_fuzzers_from_commit(self): Tests if the fuzzers can build at a specified commit. This is done by using a kno...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old com...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BuildImageIntegrationTest: """Tests if an image can be built from different states e.g. a commit.""" def test_build_fuzzers_from_commit(self): """Tests if the fuzzers can build at a specified commit. This is done by using a known regression range for a specific test case. The old commit should sh...
the_stack_v2_python_sparse
infra/build_specified_commit_test.py
google/oss-fuzz
train
9,438
2373044a9e7cddcff1bd79b34500cc44ae84909b
[ "def isPalindrome(i, j) -> bool:\n return s[i:j + 1] == s[i:j + 1][::-1]\ni = 0\ncount = 0\nslen = len(s)\nwhile i < slen:\n j = slen - 1\n while j >= i:\n if isPalindrome(i, j):\n count += 1\n j -= 1\n i += 1\nreturn count", "count = 0\nslen = len(s)\ni = 0\n\ndef isPalin(i, ...
<|body_start_0|> def isPalindrome(i, j) -> bool: return s[i:j + 1] == s[i:j + 1][::-1] i = 0 count = 0 slen = len(s) while i < slen: j = slen - 1 while j >= i: if isPalindrome(i, j): count += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubString(self, s) -> int: """:type s: String :return: int""" <|body_0|> def countString2(self, s): """while (i < len(s) -1) : within while loop : call inner method isPalin(i, j) where i = 0, j = len(s) -1 within isPalin - check if the subArray (i....
stack_v2_sparse_classes_10k_train_006892
1,558
no_license
[ { "docstring": ":type s: String :return: int", "name": "countSubString", "signature": "def countSubString(self, s) -> int" }, { "docstring": "while (i < len(s) -1) : within while loop : call inner method isPalin(i, j) where i = 0, j = len(s) -1 within isPalin - check if the subArray (i.e s[i:j] ...
2
stack_v2_sparse_classes_30k_train_002909
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubString(self, s) -> int: :type s: String :return: int - def countString2(self, s): while (i < len(s) -1) : within while loop : call inner method isPalin(i, j) where i ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubString(self, s) -> int: :type s: String :return: int - def countString2(self, s): while (i < len(s) -1) : within while loop : call inner method isPalin(i, j) where i ...
e3e076206b34ff6edf00596a03bc2b5911051cd8
<|skeleton|> class Solution: def countSubString(self, s) -> int: """:type s: String :return: int""" <|body_0|> def countString2(self, s): """while (i < len(s) -1) : within while loop : call inner method isPalin(i, j) where i = 0, j = len(s) -1 within isPalin - check if the subArray (i....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def countSubString(self, s) -> int: """:type s: String :return: int""" def isPalindrome(i, j) -> bool: return s[i:j + 1] == s[i:j + 1][::-1] i = 0 count = 0 slen = len(s) while i < slen: j = slen - 1 while j >= i: ...
the_stack_v2_python_sparse
Code/DataStructures/python/leetcode_ds/Py_PalindromicSubstrings_1.py
karanalang/technology
train
0
a974eccb8e1e0d44c9cfa0b1cb7e0525cab54c81
[ "if 'L' not in problem_params:\n problem_params['L'] = 1.0\nif 'init_type' not in problem_params:\n problem_params['init_type'] = 'circle'\nessential_keys = ['nvars', 'a', 'kappa', 'rest', 'thresh', 'depol', 'init_type', 'eps']\nfor key in essential_keys:\n if key not in problem_params:\n msg = 'nee...
<|body_start_0|> if 'L' not in problem_params: problem_params['L'] = 1.0 if 'init_type' not in problem_params: problem_params['init_type'] = 'circle' essential_keys = ['nvars', 'a', 'kappa', 'rest', 'thresh', 'depol', 'init_type', 'eps'] for key in essential_keys:...
Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forward transformation irfft_object: planned IFFT for backward transformation
monodomain2d_imex
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class monodomain2d_imex: """Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forward transformation irfft_object: planned...
stack_v2_sparse_classes_10k_train_006893
5,966
permissive
[ { "docstring": "Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed to parent class) dtype_f: mesh data type wuth implicit and explicit parts (will be passed to parent class)", "name": "__init__", "signature": "def __init__(self, ...
4
stack_v2_sparse_classes_30k_train_002796
Implement the Python class `monodomain2d_imex` described below. Class description: Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forwa...
Implement the Python class `monodomain2d_imex` described below. Class description: Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forwa...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class monodomain2d_imex: """Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forward transformation irfft_object: planned...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class monodomain2d_imex: """Example implementing Allen-Cahn equation in 2D using FFTs for solving linear parts, IMEX time-stepping Attributes: xvalues: grid points in space dx: mesh width lap: spectral operator for Laplacian rfft_object: planned real FFT for forward transformation irfft_object: planned IFFT for bac...
the_stack_v2_python_sparse
pySDC/playgrounds/monodomain/Monodomain.py
Parallel-in-Time/pySDC
train
30
e55bfa9c4d6a25e24dfde7a4d9ee0f3718b846d0
[ "status, error_msg, conn, trans_obj, session_obj = args\nif error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND:\n return make_json_response(success=0, errormsg=error_msg, info='DATAGRID_TRANSACTION_REQUIRED', status=404)\ncolumn_list = []\nif status and conn is not None and (trans_obj is not None) and (session_obj is not...
<|body_start_0|> status, error_msg, conn, trans_obj, session_obj = args if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND: return make_json_response(success=0, errormsg=error_msg, info='DATAGRID_TRANSACTION_REQUIRED', status=404) column_list = [] if status and conn is not None and...
FilterDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterDialog: def get(*args): """To fetch the current sorted columns""" <|body_0|> def save(*args, **kwargs): """To save the sorted columns""" <|body_1|> <|end_skeleton|> <|body_start_0|> status, error_msg, conn, trans_obj, session_obj = args ...
stack_v2_sparse_classes_10k_train_006894
3,733
permissive
[ { "docstring": "To fetch the current sorted columns", "name": "get", "signature": "def get(*args)" }, { "docstring": "To save the sorted columns", "name": "save", "signature": "def save(*args, **kwargs)" } ]
2
null
Implement the Python class `FilterDialog` described below. Class description: Implement the FilterDialog class. Method signatures and docstrings: - def get(*args): To fetch the current sorted columns - def save(*args, **kwargs): To save the sorted columns
Implement the Python class `FilterDialog` described below. Class description: Implement the FilterDialog class. Method signatures and docstrings: - def get(*args): To fetch the current sorted columns - def save(*args, **kwargs): To save the sorted columns <|skeleton|> class FilterDialog: def get(*args): ...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class FilterDialog: def get(*args): """To fetch the current sorted columns""" <|body_0|> def save(*args, **kwargs): """To save the sorted columns""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FilterDialog: def get(*args): """To fetch the current sorted columns""" status, error_msg, conn, trans_obj, session_obj = args if error_msg == ERROR_MSG_TRANS_ID_NOT_FOUND: return make_json_response(success=0, errormsg=error_msg, info='DATAGRID_TRANSACTION_REQUIRED', status...
the_stack_v2_python_sparse
_MY_ORGS/Web-Dev-Collaborative/blog-research/database/pg-admin/web/pgadmin/tools/sqleditor/utils/filter_dialog.py
bgoonz/UsefulResourceRepo2.0
train
10
20239d74b7bf130ec089b9d12ba6bea5ed1c85a9
[ "if '/' not in value:\n if ';' in value:\n raise errors.DeserializationError('Unexpected semi-colon')\n return cls.PREFIX + value\nreturn value", "if ';' not in value:\n assert value.startswith(cls.PREFIX)\n return value[len(cls.PREFIX):]\nreturn value" ]
<|body_start_0|> if '/' not in value: if ';' in value: raise errors.DeserializationError('Unexpected semi-colon') return cls.PREFIX + value return value <|end_body_0|> <|body_start_1|> if ';' not in value: assert value.startswith(cls.PREFIX) ...
MediaType field encoder/decoder.
MediaType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MediaType: """MediaType field encoder/decoder.""" def decode(cls, value): """Decoder.""" <|body_0|> def encode(cls, value): """Encoder.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if '/' not in value: if ';' in value: ...
stack_v2_sparse_classes_10k_train_006895
14,260
permissive
[ { "docstring": "Decoder.", "name": "decode", "signature": "def decode(cls, value)" }, { "docstring": "Encoder.", "name": "encode", "signature": "def encode(cls, value)" } ]
2
null
Implement the Python class `MediaType` described below. Class description: MediaType field encoder/decoder. Method signatures and docstrings: - def decode(cls, value): Decoder. - def encode(cls, value): Encoder.
Implement the Python class `MediaType` described below. Class description: MediaType field encoder/decoder. Method signatures and docstrings: - def decode(cls, value): Decoder. - def encode(cls, value): Encoder. <|skeleton|> class MediaType: """MediaType field encoder/decoder.""" def decode(cls, value): ...
4082346ef8d5e6a8365b05752be41186840dc868
<|skeleton|> class MediaType: """MediaType field encoder/decoder.""" def decode(cls, value): """Decoder.""" <|body_0|> def encode(cls, value): """Encoder.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MediaType: """MediaType field encoder/decoder.""" def decode(cls, value): """Decoder.""" if '/' not in value: if ';' in value: raise errors.DeserializationError('Unexpected semi-colon') return cls.PREFIX + value return value def encode(...
the_stack_v2_python_sparse
desktop/core/ext-py/josepy-1.1.0/src/josepy/jws.py
oyorooms/hue
train
4
34086c3d695312db7a5c06d83c72ed934239bef5
[ "self.file = None\nself.tmp_file = None\nself.pipe = []\nif file_path:\n try:\n if file_override:\n self.file = open(file_path, 'wt')\n else:\n self.file = open(file_path, 'at')\n except FileNotFoundError as e:\n '\\n 只是特别标注出来这里可能弹出的错误。\\n ...
<|body_start_0|> self.file = None self.tmp_file = None self.pipe = [] if file_path: try: if file_override: self.file = open(file_path, 'wt') else: self.file = open(file_path, 'at') except File...
重定向输出
StdoutRedirection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" <|body_0|> def context(self): """重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句...
stack_v2_sparse_classes_10k_train_006896
4,538
no_license
[ { "docstring": "如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。", "name": "__init__", "signature": "def __init__(self, file_path=None, file_override=True)" }, { "docstring": "重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句返回值,yield后退出with时执行", "name"...
2
stack_v2_sparse_classes_30k_train_005397
Implement the Python class `StdoutRedirection` described below. Class description: 重定向输出 Method signatures and docstrings: - def __init__(self, file_path=None, file_override=True): 如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。 - def context(self): 重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进...
Implement the Python class `StdoutRedirection` described below. Class description: 重定向输出 Method signatures and docstrings: - def __init__(self, file_path=None, file_override=True): 如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。 - def context(self): 重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进...
d44f7303bc4ce3764a300830d361115200ad3602
<|skeleton|> class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" <|body_0|> def context(self): """重定向输出的上下文管理器 contextlib.contextmanager装饰器自动将协程转换为上下文管理器 yield前为进入with时执行,yield为with语句...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StdoutRedirection: """重定向输出""" def __init__(self, file_path=None, file_override=True): """如果提供了文件目录,就尝试打开文件,稍后将会将输出重定向到文件。 否则将输出重定向到内部列表pipe。""" self.file = None self.tmp_file = None self.pipe = [] if file_path: try: if file_override: ...
the_stack_v2_python_sparse
pysh/manage/middleware.py
Arianxx/Pysh
train
18
bc4d46732f75a2a555f9885a97c64260cabaf1c7
[ "root_to_leaf = curr_sum = 0\nwhile root:\n if root.left:\n predecessor = root.left\n steps = 1\n while predecessor.right and predecessor.right is not root:\n predecessor = predecessor.right\n steps += 1\n if not predecessor.right:\n curr_sum = curr_su...
<|body_start_0|> root_to_leaf = curr_sum = 0 while root: if root.left: predecessor = root.left steps = 1 while predecessor.right and predecessor.right is not root: predecessor = predecessor.right steps +=...
RootToLeaf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RootToLeaf: def get_sum(self, root: 'TreeNode') -> int: """Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def get__sum(self, root: 'TreeNode') -> int: """Approach: Breadth First Search Time Complexity: O(N)...
stack_v2_sparse_classes_10k_train_006897
3,287
no_license
[ { "docstring": "Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return:", "name": "get_sum", "signature": "def get_sum(self, root: 'TreeNode') -> int" }, { "docstring": "Approach: Breadth First Search Time Complexity: O(N) Space Complexity: O(H) :param root:...
3
null
Implement the Python class `RootToLeaf` described below. Class description: Implement the RootToLeaf class. Method signatures and docstrings: - def get_sum(self, root: 'TreeNode') -> int: Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def get__sum(self, root: 'TreeNode...
Implement the Python class `RootToLeaf` described below. Class description: Implement the RootToLeaf class. Method signatures and docstrings: - def get_sum(self, root: 'TreeNode') -> int: Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return: - def get__sum(self, root: 'TreeNode...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class RootToLeaf: def get_sum(self, root: 'TreeNode') -> int: """Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" <|body_0|> def get__sum(self, root: 'TreeNode') -> int: """Approach: Breadth First Search Time Complexity: O(N)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RootToLeaf: def get_sum(self, root: 'TreeNode') -> int: """Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(1) :param root: :return:""" root_to_leaf = curr_sum = 0 while root: if root.left: predecessor = root.left steps = ...
the_stack_v2_python_sparse
revisited/trees/sum_root_to_leaf_numbers.py
Shiv2157k/leet_code
train
1
9a271f9b08b3c1b6fd0d99f87872cbeb78d93115
[ "if db_field.name == 'topic' and (not request.user.is_superuser):\n kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all())\nreturn super(TopicTableAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "topic = TopicTable.objects.get(id=object_id)\noff_days = [day for...
<|body_start_0|> if db_field.name == 'topic' and (not request.user.is_superuser): kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all()) return super(TopicTableAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) <|end_body_0|> <|body_start_1|> ...
TopicTableAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopicTableAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """limits Topics field to user's topics.""" <|body_0|> def change_view(self, request, object_id, form_url='', extra_context=None): """Overrides the change view that displays change_form...
stack_v2_sparse_classes_10k_train_006898
9,167
permissive
[ { "docstring": "limits Topics field to user's topics.", "name": "formfield_for_foreignkey", "signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)" }, { "docstring": "Overrides the change view that displays change_form.html", "name": "change_view", "signature": "de...
3
stack_v2_sparse_classes_30k_train_000798
Implement the Python class `TopicTableAdmin` described below. Class description: Implement the TopicTableAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): limits Topics field to user's topics. - def change_view(self, request, object_id, form_url='', extr...
Implement the Python class `TopicTableAdmin` described below. Class description: Implement the TopicTableAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): limits Topics field to user's topics. - def change_view(self, request, object_id, form_url='', extr...
70638c121ea85ff0e6a650c5f2641b0b3b04d6d0
<|skeleton|> class TopicTableAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """limits Topics field to user's topics.""" <|body_0|> def change_view(self, request, object_id, form_url='', extra_context=None): """Overrides the change view that displays change_form...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TopicTableAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """limits Topics field to user's topics.""" if db_field.name == 'topic' and (not request.user.is_superuser): kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all()) ...
the_stack_v2_python_sparse
cms/admin.py
Ibrahem3amer/bala7
train
0
9ed3c9b3df737c1e17fe1e02aa4f564f81562f9c
[ "self.arr = []\nself.size = maxSize\nself.offset = []", "if len(self.arr) == self.size:\n return\nself.arr.append(x)\nself.offset.append(0)", "if not self.arr:\n return -1\nif len(self.offset) > 1:\n self.offset[-2] += self.offset[-1]\nreturn self.arr.pop() + self.offset.pop()", "if not self.arr:\n ...
<|body_start_0|> self.arr = [] self.size = maxSize self.offset = [] <|end_body_0|> <|body_start_1|> if len(self.arr) == self.size: return self.arr.append(x) self.offset.append(0) <|end_body_1|> <|body_start_2|> if not self.arr: return -1 ...
CustomStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" <|body_0|> def push(self, x): """:type x: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def increment(self, k, val): """:type k: ...
stack_v2_sparse_classes_10k_train_006899
954
no_license
[ { "docstring": ":type maxSize: int", "name": "__init__", "signature": "def __init__(self, maxSize)" }, { "docstring": ":type x: int :rtype: None", "name": "push", "signature": "def push(self, x)" }, { "docstring": ":rtype: int", "name": "pop", "signature": "def pop(self)"...
4
stack_v2_sparse_classes_30k_train_000934
Implement the Python class `CustomStack` described below. Class description: Implement the CustomStack class. Method signatures and docstrings: - def __init__(self, maxSize): :type maxSize: int - def push(self, x): :type x: int :rtype: None - def pop(self): :rtype: int - def increment(self, k, val): :type k: int :typ...
Implement the Python class `CustomStack` described below. Class description: Implement the CustomStack class. Method signatures and docstrings: - def __init__(self, maxSize): :type maxSize: int - def push(self, x): :type x: int :rtype: None - def pop(self): :rtype: int - def increment(self, k, val): :type k: int :typ...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" <|body_0|> def push(self, x): """:type x: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def increment(self, k, val): """:type k: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomStack: def __init__(self, maxSize): """:type maxSize: int""" self.arr = [] self.size = maxSize self.offset = [] def push(self, x): """:type x: int :rtype: None""" if len(self.arr) == self.size: return self.arr.append(x) sel...
the_stack_v2_python_sparse
problems/N1381_Design_A_Stack_With_Increment_Operation.py
wan-catherine/Leetcode
train
5