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
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
3bfff664b92bf99250044649e99f6d9568c7bc35
[ "if not graph.is_directed():\n raise ValueError('the graph is not directed')\nself.graph = graph\nself.residual = self.graph.__class__(self.graph.v(), directed=True)\nfor node in self.graph.iternodes():\n self.residual.add_node(node)\nfor edge in self.graph.iteredges():\n self.residual.add_edge(edge)\n ...
<|body_start_0|> if not graph.is_directed(): raise ValueError('the graph is not directed') self.graph = graph self.residual = self.graph.__class__(self.graph.v(), directed=True) for node in self.graph.iternodes(): self.residual.add_node(node) for edge in s...
The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with node levels Notes ----- Based on: https://en.wikipedia.org/wiki/Dinic's_a...
Dinic
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dinic: """The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with node levels Notes ----- Based on: https:...
stack_v2_sparse_classes_75kplus_train_009300
7,551
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source, sink)" }, { "docstring": "Find if more flow can be sent from source to sink....
4
stack_v2_sparse_classes_30k_train_009795
Implement the Python class `Dinic` described below. Class description: The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with n...
Implement the Python class `Dinic` described below. Class description: The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with n...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class Dinic: """The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with node levels Notes ----- Based on: https:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dinic: """The Dinic's algorithm for computing the maximum flow. Attributes ---------- graph : input directed graph (flow network) residual : directed graph (residual network) flow : dict-of-dict source : node sink : node max_flow : number level : dict with node levels Notes ----- Based on: https://en.wikipedi...
the_stack_v2_python_sparse
graphtheory/flow/dinic.py
kgashok/graphs-dict
train
0
9379c54ff006eb52295df41aeb95e802e6ec2d33
[ "super().__init__(grad=False)\nif len(transforms) == 1 and isinstance(transforms[0], Sequence):\n transforms = transforms[0]\nself.transforms = torch.nn.ModuleList(list(transforms))", "for t in self.transforms:\n batch = t(**batch)\nreturn batch" ]
<|body_start_0|> super().__init__(grad=False) if len(transforms) == 1 and isinstance(transforms[0], Sequence): transforms = transforms[0] self.transforms = torch.nn.ModuleList(list(transforms)) <|end_body_0|> <|body_start_1|> for t in self.transforms: batch = t(*...
Compose
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Compose: def __init__(self, *transforms): """Compose multiple transforms to one Args: transforms: transformations to compose""" <|body_0|> def forward(self, **batch): """Augment batch""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(...
stack_v2_sparse_classes_75kplus_train_009301
1,381
permissive
[ { "docstring": "Compose multiple transforms to one Args: transforms: transformations to compose", "name": "__init__", "signature": "def __init__(self, *transforms)" }, { "docstring": "Augment batch", "name": "forward", "signature": "def forward(self, **batch)" } ]
2
null
Implement the Python class `Compose` described below. Class description: Implement the Compose class. Method signatures and docstrings: - def __init__(self, *transforms): Compose multiple transforms to one Args: transforms: transformations to compose - def forward(self, **batch): Augment batch
Implement the Python class `Compose` described below. Class description: Implement the Compose class. Method signatures and docstrings: - def __init__(self, *transforms): Compose multiple transforms to one Args: transforms: transformations to compose - def forward(self, **batch): Augment batch <|skeleton|> class Com...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class Compose: def __init__(self, *transforms): """Compose multiple transforms to one Args: transforms: transformations to compose""" <|body_0|> def forward(self, **batch): """Augment batch""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Compose: def __init__(self, *transforms): """Compose multiple transforms to one Args: transforms: transformations to compose""" super().__init__(grad=False) if len(transforms) == 1 and isinstance(transforms[0], Sequence): transforms = transforms[0] self.transforms =...
the_stack_v2_python_sparse
nndet/io/transforms/base.py
dboun/nnDetection
train
1
3f413bbeb286c9b706c14a7b706281439189d82c
[ "self._trie = dict()\nfor word in words:\n for start in range(0, len(word) - 1):\n current_dict = self._trie\n for letter in word[start:]:\n current_dict = current_dict.setdefault(letter, {})\n if not current_dict.get(_end):\n current_dict[_end] = []\n current_di...
<|body_start_0|> self._trie = dict() for word in words: for start in range(0, len(word) - 1): current_dict = self._trie for letter in word[start:]: current_dict = current_dict.setdefault(letter, {}) if not current_dict.get(_...
SubstringTrie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" <|body_0|> def fetch(self, substring): """Return words that contain `substring`""" ...
stack_v2_sparse_classes_75kplus_train_009302
3,437
no_license
[ { "docstring": "This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": "Return words that contain `substring`", "name": "fetch", "sign...
2
stack_v2_sparse_classes_30k_train_048693
Implement the Python class `SubstringTrie` described below. Class description: Implement the SubstringTrie class. Method signatures and docstrings: - def __init__(self, words): This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word] - def fetch(s...
Implement the Python class `SubstringTrie` described below. Class description: Implement the SubstringTrie class. Method signatures and docstrings: - def __init__(self, words): This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word] - def fetch(s...
60b0700156b893b95a1f30e6a45fb8cd0fb4bd32
<|skeleton|> class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" <|body_0|> def fetch(self, substring): """Return words that contain `substring`""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubstringTrie: def __init__(self, words): """This little fucker needs to know about the substring's original words, so instead of _END: _END let's put _END: [original word]""" self._trie = dict() for word in words: for start in range(0, len(word) - 1): curre...
the_stack_v2_python_sparse
portmanteaux/trie.py
rfong/shittynlp
train
2
dd8d4f5b4ef90aaa52373551bb60fa502e94df94
[ "super(InferenceNetwork, self).__init__()\nself.num_stochastic_layers = num_stochastic_layers\nself.z_dim = z_dim\nself.experiment = experiment\nself.context_dim = context_dim\nself.h_dim = h_dim\ninput_dim = self.context_dim + self.h_dim\nself.model = nn.ModuleList()\nif experiment == 'synthetic':\n for i in ra...
<|body_start_0|> super(InferenceNetwork, self).__init__() self.num_stochastic_layers = num_stochastic_layers self.z_dim = z_dim self.experiment = experiment self.context_dim = context_dim self.h_dim = h_dim input_dim = self.context_dim + self.h_dim self.mo...
Variational approximation q(z_1, ..., z_L|c, x).
InferenceNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InferenceNetwork: """Variational approximation q(z_1, ..., z_L|c, x).""" def __init__(self, experiment, num_stochastic_layers, z_dim, context_dim, h_dim): """:param num_stochastic_layers: number of stochastic layers in the model :param z_dim: dimension of each stochastic layer :param...
stack_v2_sparse_classes_75kplus_train_009303
35,795
no_license
[ { "docstring": ":param num_stochastic_layers: number of stochastic layers in the model :param z_dim: dimension of each stochastic layer :param context_dim: dimension of c :param h_dim: dimension of (encoded) input", "name": "__init__", "signature": "def __init__(self, experiment, num_stochastic_layers, ...
2
stack_v2_sparse_classes_30k_train_017642
Implement the Python class `InferenceNetwork` described below. Class description: Variational approximation q(z_1, ..., z_L|c, x). Method signatures and docstrings: - def __init__(self, experiment, num_stochastic_layers, z_dim, context_dim, h_dim): :param num_stochastic_layers: number of stochastic layers in the mode...
Implement the Python class `InferenceNetwork` described below. Class description: Variational approximation q(z_1, ..., z_L|c, x). Method signatures and docstrings: - def __init__(self, experiment, num_stochastic_layers, z_dim, context_dim, h_dim): :param num_stochastic_layers: number of stochastic layers in the mode...
05c85b0d53f2b3ab2912cb5ebb94cecdeaa0be95
<|skeleton|> class InferenceNetwork: """Variational approximation q(z_1, ..., z_L|c, x).""" def __init__(self, experiment, num_stochastic_layers, z_dim, context_dim, h_dim): """:param num_stochastic_layers: number of stochastic layers in the model :param z_dim: dimension of each stochastic layer :param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InferenceNetwork: """Variational approximation q(z_1, ..., z_L|c, x).""" def __init__(self, experiment, num_stochastic_layers, z_dim, context_dim, h_dim): """:param num_stochastic_layers: number of stochastic layers in the model :param z_dim: dimension of each stochastic layer :param context_dim:...
the_stack_v2_python_sparse
models.py
yuxinc17/neural-stat
train
0
e4f9e4c88a465b2dc0cf8a893f63f747de1e4e01
[ "BaseEstimator.__init__(self)\nRegressorMixin.__init__(self)\nMultiOutputMixin.__init__(self)\nfor k, v in kwargs.items():\n setattr(self, k, v)\nself.force_positive = force_positive", "res = NMF._get_param_names()\nres = res + ['force_positive']\nreturn res", "res = {}\nfor k in self.__class__._get_param_na...
<|body_start_0|> BaseEstimator.__init__(self) RegressorMixin.__init__(self) MultiOutputMixin.__init__(self) for k, v in kwargs.items(): setattr(self, k, v) self.force_positive = force_positive <|end_body_0|> <|body_start_1|> res = NMF._get_param_names() ...
Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :epkg:`sklearn:decomposition:NMF`. The prediction projects the test data into the components ...
ApproximateNMFPredictor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApproximateNMFPredictor: """Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :epkg:`sklearn:decomposition:NMF`. The pre...
stack_v2_sparse_classes_75kplus_train_009304
3,582
permissive
[ { "docstring": "*kwargs* should contains parameters for :epkg:`sklearn:decomposition:NMF`. The parameter *force_positive* removes all negative predictions and replaces by zero.", "name": "__init__", "signature": "def __init__(self, force_positive=False, **kwargs)" }, { "docstring": "Returns the ...
5
stack_v2_sparse_classes_30k_train_054482
Implement the Python class `ApproximateNMFPredictor` described below. Class description: Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :ep...
Implement the Python class `ApproximateNMFPredictor` described below. Class description: Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :ep...
4b610bacaafff835a30880f2fb955fff3b087ad5
<|skeleton|> class ApproximateNMFPredictor: """Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :epkg:`sklearn:decomposition:NMF`. The pre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApproximateNMFPredictor: """Converts :epkg:`sklearn:decomposition:NMF` into a predictor so that the prediction does not involve training even for new observations. The class uses a :epkg:`sklearn:decomposition:TruncatedSVD` of the components found by the :epkg:`sklearn:decomposition:NMF`. The prediction proje...
the_stack_v2_python_sparse
mlinsights/mlmodel/anmf_predictor.py
sdpython/mlinsights
train
64
58d0388509b70e4bf541f3742244ea577d9b7ba5
[ "self.csv_path = csv_path\nself.cow_list = []\nself.date = date.strftime('%Y/%m/%d')\nself.csv_path += date.strftime('%Y%m%d') + '/'\nself.__read_from_db(self.__get_cow_id_list())", "dt = datetime.datetime(int(self.date[:4]), int(self.date[5:7]), int(self.date[8:10]))\nprint('reading cow information : ' + self.da...
<|body_start_0|> self.csv_path = csv_path self.cow_list = [] self.date = date.strftime('%Y/%m/%d') self.csv_path += date.strftime('%Y%m%d') + '/' self.__read_from_db(self.__get_cow_id_list()) <|end_body_0|> <|body_start_1|> dt = datetime.datetime(int(self.date[:4]), int(...
Cowshed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" <|body_0|> def __read_from_db(self, cow_id_list): """1頭ずつデータベースからRSSI情報を読み込む""" <|body_1|> def __get_cow_id_list(self): """csvファイルからその日第一放牧場にいた牛...
stack_v2_sparse_classes_75kplus_train_009305
2,305
no_license
[ { "docstring": "その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み", "name": "__init__", "signature": "def __init__(self, date: datetime, csv_path)" }, { "docstring": "1頭ずつデータベースからRSSI情報を読み込む", "name": "__read_from_db", "signature": "def __read_from_db(self, cow_id_list)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_048378
Implement the Python class `Cowshed` described below. Class description: Implement the Cowshed class. Method signatures and docstrings: - def __init__(self, date: datetime, csv_path): その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み - def __read_from_db(self, cow_id_list): 1頭ずつデータベースからRSSI情報を読み込む - def __get_cow_id_list(self...
Implement the Python class `Cowshed` described below. Class description: Implement the Cowshed class. Method signatures and docstrings: - def __init__(self, date: datetime, csv_path): その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み - def __read_from_db(self, cow_id_list): 1頭ずつデータベースからRSSI情報を読み込む - def __get_cow_id_list(self...
9046329d57ef10b6643c9c6e7dcc3ea9b6294dee
<|skeleton|> class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" <|body_0|> def __read_from_db(self, cow_id_list): """1頭ずつデータベースからRSSI情報を読み込む""" <|body_1|> def __get_cow_id_list(self): """csvファイルからその日第一放牧場にいた牛...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" self.csv_path = csv_path self.cow_list = [] self.date = date.strftime('%Y/%m/%d') self.csv_path += date.strftime('%Y%m%d') + '/' self.__read_from_db(self.__get_...
the_stack_v2_python_sparse
COW_PROJECT/cows/cowshed_rssi.py
FUKUSHUN/cow_python
train
1
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car'))\nnew_spec.save()\nreturn new_spec", "instance.key = validated_data.get('key', instance.key)\ninstance.value = validated_data.get('value', instance.val...
<|body_start_0|> new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car')) new_spec.save() return new_spec <|end_body_0|> <|body_start_1|> instance.key = validated_data.get('key', in...
SpecificationSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Specification` instance""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_009306
6,342
no_license
[ { "docstring": "create and return new 'Specification' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `Specification` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_035782
Implement the Python class `SpecificationSerializer` described below. Class description: Implement the SpecificationSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Specification' instance - def update(self, instance, validated_data): Update and return an ...
Implement the Python class `SpecificationSerializer` described below. Class description: Implement the SpecificationSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Specification' instance - def update(self, instance, validated_data): Update and return an ...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Specification` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car')) new_spec.sa...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
c085289f31151cb3b8ae782250141b9d4c00732e
[ "context = super().get_context_data(**kwargs)\norderby = self.request.GET.get('sort', 'id') or 'id'\nmatch = self.request.GET.get('match', '')\ncontext['attachments'] = attachment_helpers.get_study_attachments(context['study'], orderby, match)\ncontext['match'] = match\nreturn context", "attachment = self.request...
<|body_start_0|> context = super().get_context_data(**kwargs) orderby = self.request.GET.get('sort', 'id') or 'id' match = self.request.GET.get('match', '') context['attachments'] = attachment_helpers.get_study_attachments(context['study'], orderby, match) context['match'] = matc...
StudyAttachments View shows video attachments for the study
StudyAttachments
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyAttachments: """StudyAttachments View shows video attachments for the study""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" <|body_0|> def post(self, request, *args, ...
stack_v2_sparse_classes_75kplus_train_009307
34,217
permissive
[ { "docstring": "In addition to the study, adds several items to the context dictionary. Study results are paginated.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Downloads study video", "name": "post", "signature": "def post(self, r...
2
stack_v2_sparse_classes_30k_train_014675
Implement the Python class `StudyAttachments` described below. Class description: StudyAttachments View shows video attachments for the study Method signatures and docstrings: - def get_context_data(self, **kwargs): In addition to the study, adds several items to the context dictionary. Study results are paginated. -...
Implement the Python class `StudyAttachments` described below. Class description: StudyAttachments View shows video attachments for the study Method signatures and docstrings: - def get_context_data(self, **kwargs): In addition to the study, adds several items to the context dictionary. Study results are paginated. -...
621fbb8b25100a21fd94721d39003b5d4f651dc5
<|skeleton|> class StudyAttachments: """StudyAttachments View shows video attachments for the study""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" <|body_0|> def post(self, request, *args, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StudyAttachments: """StudyAttachments View shows video attachments for the study""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" context = super().get_context_data(**kwargs) orderby...
the_stack_v2_python_sparse
exp/views/study.py
enrobyn/lookit-api
train
0
2cf5afff4a64c1b1b889f5a95c0b96b772f4dc1e
[ "self.sensor = Sensor('127.0.0.1', 8000)\nself.sensor.measure = MagicMock(return_value=100)\nself.pump = Pump('127.0.0.1', 8000)\nself.pump.set_state = MagicMock(return_value=True)\nself.pump.get_state = MagicMock(return_value=self.pump.PUMP_OFF)\nself.decider = Decider(100, 0.1)\nself.decider.decide = MagicMock(re...
<|body_start_0|> self.sensor = Sensor('127.0.0.1', 8000) self.sensor.measure = MagicMock(return_value=100) self.pump = Pump('127.0.0.1', 8000) self.pump.set_state = MagicMock(return_value=True) self.pump.get_state = MagicMock(return_value=self.pump.PUMP_OFF) self.decider ...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Set up method for test_controller""" <|body_0|> def test_controller(self): """Test controller and tick: 1: Check sensor.measure for accuracy 2: test pump.get_state for correct return 3...
stack_v2_sparse_classes_75kplus_train_009308
4,232
no_license
[ { "docstring": "Set up method for test_controller", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test controller and tick: 1: Check sensor.measure for accuracy 2: test pump.get_state for correct return 3: decider.decide for correct 'decision' 4: Test pump.set_state for expe...
2
stack_v2_sparse_classes_30k_train_031206
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Set up method for test_controller - def test_controller(self): Test controller and tick: 1: Check sensor.measure for accuracy 2: test pump.get_state...
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Set up method for test_controller - def test_controller(self): Test controller and tick: 1: Check sensor.measure for accuracy 2: test pump.get_state...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Set up method for test_controller""" <|body_0|> def test_controller(self): """Test controller and tick: 1: Check sensor.measure for accuracy 2: test pump.get_state for correct return 3...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Set up method for test_controller""" self.sensor = Sensor('127.0.0.1', 8000) self.sensor.measure = MagicMock(return_value=100) self.pump = Pump('127.0.0.1', 8000) self.pump.set_state = M...
the_stack_v2_python_sparse
students/MicahBraun/Lesson 6/water-regulation/test.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
efa3617ec1b40971144d93c92122f7aa9c1e3097
[ "res = []\nif not root:\n return res\nq1 = collections.deque()\nq2 = collections.deque()\norder = 1\nq1.append(root)\nwhile q1 or q2:\n res.append([])\n if order == 1:\n while q1:\n node = q1.popleft()\n res[-1].append(node.val)\n if node.left:\n q2.ap...
<|body_start_0|> res = [] if not root: return res q1 = collections.deque() q2 = collections.deque() order = 1 q1.append(root) while q1 or q2: res.append([]) if order == 1: while q1: node = q1....
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrder2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] if not ...
stack_v2_sparse_classes_75kplus_train_009309
1,923
permissive
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder2", "signature": "def levelOrder2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_047974
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder2(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrder2(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> class Solution:...
34d34280170c991ea7a28d74a3f2338753844917
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrder2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" res = [] if not root: return res q1 = collections.deque() q2 = collections.deque() order = 1 q1.append(root) while q1 or q2: res.appe...
the_stack_v2_python_sparse
binary_tree_level_order_traversal_102.py
danielsunzhongyuan/my_leetcode_in_python
train
0
33d21395285617850f59e68074defa3edbba3cd1
[ "self.board = board\nself.archive = archive\nself.archive.visitedStates[str(self.board.changeable)] = 'beginning!'\nself.save = save", "print('[' + time.strftime('%H:%M:%S') + ']' + ' Running algorithm...\\n')\nwhile self.board.checkSolution() != 0:\n children = self.board.createChildren()\n childToCheck = ...
<|body_start_0|> self.board = board self.archive = archive self.archive.visitedStates[str(self.board.changeable)] = 'beginning!' self.save = save <|end_body_0|> <|body_start_1|> print('[' + time.strftime('%H:%M:%S') + ']' + ' Running algorithm...\n') while self.board.che...
Random
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Random: def __init__(self, board, archive, save): """Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game. archive (class): Containing the archive class. save (class): Containing the save class.""" ...
stack_v2_sparse_classes_75kplus_train_009310
1,929
no_license
[ { "docstring": "Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game. archive (class): Containing the archive class. save (class): Containing the save class.", "name": "__init__", "signature": "def __init__(self, boa...
2
stack_v2_sparse_classes_30k_train_051724
Implement the Python class `Random` described below. Class description: Implement the Random class. Method signatures and docstrings: - def __init__(self, board, archive, save): Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game...
Implement the Python class `Random` described below. Class description: Implement the Random class. Method signatures and docstrings: - def __init__(self, board, archive, save): Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game...
4d1eb8a94e38e256699c964b0c7147364ece099a
<|skeleton|> class Random: def __init__(self, board, archive, save): """Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game. archive (class): Containing the archive class. save (class): Containing the save class.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Random: def __init__(self, board, archive, save): """Takes all information of the board with it's state as the beginning of the game. Args: board (class): Containing all information of the game. archive (class): Containing the archive class. save (class): Containing the save class.""" self.boa...
the_stack_v2_python_sparse
src/algorithms/random.py
KevinVuongly/ProgrAmsterdam
train
0
ff021c5d7db2117db1fa807d5adebbe737324af0
[ "tk.Frame.__init__(self, parent)\nself.controller = controller\nlbl_enter_test_type = tk.Label(self, text='Type of test run: ')\nlbl_enter_primary_weight = tk.Label(self, text='CVT primary weight: ')\nlbl_enter_primary_spring = tk.Label(self, text='CVT primary spring: ')\nlbl_enter_secondary_spring = tk.Label(self,...
<|body_start_0|> tk.Frame.__init__(self, parent) self.controller = controller lbl_enter_test_type = tk.Label(self, text='Type of test run: ') lbl_enter_primary_weight = tk.Label(self, text='CVT primary weight: ') lbl_enter_primary_spring = tk.Label(self, text='CVT primary spring:...
InputPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputPage: def __init__(self, parent, controller): """Create the input page containing the text fields.""" <|body_0|> def save_info(self, type_of_run, primary_weight, primary_spring, secondary_spring, secondary_clock, controller): """Save the information entered in t...
stack_v2_sparse_classes_75kplus_train_009311
6,622
no_license
[ { "docstring": "Create the input page containing the text fields.", "name": "__init__", "signature": "def __init__(self, parent, controller)" }, { "docstring": "Save the information entered in the Input page.", "name": "save_info", "signature": "def save_info(self, type_of_run, primary_w...
2
stack_v2_sparse_classes_30k_train_015270
Implement the Python class `InputPage` described below. Class description: Implement the InputPage class. Method signatures and docstrings: - def __init__(self, parent, controller): Create the input page containing the text fields. - def save_info(self, type_of_run, primary_weight, primary_spring, secondary_spring, s...
Implement the Python class `InputPage` described below. Class description: Implement the InputPage class. Method signatures and docstrings: - def __init__(self, parent, controller): Create the input page containing the text fields. - def save_info(self, type_of_run, primary_weight, primary_spring, secondary_spring, s...
f03b2ce7e634badb0e55396f3914301def57934c
<|skeleton|> class InputPage: def __init__(self, parent, controller): """Create the input page containing the text fields.""" <|body_0|> def save_info(self, type_of_run, primary_weight, primary_spring, secondary_spring, secondary_clock, controller): """Save the information entered in t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputPage: def __init__(self, parent, controller): """Create the input page containing the text fields.""" tk.Frame.__init__(self, parent) self.controller = controller lbl_enter_test_type = tk.Label(self, text='Type of test run: ') lbl_enter_primary_weight = tk.Label(se...
the_stack_v2_python_sparse
GUI/GUI.py
krystal-bc/Senior-Design
train
0
71d4689d054126195b899474efa7654b0eec14bb
[ "s = 'nothingremovedhere'\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual(s, result)", "s = '#$%#^$%&**'\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual('', result)", "s = ''\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual('', result)" ]
<|body_start_0|> s = 'nothingremovedhere' result = findbestmatch._clean_non_chars(s) self.assertEqual(s, result) <|end_body_0|> <|body_start_1|> s = '#$%#^$%&**' result = findbestmatch._clean_non_chars(s) self.assertEqual('', result) <|end_body_1|> <|body_start_2|> ...
TestFindBestMatch
[ "BSD-3-Clause", "LGPL-2.1-or-later", "LGPL-2.1-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" <|body_0|> def testclean_text_2(self): """Test for _clean_non_chars (special symbols)""" <|body_1|> def testclean_text_3(self): """Test for _cle...
stack_v2_sparse_classes_75kplus_train_009312
4,823
permissive
[ { "docstring": "Test for _clean_non_chars (alphanumeric symbols)", "name": "testclean_text_1", "signature": "def testclean_text_1(self)" }, { "docstring": "Test for _clean_non_chars (special symbols)", "name": "testclean_text_2", "signature": "def testclean_text_2(self)" }, { "do...
3
stack_v2_sparse_classes_30k_train_050656
Implement the Python class `TestFindBestMatch` described below. Class description: Implement the TestFindBestMatch class. Method signatures and docstrings: - def testclean_text_1(self): Test for _clean_non_chars (alphanumeric symbols) - def testclean_text_2(self): Test for _clean_non_chars (special symbols) - def tes...
Implement the Python class `TestFindBestMatch` described below. Class description: Implement the TestFindBestMatch class. Method signatures and docstrings: - def testclean_text_1(self): Test for _clean_non_chars (alphanumeric symbols) - def testclean_text_2(self): Test for _clean_non_chars (special symbols) - def tes...
bf7f789d01b7c66ccd0c213db0a029da7e588c9e
<|skeleton|> class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" <|body_0|> def testclean_text_2(self): """Test for _clean_non_chars (special symbols)""" <|body_1|> def testclean_text_3(self): """Test for _cle...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" s = 'nothingremovedhere' result = findbestmatch._clean_non_chars(s) self.assertEqual(s, result) def testclean_text_2(self): """Test for _clean_non_chars (special s...
the_stack_v2_python_sparse
pywinauto/unittests/test_findbestmatch.py
pywinauto/pywinauto
train
4,466
5c9f05f46527f6dc76d6bf40e1d2fa43fcb5b29f
[ "if request.user.is_authenticated:\n return redirect('account')\nreturn render(request, 'auth_form.html', self.ctx)", "form = UserCreationForm(request.POST)\nif form.is_valid():\n form.save()\n email = form.cleaned_data.get('email')\n raw_password = form.cleaned_data.get('password1')\n user = authe...
<|body_start_0|> if request.user.is_authenticated: return redirect('account') return render(request, 'auth_form.html', self.ctx) <|end_body_0|> <|body_start_1|> form = UserCreationForm(request.POST) if form.is_valid(): form.save() email = form.cleaned...
Class handling the registration form
SignupView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignupView: """Class handling the registration form""" def get(self, request, *args, **kwargs): """Renders the registration form, or redirect to 'account' if the user is already authenticated""" <|body_0|> def post(self, request, *args, **kwargs): """Handles the ...
stack_v2_sparse_classes_75kplus_train_009313
5,701
no_license
[ { "docstring": "Renders the registration form, or redirect to 'account' if the user is already authenticated", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Handles the form validation and user registration", "name": "post", "signature": "def po...
2
stack_v2_sparse_classes_30k_train_040946
Implement the Python class `SignupView` described below. Class description: Class handling the registration form Method signatures and docstrings: - def get(self, request, *args, **kwargs): Renders the registration form, or redirect to 'account' if the user is already authenticated - def post(self, request, *args, **...
Implement the Python class `SignupView` described below. Class description: Class handling the registration form Method signatures and docstrings: - def get(self, request, *args, **kwargs): Renders the registration form, or redirect to 'account' if the user is already authenticated - def post(self, request, *args, **...
9a58efe4a4c1dd0b3d27bbc01ee945baa6dc4e97
<|skeleton|> class SignupView: """Class handling the registration form""" def get(self, request, *args, **kwargs): """Renders the registration form, or redirect to 'account' if the user is already authenticated""" <|body_0|> def post(self, request, *args, **kwargs): """Handles the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignupView: """Class handling the registration form""" def get(self, request, *args, **kwargs): """Renders the registration form, or redirect to 'account' if the user is already authenticated""" if request.user.is_authenticated: return redirect('account') return render...
the_stack_v2_python_sparse
accounts/views.py
SebGoliot/oc_p8-purbeurre
train
0
bd96779cbd1a8e8c860370b167a87a20102decab
[ "if root == None:\n return ''\nres = []\nq = collections.deque()\nq.append(root)\nwhile q:\n x = q.popleft()\n if x:\n res.append(str(x.val))\n q.append(x.left)\n q.append(x.right)\n else:\n res.append('None')\nreturn ','.join(res)", "if data == '':\n return None\ndata =...
<|body_start_0|> if root == None: return '' res = [] q = collections.deque() q.append(root) while q: x = q.popleft() if x: res.append(str(x.val)) q.append(x.left) q.append(x.right) els...
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_75kplus_train_009314
1,591
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_033333
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:...
c745168a01380edb52155ca3918787d2dd356e5b
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '' res = [] q = collections.deque() q.append(root) while q: x = q.popleft() if x: ...
the_stack_v2_python_sparse
pythonAlgorithm/Practice/hard/297二叉树的序列化与反序列化.py
bossjoker1/algorithm
train
4
0309c140249b6c506b66f4fb3960977397f36597
[ "for i in range(len(nums)):\n start = i\n if nums[i] == 0:\n continue\n positive = nums[start] > 0\n if nums[start] % len(nums) == 0:\n continue\n i_next = (i + nums[start]) % len(nums)\n while nums[i_next] % len(nums) != 0:\n if positive != (nums[i_next] > 0):\n br...
<|body_start_0|> for i in range(len(nums)): start = i if nums[i] == 0: continue positive = nums[start] > 0 if nums[start] % len(nums) == 0: continue i_next = (i + nums[start]) % len(nums) while nums[i_next] %...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def circularArrayLoop(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def circularArrayLoop2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(len(nums)): ...
stack_v2_sparse_classes_75kplus_train_009315
2,818
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "circularArrayLoop", "signature": "def circularArrayLoop(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "circularArrayLoop2", "signature": "def circularArrayLoop2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000253
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def circularArrayLoop(self, nums): :type nums: List[int] :rtype: bool - def circularArrayLoop2(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def circularArrayLoop(self, nums): :type nums: List[int] :rtype: bool - def circularArrayLoop2(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def circularArrayLoop(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def circularArrayLoop2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def circularArrayLoop(self, nums): """:type nums: List[int] :rtype: bool""" for i in range(len(nums)): start = i if nums[i] == 0: continue positive = nums[start] > 0 if nums[start] % len(nums) == 0: conti...
the_stack_v2_python_sparse
code457CircularArrayLoop.py
cybelewang/leetcode-python
train
0
55ae62165f757289721c3796b3aaa2206ff3ad2a
[ "self.is_categorical = is_categorical\nself.is_binary = len(unique_values) == 2\nself.unique_values = unique_values\nself.min = min(unique_values)\nself.max = max(unique_values)", "mean = stats.mean(unique_values)\nstdev = stats.stdev(unique_values)\nreturn [mean - stdev, mean + stdev]", "min_max_diff = self.ma...
<|body_start_0|> self.is_categorical = is_categorical self.is_binary = len(unique_values) == 2 self.unique_values = unique_values self.min = min(unique_values) self.max = max(unique_values) <|end_body_0|> <|body_start_1|> mean = stats.mean(unique_values) stdev = ...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, unique_values, is_categorical): """Constructor of an Encoder using one-hot-encoding""" <|body_0|> def __get_stdev_band(self, unique_values): """Get the lower bound and upper bound for the standard devaitation band for continuous value.""" ...
stack_v2_sparse_classes_75kplus_train_009316
1,820
no_license
[ { "docstring": "Constructor of an Encoder using one-hot-encoding", "name": "__init__", "signature": "def __init__(self, unique_values, is_categorical)" }, { "docstring": "Get the lower bound and upper bound for the standard devaitation band for continuous value.", "name": "__get_stdev_band",...
4
stack_v2_sparse_classes_30k_train_004462
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, unique_values, is_categorical): Constructor of an Encoder using one-hot-encoding - def __get_stdev_band(self, unique_values): Get the lower bound and upper bound...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, unique_values, is_categorical): Constructor of an Encoder using one-hot-encoding - def __get_stdev_band(self, unique_values): Get the lower bound and upper bound...
9ae339f81fc7134ba9058fe975dec9ac7e3aaba4
<|skeleton|> class Encoder: def __init__(self, unique_values, is_categorical): """Constructor of an Encoder using one-hot-encoding""" <|body_0|> def __get_stdev_band(self, unique_values): """Get the lower bound and upper bound for the standard devaitation band for continuous value.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: def __init__(self, unique_values, is_categorical): """Constructor of an Encoder using one-hot-encoding""" self.is_categorical = is_categorical self.is_binary = len(unique_values) == 2 self.unique_values = unique_values self.min = min(unique_values) self...
the_stack_v2_python_sparse
Project6/encoding.py
vincy0320/School_Intro_to_ML
train
0
fdf29d115289758c0fc2b00344f357292e489ce7
[ "test = '5 6\\n1 2\\n1 3\\n2 3\\n2 4\\n3 4\\n4 5'\nd = Musk(test)\nself.assertEqual(d.n, 5)\nself.assertEqual(d.m, 6)\nself.assertEqual(d.numa, [0, 0, 1, 1, 2, 3])\nself.assertEqual(d.numb, [1, 2, 2, 3, 3, 4])\nself.assertEqual(d.sets[0], {1, 2})\nself.assertEqual(d.sets[3], {1, 2, 4})\nself.assertEqual(Musk(test)....
<|body_start_0|> test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5' d = Musk(test) self.assertEqual(d.n, 5) self.assertEqual(d.m, 6) self.assertEqual(d.numa, [0, 0, 1, 1, 2, 3]) self.assertEqual(d.numb, [1, 2, 2, 3, 3, 4]) self.assertEqual(d.sets[0], {1, 2}) self....
unitTests
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unitTests: def test_single_test(self): """Musk class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|> <|body_start_0|> test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5' d = Musk(test) ...
stack_v2_sparse_classes_75kplus_train_009317
3,953
permissive
[ { "docstring": "Musk class testing", "name": "test_single_test", "signature": "def test_single_test(self)" }, { "docstring": "Timelimit testing", "name": "time_limit_test", "signature": "def time_limit_test(self, nmax)" } ]
2
stack_v2_sparse_classes_30k_train_040643
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): Musk class testing - def time_limit_test(self, nmax): Timelimit testing
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): Musk class testing - def time_limit_test(self, nmax): Timelimit testing <|skeleton|> class unitTests: def test_single_test(self): """M...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class unitTests: def test_single_test(self): """Musk class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class unitTests: def test_single_test(self): """Musk class testing""" test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5' d = Musk(test) self.assertEqual(d.n, 5) self.assertEqual(d.m, 6) self.assertEqual(d.numa, [0, 0, 1, 1, 2, 3]) self.assertEqual(d.numb, [1, 2, 2, 3,...
the_stack_v2_python_sparse
codeforces/574B_musk.py
snsokolov/contests
train
1
31a4a12b348e3837db43254aff922a8ad4447f1c
[ "self.face_detector = face_detector\nself.face_generator = face_generator\nself.save_all = save_all\nself.config = config\nself.video_converter = None\nif 'video_smooth_filter' in self.config:\n self.video_converter = video_utils.VideoConverter(use_kalman_filter=self.config['video_smooth_filter'] == 'kalman', bb...
<|body_start_0|> self.face_detector = face_detector self.face_generator = face_generator self.save_all = save_all self.config = config self.video_converter = None if 'video_smooth_filter' in self.config: self.video_converter = video_utils.VideoConverter(use_ka...
Swapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Swapper: def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, config, save_all=False): """Utility object that holds and manages the components necessary for swapping faces in a picture. :param face_detector: :param face_generator: :param config: :param save_all:...
stack_v2_sparse_classes_75kplus_train_009318
14,636
permissive
[ { "docstring": "Utility object that holds and manages the components necessary for swapping faces in a picture. :param face_detector: :param face_generator: :param config: :param save_all:", "name": "__init__", "signature": "def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, ...
2
stack_v2_sparse_classes_30k_train_008977
Implement the Python class `Swapper` described below. Class description: Implement the Swapper class. Method signatures and docstrings: - def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, config, save_all=False): Utility object that holds and manages the components necessary for swapping ...
Implement the Python class `Swapper` described below. Class description: Implement the Swapper class. Method signatures and docstrings: - def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, config, save_all=False): Utility object that holds and manages the components necessary for swapping ...
ada4803d4f1d53233ba4592beec75271254e5182
<|skeleton|> class Swapper: def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, config, save_all=False): """Utility object that holds and manages the components necessary for swapping faces in a picture. :param face_detector: :param face_generator: :param config: :param save_all:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Swapper: def __init__(self, face_detector: FaceDetector, face_generator: FaceGenerator, config, save_all=False): """Utility object that holds and manages the components necessary for swapping faces in a picture. :param face_detector: :param face_generator: :param config: :param save_all:""" se...
the_stack_v2_python_sparse
face_swap/deep_swap.py
brahimbellahcen/face-swap
train
0
4f50754d0b54b21756753e73d486c9418fb8db90
[ "assert isinstance(input_size, tuple), 'Input size must be a tuple (input_width, input_height)'\nself.input_size = input_size[:2]\nif gaussian_std is None:\n self.gaussian_std = gaussian_std\nelse:\n assert isinstance(gaussian_std, float), 'Gaussian std. dev must be a float'\n assert gaussian_std > 0.0, 'g...
<|body_start_0|> assert isinstance(input_size, tuple), 'Input size must be a tuple (input_width, input_height)' self.input_size = input_size[:2] if gaussian_std is None: self.gaussian_std = gaussian_std else: assert isinstance(gaussian_std, float), 'Gaussian std. ...
SpectrogramAddGaussNoise
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectrogramAddGaussNoise: def __init__(self, input_size, gaussian_mean=0.0, gaussian_std=None, prob_to_have_noise=1.0): """Add Gaussian Noise to the spectrogram using numpy Args: - input_size: size of the spectrogram OPTIONAL: - gaussian_mean: gaussian mean to apply - gaussian_std: gauss...
stack_v2_sparse_classes_75kplus_train_009319
5,592
no_license
[ { "docstring": "Add Gaussian Noise to the spectrogram using numpy Args: - input_size: size of the spectrogram OPTIONAL: - gaussian_mean: gaussian mean to apply - gaussian_std: gaussian standard deviation to apply - prob_to_have_noise: probability to have noise", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_train_033210
Implement the Python class `SpectrogramAddGaussNoise` described below. Class description: Implement the SpectrogramAddGaussNoise class. Method signatures and docstrings: - def __init__(self, input_size, gaussian_mean=0.0, gaussian_std=None, prob_to_have_noise=1.0): Add Gaussian Noise to the spectrogram using numpy Ar...
Implement the Python class `SpectrogramAddGaussNoise` described below. Class description: Implement the SpectrogramAddGaussNoise class. Method signatures and docstrings: - def __init__(self, input_size, gaussian_mean=0.0, gaussian_std=None, prob_to_have_noise=1.0): Add Gaussian Noise to the spectrogram using numpy Ar...
efaf7c637e8387116d0eea37a0a173bb65bbccc9
<|skeleton|> class SpectrogramAddGaussNoise: def __init__(self, input_size, gaussian_mean=0.0, gaussian_std=None, prob_to_have_noise=1.0): """Add Gaussian Noise to the spectrogram using numpy Args: - input_size: size of the spectrogram OPTIONAL: - gaussian_mean: gaussian mean to apply - gaussian_std: gauss...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpectrogramAddGaussNoise: def __init__(self, input_size, gaussian_mean=0.0, gaussian_std=None, prob_to_have_noise=1.0): """Add Gaussian Noise to the spectrogram using numpy Args: - input_size: size of the spectrogram OPTIONAL: - gaussian_mean: gaussian mean to apply - gaussian_std: gaussian standard d...
the_stack_v2_python_sparse
core/data_augmentation/image_transformations.py
EmanueleMusumeci/UrbanSound8K-CNN-sound-classification
train
1
46b1fce46aaec00aee7e8011fc02a3a7a6e62714
[ "loan = Loan.objects.all()\nserializer = LoanSerializer2(loan, many=True)\nreturn Response(serializer.data)", "json_data = request.data\nloan = {'loan_amount': request.data['loan_amount'], 'loan_duration': request.data['loan_duration'], 'rate_of_interest': request.data['rate_of_interest'], 'interest_amount': requ...
<|body_start_0|> loan = Loan.objects.all() serializer = LoanSerializer2(loan, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> json_data = request.data loan = {'loan_amount': request.data['loan_amount'], 'loan_duration': request.data['loan_duration'], ...
Management
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Management: def get(self, request): """Get tha Loan data.""" <|body_0|> def post(self, request): """Post loan data""" <|body_1|> <|end_skeleton|> <|body_start_0|> loan = Loan.objects.all() serializer = LoanSerializer2(loan, many=True) ...
stack_v2_sparse_classes_75kplus_train_009320
3,932
no_license
[ { "docstring": "Get tha Loan data.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Post loan data", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009394
Implement the Python class `Management` described below. Class description: Implement the Management class. Method signatures and docstrings: - def get(self, request): Get tha Loan data. - def post(self, request): Post loan data
Implement the Python class `Management` described below. Class description: Implement the Management class. Method signatures and docstrings: - def get(self, request): Get tha Loan data. - def post(self, request): Post loan data <|skeleton|> class Management: def get(self, request): """Get tha Loan data...
83455c50e2ee910f03db47fbe1420d1cbd7eb292
<|skeleton|> class Management: def get(self, request): """Get tha Loan data.""" <|body_0|> def post(self, request): """Post loan data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Management: def get(self, request): """Get tha Loan data.""" loan = Loan.objects.all() serializer = LoanSerializer2(loan, many=True) return Response(serializer.data) def post(self, request): """Post loan data""" json_data = request.data loan = {'loa...
the_stack_v2_python_sparse
mcred/loan_operation/views.py
vshaladhav97/django_practise_projects
train
0
2d68b016ac3b57dfdb06067f6e25d351a4ad9c6b
[ "rb_params = params\nparam_units = {k: unit.kJ / unit.mol for k in rb_params}\nreturn _copy_params(rb_params, param_units=param_units)", "for proper in topology.propers:\n atom_indices = tuple((topology.atom_index(atom) for atom in proper))\n top_key = TopologyKey(atom_indices=atom_indices)\n pot_key_ids...
<|body_start_0|> rb_params = params param_units = {k: unit.kJ / unit.mol for k in rb_params} return _copy_params(rb_params, param_units=param_units) <|end_body_0|> <|body_start_1|> for proper in topology.propers: atom_indices = tuple((topology.atom_index(atom) for atom in pr...
Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.
FoyerRBProperHandler
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" <|body_0|> def store_matches(self, atom_slot...
stack_v2_sparse_classes_75kplus_train_009321
6,006
permissive
[ { "docstring": "Get the parameters of this handler, tagged with units.", "name": "get_params_with_units", "signature": "def get_params_with_units(self, params)" }, { "docstring": "Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].", "name": "store_matches", "signatu...
2
stack_v2_sparse_classes_30k_train_004316
Implement the Python class `FoyerRBProperHandler` described below. Class description: Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field. Method signatures and docstrings: - def get_params_with_units(self, params): Get the parameters of this handler, tagged with units. - d...
Implement the Python class `FoyerRBProperHandler` described below. Class description: Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field. Method signatures and docstrings: - def get_params_with_units(self, params): Get the parameters of this handler, tagged with units. - d...
4616f2cff477c18e2c6ca70ac4c74c28b283a4be
<|skeleton|> class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" <|body_0|> def store_matches(self, atom_slot...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" rb_params = params param_units = {k: unit.kJ / unit.mo...
the_stack_v2_python_sparse
openff/interchange/foyer/_valence.py
openforcefield/openff-interchange
train
39
bf39ff7a8923716007dba8836708fa272d543c38
[ "if data != []:\n return cls({key: value['value'] for key, value in data.items()})\nreturn cls()", "norm_data = {}\nfor key, value in data.items():\n if isinstance(value, str):\n norm_data[key] = {'language': key, 'value': value}\n else:\n norm_data[key] = value\nreturn norm_data", "data ...
<|body_start_0|> if data != []: return cls({key: value['value'] for key, value in data.items()}) return cls() <|end_body_0|> <|body_start_1|> norm_data = {} for key, value in data.items(): if isinstance(value, str): norm_data[key] = {'language': k...
A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others.
LanguageDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageDict: """A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others.""" def fromJSON(cls, data, repo=None): """Construct a new LanguageDict from JSON.""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_009322
18,327
permissive
[ { "docstring": "Construct a new LanguageDict from JSON.", "name": "fromJSON", "signature": "def fromJSON(cls, data, repo=None)" }, { "docstring": "Helper function to expand data into the Wikibase API structure. :param data: Data to normalize :return: The dict with normalized data", "name": "...
3
stack_v2_sparse_classes_30k_train_013034
Implement the Python class `LanguageDict` described below. Class description: A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others. Method signatures and docstrings: - def fromJSON(cls, data, repo=None): Construct a ...
Implement the Python class `LanguageDict` described below. Class description: A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others. Method signatures and docstrings: - def fromJSON(cls, data, repo=None): Construct a ...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class LanguageDict: """A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others.""" def fromJSON(cls, data, repo=None): """Construct a new LanguageDict from JSON.""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LanguageDict: """A structure holding language data for a Wikibase entity. Language data are mappings from a language to a string. It can be labels, descriptions and others.""" def fromJSON(cls, data, repo=None): """Construct a new LanguageDict from JSON.""" if data != []: retu...
the_stack_v2_python_sparse
pywikibot/page/_collections.py
wikimedia/pywikibot
train
432
1624ecff9683ececb1823d0a95a379d234c66d99
[ "try:\n info = ParamFormat(Request()).get_search_params()\n function_info = Func.get_list(**info)\n return self.succeed('查询成功', {'app_list': function_info.get('list'), 'page_info': function_info.get('page_info')})\nexcept ValueError as e:\n return self.error_400(str(e))\nexcept BaseException as e:\n ...
<|body_start_0|> try: info = ParamFormat(Request()).get_search_params() function_info = Func.get_list(**info) return self.succeed('查询成功', {'app_list': function_info.get('list'), 'page_info': function_info.get('page_info')}) except ValueError as e: return s...
FunctionList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionList: def get(self): """:return:""" <|body_0|> def post(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: info = ParamFormat(Request()).get_search_params() function_info = Func.get_list(**info) ...
stack_v2_sparse_classes_75kplus_train_009323
2,971
permissive
[ { "docstring": ":return:", "name": "get", "signature": "def get(self)" }, { "docstring": ":return:", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `FunctionList` described below. Class description: Implement the FunctionList class. Method signatures and docstrings: - def get(self): :return: - def post(self): :return:
Implement the Python class `FunctionList` described below. Class description: Implement the FunctionList class. Method signatures and docstrings: - def get(self): :return: - def post(self): :return: <|skeleton|> class FunctionList: def get(self): """:return:""" <|body_0|> def post(self): ...
3252f47e6b3fca170b57819f8fdbdeb0f868654e
<|skeleton|> class FunctionList: def get(self): """:return:""" <|body_0|> def post(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionList: def get(self): """:return:""" try: info = ParamFormat(Request()).get_search_params() function_info = Func.get_list(**info) return self.succeed('查询成功', {'app_list': function_info.get('list'), 'page_info': function_info.get('page_info')}) ...
the_stack_v2_python_sparse
apps/controllers/v1/function.py
BruceWW/flask-basic
train
1
29666ceeb7ad8b049896dac71ecf612edb5778d0
[ "data = db.Db()\nresult = data.getCartridgesByState(state_id)\nresp.status = falcon.HTTP_200\nresp.content_type = falcon.MEDIA_TEXT\nresp.text = result", "param = req.media\naction = int(param['action'])\ndata = db.Db()\nif action == 0:\n result = data.changeCartridgeState(param)\n resp.status = falcon.HTTP...
<|body_start_0|> data = db.Db() result = data.getCartridgesByState(state_id) resp.status = falcon.HTTP_200 resp.content_type = falcon.MEDIA_TEXT resp.text = result <|end_body_0|> <|body_start_1|> param = req.media action = int(param['action']) data = db.D...
CartridgeState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartridgeState: def on_get(self, req, resp, state_id): """handle get request""" <|body_0|> def on_post(self, req, resp): """handle post""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = db.Db() result = data.getCartridgesByState(state_i...
stack_v2_sparse_classes_75kplus_train_009324
850
no_license
[ { "docstring": "handle get request", "name": "on_get", "signature": "def on_get(self, req, resp, state_id)" }, { "docstring": "handle post", "name": "on_post", "signature": "def on_post(self, req, resp)" } ]
2
stack_v2_sparse_classes_30k_train_015018
Implement the Python class `CartridgeState` described below. Class description: Implement the CartridgeState class. Method signatures and docstrings: - def on_get(self, req, resp, state_id): handle get request - def on_post(self, req, resp): handle post
Implement the Python class `CartridgeState` described below. Class description: Implement the CartridgeState class. Method signatures and docstrings: - def on_get(self, req, resp, state_id): handle get request - def on_post(self, req, resp): handle post <|skeleton|> class CartridgeState: def on_get(self, req, r...
529e9a0c66a6c7021224a2daf60f378f01164ca5
<|skeleton|> class CartridgeState: def on_get(self, req, resp, state_id): """handle get request""" <|body_0|> def on_post(self, req, resp): """handle post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CartridgeState: def on_get(self, req, resp, state_id): """handle get request""" data = db.Db() result = data.getCartridgesByState(state_id) resp.status = falcon.HTTP_200 resp.content_type = falcon.MEDIA_TEXT resp.text = result def on_post(self, req, resp): ...
the_stack_v2_python_sparse
answers/cartridge_state.py
Logsod/noti_rest_server
train
0
1e5418371050193189726d6653a01c532e592ea0
[ "if len(string1) == len(string2):\n string1 = sorted(string1)\n string2 = sorted(string2)\n return string1 == string2\nelse:\n return False", "string1 = string1.replace(' ', '')\nstring2 = string2.replace(' ', '')\nif len(string1) != len(string2):\n return False\nelse:\n lettersDict: Dict[str, s...
<|body_start_0|> if len(string1) == len(string2): string1 = sorted(string1) string2 = sorted(string2) return string1 == string2 else: return False <|end_body_0|> <|body_start_1|> string1 = string1.replace(' ', '') string2 = string2.replace...
AnagramSolutions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnagramSolutions: def anagrams_with_sort(self, string1: str, string2: str) -> bool: """This function will determine if two strings are anagrams of one another by sorting them and seeing if they form the same string Args: string1 (str) string2 (str) Returns: valid (bool): Will return True...
stack_v2_sparse_classes_75kplus_train_009325
2,633
permissive
[ { "docstring": "This function will determine if two strings are anagrams of one another by sorting them and seeing if they form the same string Args: string1 (str) string2 (str) Returns: valid (bool): Will return True if the strings are anagram, False otherwise", "name": "anagrams_with_sort", "signature...
2
stack_v2_sparse_classes_30k_train_017414
Implement the Python class `AnagramSolutions` described below. Class description: Implement the AnagramSolutions class. Method signatures and docstrings: - def anagrams_with_sort(self, string1: str, string2: str) -> bool: This function will determine if two strings are anagrams of one another by sorting them and seei...
Implement the Python class `AnagramSolutions` described below. Class description: Implement the AnagramSolutions class. Method signatures and docstrings: - def anagrams_with_sort(self, string1: str, string2: str) -> bool: This function will determine if two strings are anagrams of one another by sorting them and seei...
b21386e54a49d03c74f27eee9818b6d2a715371d
<|skeleton|> class AnagramSolutions: def anagrams_with_sort(self, string1: str, string2: str) -> bool: """This function will determine if two strings are anagrams of one another by sorting them and seeing if they form the same string Args: string1 (str) string2 (str) Returns: valid (bool): Will return True...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnagramSolutions: def anagrams_with_sort(self, string1: str, string2: str) -> bool: """This function will determine if two strings are anagrams of one another by sorting them and seeing if they form the same string Args: string1 (str) string2 (str) Returns: valid (bool): Will return True if the string...
the_stack_v2_python_sparse
python/string algorithms/anagrams.py
SoumyaMalgonde/AlgoBook
train
3
6163f0a1adb85a9fe56b50b3065461837c654ae9
[ "if device in cls.warned_devices:\n return\ncls.warned_devices.add(device)\nif fstype is None:\n logger.warning(f'Failed to determine filesystem type for {path} (device id: {device}). Using soft file locks to avoid potential data corruption.')\n return\nlogger.warning(f'The lock file {path} is on a filesys...
<|body_start_0|> if device in cls.warned_devices: return cls.warned_devices.add(device) if fstype is None: logger.warning(f'Failed to determine filesystem type for {path} (device id: {device}). Using soft file locks to avoid potential data corruption.') return...
This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it to the partition and finally checking the filesystem type. We prefer using soft file ...
FileSystemInspector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSystemInspector: """This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it to the partition and finally checking ...
stack_v2_sparse_classes_75kplus_train_009326
7,858
permissive
[ { "docstring": "Warn only once per device. This is used to avoid spamming the logs with the same message.", "name": "_warn_only_once", "signature": "def _warn_only_once(cls, path: str, device: int, fstype: Optional[str]) -> None" }, { "docstring": "Returns a mapping of device numbers to filesyst...
4
stack_v2_sparse_classes_30k_train_011391
Implement the Python class `FileSystemInspector` described below. Class description: This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it...
Implement the Python class `FileSystemInspector` described below. Class description: This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it...
34e5c2c29abe9b26699760074adcadfe8fd4cfe0
<|skeleton|> class FileSystemInspector: """This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it to the partition and finally checking ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileSystemInspector: """This class is used to inspect the file system state and determine if the file being created can use `fcntl` / `flock` or should use soft file locks. This can be achieved by finding the device owning the parent directory and mapping it to the partition and finally checking the filesyste...
the_stack_v2_python_sparse
src/python/aim/_core/storage/locking.py
aimhubio/aim
train
4,091
70e36e25eb8e125be4492ba3a92d1812ecd030c2
[ "Process.__init__(self)\nself.conf = conf\nself._cmp_tree_path = _cmp_tree_path\nself.cmp_model_fpath = cmp_model_fpath\nself.full_list_fpath = full_list_fpath\nself.logger = logging.getLogger('CMPComposition')", "with open('%s_cmp.hed' % self.conf.TYPE_HED_UNSEEN_BASE, 'w') as f:\n f.write('\\nTR 2\\n\\n')\n ...
<|body_start_0|> Process.__init__(self) self.conf = conf self._cmp_tree_path = _cmp_tree_path self.cmp_model_fpath = cmp_model_fpath self.full_list_fpath = full_list_fpath self.logger = logging.getLogger('CMPComposition') <|end_body_0|> <|body_start_1|> with open...
Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel.
CMPComposition
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMPComposition: """Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel.""" def __init__(self, conf, _cmp_tree_path, cmp_model_fpath, full_list_fpath): """Constructor :param co...
stack_v2_sparse_classes_75kplus_train_009327
7,028
no_license
[ { "docstring": "Constructor :param conf: the configuration object :param _cmp_tree_path: the path of the decision tree file :param cmp_model_fpath: the path of the model file :param full_list_fpath: the path of the file containing the list of needed labels :returns: None :rtype:", "name": "__init__", "s...
3
stack_v2_sparse_classes_30k_train_037806
Implement the Python class `CMPComposition` described below. Class description: Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel. Method signatures and docstrings: - def __init__(self, conf, _cmp_tree_path,...
Implement the Python class `CMPComposition` described below. Class description: Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel. Method signatures and docstrings: - def __init__(self, conf, _cmp_tree_path,...
c537a391f4547fcc48aa34ca7ddd949c3ebdc441
<|skeleton|> class CMPComposition: """Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel.""" def __init__(self, conf, _cmp_tree_path, cmp_model_fpath, full_list_fpath): """Constructor :param co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CMPComposition: """Class to generate the CMP models based on a given set of labels, the trained models and decision trees. This class is a process to be able to be run in parallel.""" def __init__(self, conf, _cmp_tree_path, cmp_model_fpath, full_list_fpath): """Constructor :param conf: the confi...
the_stack_v2_python_sparse
generation/utils/composition.py
seblemaguer/pyhts
train
1
f6a61012d2a48f4d44b181835af9d5ae68a428e8
[ "if not root:\n return\nif key >= root.data:\n if not root.right:\n root.right = Node(key)\n else:\n self.insert(root.right, key)\nelif not root.left:\n root.left = Node(key)\nelse:\n self.insert(root.left, key)", "if not root:\n return\nif key > root.data:\n self.find(root.righ...
<|body_start_0|> if not root: return if key >= root.data: if not root.right: root.right = Node(key) else: self.insert(root.right, key) elif not root.left: root.left = Node(key) else: self.insert(r...
二叉平衡搜索树,左节点<根节点,右节点>根节点
BinarySearchTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTree: """二叉平衡搜索树,左节点<根节点,右节点>根节点""" def insert(self, root: Node, key): """插入数据""" <|body_0|> def find(self, root: Node, key): """在以 root 为根节点的树上查找 key""" <|body_1|> def get_min(self, root: Node) -> Optional[Node]: """查找以 root 为根节点...
stack_v2_sparse_classes_75kplus_train_009328
2,289
no_license
[ { "docstring": "插入数据", "name": "insert", "signature": "def insert(self, root: Node, key)" }, { "docstring": "在以 root 为根节点的树上查找 key", "name": "find", "signature": "def find(self, root: Node, key)" }, { "docstring": "查找以 root 为根节点的树上的最小节点", "name": "get_min", "signature": "...
4
null
Implement the Python class `BinarySearchTree` described below. Class description: 二叉平衡搜索树,左节点<根节点,右节点>根节点 Method signatures and docstrings: - def insert(self, root: Node, key): 插入数据 - def find(self, root: Node, key): 在以 root 为根节点的树上查找 key - def get_min(self, root: Node) -> Optional[Node]: 查找以 root 为根节点的树上的最小节点 - def ...
Implement the Python class `BinarySearchTree` described below. Class description: 二叉平衡搜索树,左节点<根节点,右节点>根节点 Method signatures and docstrings: - def insert(self, root: Node, key): 插入数据 - def find(self, root: Node, key): 在以 root 为根节点的树上查找 key - def get_min(self, root: Node) -> Optional[Node]: 查找以 root 为根节点的树上的最小节点 - def ...
332b75948745d66d1a74253033444a2c63fb8e51
<|skeleton|> class BinarySearchTree: """二叉平衡搜索树,左节点<根节点,右节点>根节点""" def insert(self, root: Node, key): """插入数据""" <|body_0|> def find(self, root: Node, key): """在以 root 为根节点的树上查找 key""" <|body_1|> def get_min(self, root: Node) -> Optional[Node]: """查找以 root 为根节点...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinarySearchTree: """二叉平衡搜索树,左节点<根节点,右节点>根节点""" def insert(self, root: Node, key): """插入数据""" if not root: return if key >= root.data: if not root.right: root.right = Node(key) else: self.insert(root.right, key) ...
the_stack_v2_python_sparse
algorithm_demo/binary_search_tree_demo.py
linkcheng/python_demo
train
2
05aeeacedf29184406bee077e06ddd43215b6ff4
[ "self._device_queue = device_queue\nself._device_cache = device_cache\nself._entity_cache = entity_cache\nself._plugins = plugins\nself._exclude_known_noisy_beacons = exclude_known_noisy_beacons\nself._blacklist = blacklist", "new_entity = device_to_entity(device, data)\nif self._exclude_known_noisy_beacons and s...
<|body_start_0|> self._device_queue = device_queue self._device_cache = device_cache self._entity_cache = entity_cache self._plugins = plugins self._exclude_known_noisy_beacons = exclude_known_noisy_beacons self._blacklist = blacklist <|end_body_0|> <|body_start_1|> ...
Event handler for BLE devices.
EventHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventHandler: """Event handler for BLE devices.""" def __init__(self, device_queue: Queue, device_cache: DeviceCache, entity_cache: EntityCache, plugins: Collection[BaseBluetoothPlugin], exclude_known_noisy_beacons: bool, blacklist: DevicesBlacklist): """:param device_queue: Queue us...
stack_v2_sparse_classes_75kplus_train_009329
7,916
permissive
[ { "docstring": ":param device_queue: Queue used to publish updated devices upstream. :param device_cache: Device cache. :param entity_cache: Entity cache. :param exclude_known_noisy_beacons: Exclude known noisy beacons. :param blacklist: Blacklist rules.", "name": "__init__", "signature": "def __init__(...
3
stack_v2_sparse_classes_30k_train_000874
Implement the Python class `EventHandler` described below. Class description: Event handler for BLE devices. Method signatures and docstrings: - def __init__(self, device_queue: Queue, device_cache: DeviceCache, entity_cache: EntityCache, plugins: Collection[BaseBluetoothPlugin], exclude_known_noisy_beacons: bool, bl...
Implement the Python class `EventHandler` described below. Class description: Event handler for BLE devices. Method signatures and docstrings: - def __init__(self, device_queue: Queue, device_cache: DeviceCache, entity_cache: EntityCache, plugins: Collection[BaseBluetoothPlugin], exclude_known_noisy_beacons: bool, bl...
446bc2f67493d3554c5422242ff91d5b5c76d78a
<|skeleton|> class EventHandler: """Event handler for BLE devices.""" def __init__(self, device_queue: Queue, device_cache: DeviceCache, entity_cache: EntityCache, plugins: Collection[BaseBluetoothPlugin], exclude_known_noisy_beacons: bool, blacklist: DevicesBlacklist): """:param device_queue: Queue us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EventHandler: """Event handler for BLE devices.""" def __init__(self, device_queue: Queue, device_cache: DeviceCache, entity_cache: EntityCache, plugins: Collection[BaseBluetoothPlugin], exclude_known_noisy_beacons: bool, blacklist: DevicesBlacklist): """:param device_queue: Queue used to publish...
the_stack_v2_python_sparse
platypush/plugins/bluetooth/_ble/_event_handler.py
BlackLight/platypush
train
265
08f6dd9663ac53dc4e6431ba1f41d75c80c4d746
[ "if bamFile == None or bamFile.sam == True:\n self.convertToBam(bamFile)\nif bamFile.sorted == True:\n return\noutputFile = bamFile.getNewFileName()\ncmd = bamFile.pool.config.getProgramPath('samtools') + ' sort -o ' + bamFile.getFile() + ' ' + outputFile + ' > ' + outputFile\nself.execute(cmd, 'samtools sort...
<|body_start_0|> if bamFile == None or bamFile.sam == True: self.convertToBam(bamFile) if bamFile.sorted == True: return outputFile = bamFile.getNewFileName() cmd = bamFile.pool.config.getProgramPath('samtools') + ' sort -o ' + bamFile.getFile() + ' ' + outputFile...
The class ConvertionTools regulates the support between the mappers and the programs for SV calling.
ConversionTools
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConversionTools: """The class ConvertionTools regulates the support between the mappers and the programs for SV calling.""" def sortBam(self, bamFile): """The method sortBam sorts a bam file of a given sample. The bam file can only be sorted when this is a bam file. If it is not a ba...
stack_v2_sparse_classes_75kplus_train_009330
5,550
no_license
[ { "docstring": "The method sortBam sorts a bam file of a given sample. The bam file can only be sorted when this is a bam file. If it is not a bam file, the file first will be converted to a bam file. :param sample: The sample which contains the bam file to be sorted :type sample: an instance of a Sample object...
6
stack_v2_sparse_classes_30k_train_006691
Implement the Python class `ConversionTools` described below. Class description: The class ConvertionTools regulates the support between the mappers and the programs for SV calling. Method signatures and docstrings: - def sortBam(self, bamFile): The method sortBam sorts a bam file of a given sample. The bam file can ...
Implement the Python class `ConversionTools` described below. Class description: The class ConvertionTools regulates the support between the mappers and the programs for SV calling. Method signatures and docstrings: - def sortBam(self, bamFile): The method sortBam sorts a bam file of a given sample. The bam file can ...
2543f2bdb61fb07e2ee8ab76ffc930c13f0a4dbb
<|skeleton|> class ConversionTools: """The class ConvertionTools regulates the support between the mappers and the programs for SV calling.""" def sortBam(self, bamFile): """The method sortBam sorts a bam file of a given sample. The bam file can only be sorted when this is a bam file. If it is not a ba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConversionTools: """The class ConvertionTools regulates the support between the mappers and the programs for SV calling.""" def sortBam(self, bamFile): """The method sortBam sorts a bam file of a given sample. The bam file can only be sorted when this is a bam file. If it is not a bam file, the f...
the_stack_v2_python_sparse
pythonCodeBase/src/programs/ConversionTools.py
VLPB/VLPB
train
0
788c127268c4562d6d9257ac38ba6b7d686250a9
[ "if context is None:\n context = {}\nbody = render_to_string(tpl, context)\nsuper(EmailMessage, self).__init__(subject, body, from_email=from_email)", "if to and isinstance(to, (tuple, list)):\n self.to = list(to)\nif bcc and isinstance(bcc, (tuple, list)):\n self.bcc = list(to)\nif cc and isinstance(cc,...
<|body_start_0|> if context is None: context = {} body = render_to_string(tpl, context) super(EmailMessage, self).__init__(subject, body, from_email=from_email) <|end_body_0|> <|body_start_1|> if to and isinstance(to, (tuple, list)): self.to = list(to) if...
Template-based email message.
EmailMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailMessage: """Template-based email message.""" def __init__(self, subject, tpl, context=None, from_email=None): """Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :param context: Template context (dict or None) :param from_em...
stack_v2_sparse_classes_75kplus_train_009331
2,671
permissive
[ { "docstring": "Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :param context: Template context (dict or None) :param from_email: Email origin (str or None)", "name": "__init__", "signature": "def __init__(self, subject, tpl, context=None, from_em...
2
stack_v2_sparse_classes_30k_train_032894
Implement the Python class `EmailMessage` described below. Class description: Template-based email message. Method signatures and docstrings: - def __init__(self, subject, tpl, context=None, from_email=None): Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :para...
Implement the Python class `EmailMessage` described below. Class description: Template-based email message. Method signatures and docstrings: - def __init__(self, subject, tpl, context=None, from_email=None): Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :para...
8f4a3d3d07a1f80b7225a415cea30dfc65a38bf1
<|skeleton|> class EmailMessage: """Template-based email message.""" def __init__(self, subject, tpl, context=None, from_email=None): """Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :param context: Template context (dict or None) :param from_em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailMessage: """Template-based email message.""" def __init__(self, subject, tpl, context=None, from_email=None): """Initialize a email message instance. :param subject: Subject (str) :param tpl: Template file path (str) :param context: Template context (dict or None) :param from_email: Email or...
the_stack_v2_python_sparse
ydns/utils/mail.py
nocnokneo/ydns
train
0
8ebbd73431e72e56461f59a566870a7c621bce95
[ "super(Unet, self).__init__()\nfeatures = init_features\nself.encoder1 = self._block(in_channels, features)\nself.pool1 = MaxPool2d(kernel_size=2, stride=2)\nself.encoder2 = self._block(features, features * 2)\nself.pool2 = MaxPool2d(kernel_size=2, stride=2)\nself.encoder3 = self._block(features * 2, features * 4)\...
<|body_start_0|> super(Unet, self).__init__() features = init_features self.encoder1 = self._block(in_channels, features) self.pool1 = MaxPool2d(kernel_size=2, stride=2) self.encoder2 = self._block(features, features * 2) self.pool2 = MaxPool2d(kernel_size=2, stride=2) ...
Create ResNet SearchSpace.
Unet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Unet: """Create ResNet SearchSpace.""" def __init__(self, in_channels=3, out_channels=1, init_features=32): """Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_channels: int :param init_features: features :type init_feat...
stack_v2_sparse_classes_75kplus_train_009332
3,918
permissive
[ { "docstring": "Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_channels: int :param init_features: features :type init_features: int", "name": "__init__", "signature": "def __init__(self, in_channels=3, out_channels=1, init_features=32)" ...
3
stack_v2_sparse_classes_30k_train_001572
Implement the Python class `Unet` described below. Class description: Create ResNet SearchSpace. Method signatures and docstrings: - def __init__(self, in_channels=3, out_channels=1, init_features=32): Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_cha...
Implement the Python class `Unet` described below. Class description: Create ResNet SearchSpace. Method signatures and docstrings: - def __init__(self, in_channels=3, out_channels=1, init_features=32): Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_cha...
52b53582fe7df95d7aacc8425013fd18645d079f
<|skeleton|> class Unet: """Create ResNet SearchSpace.""" def __init__(self, in_channels=3, out_channels=1, init_features=32): """Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_channels: int :param init_features: features :type init_feat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Unet: """Create ResNet SearchSpace.""" def __init__(self, in_channels=3, out_channels=1, init_features=32): """Create layers. :param in_channels: in channel :type in_channels: int :param out_channels: out_channels :type out_channels: int :param init_features: features :type init_features: int""" ...
the_stack_v2_python_sparse
vega/networks/unet.py
yiziqi/vega
train
0
4f38f6bb13d11c9d185e13a4eb6602637ad00205
[ "confusion_matrix = metrics.confusion_matrix(test_labels, labels).astype(np.float32)\nconfusion_matrix = confusion_matrix / confusion_matrix.sum(axis=1)[:, np.newaxis]\ndf_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names)\nplt.figure(figsize=(10, 7))\nsns.heatmap(df_cm, annot=True)\nplt.yl...
<|body_start_0|> confusion_matrix = metrics.confusion_matrix(test_labels, labels).astype(np.float32) confusion_matrix = confusion_matrix / confusion_matrix.sum(axis=1)[:, np.newaxis] df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names) plt.figure(figsize=(10, 7)...
Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.
ClassificationVisualiser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title...
stack_v2_sparse_classes_75kplus_train_009333
3,314
no_license
[ { "docstring": "Plots a confusion matrix for the given labels. Parameters ---------- labels : array-like Predicted labels from the classifier. test_labels : array-like Ground truth labels. class_names : array-like The names of the classes in the data. title : str Title of the plot and name of the file.", "n...
2
stack_v2_sparse_classes_30k_train_014070
Implement the Python class `ClassificationVisualiser` described below. Class description: Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications. Method signatures and docstrings: - def...
Implement the Python class `ClassificationVisualiser` described below. Class description: Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications. Method signatures and docstrings: - def...
0e95ca353335acdb2f9e15958c59a1074d705441
<|skeleton|> class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title): ""...
the_stack_v2_python_sparse
action_recognition/classifiers/classification_visualiser.py
CamiloAguilar/openpose-tda-action-recognition
train
0
b7d8de726930c839831a25cec79986f0d595a689
[ "if d_ij is None:\n d_ij = np.empty(0)\nif C_ij is None:\n C_ij = np.empty(0)\nind = np.argsort(d_ij)\nself.d_ij = d_ij[ind]\nself.C_ij = C_ij[ind]", "d_ij = np.hstack((self.d_ij, correlation.d_ij))\nC_ij = np.hstack((self.C_ij, correlation.C_ij))\nind = np.argsort(d_ij)\nself.d_ij = d[ind]\nself.C_ij = C_i...
<|body_start_0|> if d_ij is None: d_ij = np.empty(0) if C_ij is None: C_ij = np.empty(0) ind = np.argsort(d_ij) self.d_ij = d_ij[ind] self.C_ij = C_ij[ind] <|end_body_0|> <|body_start_1|> d_ij = np.hstack((self.d_ij, correlation.d_ij)) C_i...
Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements
SpatialCorrelation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialCorrelation: """Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements""" def __init__(self, d_ij=None, C_ij=None): """Instantia...
stack_v2_sparse_classes_75kplus_train_009334
8,963
permissive
[ { "docstring": "Instantiate container for correlations between 1-D timeseries. Args: d_ij (np.ndarray) - pairwise separation distances C_ij (np.ndarray) - normalized pairwise fluctuations", "name": "__init__", "signature": "def __init__(self, d_ij=None, C_ij=None)" }, { "docstring": "Concatenate...
2
stack_v2_sparse_classes_30k_train_040596
Implement the Python class `SpatialCorrelation` described below. Class description: Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements Method signatures and docstrin...
Implement the Python class `SpatialCorrelation` described below. Class description: Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements Method signatures and docstrin...
4a622c3f5fed4456c3b9240f5a96428789fde9bd
<|skeleton|> class SpatialCorrelation: """Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements""" def __init__(self, d_ij=None, C_ij=None): """Instantia...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpatialCorrelation: """Container for correlations between 1-D timeseries. Attributes: d_ij (np array) - pairwise separation distances between measurements C_ij (np array) - normalized pairwise fluctuations between measurements""" def __init__(self, d_ij=None, C_ij=None): """Instantiate container ...
the_stack_v2_python_sparse
flyqma/annotation/spatial/correlation.py
sbernasek/flyqma
train
1
ba2e6254bf560d2d9a1c38f9237a0e26b096551f
[ "ugrid_filename = os.path.join(PKG_PATH, 'converters', 'aflr', 'ugrid', 'models', 'two_blade_wake_sym_extended.surf')\nlog = SimpleLogger(level='warning')\ntest = SurfGui()\ntest.log = log\ntest.on_load_geometry(ugrid_filename, geometry_format='surf', raise_error=True)", "log = SimpleLogger(level='error')\nMODEL_...
<|body_start_0|> ugrid_filename = os.path.join(PKG_PATH, 'converters', 'aflr', 'ugrid', 'models', 'two_blade_wake_sym_extended.surf') log = SimpleLogger(level='warning') test = SurfGui() test.log = log test.on_load_geometry(ugrid_filename, geometry_format='surf', raise_error=True...
defines *.surf tests
TestSurfGui
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSurfGui: """defines *.surf tests""" def test_surf_gui_01(self): """tests two_blade_wake_sym_extended.surf""" <|body_0|> def test_surf_01(self): """tests two_blade_wake_sym_extended.surf""" <|body_1|> <|end_skeleton|> <|body_start_0|> ugrid_f...
stack_v2_sparse_classes_75kplus_train_009335
4,370
no_license
[ { "docstring": "tests two_blade_wake_sym_extended.surf", "name": "test_surf_gui_01", "signature": "def test_surf_gui_01(self)" }, { "docstring": "tests two_blade_wake_sym_extended.surf", "name": "test_surf_01", "signature": "def test_surf_01(self)" } ]
2
stack_v2_sparse_classes_30k_train_041199
Implement the Python class `TestSurfGui` described below. Class description: defines *.surf tests Method signatures and docstrings: - def test_surf_gui_01(self): tests two_blade_wake_sym_extended.surf - def test_surf_01(self): tests two_blade_wake_sym_extended.surf
Implement the Python class `TestSurfGui` described below. Class description: defines *.surf tests Method signatures and docstrings: - def test_surf_gui_01(self): tests two_blade_wake_sym_extended.surf - def test_surf_01(self): tests two_blade_wake_sym_extended.surf <|skeleton|> class TestSurfGui: """defines *.su...
cc596e637b53cf0a997f92e0e09f43222960052c
<|skeleton|> class TestSurfGui: """defines *.surf tests""" def test_surf_gui_01(self): """tests two_blade_wake_sym_extended.surf""" <|body_0|> def test_surf_01(self): """tests two_blade_wake_sym_extended.surf""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSurfGui: """defines *.surf tests""" def test_surf_gui_01(self): """tests two_blade_wake_sym_extended.surf""" ugrid_filename = os.path.join(PKG_PATH, 'converters', 'aflr', 'ugrid', 'models', 'two_blade_wake_sym_extended.surf') log = SimpleLogger(level='warning') test = ...
the_stack_v2_python_sparse
pyNastran/converters/aflr/surf/test_surf_gui.py
lnderuiter/pyNastran
train
0
cc8599f951de065a6c9857673beb5ff8aba11142
[ "profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.inset.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Inset', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://ww...
<|body_start_0|> profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.inset.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Inset', self, '') self.openWikiManualHelpPage = settings.HelpPag...
A class to handle the inset settings.
InsetRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsetRepository: """A class to handle the inset settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Inset button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_009336
19,617
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inset button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_012504
Implement the Python class `InsetRepository` described below. Class description: A class to handle the inset settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Inset button has been clicked.
Implement the Python class `InsetRepository` described below. Class description: A class to handle the inset settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Inset button has been clicked. <|skeleton|> class InsetRepos...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class InsetRepository: """A class to handle the inset settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Inset button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InsetRepository: """A class to handle the inset settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.inset.html', self) self.fileNameInput = settings.FileNameInput(...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/inset.py
bmander/skeinforge
train
34
c1fe0fbecbd57674395e65d4d7995f70476caa72
[ "self.barcode = barcode\nself.time_label = time_label\nself.frame_label = frame_label\nself.x_pos = mouse_x\nself.y_pos = mouse_y\nself.window = tkinter.Tk()\nself.window.wm_title('At this point...')\nself.window.iconbitmap(resource_path('kalmus_icon.ico'))\nstart_label = tkinter.Label(master=self.window, text='Sta...
<|body_start_0|> self.barcode = barcode self.time_label = time_label self.frame_label = frame_label self.x_pos = mouse_x self.y_pos = mouse_y self.window = tkinter.Tk() self.window.wm_title('At this point...') self.window.iconbitmap(resource_path('kalmus_i...
CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode
CalibrateBarcodeTimeWindow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalibrateBarcodeTimeWindow: """CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode""" def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): """Initialize :param barcode: The barcode to recalibrate :param time_label: the text lab...
stack_v2_sparse_classes_75kplus_train_009337
4,396
permissive
[ { "docstring": "Initialize :param barcode: The barcode to recalibrate :param time_label: the text label for time :param frame_label: the text label for the frame index :param mouse_x: the x position of the clicked point :param mouse_y: the y position of the clicked point", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_038837
Implement the Python class `CalibrateBarcodeTimeWindow` described below. Class description: CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode Method signatures and docstrings: - def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): Initialize :param barcode: T...
Implement the Python class `CalibrateBarcodeTimeWindow` described below. Class description: CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode Method signatures and docstrings: - def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): Initialize :param barcode: T...
fb26d51d086cc509e9394fd6da8ce8043f80cfd2
<|skeleton|> class CalibrateBarcodeTimeWindow: """CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode""" def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): """Initialize :param barcode: The barcode to recalibrate :param time_label: the text lab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CalibrateBarcodeTimeWindow: """CalibrateBarcodeTimeWindow Class GUI window for user to recalibrate the time of a barcode""" def __init__(self, barcode, time_label, frame_label, mouse_x, mouse_y): """Initialize :param barcode: The barcode to recalibrate :param time_label: the text label for time :...
the_stack_v2_python_sparse
kalmus/tkinter_windows/time_points_windows/CalibrateBarcodeTimeWindow.py
imayuyu/KALMUS
train
0
16e14bb2cd78bebee833ec96484d40f93d9ece76
[ "module_scripts = ['core_parser_app/js/builtin/checkboxes.js']\nif scripts:\n module_scripts += scripts\nmodule_styles = ['core_parser_app/css/builtin/checkboxes.css']\nif styles:\n module_styles += styles\nAbstractModule.__init__(self, scripts=module_scripts, styles=module_styles)\nif name is None:\n rais...
<|body_start_0|> module_scripts = ['core_parser_app/js/builtin/checkboxes.js'] if scripts: module_scripts += scripts module_styles = ['core_parser_app/css/builtin/checkboxes.css'] if styles: module_styles += styles AbstractModule.__init__(self, scripts=mod...
Checkboxes module
AbstractCheckboxesModule
[ "NIST-Software", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractCheckboxesModule: """Checkboxes module""" def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None): """Initialize the module Args: scripts: styles: label: name: options: selected:""" <|body_0|> def _create_html_checkbox(in...
stack_v2_sparse_classes_75kplus_train_009338
3,012
permissive
[ { "docstring": "Initialize the module Args: scripts: styles: label: name: options: selected:", "name": "__init__", "signature": "def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None)" }, { "docstring": "Return the html of the checkboxes Args: input_key...
3
null
Implement the Python class `AbstractCheckboxesModule` described below. Class description: Checkboxes module Method signatures and docstrings: - def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None): Initialize the module Args: scripts: styles: label: name: options: selected...
Implement the Python class `AbstractCheckboxesModule` described below. Class description: Checkboxes module Method signatures and docstrings: - def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None): Initialize the module Args: scripts: styles: label: name: options: selected...
cef5e0f040c87e5fb224c59f90c314a6944e4d6b
<|skeleton|> class AbstractCheckboxesModule: """Checkboxes module""" def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None): """Initialize the module Args: scripts: styles: label: name: options: selected:""" <|body_0|> def _create_html_checkbox(in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AbstractCheckboxesModule: """Checkboxes module""" def __init__(self, scripts=None, styles=None, label=None, name=None, options=None, selected=None): """Initialize the module Args: scripts: styles: label: name: options: selected:""" module_scripts = ['core_parser_app/js/builtin/checkboxes....
the_stack_v2_python_sparse
core_parser_app/tools/modules/views/builtin/checkboxes_module.py
usnistgov/core_parser_app
train
0
64867d083bf89ee7e67b2eadce667609eaab2f1e
[ "super(StActiveButton, self).__init__(parent)\nself.algoEngine = algoEngine\nself.spreadName = spreadName\nself.active = False\nself.setStopped()\nself.clicked.connect(self.buttonClicked)", "if self.active:\n self.stop()\nelse:\n self.start()", "algoActive = self.algoEngine.stopAlgo(self.spreadName)\nif n...
<|body_start_0|> super(StActiveButton, self).__init__(parent) self.algoEngine = algoEngine self.spreadName = spreadName self.active = False self.setStopped() self.clicked.connect(self.buttonClicked) <|end_body_0|> <|body_start_1|> if self.active: self...
StActiveButton
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" <|body_0|> def buttonClicked(self): """改变运行模式""" <|body_1|> def stop(self): """停止""" <|body_2|> def start(self): """启动""" <|bo...
stack_v2_sparse_classes_75kplus_train_009339
22,428
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, algoEngine, spreadName, parent=None)" }, { "docstring": "改变运行模式", "name": "buttonClicked", "signature": "def buttonClicked(self)" }, { "docstring": "停止", "name": "stop", "signature": "def s...
6
stack_v2_sparse_classes_30k_train_011105
Implement the Python class `StActiveButton` described below. Class description: Implement the StActiveButton class. Method signatures and docstrings: - def __init__(self, algoEngine, spreadName, parent=None): Constructor - def buttonClicked(self): 改变运行模式 - def stop(self): 停止 - def start(self): 启动 - def setStarted(sel...
Implement the Python class `StActiveButton` described below. Class description: Implement the StActiveButton class. Method signatures and docstrings: - def __init__(self, algoEngine, spreadName, parent=None): Constructor - def buttonClicked(self): 改变运行模式 - def stop(self): 停止 - def start(self): 启动 - def setStarted(sel...
75f95a00e7eb569cb7cc530ea55d6646ba4595c1
<|skeleton|> class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" <|body_0|> def buttonClicked(self): """改变运行模式""" <|body_1|> def stop(self): """停止""" <|body_2|> def start(self): """启动""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" super(StActiveButton, self).__init__(parent) self.algoEngine = algoEngine self.spreadName = spreadName self.active = False self.setStopped() self.clicked.connect(s...
the_stack_v2_python_sparse
vnpy/trader/app/spreadTrading/uiStWidget.py
KilimanjaroFreeman/vnpy
train
3
29fff5538d81fc2a9d182ec7ff1592062e783825
[ "self.pendulum_mass = pendulum_mass\nself.cart_mass = cart_mass\nself.length = length\nself.rot_friction = rot_friction\nself.gravity = gravity\nsuper().__init__(func=self._ode, step_size=step_size, dim_action=(1,), dim_state=(4,))", "bk = get_backend(state)\npendulum_mass = self.pendulum_mass\ncart_mass = self.c...
<|body_start_0|> self.pendulum_mass = pendulum_mass self.cart_mass = cart_mass self.length = length self.rot_friction = rot_friction self.gravity = gravity super().__init__(func=self._ode, step_size=step_size, dim_action=(1,), dim_state=(4,)) <|end_body_0|> <|body_start_...
Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional
CartPole
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartPole: """Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional""" def __init__(self, pendulum_mass, cart_mass, length, rot_friction=0.0, gravity...
stack_v2_sparse_classes_75kplus_train_009340
2,902
permissive
[ { "docstring": "Initialization; see `CartPole`.", "name": "__init__", "signature": "def __init__(self, pendulum_mass, cart_mass, length, rot_friction=0.0, gravity=9.81, step_size=0.01)" }, { "docstring": "Compute the state time-derivative. Parameters ---------- state: ndarray or Tensor States. a...
2
stack_v2_sparse_classes_30k_train_005884
Implement the Python class `CartPole` described below. Class description: Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional Method signatures and docstrings: - def __init...
Implement the Python class `CartPole` described below. Class description: Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional Method signatures and docstrings: - def __init...
c144aeecba5f35ccfb4ec943d29d7092c0fa20e3
<|skeleton|> class CartPole: """Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional""" def __init__(self, pendulum_mass, cart_mass, length, rot_friction=0.0, gravity...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CartPole: """Cart with mounted inverted pendulum. Parameters ---------- pendulum_mass : float cart_mass : float length : float rot_friction : float, optional gravity: float, optional step_size : float, optional""" def __init__(self, pendulum_mass, cart_mass, length, rot_friction=0.0, gravity=9.81, step_s...
the_stack_v2_python_sparse
rllib/environment/systems/cart_pole.py
tzahishimkin/extended-hucrl
train
0
eb34f949f2898c3a85269754eed9d2ccbd34fa2c
[ "self.db_type = db_type\nassert self.db_type in ['MAST', 'SQL'], 'Unrecognized database type: {}. Must be SQL or MAST.'.format(db_type)\nif self.db_type == 'MAST':\n self.init_MAST(instrument)\nelif self.db_type == 'SQL':\n self.init_SQL()", "connection_string = get_config()['database']['connection_string']...
<|body_start_0|> self.db_type = db_type assert self.db_type in ['MAST', 'SQL'], 'Unrecognized database type: {}. Must be SQL or MAST.'.format(db_type) if self.db_type == 'MAST': self.init_MAST(instrument) elif self.db_type == 'SQL': self.init_SQL() <|end_body_0|> ...
Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database that enables querying
DatabaseConnection
[ "BSD-3-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseConnection: """Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database that enables querying""" def __ini...
stack_v2_sparse_classes_75kplus_train_009341
4,400
permissive
[ { "docstring": "Determine what kind of database is being queried, and call appropriate initialization method", "name": "__init__", "signature": "def __init__(self, db_type, instrument=None)" }, { "docstring": "Start SQLAlchemy session with the ``jwql`` database", "name": "init_SQL", "sig...
4
null
Implement the Python class `DatabaseConnection` described below. Class description: Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database ...
Implement the Python class `DatabaseConnection` described below. Class description: Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database ...
2ae74c51594925f81dde2f28b51548ffcdc257fd
<|skeleton|> class DatabaseConnection: """Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database that enables querying""" def __ini...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DatabaseConnection: """Facilitates connection with the ``jwql`` database. Attributes ---------- ObservationWebtest : obj Class instance in an "automap" schema corresponding to the ``observationwebtest`` database table session : obj Session with the database that enables querying""" def __init__(self, db_...
the_stack_v2_python_sparse
jwql/website/apps/jwql/db.py
catherine-martlin/jwql
train
1
cdff29985afd8f18dc0a362b9c49cc24f08032e4
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AutomaticRepliesSetting()", "from .automatic_replies_status import AutomaticRepliesStatus\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .external_audience_scope import ExternalAudienceScope\nfrom .automatic_replies_status im...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AutomaticRepliesSetting() <|end_body_0|> <|body_start_1|> from .automatic_replies_status import AutomaticRepliesStatus from .date_time_time_zone import DateTimeTimeZone from .ext...
AutomaticRepliesSetting
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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 creat...
stack_v2_sparse_classes_75kplus_train_009342
5,128
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: AutomaticRepliesSetting", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
stack_v2_sparse_classes_30k_train_037640
Implement the Python class `AutomaticRepliesSetting` described below. Class description: Implement the AutomaticRepliesSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: Creates a new instance of the appropriate clas...
Implement the Python class `AutomaticRepliesSetting` described below. Class description: Implement the AutomaticRepliesSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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 creat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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 R...
the_stack_v2_python_sparse
msgraph/generated/models/automatic_replies_setting.py
microsoftgraph/msgraph-sdk-python
train
135
0867f78d4ce33206b6ab3b792a286315e69e4051
[ "if n < 2:\n return n\nreturn self.fib(n - 1) + self.fib(n - 2)", "def fib_tail(n, a, b):\n if n < 2:\n return n\n if n == 2:\n return a + b\n else:\n return fib_tail(n - 1, b, a + b)\nreturn fib_tail(n, 0, 1)", "def fibonacci(n, memo):\n if n < 2:\n return n\n if m...
<|body_start_0|> if n < 2: return n return self.fib(n - 1) + self.fib(n - 2) <|end_body_0|> <|body_start_1|> def fib_tail(n, a, b): if n < 2: return n if n == 2: return a + b else: return fib_tail(n ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" <|body_0|> def fib0(self, n: int) -> int: """递归超时,尾递归""" <|body_1|> def fib1(self, n: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_2|> def fib2(self, n: int) -> i...
stack_v2_sparse_classes_75kplus_train_009343
3,131
permissive
[ { "docstring": "0、1、1、2、3、5、8、13、21...", "name": "fib", "signature": "def fib(self, n: int) -> int" }, { "docstring": "递归超时,尾递归", "name": "fib0", "signature": "def fib0(self, n: int) -> int" }, { "docstring": "递归超时,记忆化递归实现(数组/哈希表)", "name": "fib1", "signature": "def fib1(...
6
stack_v2_sparse_classes_30k_train_009685
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: 0、1、1、2、3、5、8、13、21... - def fib0(self, n: int) -> int: 递归超时,尾递归 - def fib1(self, n: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib2(self, n: int) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: 0、1、1、2、3、5、8、13、21... - def fib0(self, n: int) -> int: 递归超时,尾递归 - def fib1(self, n: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib2(self, n: int) -> i...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" <|body_0|> def fib0(self, n: int) -> int: """递归超时,尾递归""" <|body_1|> def fib1(self, n: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_2|> def fib2(self, n: int) -> i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def fib(self, n: int) -> int: """0、1、1、2、3、5、8、13、21...""" if n < 2: return n return self.fib(n - 1) + self.fib(n - 2) def fib0(self, n: int) -> int: """递归超时,尾递归""" def fib_tail(n, a, b): if n < 2: return n ...
the_stack_v2_python_sparse
lcof/10-fei-bo-na-qi-shu-lie-lcof.py
yuenliou/leetcode
train
0
ba3e7708765ad557a2cb01cac370a5c2da1fa74b
[ "network = self.create_network(dns_domain='starwars.')\nself.setup_network_and_server(network=network, server_name='luke')\nself.create_pingable_secgroup_rule(secgroup_id=self.security_groups[-1]['id'])\nself.check_connectivity(self.fip['floating_ip_address'], CONF.validation.image_ssh_user, self.keypair['private_k...
<|body_start_0|> network = self.create_network(dns_domain='starwars.') self.setup_network_and_server(network=network, server_name='luke') self.create_pingable_secgroup_rule(secgroup_id=self.security_groups[-1]['id']) self.check_connectivity(self.fip['floating_ip_address'], CONF.validatio...
Tests internal DNS capabilities.
InternalDNSTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping...
stack_v2_sparse_classes_75kplus_train_009344
8,441
permissive
[ { "docstring": "Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping the other VM's hostname", "name": "test_dns_domain_and_name", "signature": "def test_dns_domain_an...
2
stack_v2_sparse_classes_30k_train_005908
Implement the Python class `InternalDNSTest` described below. Class description: Tests internal DNS capabilities. Method signatures and docstrings: - def test_dns_domain_and_name(self): Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the...
Implement the Python class `InternalDNSTest` described below. Class description: Tests internal DNS capabilities. Method signatures and docstrings: - def test_dns_domain_and_name(self): Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the...
8f63937f01e6e662ced78a758991a0035df468b9
<|skeleton|> class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping the other VM...
the_stack_v2_python_sparse
neutron_tempest_plugin/scenario/test_internal_dns.py
openstack/neutron-tempest-plugin
train
14
2d69df4b9212792e517bee4225f2164836a6f9b4
[ "with self.Session() as session:\n if notification_id is not None:\n notification = session.scalars(UserNotification.select(session.user_or_token).where(UserNotification == notification_id)).first()\n if notification is None:\n return self.error(f'Cannot find UserNotification with ID: {n...
<|body_start_0|> with self.Session() as session: if notification_id is not None: notification = session.scalars(UserNotification.select(session.user_or_token).where(UserNotification == notification_id)).first() if notification is None: return self....
NotificationHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationHandler: def get(self, notification_id=None): """Fetch notification(s)""" <|body_0|> def patch(self, notification_id): """Update a notification""" <|body_1|> def delete(self, notification_id): """Delete a notification""" <|bod...
stack_v2_sparse_classes_75kplus_train_009345
4,496
permissive
[ { "docstring": "Fetch notification(s)", "name": "get", "signature": "def get(self, notification_id=None)" }, { "docstring": "Update a notification", "name": "patch", "signature": "def patch(self, notification_id)" }, { "docstring": "Delete a notification", "name": "delete", ...
3
stack_v2_sparse_classes_30k_train_037862
Implement the Python class `NotificationHandler` described below. Class description: Implement the NotificationHandler class. Method signatures and docstrings: - def get(self, notification_id=None): Fetch notification(s) - def patch(self, notification_id): Update a notification - def delete(self, notification_id): De...
Implement the Python class `NotificationHandler` described below. Class description: Implement the NotificationHandler class. Method signatures and docstrings: - def get(self, notification_id=None): Fetch notification(s) - def patch(self, notification_id): Update a notification - def delete(self, notification_id): De...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class NotificationHandler: def get(self, notification_id=None): """Fetch notification(s)""" <|body_0|> def patch(self, notification_id): """Update a notification""" <|body_1|> def delete(self, notification_id): """Delete a notification""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationHandler: def get(self, notification_id=None): """Fetch notification(s)""" with self.Session() as session: if notification_id is not None: notification = session.scalars(UserNotification.select(session.user_or_token).where(UserNotification == notification...
the_stack_v2_python_sparse
skyportal/handlers/api/internal/notifications.py
skyportal/skyportal
train
80
fd07e6d050c95e989a313342eef7c5ad2f2a6734
[ "super(LuisNet, self).__init__()\nself.threshold = params.defm_dcsn_threshold\nif 'glove' in params.embed_types:\n print('- Using glove embeddings')\n self.word_embed_type = 'glove'\n self.defm_embed_size = params.glove_embedding_size\n self.embedding = nn.Embedding(params.glove_vocab_size, params.defm_...
<|body_start_0|> super(LuisNet, self).__init__() self.threshold = params.defm_dcsn_threshold if 'glove' in params.embed_types: print('- Using glove embeddings') self.word_embed_type = 'glove' self.defm_embed_size = params.glove_embedding_size self....
This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional to apply functions such as F.relu,...
LuisNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LuisNet: """This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional...
stack_v2_sparse_classes_75kplus_train_009346
14,561
no_license
[ { "docstring": "We define a definition model which predicts if a sentence is a definition setnence or not. - an embedding layer: maps input to word embeddings - cnn layer: convolves over words in sentences - max pool: pooling layer - bilstm: applying the Bi-LSTM on the sequential input returns an output for eac...
2
stack_v2_sparse_classes_30k_train_036225
Implement the Python class `LuisNet` described below. Class description: This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward fu...
Implement the Python class `LuisNet` described below. Class description: This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward fu...
33c704480411bccc79dfefbe1b51d0f2123ec1a8
<|skeleton|> class LuisNet: """This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LuisNet: """This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional to apply fun...
the_stack_v2_python_sparse
src_def/model/net.py
FelixFra/cs224n_glossary_extraction
train
0
59aaf1162e0b085cb8accbdf8eef1d6f2f11e1c5
[ "list.sort(values, key=lambda x: x.value)\nn = len(values)\nif n == 0:\n return 0\nn_half = n // 2\nif n % 2 == 0:\n return (values[n_half - 1].value + values[n_half].value) // 2\nelse:\n return int(values[n_half].value)", "results = QuestionResponse.query.filter_by(question_id=self.question_id, verified...
<|body_start_0|> list.sort(values, key=lambda x: x.value) n = len(values) if n == 0: return 0 n_half = n // 2 if n % 2 == 0: return (values[n_half - 1].value + values[n_half].value) // 2 else: return int(values[n_half].value) <|end_body...
QuestionStatistic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionStatistic: def calculate_median(values: List[QuestionResponse]) -> float: """Returns the median value of all QuestionResults""" <|body_0|> def update(self): """Updates the statistics taking into account all QuestionResults of self.question that are verified."...
stack_v2_sparse_classes_75kplus_train_009347
3,122
no_license
[ { "docstring": "Returns the median value of all QuestionResults", "name": "calculate_median", "signature": "def calculate_median(values: List[QuestionResponse]) -> float" }, { "docstring": "Updates the statistics taking into account all QuestionResults of self.question that are verified.", "...
2
stack_v2_sparse_classes_30k_train_009052
Implement the Python class `QuestionStatistic` described below. Class description: Implement the QuestionStatistic class. Method signatures and docstrings: - def calculate_median(values: List[QuestionResponse]) -> float: Returns the median value of all QuestionResults - def update(self): Updates the statistics taking...
Implement the Python class `QuestionStatistic` described below. Class description: Implement the QuestionStatistic class. Method signatures and docstrings: - def calculate_median(values: List[QuestionResponse]) -> float: Returns the median value of all QuestionResults - def update(self): Updates the statistics taking...
e940e841a115bc7f3b9953ccb6815ae5470b29d2
<|skeleton|> class QuestionStatistic: def calculate_median(values: List[QuestionResponse]) -> float: """Returns the median value of all QuestionResults""" <|body_0|> def update(self): """Updates the statistics taking into account all QuestionResults of self.question that are verified."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionStatistic: def calculate_median(values: List[QuestionResponse]) -> float: """Returns the median value of all QuestionResults""" list.sort(values, key=lambda x: x.value) n = len(values) if n == 0: return 0 n_half = n // 2 if n % 2 == 0: ...
the_stack_v2_python_sparse
backend/app/model/models/QuestionStatistic.py
yeldiRium/st3k101
train
1
86951d6db83ab5f1900c3e52c12cae259b1c6310
[ "super(CriticCnn, self).__init__()\nself.conv1 = nn.Conv2d(num_images, 32, 8, 4)\nself.conv2 = nn.Conv2d(32, 64, 4, 2)\nself.conv3 = nn.Conv2d(64, 64, 3)\nself.fc1 = nn.Linear(1024, 400)\nself.fc2 = nn.Linear(400 + num_actions, 300)\nself.fc3 = nn.Linear(300, 1)\nfan_in, _ = nn.init._calculate_fan_in_and_fan_out(se...
<|body_start_0|> super(CriticCnn, self).__init__() self.conv1 = nn.Conv2d(num_images, 32, 8, 4) self.conv2 = nn.Conv2d(32, 64, 4, 2) self.conv3 = nn.Conv2d(64, 64, 3) self.fc1 = nn.Linear(1024, 400) self.fc2 = nn.Linear(400 + num_actions, 300) self.fc3 = nn.Linear...
Represents a Critic in the Actor to Critic Model.
CriticCnn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticCnn: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" <|body_0|> def forward(self, obs_batch, acti...
stack_v2_sparse_classes_75kplus_train_009348
13,450
no_license
[ { "docstring": "Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions", "name": "__init__", "signature": "def __init__(self, num_images, num_actions)" }, { "docstring": "Generate Q-values for the batch of observations and actions pairs. Args...
2
stack_v2_sparse_classes_30k_train_020590
Implement the Python class `CriticCnn` described below. Class description: Represents a Critic in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, num_images, num_actions): Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions - d...
Implement the Python class `CriticCnn` described below. Class description: Represents a Critic in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, num_images, num_actions): Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions - d...
6dcb04e79f776fc780b843208e2c689578c94bb3
<|skeleton|> class CriticCnn: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" <|body_0|> def forward(self, obs_batch, acti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CriticCnn: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" super(CriticCnn, self).__init__() self.conv1 = nn.Conv...
the_stack_v2_python_sparse
retina_reinforcement_sim/src/model/models.py
lewisboyd/MsciProject
train
0
c3a44a1f2506064752820e73fb459c1eb4256ec7
[ "threading.Thread.__init__(self)\nself.daemon = True\nself.camera = picamera.PiCamera()\nself.camera.resolution = (config['Camera'].getint('CAMERA_RESOLUTION_H'), config['Camera'].getint('CAMERA_RESOLUTION_V'))\nself.camera.framerate = config['Camera'].getint('framerate')\nself.rawCapture = PiRGBArray(self.camera, ...
<|body_start_0|> threading.Thread.__init__(self) self.daemon = True self.camera = picamera.PiCamera() self.camera.resolution = (config['Camera'].getint('CAMERA_RESOLUTION_H'), config['Camera'].getint('CAMERA_RESOLUTION_V')) self.camera.framerate = config['Camera'].getint('framera...
Thread to push camera to frame.
thready_boy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class thready_boy: """Thread to push camera to frame.""" def __init__(self): """Initialise camera object.""" <|body_0|> def run(self): """continuous capture the camera.""" <|body_1|> <|end_skeleton|> <|body_start_0|> threading.Thread.__init__(self) ...
stack_v2_sparse_classes_75kplus_train_009349
2,137
no_license
[ { "docstring": "Initialise camera object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "continuous capture the camera.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_024955
Implement the Python class `thready_boy` described below. Class description: Thread to push camera to frame. Method signatures and docstrings: - def __init__(self): Initialise camera object. - def run(self): continuous capture the camera.
Implement the Python class `thready_boy` described below. Class description: Thread to push camera to frame. Method signatures and docstrings: - def __init__(self): Initialise camera object. - def run(self): continuous capture the camera. <|skeleton|> class thready_boy: """Thread to push camera to frame.""" ...
646583889954f52ea44eb0bae73c6e4a05a07846
<|skeleton|> class thready_boy: """Thread to push camera to frame.""" def __init__(self): """Initialise camera object.""" <|body_0|> def run(self): """continuous capture the camera.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class thready_boy: """Thread to push camera to frame.""" def __init__(self): """Initialise camera object.""" threading.Thread.__init__(self) self.daemon = True self.camera = picamera.PiCamera() self.camera.resolution = (config['Camera'].getint('CAMERA_RESOLUTION_H'), con...
the_stack_v2_python_sparse
src/hardware/camera.py
rummens1337/project-row-rover
train
1
90d3f21dd63495c29c5f6d8cfd7f0bec78b1aa9b
[ "if connect_params is None:\n self.connect_params = {}\nelse:\n self.connect_params = connect_params\nself.db = self._open_connection()\nself.cursor = self.db.cursor()", "try:\n return MySQLdb.connect(**self.connect_params)\nexcept MySQLdb.MySQLError as e:\n raise DatabaseAccessError(e)", "try:\n ...
<|body_start_0|> if connect_params is None: self.connect_params = {} else: self.connect_params = connect_params self.db = self._open_connection() self.cursor = self.db.cursor() <|end_body_0|> <|body_start_1|> try: return MySQLdb.connect(**self...
Database that connects to MySQL.
MySQLDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLDatabase: """Database that connects to MySQL.""" def __init__(self, connect_params): """Create a MySQL database with connection parameters.""" <|body_0|> def _open_connection(self): """Open connection to database and return the connection object""" <...
stack_v2_sparse_classes_75kplus_train_009350
4,399
no_license
[ { "docstring": "Create a MySQL database with connection parameters.", "name": "__init__", "signature": "def __init__(self, connect_params)" }, { "docstring": "Open connection to database and return the connection object", "name": "_open_connection", "signature": "def _open_connection(sel...
6
stack_v2_sparse_classes_30k_train_020471
Implement the Python class `MySQLDatabase` described below. Class description: Database that connects to MySQL. Method signatures and docstrings: - def __init__(self, connect_params): Create a MySQL database with connection parameters. - def _open_connection(self): Open connection to database and return the connectio...
Implement the Python class `MySQLDatabase` described below. Class description: Database that connects to MySQL. Method signatures and docstrings: - def __init__(self, connect_params): Create a MySQL database with connection parameters. - def _open_connection(self): Open connection to database and return the connectio...
dbf372b361742484b270c4b69a3d5c5d18f300b6
<|skeleton|> class MySQLDatabase: """Database that connects to MySQL.""" def __init__(self, connect_params): """Create a MySQL database with connection parameters.""" <|body_0|> def _open_connection(self): """Open connection to database and return the connection object""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MySQLDatabase: """Database that connects to MySQL.""" def __init__(self, connect_params): """Create a MySQL database with connection parameters.""" if connect_params is None: self.connect_params = {} else: self.connect_params = connect_params self.d...
the_stack_v2_python_sparse
src/scripts/libs/ng/database.py
lichuanzju/ngavatar
train
0
205de0a26bd935f82dab87717f41c860fc571555
[ "super().modify_request_args(kwargs)\nkwargs.pop('get_footer_url', None)\nresource_type = kwargs.get('resource_type')\nparams = kwargs.setdefault('params', {})\nreferences = params.get('references')\nif references is None:\n if resource_type in (Resource.categoryscheme, Resource.dataflow, Resource.datastructure)...
<|body_start_0|> super().modify_request_args(kwargs) kwargs.pop('get_footer_url', None) resource_type = kwargs.get('resource_type') params = kwargs.setdefault('params', {}) references = params.get('references') if references is None: if resource_type in (Resou...
Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To configure :meth:`finish_message`, pass its `get_footer_url` argument to :m...
Source
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Source: """Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To configure :meth:`finish_message`, pass i...
stack_v2_sparse_classes_75kplus_train_009351
4,903
permissive
[ { "docstring": "Modify arguments used to build query URL. For the \"references\" query parameter, ESTAT (as of 2022-11-13) only supports the values \"children\", \"descendants\", or \"none\". Other values—including the \"all\" or \"parentsandsiblings\" used as defaults by :class:`.Client` cause errors. Replace ...
3
stack_v2_sparse_classes_30k_train_021357
Implement the Python class `Source` described below. Class description: Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To c...
Implement the Python class `Source` described below. Class description: Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To c...
7a648fb07b78d06b766aa65978101526d393eb14
<|skeleton|> class Source: """Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To configure :meth:`finish_message`, pass i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Source: """Handle Eurostat's mechanism for large datasets and other quirks. For some requests, ESTAT returns a DataMessage that has no content except for a ``<footer:Footer>`` element containing a URL where the data will be made available as a ZIP file. To configure :meth:`finish_message`, pass its `get_foote...
the_stack_v2_python_sparse
sdmx/source/estat.py
khaeru/sdmx
train
10
179862ad6bdba466e9999cbf3a707eb2e3202104
[ "email = request.data.get('email')\nif request.user.is_authenticated and email != request.user.email:\n raise PermissionDenied()\nreturn super(ResendConfirmationEmail, self).initial(request, *args, **kwargs)", "serializer = self.serializer_class(data=request.data)\nif not serializer.is_valid():\n return res...
<|body_start_0|> email = request.data.get('email') if request.user.is_authenticated and email != request.user.email: raise PermissionDenied() return super(ResendConfirmationEmail, self).initial(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> serializer = self.seria...
Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match.
ResendConfirmationEmail
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResendConfirmationEmail: """Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match.""" def initial(self, request, *args, **kwargs): """Disallow users other than the user whose email is being r...
stack_v2_sparse_classes_75kplus_train_009352
10,251
permissive
[ { "docstring": "Disallow users other than the user whose email is being reset.", "name": "initial", "signature": "def initial(self, request, *args, **kwargs)" }, { "docstring": "Validate `email` and send a request to confirm it.", "name": "post", "signature": "def post(self, request, *ar...
2
stack_v2_sparse_classes_30k_train_002211
Implement the Python class `ResendConfirmationEmail` described below. Class description: Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match. Method signatures and docstrings: - def initial(self, request, *args, **kwargs): ...
Implement the Python class `ResendConfirmationEmail` described below. Class description: Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match. Method signatures and docstrings: - def initial(self, request, *args, **kwargs): ...
28cd481d333fa313601825dab4b05f3e51974fe8
<|skeleton|> class ResendConfirmationEmail: """Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match.""" def initial(self, request, *args, **kwargs): """Disallow users other than the user whose email is being r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResendConfirmationEmail: """Resend a confirmation email. `POST` request to resend a confirmation email for existing user. If user is authenticated the email sent should match.""" def initial(self, request, *args, **kwargs): """Disallow users other than the user whose email is being reset.""" ...
the_stack_v2_python_sparse
user_management/api/views.py
incuna/django-user-management
train
56
a4bafe5c65c309fcde772fc97c097564dc89c41e
[ "super().__init__(**kwargs)\nself.parent = parent\nself.resizable(0, 0)\nself.title('Visualization options')\nself.action = action\nself.option = StringVar()\nself.main_frame = Frame(self, width=200, height=400)\nself.main_frame.grid(row=0, column=0, padx=10, pady=5)\nif self.action == 'viz':\n self.option_label...
<|body_start_0|> super().__init__(**kwargs) self.parent = parent self.resizable(0, 0) self.title('Visualization options') self.action = action self.option = StringVar() self.main_frame = Frame(self, width=200, height=400) self.main_frame.grid(row=0, column...
Class for the window to select graph options.
VisualizeOptionWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualizeOptionWindow: """Class for the window to select graph options.""" def __init__(self, parent, action, **kwargs): """Init function for the option window :param parent: the parent window :param kwargs: the arguments for the tkinter.Toplevel superclass""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_009353
2,127
no_license
[ { "docstring": "Init function for the option window :param parent: the parent window :param kwargs: the arguments for the tkinter.Toplevel superclass", "name": "__init__", "signature": "def __init__(self, parent, action, **kwargs)" }, { "docstring": "Sends the option selected to the parent windo...
2
stack_v2_sparse_classes_30k_train_006496
Implement the Python class `VisualizeOptionWindow` described below. Class description: Class for the window to select graph options. Method signatures and docstrings: - def __init__(self, parent, action, **kwargs): Init function for the option window :param parent: the parent window :param kwargs: the arguments for t...
Implement the Python class `VisualizeOptionWindow` described below. Class description: Class for the window to select graph options. Method signatures and docstrings: - def __init__(self, parent, action, **kwargs): Init function for the option window :param parent: the parent window :param kwargs: the arguments for t...
db7186d548bb9eea83ef2455946f7fd31245c26c
<|skeleton|> class VisualizeOptionWindow: """Class for the window to select graph options.""" def __init__(self, parent, action, **kwargs): """Init function for the option window :param parent: the parent window :param kwargs: the arguments for the tkinter.Toplevel superclass""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisualizeOptionWindow: """Class for the window to select graph options.""" def __init__(self, parent, action, **kwargs): """Init function for the option window :param parent: the parent window :param kwargs: the arguments for the tkinter.Toplevel superclass""" super().__init__(**kwargs) ...
the_stack_v2_python_sparse
PRD2_CONDETTE_Clément/PRD_Project/View/VisualizeOptionWindow.py
Jean-Baptiste-HUYGHE/PRD
train
1
14e9e4bfbb9f8134a12ff629d4b85571d4a8e993
[ "send_url = self.get_peizhi_(name='mensuo', yaml_ming='h5.yaml')\nsend_url = send_url['listUser']\nlogging.info('url is %s' % send_url)\nsend_dict = {'doorId': doorId}\nresponse = self.request_post(base_url=send_url, dict_data=send_dict)\nreturn response", "send_url = self.get_peizhi_(name='mensuo', yaml_ming='h5...
<|body_start_0|> send_url = self.get_peizhi_(name='mensuo', yaml_ming='h5.yaml') send_url = send_url['listUser'] logging.info('url is %s' % send_url) send_dict = {'doorId': doorId} response = self.request_post(base_url=send_url, dict_data=send_dict) return response <|end_...
房东端H5
Fangdongduan_H5
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fangdongduan_H5: """房东端H5""" def listUser(self, doorId): """获取门锁所有有权限用户列表""" <|body_0|> def getDoorBaseInfo(self, doorId): """获取门锁基本信息""" <|body_1|> def unfreezeRenter(self, userId, doorId): """房东解冻租客""" <|body_2|> def freezeRent...
stack_v2_sparse_classes_75kplus_train_009354
2,562
no_license
[ { "docstring": "获取门锁所有有权限用户列表", "name": "listUser", "signature": "def listUser(self, doorId)" }, { "docstring": "获取门锁基本信息", "name": "getDoorBaseInfo", "signature": "def getDoorBaseInfo(self, doorId)" }, { "docstring": "房东解冻租客", "name": "unfreezeRenter", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_046390
Implement the Python class `Fangdongduan_H5` described below. Class description: 房东端H5 Method signatures and docstrings: - def listUser(self, doorId): 获取门锁所有有权限用户列表 - def getDoorBaseInfo(self, doorId): 获取门锁基本信息 - def unfreezeRenter(self, userId, doorId): 房东解冻租客 - def freezeRenter(self, userId, doorId): 房东冻结租客
Implement the Python class `Fangdongduan_H5` described below. Class description: 房东端H5 Method signatures and docstrings: - def listUser(self, doorId): 获取门锁所有有权限用户列表 - def getDoorBaseInfo(self, doorId): 获取门锁基本信息 - def unfreezeRenter(self, userId, doorId): 房东解冻租客 - def freezeRenter(self, userId, doorId): 房东冻结租客 <|skel...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class Fangdongduan_H5: """房东端H5""" def listUser(self, doorId): """获取门锁所有有权限用户列表""" <|body_0|> def getDoorBaseInfo(self, doorId): """获取门锁基本信息""" <|body_1|> def unfreezeRenter(self, userId, doorId): """房东解冻租客""" <|body_2|> def freezeRent...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fangdongduan_H5: """房东端H5""" def listUser(self, doorId): """获取门锁所有有权限用户列表""" send_url = self.get_peizhi_(name='mensuo', yaml_ming='h5.yaml') send_url = send_url['listUser'] logging.info('url is %s' % send_url) send_dict = {'doorId': doorId} response = self....
the_stack_v2_python_sparse
public/aYiLou_fangdong/yilou_fangdong_business/fangdongduan_H5.py
GSIL-Monitor/mrbao_python
train
0
f7542da8340f0c6d3b57e7b58e81522c4f3a6587
[ "node = Node()\nnode.id = '1234'\nself.assertEqual(node.getId(), node.id)", "node = Node()\nnode.properties['datawire_nodeId'] = '4567'\nself.assertEqual(node.getId(), '4567')" ]
<|body_start_0|> node = Node() node.id = '1234' self.assertEqual(node.getId(), node.id) <|end_body_0|> <|body_start_1|> node = Node() node.properties['datawire_nodeId'] = '4567' self.assertEqual(node.getId(), '4567') <|end_body_1|>
Tests for Node.
NodeTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeTests: """Tests for Node.""" def test_id(self): """Node.getId() uses Node.id if present.""" <|body_0|> def test_missingId(self): """Node.getId() uses the datawire_nodeId property if the id is not set.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_009355
35,450
permissive
[ { "docstring": "Node.getId() uses Node.id if present.", "name": "test_id", "signature": "def test_id(self)" }, { "docstring": "Node.getId() uses the datawire_nodeId property if the id is not set.", "name": "test_missingId", "signature": "def test_missingId(self)" } ]
2
stack_v2_sparse_classes_30k_train_015640
Implement the Python class `NodeTests` described below. Class description: Tests for Node. Method signatures and docstrings: - def test_id(self): Node.getId() uses Node.id if present. - def test_missingId(self): Node.getId() uses the datawire_nodeId property if the id is not set.
Implement the Python class `NodeTests` described below. Class description: Tests for Node. Method signatures and docstrings: - def test_id(self): Node.getId() uses Node.id if present. - def test_missingId(self): Node.getId() uses the datawire_nodeId property if the id is not set. <|skeleton|> class NodeTests: ""...
8b4ad9aa1e3602f4ec7f3bdd5f2c22abcfe81463
<|skeleton|> class NodeTests: """Tests for Node.""" def test_id(self): """Node.getId() uses Node.id if present.""" <|body_0|> def test_missingId(self): """Node.getId() uses the datawire_nodeId property if the id is not set.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NodeTests: """Tests for Node.""" def test_id(self): """Node.getId() uses Node.id if present.""" node = Node() node.id = '1234' self.assertEqual(node.getId(), node.id) def test_missingId(self): """Node.getId() uses the datawire_nodeId property if the id is not ...
the_stack_v2_python_sparse
unittests/test_discovery.py
casualuser/mdk
train
0
806f59f4eafffa214b25d5e8bbadef45976cbd84
[ "zip_file = ZipFile(text_input_path)\nxml_data = zip_file.read('word/document.xml')\nzip_file.close()\nreturn BeautifulSoup(xml_data, 'xml')", "list_of_value = []\ntables = text_input_soup.find_all('tbl')\ndd_lists_content = tables[table_index].find_all('sdtContent')\nfor i in dd_lists_content:\n list_of_value...
<|body_start_0|> zip_file = ZipFile(text_input_path) xml_data = zip_file.read('word/document.xml') zip_file.close() return BeautifulSoup(xml_data, 'xml') <|end_body_0|> <|body_start_1|> list_of_value = [] tables = text_input_soup.find_all('tbl') dd_lists_content ...
DropDownLists
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DropDownLists: def get_soup(text_input_path) -> BeautifulSoup: """Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSoup object. Args: text_input_path: Path of the text input form. Returns: BeautifulSoup object that cont...
stack_v2_sparse_classes_75kplus_train_009356
1,611
no_license
[ { "docstring": "Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSoup object. Args: text_input_path: Path of the text input form. Returns: BeautifulSoup object that contains the XML data of the .docx document.", "name": "get_soup", "si...
2
stack_v2_sparse_classes_30k_train_050184
Implement the Python class `DropDownLists` described below. Class description: Implement the DropDownLists class. Method signatures and docstrings: - def get_soup(text_input_path) -> BeautifulSoup: Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSo...
Implement the Python class `DropDownLists` described below. Class description: Implement the DropDownLists class. Method signatures and docstrings: - def get_soup(text_input_path) -> BeautifulSoup: Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSo...
f0ce3f75756be5a1b377474882b66293be8ed5ac
<|skeleton|> class DropDownLists: def get_soup(text_input_path) -> BeautifulSoup: """Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSoup object. Args: text_input_path: Path of the text input form. Returns: BeautifulSoup object that cont...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DropDownLists: def get_soup(text_input_path) -> BeautifulSoup: """Opens a .docx file as a .zip file and stores the XML data containing the infos about the .docx document in a BeautifulSoup object. Args: text_input_path: Path of the text input form. Returns: BeautifulSoup object that contains the XML d...
the_stack_v2_python_sparse
docx_package/dropdown_lists.py
how2know/Usability_Testing_Report_Generator
train
0
6e256b6d2927d3b8788ddc3e35ed29846bb1c0ec
[ "l1, l2 = (headA, headB)\nwhile l1 != l2:\n l1 = l1.next if l1 else headB\n l2 = l2.next if l2 else headA\nreturn l1", "p1, p2 = (headA, headB)\nc1, c2 = (0, 0)\nwhile p1:\n p1 = p1.next\n c1 += 1\nwhile p2:\n p2 = p2.next\n c2 += 1\nheadA, headB = (headA, headB)\nif c1 > c2:\n for _ in range...
<|body_start_0|> l1, l2 = (headA, headB) while l1 != l2: l1 = l1.next if l1 else headB l2 = l2.next if l2 else headA return l1 <|end_body_0|> <|body_start_1|> p1, p2 = (headA, headB) c1, c2 = (0, 0) while p1: p1 = p1.next c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_009357
2,813
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode2", "signature": "def getIntersectionNo...
2
stack_v2_sparse_classes_30k_train_029079
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li...
d4215451f1cad3ab6dfb4b082f4fd694fe0d31b4
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" l1, l2 = (headA, headB) while l1 != l2: l1 = l1.next if l1 else headB l2 = l2.next if l2 else headA return l1 def getIntersectionNode2(self, h...
the_stack_v2_python_sparse
leetcode/探索中级算法/2链表/3相交链表.py
FishRedLeaf/my_code
train
3
62f2c8ed228d5e031079097b1590f017fc53f44e
[ "self.logger = ServerLogger(__name__, debug=debug)\nif ip_list:\n self.ip = ip_list\nelse:\n self.ip = []\nif status_code:\n self.status_code = [int(status) for status in status_code]\nelse:\n self.status_code = []\nself.logged_IP = list()", "for ip in data.keys():\n if ip in self.ip:\n if i...
<|body_start_0|> self.logger = ServerLogger(__name__, debug=debug) if ip_list: self.ip = ip_list else: self.ip = [] if status_code: self.status_code = [int(status) for status in status_code] else: self.status_code = [] self....
UserFilter class.
UserFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserFilter: """UserFilter class.""" def __init__(self, debug=False, ip_list=None, status_code=None): """Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log file status_code (list): List of status code to filter / g...
stack_v2_sparse_classes_75kplus_train_009358
3,678
permissive
[ { "docstring": "Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log file status_code (list): List of status code to filter / grab of the log file Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=...
3
stack_v2_sparse_classes_30k_train_046546
Implement the Python class `UserFilter` described below. Class description: UserFilter class. Method signatures and docstrings: - def __init__(self, debug=False, ip_list=None, status_code=None): Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log f...
Implement the Python class `UserFilter` described below. Class description: UserFilter class. Method signatures and docstrings: - def __init__(self, debug=False, ip_list=None, status_code=None): Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log f...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class UserFilter: """UserFilter class.""" def __init__(self, debug=False, ip_list=None, status_code=None): """Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log file status_code (list): List of status code to filter / g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserFilter: """UserFilter class.""" def __init__(self, debug=False, ip_list=None, status_code=None): """Initialize UserFilter. Args: debug (bool): Log on terminal or not ip_list (list): List of IPs to filter / grab of the log file status_code (list): List of status code to filter / grab of the lo...
the_stack_v2_python_sparse
securetea/lib/log_monitor/server_log/user_filter.py
rejahrehim/SecureTea-Project
train
1
6c3b0896585a2b834791b7db54084116cb9587fc
[ "self.ide = identity_element\nself.lide = lazy_ide\nself.func = segfunc\nn = len(ls)\nself.num = 2 ** (n - 1).bit_length()\nself.tree = [self.ide] * (2 * self.num)\nself.lazy = [self.lide] * (2 * self.num)\nfor i, l in enumerate(ls):\n self.tree[i + self.num - 1] = l\nfor i in range(self.num - 2, -1, -1):\n s...
<|body_start_0|> self.ide = identity_element self.lide = lazy_ide self.func = segfunc n = len(ls) self.num = 2 ** (n - 1).bit_length() self.tree = [self.ide] * (2 * self.num) self.lazy = [self.lide] * (2 * self.num) for i, l in enumerate(ls): s...
SegmentTreeForRSQandRAQ
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentTreeForRSQandRAQ: def __init__(self, ls: list, segfunc=operator.add, identity_element=0, lazy_ide=0): """セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%...
stack_v2_sparse_classes_75kplus_train_009359
23,273
no_license
[ { "docstring": "セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)", "name": "__init__", "signature": "def __init__(self, ls: list, segfunc=operator.add, identi...
4
stack_v2_sparse_classes_30k_train_029652
Implement the Python class `SegmentTreeForRSQandRAQ` described below. Class description: Implement the SegmentTreeForRSQandRAQ class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc=operator.add, identity_element=0, lazy_ide=0): セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncに...
Implement the Python class `SegmentTreeForRSQandRAQ` described below. Class description: Implement the SegmentTreeForRSQandRAQ class. Method signatures and docstrings: - def __init__(self, ls: list, segfunc=operator.add, identity_element=0, lazy_ide=0): セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncに...
74915a40ac157f89fe400e3f98e9bf3c10012cd7
<|skeleton|> class SegmentTreeForRSQandRAQ: def __init__(self, ls: list, segfunc=operator.add, identity_element=0, lazy_ide=0): """セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegmentTreeForRSQandRAQ: def __init__(self, ls: list, segfunc=operator.add, identity_element=0, lazy_ide=0): """セグ木 もしかしたらバグがあるかも 一次元のリストlsを受け取り初期化する。O(len(ls)) 区間のルールはsegfuncによって定義される identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0 [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85...
the_stack_v2_python_sparse
algorithm/SegmentTree.py
masakiaota/kyoupuro
train
1
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_75kplus_train_009360
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_030265
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_75kplus
data/stack_v2_sparse_classes_30k
75,829
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
08119d2fc116a956fb18dacf8504ce5c550c73ec
[ "super(ExtractReferenceB0Image, self).__init__()\nself.add_trait('dw_image', File(_Undefined(), optional=False, output=False, exists=True, desc='an existing diffusion weighted image'))\nself.add_trait('bvals', File(_Undefined(), optional=False, output=False, exists=True, desc='the the diffusion b-values'))\nself.ad...
<|body_start_0|> super(ExtractReferenceB0Image, self).__init__() self.add_trait('dw_image', File(_Undefined(), optional=False, output=False, exists=True, desc='an existing diffusion weighted image')) self.add_trait('bvals', File(_Undefined(), optional=False, output=False, exists=True, desc='the ...
Extract the first reference (b=0) image from a diffusion timeserie
ExtractReferenceB0Image
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractReferenceB0Image: """Extract the first reference (b=0) image from a diffusion timeserie""" def __init__(self): """Initialize ExtractReferenceB0Image class""" <|body_0|> def _run_process(self): """ExtractReferenceB0Image execution code""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_009361
9,597
no_license
[ { "docstring": "Initialize ExtractReferenceB0Image class", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "ExtractReferenceB0Image execution code", "name": "_run_process", "signature": "def _run_process(self)" }, { "docstring": "Method to get the first re...
3
stack_v2_sparse_classes_30k_train_001134
Implement the Python class `ExtractReferenceB0Image` described below. Class description: Extract the first reference (b=0) image from a diffusion timeserie Method signatures and docstrings: - def __init__(self): Initialize ExtractReferenceB0Image class - def _run_process(self): ExtractReferenceB0Image execution code ...
Implement the Python class `ExtractReferenceB0Image` described below. Class description: Extract the first reference (b=0) image from a diffusion timeserie Method signatures and docstrings: - def __init__(self): Initialize ExtractReferenceB0Image class - def _run_process(self): ExtractReferenceB0Image execution code ...
02d5e94dce362b2f99dedf486e5342f98af17af4
<|skeleton|> class ExtractReferenceB0Image: """Extract the first reference (b=0) image from a diffusion timeserie""" def __init__(self): """Initialize ExtractReferenceB0Image class""" <|body_0|> def _run_process(self): """ExtractReferenceB0Image execution code""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExtractReferenceB0Image: """Extract the first reference (b=0) image from a diffusion timeserie""" def __init__(self): """Initialize ExtractReferenceB0Image class""" super(ExtractReferenceB0Image, self).__init__() self.add_trait('dw_image', File(_Undefined(), optional=False, output...
the_stack_v2_python_sparse
clindmri/preproc/bet.py
dgoyard/caps-clindmri
train
0
20d7f9803f787611c1580c0df141ed3f9fa59e6a
[ "self.assertEqual(start_point(52), (50, 5))\nself.assertEqual(start_point(61), (50, 5))\nself.assertEqual(start_point(31), (26, 4))\nself.assertEqual(start_point(47), (26, 4))\nself.assertEqual(start_point(19), (10, 3))\nself.assertEqual(start_point(3), (2, 2))\nself.assertEqual(start_point(1), (1, 1))", "self.as...
<|body_start_0|> self.assertEqual(start_point(52), (50, 5)) self.assertEqual(start_point(61), (50, 5)) self.assertEqual(start_point(31), (26, 4)) self.assertEqual(start_point(47), (26, 4)) self.assertEqual(start_point(19), (10, 3)) self.assertEqual(start_point(3), (2, 2))...
Unist tests for actual day
MyTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTest: """Unist tests for actual day""" def test_start(self): """Test start point""" <|body_0|> def test_y(self): """Test y value""" <|body_1|> def test_side(self): """Test side position""" <|body_2|> def test_match(self): ...
stack_v2_sparse_classes_75kplus_train_009362
1,777
permissive
[ { "docstring": "Test start point", "name": "test_start", "signature": "def test_start(self)" }, { "docstring": "Test y value", "name": "test_y", "signature": "def test_y(self)" }, { "docstring": "Test side position", "name": "test_side", "signature": "def test_side(self)"...
4
stack_v2_sparse_classes_30k_train_051729
Implement the Python class `MyTest` described below. Class description: Unist tests for actual day Method signatures and docstrings: - def test_start(self): Test start point - def test_y(self): Test y value - def test_side(self): Test side position - def test_match(self): The basic test cases
Implement the Python class `MyTest` described below. Class description: Unist tests for actual day Method signatures and docstrings: - def test_start(self): Test start point - def test_y(self): Test y value - def test_side(self): Test side position - def test_match(self): The basic test cases <|skeleton|> class MyTe...
635be485ec691f9c0cdeb83f944de190f51c1ba3
<|skeleton|> class MyTest: """Unist tests for actual day""" def test_start(self): """Test start point""" <|body_0|> def test_y(self): """Test y value""" <|body_1|> def test_side(self): """Test side position""" <|body_2|> def test_match(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyTest: """Unist tests for actual day""" def test_start(self): """Test start point""" self.assertEqual(start_point(52), (50, 5)) self.assertEqual(start_point(61), (50, 5)) self.assertEqual(start_point(31), (26, 4)) self.assertEqual(start_point(47), (26, 4)) ...
the_stack_v2_python_sparse
2017/03_1/code.test.py
budavariam/advent_of_code
train
1
3919f0bb9818585f8d82c3ee8a9db80a50fa73f8
[ "from_uid = self.authenticate(token)\nmsg = Messages()\nif to_uid:\n if start_count and end_count:\n data = msg.getMessageThread(from_uid, to_uid, start_count, end_count)\n else:\n data = msg.getMessageThread(from_uid, to_uid)\nelse:\n data = msg.getUsersMessaged(from_uid)\nif data:\n retu...
<|body_start_0|> from_uid = self.authenticate(token) msg = Messages() if to_uid: if start_count and end_count: data = msg.getMessageThread(from_uid, to_uid, start_count, end_count) else: data = msg.getMessageThread(from_uid, to_uid) ...
MessageApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageApi: def GET(self, token, to_uid=None, start_count=None, end_count=None): """Return messages to the client. Doing a GET with only a token will return all the people they have talked to. Doing a GET with the UID will result in them actually getting message from that thread. :return...
stack_v2_sparse_classes_75kplus_train_009363
11,215
permissive
[ { "docstring": "Return messages to the client. Doing a GET with only a token will return all the people they have talked to. Doing a GET with the UID will result in them actually getting message from that thread. :return:", "name": "GET", "signature": "def GET(self, token, to_uid=None, start_count=None,...
2
null
Implement the Python class `MessageApi` described below. Class description: Implement the MessageApi class. Method signatures and docstrings: - def GET(self, token, to_uid=None, start_count=None, end_count=None): Return messages to the client. Doing a GET with only a token will return all the people they have talked ...
Implement the Python class `MessageApi` described below. Class description: Implement the MessageApi class. Method signatures and docstrings: - def GET(self, token, to_uid=None, start_count=None, end_count=None): Return messages to the client. Doing a GET with only a token will return all the people they have talked ...
b8a4324490453bcf5bff1d7f3c3cc8aaab542e76
<|skeleton|> class MessageApi: def GET(self, token, to_uid=None, start_count=None, end_count=None): """Return messages to the client. Doing a GET with only a token will return all the people they have talked to. Doing a GET with the UID will result in them actually getting message from that thread. :return...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageApi: def GET(self, token, to_uid=None, start_count=None, end_count=None): """Return messages to the client. Doing a GET with only a token will return all the people they have talked to. Doing a GET with the UID will result in them actually getting message from that thread. :return:""" f...
the_stack_v2_python_sparse
garrulous.py
IMidULti/garrulous-api
train
0
7db6f15b378c878d272b9d49ed79750117d32712
[ "node_data = dict(id='node' + node['id'], type=node['labels'][0])\nif node.get('properties'):\n node_data.update(node['properties'])\nreturn {'data': node_data}", "edge_data = dict(id='edge' + edge['id'], type=edge['type'], source='node' + edge['startNode'], target='node' + edge['endNode'])\nif edge.get('prope...
<|body_start_0|> node_data = dict(id='node' + node['id'], type=node['labels'][0]) if node.get('properties'): node_data.update(node['properties']) return {'data': node_data} <|end_body_0|> <|body_start_1|> edge_data = dict(id='edge' + edge['id'], type=edge['type'], source='no...
Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/).
CytoscapeOutputFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CytoscapeOutputFormatter: """Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/).""" def format_node(self, node): """Format a Cytoscape graph node. Args: node: A dictionary with one no...
stack_v2_sparse_classes_75kplus_train_009364
8,202
permissive
[ { "docstring": "Format a Cytoscape graph node. Args: node: A dictionary with one node Returns: Dictionary with a Cytoscape formatted node", "name": "format_node", "signature": "def format_node(self, node)" }, { "docstring": "Format a Cytoscape graph egde. Args: edge: A dictionary with one edge R...
2
stack_v2_sparse_classes_30k_train_003755
Implement the Python class `CytoscapeOutputFormatter` described below. Class description: Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/). Method signatures and docstrings: - def format_node(self, node): Format a C...
Implement the Python class `CytoscapeOutputFormatter` described below. Class description: Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/). Method signatures and docstrings: - def format_node(self, node): Format a C...
e0c833151c28e940103c3034f4cb26b1eb81750e
<|skeleton|> class CytoscapeOutputFormatter: """Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/).""" def format_node(self, node): """Format a Cytoscape graph node. Args: node: A dictionary with one no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CytoscapeOutputFormatter: """Cytoscape formatter. This formatter will return the graph compatible with the open source graph Javascript library Cytoscape (http://js.cytoscape.org/).""" def format_node(self, node): """Format a Cytoscape graph node. Args: node: A dictionary with one node Returns: D...
the_stack_v2_python_sparse
timesketch/lib/datastores/neo4j.py
LDO-CERT/timesketch
train
1
989a1f4d7ee01dca0dc4a6f147342bb921b0d98b
[ "if not nums:\n return None\n' run outer loop `k` times, and not for `n` times\\n since we only need to bubble kth largest element\\n to its sorted place in the array\\n '\nfor i in range(k):\n ' for each iteration of outer loop, run inner\\n loop one less than the ...
<|body_start_0|> if not nums: return None ' run outer loop `k` times, and not for `n` times\n since we only need to bubble kth largest element\n to its sorted place in the array\n ' for i in range(k): ' for each iteration of outer loop, run in...
KLargestElement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" <|body_0|> def find_heap(self, nums: List[int], k: int) -> int: """using heap complexity : O(n + k lo...
stack_v2_sparse_classes_75kplus_train_009365
2,275
permissive
[ { "docstring": "using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times", "name": "find_bubble_sort", "signature": "def find_bubble_sort(self, nums: List[int], k: int) -> int" }, { "docstring": "using heap complexity : O(n + k log n) -> O(n) for creating the heap -> O(...
2
stack_v2_sparse_classes_30k_train_044439
Implement the Python class `KLargestElement` described below. Class description: Implement the KLargestElement class. Method signatures and docstrings: - def find_bubble_sort(self, nums: List[int], k: int) -> int: using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times - def find_heap(self,...
Implement the Python class `KLargestElement` described below. Class description: Implement the KLargestElement class. Method signatures and docstrings: - def find_bubble_sort(self, nums: List[int], k: int) -> int: using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times - def find_heap(self,...
14356c6adb1946417482eaaf6f42dde4b8351d2f
<|skeleton|> class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" <|body_0|> def find_heap(self, nums: List[int], k: int) -> int: """using heap complexity : O(n + k lo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" if not nums: return None ' run outer loop `k` times, and not for `n` times\n since we only need t...
the_stack_v2_python_sparse
simple_array/m_kth_largest.py
dhrubach/python-code-recipes
train
1
45fe5814285e36df32f860f0546176d80f9c4a0e
[ "self._on_not_found: Callable[[str, str], None] | None = None\nrel_paths = {(key_map or {}).get(key, key): file for key, file in type(self).__dict__.items() if not key.startswith('_')}\nabs_paths = {key: f'{root}/{file}' for key, file in rel_paths.items()}\nself.__dict__ = abs_paths\nsuper().__init__(abs_paths)", ...
<|body_start_0|> self._on_not_found: Callable[[str, str], None] | None = None rel_paths = {(key_map or {}).get(key, key): file for key, file in type(self).__dict__.items() if not key.startswith('_')} abs_paths = {key: f'{root}/{file}' for key, file in rel_paths.items()} self.__dict__ = a...
Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when changing the key of a file.
Files
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when ...
stack_v2_sparse_classes_75kplus_train_009366
10,259
permissive
[ { "docstring": "Create a Files instance. Args: root (str, optional): Root directory used to absolufy every file path. Defaults to '~/.cache/matbench-discovery/[latest_figshare_release]' where latest_figshare_release is e.g. 1.0.0. Can also be set through env var MATBENCH_DISCOVERY_CACHE_DIR. key_map (dict[str, ...
2
stack_v2_sparse_classes_30k_train_035100
Implement the Python class `Files` described below. Class description: Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating att...
Implement the Python class `Files` described below. Class description: Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating att...
5df80efbc23541d38f9f300256cc30d92c61cbce
<|skeleton|> class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when changing the ...
the_stack_v2_python_sparse
matbench_discovery/data.py
janosh/matbench-discovery
train
30
370ed2bbce32b684f125d52cd13d20600774bf40
[ "l = self.find(ControlType='List', exact_level=1, exception_on_find_fail=False, timeout=1)\nif l is None:\n return None\nreturn l.list_items()", "item_name = str(item_name)\nif self.list_items() is None:\n raise FindFailed('List of ComboBox %s was not found. Is this list collapsed?' % repr(self))\nif wait_w...
<|body_start_0|> l = self.find(ControlType='List', exact_level=1, exception_on_find_fail=False, timeout=1) if l is None: return None return l.list_items() <|end_body_0|> <|body_start_1|> item_name = str(item_name) if self.list_items() is None: raise FindF...
Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods.
ComboBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComboBox: """Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods.""" def list_items(self): """Если меню открыто, то вре...
stack_v2_sparse_classes_75kplus_train_009367
5,000
permissive
[ { "docstring": "Если меню открыто, то вренут списко объектов, описывающих каждый пункт меню (теоретически, это может быть пустой список). Если меню закрыто, то вернет None.", "name": "list_items", "signature": "def list_items(self)" }, { "docstring": "Если список ракрыт, то вернут подходящий объ...
4
stack_v2_sparse_classes_30k_train_041953
Implement the Python class `ComboBox` described below. Class description: Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods. Method signatures and docs...
Implement the Python class `ComboBox` described below. Class description: Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods. Method signatures and docs...
b67e33fa51a7bb7252c5ac11651e2f005542f955
<|skeleton|> class ComboBox: """Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods.""" def list_items(self): """Если меню открыто, то вре...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComboBox: """Методы: select_item -- Мышкой выбирает элемент из выпадающего меню. set_value_api -- Через UIA API выставить новое значение (метод из _ValuePattern_methods). get_value -- Переопредеялем метод из _ValuePattern_methods.""" def list_items(self): """Если меню открыто, то вренут списко об...
the_stack_v2_python_sparse
pikuli/uia/control_wrappers/combo_box.py
Marti112/pikuli
train
0
3cafc44d35d98bff56c5d27a71a4cf8497bb5d83
[ "super(MajorityVote, self).__init__(raise_error=raise_error)\nself.threshold = threshold\nself.normalizer = normalizer", "if len(values) == 0:\n if not raise_error:\n return default\n raise ValueError('cannot pick from empty set')\nvalue, freq = values.most_common(1)[0]\nif self.threshold is not None...
<|body_start_0|> super(MajorityVote, self).__init__(raise_error=raise_error) self.threshold = threshold self.normalizer = normalizer <|end_body_0|> <|body_start_1|> if len(values) == 0: if not raise_error: return default raise ValueError('cannot p...
Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional threshold (min. frequency) that the most-frequent value has to satisfy.
MajorityVote
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajorityVote: """Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional threshold (min. frequency) that the most-freq...
stack_v2_sparse_classes_75kplus_train_009368
11,064
permissive
[ { "docstring": "Initialize the optional min. frequency thrshold and normalizer that will be applied to frequency values. Parameters ---------- threshold: float, default=None Additional frequency threshold for the selected value. Ignored if None. normalizer: callable, default=None Normalizer that is applied to t...
2
stack_v2_sparse_classes_30k_train_034466
Implement the Python class `MajorityVote` described below. Class description: Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional thresh...
Implement the Python class `MajorityVote` described below. Class description: Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional thresh...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class MajorityVote: """Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional threshold (min. frequency) that the most-freq...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MajorityVote: """Majority picker that select the most frequent value. This picker returns the default value (or raises an error) if the given list of values is empty or there are multiple-most frequent values. THe picker allows to define an additional threshold (min. frequency) that the most-frequent value ha...
the_stack_v2_python_sparse
openclean/function/value/picker.py
Denisfench/openclean-core
train
0
a29929e3f679a1a26edf2cd40dbc3ca4d1f47931
[ "if not nums:\n return None\nhead = 0\ntail = len(nums) - 1\nwhile head <= tail:\n mid = (head + tail) // 2\n if nums[mid] <= nums[mid - 1]:\n return nums[mid]\n elif nums[mid] > nums[mid - 1] and nums[mid] > nums[-1]:\n head = mid + 1\n else:\n tail = mid - 1", "if not nums:\n...
<|body_start_0|> if not nums: return None head = 0 tail = len(nums) - 1 while head <= tail: mid = (head + tail) // 2 if nums[mid] <= nums[mid - 1]: return nums[mid] elif nums[mid] > nums[mid - 1] and nums[mid] > nums[-1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMin1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return None head =...
stack_v2_sparse_classes_75kplus_train_009369
914
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin1", "signature": "def findMin1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin2", "signature": "def findMin2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_001046
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin1(self, nums): :type nums: List[int] :rtype: int - def findMin2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin1(self, nums): :type nums: List[int] :rtype: int - def findMin2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findMin1(self, nu...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def findMin1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMin1(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return None head = 0 tail = len(nums) - 1 while head <= tail: mid = (head + tail) // 2 if nums[mid] <= nums[mid - 1]: return nums...
the_stack_v2_python_sparse
Python/LeetCode/153.py
czx94/Algorithms-Collection
train
2
a6acebb61291716f567fc716a84334a0552fcf38
[ "if not request.user.is_superuser:\n return HttpResponseForbidden()\nextension = ReviewBotExtension.instance\nuser = get_object_or_404(User, pk=extension.settings.get('user'))\nreturn HttpResponse(json.dumps(_serialize_user(request, user)), content_type='application/json')", "if not request.user.is_superuser:\...
<|body_start_0|> if not request.user.is_superuser: return HttpResponseForbidden() extension = ReviewBotExtension.instance user = get_object_or_404(User, pk=extension.settings.get('user')) return HttpResponse(json.dumps(_serialize_user(request, user)), content_type='applicatio...
An endpoint for setting the user for Review Bot.
ConfigureUserView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" ...
stack_v2_sparse_classes_75kplus_train_009370
11,244
permissive
[ { "docstring": "Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create a new user for Review Bo...
2
stack_v2_sparse_classes_30k_train_034900
Implement the Python class `ConfigureUserView` described below. Class description: An endpoint for setting the user for Review Bot. Method signatures and docstrings: - def get(self, request): Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A re...
Implement the Python class `ConfigureUserView` described below. Class description: An endpoint for setting the user for Review Bot. Method signatures and docstrings: - def get(self, request): Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A re...
b59b566e127b5ef1b08f3189f1aa0194b7437d94
<|skeleton|> class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" if not req...
the_stack_v2_python_sparse
extension/reviewbotext/views.py
reviewboard/ReviewBot
train
110
a548c83b157f27d7ddd7bc12aeed81548e63f3bf
[ "self.model = model\nself.optimizer = optimizer\nself.criteria = criteria\nself.scheduler = scheduler\nself.train = train\nself.test = test\nself.epochs = epochs\nself.lr = lr\nself.device = device\nself.dropout = dropout\nself.scaler = scaler\nself.train_loader = train_loader\nself.test_loader = test_loader\nself....
<|body_start_0|> self.model = model self.optimizer = optimizer self.criteria = criteria self.scheduler = scheduler self.train = train self.test = test self.epochs = epochs self.lr = lr self.device = device self.dropout = dropout sel...
Class to encapsulate model training
Training
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Training: """Class to encapsulate model training""" def __init__(self, model, optimizer, criteria, scheduler, train, test, train_loader, test_loader, lr, epochs, device, dropout, scaler): """Initialize Trainer Args: model (Net): Instance of model to be trained optimizer (torch.optim)...
stack_v2_sparse_classes_75kplus_train_009371
5,259
permissive
[ { "docstring": "Initialize Trainer Args: model (Net): Instance of model to be trained optimizer (torch.optim): Instance of Optimizer used scheduler (Scheduler): Instance of scheduler used train (train): Training function for model test (test): Validation function for model train_loader (DataLoader): Train data ...
6
null
Implement the Python class `Training` described below. Class description: Class to encapsulate model training Method signatures and docstrings: - def __init__(self, model, optimizer, criteria, scheduler, train, test, train_loader, test_loader, lr, epochs, device, dropout, scaler): Initialize Trainer Args: model (Net)...
Implement the Python class `Training` described below. Class description: Class to encapsulate model training Method signatures and docstrings: - def __init__(self, model, optimizer, criteria, scheduler, train, test, train_loader, test_loader, lr, epochs, device, dropout, scaler): Initialize Trainer Args: model (Net)...
e77a6d035349f4f98141aa7832779dfcbf79a1a8
<|skeleton|> class Training: """Class to encapsulate model training""" def __init__(self, model, optimizer, criteria, scheduler, train, test, train_loader, test_loader, lr, epochs, device, dropout, scaler): """Initialize Trainer Args: model (Net): Instance of model to be trained optimizer (torch.optim)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Training: """Class to encapsulate model training""" def __init__(self, model, optimizer, criteria, scheduler, train, test, train_loader, test_loader, lr, epochs, device, dropout, scaler): """Initialize Trainer Args: model (Net): Instance of model to be trained optimizer (torch.optim): Instance of...
the_stack_v2_python_sparse
woollylib/training.py
woolly-of-cv/pytorch-lib
train
0
6605c256fadef9faf9d1267987bd6a76f069fcb0
[ "super(DefinitionsIndex, self).__init__(message_method)\nself.index_name = 'oval_definitions'\nself.item_label = 'definition'\nself.schema_dictionary = {'oval_id': whoosh.fields.ID(stored=True, unique=True), 'oval_version': whoosh.fields.STORED(), 'min_schema_version': whoosh.fields.NUMERIC(stored=True), 'title': w...
<|body_start_0|> super(DefinitionsIndex, self).__init__(message_method) self.index_name = 'oval_definitions' self.item_label = 'definition' self.schema_dictionary = {'oval_id': whoosh.fields.ID(stored=True, unique=True), 'oval_version': whoosh.fields.STORED(), 'min_schema_version': whoos...
A SearchIndex for OVAL definitions.
DefinitionsIndex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefinitionsIndex: """A SearchIndex for OVAL definitions.""" def __init__(self, message_method=False): """constructor, set defaults for instances""" <|body_0|> def version_to_int(self, version_number): """Converts a version number string to a int that can be sorte...
stack_v2_sparse_classes_75kplus_train_009372
30,962
no_license
[ { "docstring": "constructor, set defaults for instances", "name": "__init__", "signature": "def __init__(self, message_method=False)" }, { "docstring": "Converts a version number string to a int that can be sorted", "name": "version_to_int", "signature": "def version_to_int(self, version...
3
stack_v2_sparse_classes_30k_train_048295
Implement the Python class `DefinitionsIndex` described below. Class description: A SearchIndex for OVAL definitions. Method signatures and docstrings: - def __init__(self, message_method=False): constructor, set defaults for instances - def version_to_int(self, version_number): Converts a version number string to a ...
Implement the Python class `DefinitionsIndex` described below. Class description: A SearchIndex for OVAL definitions. Method signatures and docstrings: - def __init__(self, message_method=False): constructor, set defaults for instances - def version_to_int(self, version_number): Converts a version number string to a ...
5546ec1be39fc08d243310fb016467ae98fca591
<|skeleton|> class DefinitionsIndex: """A SearchIndex for OVAL definitions.""" def __init__(self, message_method=False): """constructor, set defaults for instances""" <|body_0|> def version_to_int(self, version_number): """Converts a version number string to a int that can be sorte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefinitionsIndex: """A SearchIndex for OVAL definitions.""" def __init__(self, message_method=False): """constructor, set defaults for instances""" super(DefinitionsIndex, self).__init__(message_method) self.index_name = 'oval_definitions' self.item_label = 'definition' ...
the_stack_v2_python_sparse
scripts/lib_search.py
CISecurity/OVALRepo
train
275
2b54fd803469bba04987b9341e8ad5533962f61b
[ "self.cohesity_key_vault = cohesity_key_vault\nself.customer_key_vault = customer_key_vault\nself.vault_owner = vault_owner", "if dictionary is None:\n return None\ncohesity_key_vault = cohesity_management_sdk.models.key_vault_params.KeyVaultParams.from_dictionary(dictionary.get('cohesityKeyVault')) if diction...
<|body_start_0|> self.cohesity_key_vault = cohesity_key_vault self.customer_key_vault = customer_key_vault self.vault_owner = vault_owner <|end_body_0|> <|body_start_1|> if dictionary is None: return None cohesity_key_vault = cohesity_management_sdk.models.key_vault_...
Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the customer managed key vault details. vault_owner (VaultOwnerEnum): Specifies if its a coh...
AzureKmsConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureKmsConfiguration: """Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the customer managed key vault details. vau...
stack_v2_sparse_classes_75kplus_train_009373
2,529
permissive
[ { "docstring": "Constructor for the AzureKmsConfiguration class", "name": "__init__", "signature": "def __init__(self, cohesity_key_vault=None, customer_key_vault=None, vault_owner=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
null
Implement the Python class `AzureKmsConfiguration` described below. Class description: Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the ...
Implement the Python class `AzureKmsConfiguration` described below. Class description: Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AzureKmsConfiguration: """Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the customer managed key vault details. vau...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AzureKmsConfiguration: """Implementation of the 'AzureKmsConfiguration' model. TODO: type description here. Attributes: cohesity_key_vault (KeyVaultParams): Specifies the cohesity managed key vault details. customer_key_vault (KeyVaultParams): Specifies the customer managed key vault details. vault_owner (Vau...
the_stack_v2_python_sparse
cohesity_management_sdk/models/azure_kms_configuration.py
cohesity/management-sdk-python
train
24
33a11f693f70bd96424e114f882164a34974c53e
[ "responses = []\nfor c in cls.clts:\n request = Request()\n request.set_accept_format('json')\n request.add_query_param('PageNumber', page_num)\n request.add_query_param('PageSize', page_size)\n resp = json.loads(c.do_action(request))\n responses.append([c, resp])\nreturn responses", "request.se...
<|body_start_0|> responses = [] for c in cls.clts: request = Request() request.set_accept_format('json') request.add_query_param('PageNumber', page_num) request.add_query_param('PageSize', page_size) resp = json.loads(c.do_action(request)) ...
Aliyun base class.
AliyunBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliyunBase: """Aliyun base class.""" def do_request(cls, Request, page_num=1, page_size=100): """Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param page_num: page number. :type page_num: int :param page_s...
stack_v2_sparse_classes_75kplus_train_009374
2,357
no_license
[ { "docstring": "Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param page_num: page number. :type page_num: int :param page_size: page size. :type page_size: int :return: list of [client, response]. :rtype: list", "name": "do_requ...
2
stack_v2_sparse_classes_30k_train_037581
Implement the Python class `AliyunBase` described below. Class description: Aliyun base class. Method signatures and docstrings: - def do_request(cls, Request, page_num=1, page_size=100): Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param...
Implement the Python class `AliyunBase` described below. Class description: Aliyun base class. Method signatures and docstrings: - def do_request(cls, Request, page_num=1, page_size=100): Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param...
03bc651b61fa9d85b09d38c2d57395e7e53d3691
<|skeleton|> class AliyunBase: """Aliyun base class.""" def do_request(cls, Request, page_num=1, page_size=100): """Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param page_num: page number. :type page_num: int :param page_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AliyunBase: """Aliyun base class.""" def do_request(cls, Request, page_num=1, page_size=100): """Send requests to aliyun open APIs. :param Request: aliyun RpcRequest class. :type Request: aliyunsdkcore.request.RpcRequest :param page_num: page number. :type page_num: int :param page_size: page siz...
the_stack_v2_python_sparse
zcmdb/graphCMDB/aliyun/base.py
ri0day/POW
train
0
da94067534fe0d909b4cddfb4a5d47467b9dd595
[ "global COMPANY_CONN\ncursor = None\ntry:\n n = str(lieGoodsPrice['goods_id'])[-1:]\n cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True)\n sql = 'INSERT INTO lie_goods(goods_id, price) VALUES(%(goods_id)s, %(price)s)'\n cursor.execute(sql, lieGoodsPrice)\n COMPANY_CONN.commit()\nexcept Exce...
<|body_start_0|> global COMPANY_CONN cursor = None try: n = str(lieGoodsPrice['goods_id'])[-1:] cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'INSERT INTO lie_goods(goods_id, price) VALUES(%(goods_id)s, %(price)s)' cursor.execu...
LieGoodsPrice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LieGoodsPrice: def addLieGoodsPrice(cls, lieGoodsPrice): """method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice""" <|body_0|> def get_price_by_goods_id(cls, goods_id): """method: get_price_by_goods_id params: goods_id-type: int return: price return-typ...
stack_v2_sparse_classes_75kplus_train_009375
13,174
no_license
[ { "docstring": "method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice", "name": "addLieGoodsPrice", "signature": "def addLieGoodsPrice(cls, lieGoodsPrice)" }, { "docstring": "method: get_price_by_goods_id params: goods_id-type: int return: price return-type: str json", "name": "...
2
stack_v2_sparse_classes_30k_train_029801
Implement the Python class `LieGoodsPrice` described below. Class description: Implement the LieGoodsPrice class. Method signatures and docstrings: - def addLieGoodsPrice(cls, lieGoodsPrice): method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice - def get_price_by_goods_id(cls, goods_id): method: get_pri...
Implement the Python class `LieGoodsPrice` described below. Class description: Implement the LieGoodsPrice class. Method signatures and docstrings: - def addLieGoodsPrice(cls, lieGoodsPrice): method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice - def get_price_by_goods_id(cls, goods_id): method: get_pri...
1e49a6e13ea4b11427f47999c13a609be9ae3ecf
<|skeleton|> class LieGoodsPrice: def addLieGoodsPrice(cls, lieGoodsPrice): """method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice""" <|body_0|> def get_price_by_goods_id(cls, goods_id): """method: get_price_by_goods_id params: goods_id-type: int return: price return-typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LieGoodsPrice: def addLieGoodsPrice(cls, lieGoodsPrice): """method: addLieGoodsPrice params: lieGoodsPrice-type: LieGoodsPrice""" global COMPANY_CONN cursor = None try: n = str(lieGoodsPrice['goods_id'])[-1:] cursor = COMPANY_CONN.cursor(buffered=True, d...
the_stack_v2_python_sparse
rsonline/server/db/company/mysql_client.py
yunhao-qing/PythonScrapy
train
0
9601099aeb23c6effaa1c726a3cd6e6a0d2e52be
[ "if x < 0:\n return False\nif x < 10:\n return True\nl = []\nl.append(x % 10)\nx //= 10\nwhile x != 0:\n l.append(x % 10)\n x //= 10\nleft = 0\nright = len(l) - 1\nwhile left <= right:\n if l[left] != l[right]:\n return False\n left += 1\n right -= 1\nreturn True", "if x < 0:\n retu...
<|body_start_0|> if x < 0: return False if x < 10: return True l = [] l.append(x % 10) x //= 10 while x != 0: l.append(x % 10) x //= 10 left = 0 right = len(l) - 1 while left <= right: if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome0(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False if x < 10: ...
stack_v2_sparse_classes_75kplus_train_009376
1,118
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome0", "signature": "def isPalindrome0(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_025263
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome0(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome0(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome0(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False if x < 10: return True l = [] l.append(x % 10) x //= 10 while x != 0: l.append(x % 10) x //= 10 left = 0 ...
the_stack_v2_python_sparse
9.回文数.py
yangyuxiang1996/leetcode
train
0
b209ed0df65fe260e7679c9ded3bde43e22a9afd
[ "self.max_frames = int(sr * sec)\nself.n_split = n_split\nself.is_label = is_label\nself.n_class = 24", "waves = [b['wave'] for b in batch]\nframe_lengths = np.array([wave.shape[0] for wave in waves])\nhop_size = np.array([max((frame_length - self.max_frames) // (self.n_split - 1), 1) for frame_length in frame_le...
<|body_start_0|> self.max_frames = int(sr * sec) self.n_split = n_split self.is_label = is_label self.n_class = 24 <|end_body_0|> <|body_start_1|> waves = [b['wave'] for b in batch] frame_lengths = np.array([wave.shape[0] for wave in waves]) hop_size = np.array([...
Customized collater for Pytorch DataLoader for wave form data in evaluation.
WaveEvalCollater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaveEvalCollater: """Customized collater for Pytorch DataLoader for wave form data in evaluation.""" def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False): """Initialize customized collater for PyTorch DataLoader. Args: max_frames (int): The max size of wave frame. n_spli...
stack_v2_sparse_classes_75kplus_train_009377
17,227
no_license
[ { "docstring": "Initialize customized collater for PyTorch DataLoader. Args: max_frames (int): The max size of wave frame. n_split (int): The number of split eval data to apply the model.", "name": "__init__", "signature": "def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False)" }, { ...
2
stack_v2_sparse_classes_30k_train_018057
Implement the Python class `WaveEvalCollater` described below. Class description: Customized collater for Pytorch DataLoader for wave form data in evaluation. Method signatures and docstrings: - def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False): Initialize customized collater for PyTorch DataLoader. A...
Implement the Python class `WaveEvalCollater` described below. Class description: Customized collater for Pytorch DataLoader for wave form data in evaluation. Method signatures and docstrings: - def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False): Initialize customized collater for PyTorch DataLoader. A...
f4ec03b3f7d08e3e67706b972bc0d61b88c903a9
<|skeleton|> class WaveEvalCollater: """Customized collater for Pytorch DataLoader for wave form data in evaluation.""" def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False): """Initialize customized collater for PyTorch DataLoader. Args: max_frames (int): The max size of wave frame. n_spli...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WaveEvalCollater: """Customized collater for Pytorch DataLoader for wave form data in evaluation.""" def __init__(self, sr=48000, sec=10.0, n_split=7, is_label=False): """Initialize customized collater for PyTorch DataLoader. Args: max_frames (int): The max size of wave frame. n_split (int): The ...
the_stack_v2_python_sparse
input/modules/datasets/collater_fn.py
ibkuroyagi/birdclef-2021
train
0
69a13ed9ba9cdc05b7657536beb4828588ea1d3b
[ "self.ole_version = None\nself.format_id = None\nself.class_name = None\nself.topic_name = None\nself.item_name = None\nself.data = None\nself.data_size = None\nif bindata is not None:\n self.parse(bindata)", "index = 0\nself.ole_version, index = read_uint32(data, index)\nself.format_id, index = read_uint32(da...
<|body_start_0|> self.ole_version = None self.format_id = None self.class_name = None self.topic_name = None self.item_name = None self.data = None self.data_size = None if bindata is not None: self.parse(bindata) <|end_body_0|> <|body_start_1...
OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures
OleObject
[ "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OleObject: """OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures""" def __init__(self, bindata=None): """Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes, OLE 1.0 Object structure containing OLE object Note: Co...
stack_v2_sparse_classes_75kplus_train_009378
41,058
permissive
[ { "docstring": "Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes, OLE 1.0 Object structure containing OLE object Note: Code can easily by generalized to work with byte streams instead of arrays just like in OleNativeStream.", "name": "__ini...
2
stack_v2_sparse_classes_30k_train_010076
Implement the Python class `OleObject` described below. Class description: OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures Method signatures and docstrings: - def __init__(self, bindata=None): Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes...
Implement the Python class `OleObject` described below. Class description: OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures Method signatures and docstrings: - def __init__(self, bindata=None): Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes...
fb4546ec1be5f46d53856161e46ea53d7b7e532a
<|skeleton|> class OleObject: """OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures""" def __init__(self, bindata=None): """Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes, OLE 1.0 Object structure containing OLE object Note: Co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OleObject: """OLE 1.0 Object see MS-OLEDS 2.2 OLE1.0 Format Structures""" def __init__(self, bindata=None): """Constructor for OleObject. If bindata is provided, it will be parsed using the parse() method. :param bindata: bytes, OLE 1.0 Object structure containing OLE object Note: Code can easily...
the_stack_v2_python_sparse
oletools/oleobj.py
decalage2/oletools
train
2,601
14dccef513cd0ad11ec43fdbc81e4be9fee48c21
[ "event_type = self._GetJSONValue(json_dict, 'type')\nif not event_type:\n parser_mediator.ProduceExtractionWarning('Missing event type.')\n return\nif event_type not in ('access', 'networkActivity'):\n parser_mediator.ProduceExtractionWarning('Unsupported event type: {0:s}.'.format(event_type))\n return...
<|body_start_0|> event_type = self._GetJSONValue(json_dict, 'type') if not event_type: parser_mediator.ProduceExtractionWarning('Missing event type.') return if event_type not in ('access', 'networkActivity'): parser_mediator.ProduceExtractionWarning('Unsuppor...
JSON-L parser plugin for iOS application privacy report files.
IOSAppPrivacPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IOSAppPrivacPlugin: """JSON-L parser plugin for iOS application privacy report files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses an iOS application privacy report record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other com...
stack_v2_sparse_classes_75kplus_train_009379
5,927
permissive
[ { "docstring": "Parses an iOS application privacy report record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. json_dict (dict): JSON dictionary of the log record.", "name": "_ParseRecord", "signature": "def _ParseRecord(se...
4
stack_v2_sparse_classes_30k_train_014062
Implement the Python class `IOSAppPrivacPlugin` described below. Class description: JSON-L parser plugin for iOS application privacy report files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, json_dict): Parses an iOS application privacy report record. Args: parser_mediator (ParserMedia...
Implement the Python class `IOSAppPrivacPlugin` described below. Class description: JSON-L parser plugin for iOS application privacy report files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, json_dict): Parses an iOS application privacy report record. Args: parser_mediator (ParserMedia...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class IOSAppPrivacPlugin: """JSON-L parser plugin for iOS application privacy report files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses an iOS application privacy report record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other com...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IOSAppPrivacPlugin: """JSON-L parser plugin for iOS application privacy report files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses an iOS application privacy report record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such...
the_stack_v2_python_sparse
plaso/parsers/jsonl_plugins/ios_app_privacy.py
log2timeline/plaso
train
1,506
19bc98cea88c15bfa271dbb33b989e493b6d3943
[ "self.env = env\nself.devices = [dev for dev in self.env.id_map.values() if hasattr(dev, 'hw') and hasattr(dev.hw, 'stress_tool_attributes')]\nself.workers = get_workers(workers)\nif self.workers:\n self.workers['time'] = None", "for dev in self.devices:\n try:\n dev.ui.start_workload(**self.workers)...
<|body_start_0|> self.env = env self.devices = [dev for dev in self.env.id_map.values() if hasattr(dev, 'hw') and hasattr(dev.hw, 'stress_tool_attributes')] self.workers = get_workers(workers) if self.workers: self.workers['time'] = None <|end_body_0|> <|body_start_1|> ...
Main functionality for workload manipulation.
WorkloadContinuous
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" <|body_0|> def start_on_nodes(self): ""...
stack_v2_sparse_classes_75kplus_train_009380
10,313
permissive
[ { "docstring": "Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance", "name": "__init__", "signature": "def __init__(self, env, workers)" }, { "docstring": "Start workload on devices.", "name": "start_on_nodes", "signature": "de...
5
stack_v2_sparse_classes_30k_train_044517
Implement the Python class `WorkloadContinuous` described below. Class description: Main functionality for workload manipulation. Method signatures and docstrings: - def __init__(self, env, workers): Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance - def ...
Implement the Python class `WorkloadContinuous` described below. Class description: Main functionality for workload manipulation. Method signatures and docstrings: - def __init__(self, env, workers): Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance - def ...
2007bf3fe66edfe704e485141c55caed54fe13aa
<|skeleton|> class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" <|body_0|> def start_on_nodes(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" self.env = env self.devices = [dev for dev in self.env.id...
the_stack_v2_python_sparse
taf/plugins/pytest_workload.py
AndriyZabavskyy/taf
train
0
3285a3a3afb701d9b908bf18a2352aea90698329
[ "patterns = [re_path('^list/(?P<customer_id>\\\\d+)/$', self.wrapper(self.show_view), name=self.get_url_list_name), re_path('^add/(?P<customer_id>\\\\d+)/$', self.wrapper(self.add_view), name=self.get_url_add_name), re_path('^edit/(?P<customer_id>\\\\d+)/(?P<pk>\\\\d+)/$', self.wrapper(self.edit_view), name=self.ge...
<|body_start_0|> patterns = [re_path('^list/(?P<customer_id>\\d+)/$', self.wrapper(self.show_view), name=self.get_url_list_name), re_path('^add/(?P<customer_id>\\d+)/$', self.wrapper(self.add_view), name=self.get_url_add_name), re_path('^edit/(?P<customer_id>\\d+)/(?P<pk>\\d+)/$', self.wrapper(self.edit_view), ...
RecordHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecordHandler: def get_urls(self): """自定制记录相关的url""" <|body_0|> def get_queryset(self, request, *args, **kwargs): """根据前端的数据,获取到的具体参数--customer_id 特别提示:当前用户只能操作当前用户中的客户记录的增删改查,而不能查看别人的或操作公户中的数据信息 customer__consultant_id=cur_user_id过滤条件""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_009381
3,805
no_license
[ { "docstring": "自定制记录相关的url", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "根据前端的数据,获取到的具体参数--customer_id 特别提示:当前用户只能操作当前用户中的客户记录的增删改查,而不能查看别人的或操作公户中的数据信息 customer__consultant_id=cur_user_id过滤条件", "name": "get_queryset", "signature": "def get_queryset(self, req...
6
null
Implement the Python class `RecordHandler` described below. Class description: Implement the RecordHandler class. Method signatures and docstrings: - def get_urls(self): 自定制记录相关的url - def get_queryset(self, request, *args, **kwargs): 根据前端的数据,获取到的具体参数--customer_id 特别提示:当前用户只能操作当前用户中的客户记录的增删改查,而不能查看别人的或操作公户中的数据信息 custo...
Implement the Python class `RecordHandler` described below. Class description: Implement the RecordHandler class. Method signatures and docstrings: - def get_urls(self): 自定制记录相关的url - def get_queryset(self, request, *args, **kwargs): 根据前端的数据,获取到的具体参数--customer_id 特别提示:当前用户只能操作当前用户中的客户记录的增删改查,而不能查看别人的或操作公户中的数据信息 custo...
fb405ab7fa2fd8fce2cc6bdb4bd78bc62dcce794
<|skeleton|> class RecordHandler: def get_urls(self): """自定制记录相关的url""" <|body_0|> def get_queryset(self, request, *args, **kwargs): """根据前端的数据,获取到的具体参数--customer_id 特别提示:当前用户只能操作当前用户中的客户记录的增删改查,而不能查看别人的或操作公户中的数据信息 customer__consultant_id=cur_user_id过滤条件""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecordHandler: def get_urls(self): """自定制记录相关的url""" patterns = [re_path('^list/(?P<customer_id>\\d+)/$', self.wrapper(self.show_view), name=self.get_url_list_name), re_path('^add/(?P<customer_id>\\d+)/$', self.wrapper(self.add_view), name=self.get_url_add_name), re_path('^edit/(?P<customer_id...
the_stack_v2_python_sparse
crm/crm_pro/web/views/cousult_record.py
peterliuu/crm
train
0
c75220f239cf52d9054987f0b836c58a5d78f5f7
[ "super(LongCalculation, self).__init__(job, 'Cancel', 0, 0)\nself.setModal(True)\nself.input = Queue()\nself.output = Queue()\nself.input.put((fun, args, postprocess))\nself.proc = Process(target=worker, args=(self.input, self.output))\nself.proc.start()\nself.timer = QTimer()\nself.timer.timeout.connect(self.updat...
<|body_start_0|> super(LongCalculation, self).__init__(job, 'Cancel', 0, 0) self.setModal(True) self.input = Queue() self.output = Queue() self.input.put((fun, args, postprocess)) self.proc = Process(target=worker, args=(self.input, self.output)) self.proc.start()...
Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless there is one implemented without numpy vectorized coordinate calculations.
LongCalculation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LongCalculation: """Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless there is one implemented without numpy vect...
stack_v2_sparse_classes_75kplus_train_009382
2,888
no_license
[ { "docstring": "Build multiprocessing queues and start worker.", "name": "__init__", "signature": "def __init__(self, fun, args, postprocess, job)" }, { "docstring": "Check if worker is done, and close dialog.", "name": "update", "signature": "def update(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_042662
Implement the Python class `LongCalculation` described below. Class description: Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless ther...
Implement the Python class `LongCalculation` described below. Class description: Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless ther...
4a3256ff5454b7aa556aee1d66927bb8361910c5
<|skeleton|> class LongCalculation: """Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless there is one implemented without numpy vect...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LongCalculation: """Multiprocessing based worker for mesh and eigenvalue calculations. This is necessary to make sure GUI is not blocked while mesh is built, or when eigenvalue calculations are performed. Transformations do not need as much time, unless there is one implemented without numpy vectorized coordi...
the_stack_v2_python_sparse
longcalc.py
cas91010491/Eigenvalues
train
1
218589999e0dde76e41ece6493f21865600684cf
[ "dp, ans = ([0] * len(s), 0)\nfor i in range(1, len(s)):\n if s[i] == ')':\n if s[i - 1] == '(':\n dp[i] = dp[i - 2] + 2 if i >= 2 else 2\n elif i - dp[i - 1] > 0 and s[i - dp[i - 1] - 1] == '(':\n dp[i] = dp[i - 1] + (dp[i - dp[i - 1] - 2] if i - dp[i - 1] >= 2 else 0) + 2\n ...
<|body_start_0|> dp, ans = ([0] * len(s), 0) for i in range(1, len(s)): if s[i] == ')': if s[i - 1] == '(': dp[i] = dp[i - 2] + 2 if i >= 2 else 2 elif i - dp[i - 1] > 0 and s[i - dp[i - 1] - 1] == '(': dp[i] = dp[i - 1]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longest_valid_parentheses_dp(self, s): """Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. dp[i] = 0 if s[i] == '(' because it won't be a valid string 2. dp[i] = dp[i - 2] + 2 if s[i] == ')...
stack_v2_sparse_classes_75kplus_train_009383
2,926
no_license
[ { "docstring": "Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. dp[i] = 0 if s[i] == '(' because it won't be a valid string 2. dp[i] = dp[i - 2] + 2 if s[i] == ')' and s[i - i] == '(' 3. dp[i] = dp[i - 1] + dp[i - dp[i - 1] - ...
3
stack_v2_sparse_classes_30k_train_042543
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_valid_parentheses_dp(self, s): Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. d...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_valid_parentheses_dp(self, s): Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. d...
33252434f8d90b46fd2de07e257842331dcd81a8
<|skeleton|> class Solution: def longest_valid_parentheses_dp(self, s): """Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. dp[i] = 0 if s[i] == '(' because it won't be a valid string 2. dp[i] = dp[i - 2] + 2 if s[i] == ')...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longest_valid_parentheses_dp(self, s): """Dynamic Programming: Time: O(n), Space: O(n) Idea: Define dp[i] = Length of the longest sub-string which ends at i-th index. Then: 1. dp[i] = 0 if s[i] == '(' because it won't be a valid string 2. dp[i] = dp[i - 2] + 2 if s[i] == ')' and s[i - i]...
the_stack_v2_python_sparse
main/leetcode/32.py
dawnonme/Eureka
train
0
169c0220e5f8d60ed2230f6b6be185b662e73fa3
[ "assert sum(gammas.values()) == 1, 'gammas must add up to 1'\nself.gammas = gammas\nself.hyperparameters = hyperparameters", "K = 0\nK = K + self.gammas['linear'] * lk(x_i=x_i, x_j=x_j)\nK = K + self.gammas['gaussian'] * gk(x_i=x_i, x_j=x_j, sigma=self.hyperparameters['gaussian'])\nK = K + self.gammas['polynomial...
<|body_start_0|> assert sum(gammas.values()) == 1, 'gammas must add up to 1' self.gammas = gammas self.hyperparameters = hyperparameters <|end_body_0|> <|body_start_1|> K = 0 K = K + self.gammas['linear'] * lk(x_i=x_i, x_j=x_j) K = K + self.gammas['gaussian'] * gk(x_i=x_...
Class that contains the implementation of Multi Kernel with Fixed Rules
MultiKernelfixedrules
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiKernelfixedrules: """Class that contains the implementation of Multi Kernel with Fixed Rules""" def __init__(self, gammas, hyperparameters): """Function to initialize certain parameters required for the class Args: gammas = The static weights for each class hyperparameters = The...
stack_v2_sparse_classes_75kplus_train_009384
5,996
no_license
[ { "docstring": "Function to initialize certain parameters required for the class Args: gammas = The static weights for each class hyperparameters = The values for the \"q\" and \"sigma\" in polynomial and Gaussian kernel respectively", "name": "__init__", "signature": "def __init__(self, gammas, hyperpa...
3
null
Implement the Python class `MultiKernelfixedrules` described below. Class description: Class that contains the implementation of Multi Kernel with Fixed Rules Method signatures and docstrings: - def __init__(self, gammas, hyperparameters): Function to initialize certain parameters required for the class Args: gammas ...
Implement the Python class `MultiKernelfixedrules` described below. Class description: Class that contains the implementation of Multi Kernel with Fixed Rules Method signatures and docstrings: - def __init__(self, gammas, hyperparameters): Function to initialize certain parameters required for the class Args: gammas ...
d6da949ea9f6c6edd89b26ec6bf9198b4d41962d
<|skeleton|> class MultiKernelfixedrules: """Class that contains the implementation of Multi Kernel with Fixed Rules""" def __init__(self, gammas, hyperparameters): """Function to initialize certain parameters required for the class Args: gammas = The static weights for each class hyperparameters = The...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiKernelfixedrules: """Class that contains the implementation of Multi Kernel with Fixed Rules""" def __init__(self, gammas, hyperparameters): """Function to initialize certain parameters required for the class Args: gammas = The static weights for each class hyperparameters = The values for t...
the_stack_v2_python_sparse
Programming-Assignment-1/Question4/multi_kernels.py
vishwakftw/CS6510-AML
train
0
5f440a899da988eee813e52019ee88b6be330be3
[ "params = {} if params is None else params\nparams.update({'type': params.get('type', 'hive')})\nwith self.post(create_url('/v3/schedule/create/{name}', name=name), params) as res:\n code, body = (res.status, res.read())\n if code != 200:\n self.raise_error('Create schedule failed', res, body)\n js ...
<|body_start_0|> params = {} if params is None else params params.update({'type': params.get('type', 'hive')}) with self.post(create_url('/v3/schedule/create/{name}', name=name), params) as res: code, body = (res.status, res.read()) if code != 200: self.ra...
Access to Schedule API This class is inherited by :class:`tdclient.api.API`.
ScheduleAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleAPI: """Access to Schedule API This class is inherited by :class:`tdclient.api.API`.""" def create_schedule(self, name, params=None): """Create a new scheduled query with the specified name. Args: name (str): Scheduled query name. params (dict, optional): Extra parameters. - ...
stack_v2_sparse_classes_75kplus_train_009385
9,750
permissive
[ { "docstring": "Create a new scheduled query with the specified name. Args: name (str): Scheduled query name. params (dict, optional): Extra parameters. - type (str): Query type. {\"presto\", \"hive\"}. Default: \"hive\" - database (str): Target database name. - timezone (str): Scheduled query's timezone. e.g. ...
6
stack_v2_sparse_classes_30k_train_007132
Implement the Python class `ScheduleAPI` described below. Class description: Access to Schedule API This class is inherited by :class:`tdclient.api.API`. Method signatures and docstrings: - def create_schedule(self, name, params=None): Create a new scheduled query with the specified name. Args: name (str): Scheduled ...
Implement the Python class `ScheduleAPI` described below. Class description: Access to Schedule API This class is inherited by :class:`tdclient.api.API`. Method signatures and docstrings: - def create_schedule(self, name, params=None): Create a new scheduled query with the specified name. Args: name (str): Scheduled ...
aa6b1ffe886483cf4a41557d7e72063e49d6c787
<|skeleton|> class ScheduleAPI: """Access to Schedule API This class is inherited by :class:`tdclient.api.API`.""" def create_schedule(self, name, params=None): """Create a new scheduled query with the specified name. Args: name (str): Scheduled query name. params (dict, optional): Extra parameters. - ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScheduleAPI: """Access to Schedule API This class is inherited by :class:`tdclient.api.API`.""" def create_schedule(self, name, params=None): """Create a new scheduled query with the specified name. Args: name (str): Scheduled query name. params (dict, optional): Extra parameters. - type (str): Q...
the_stack_v2_python_sparse
tdclient/schedule_api.py
treasure-data/td-client-python
train
41
b00baeeea21f8769456e03bacbb89fed027f136c
[ "threading.Thread.__init__(self, name='cleaner')\nself.queues = queue\nself.date_time = date_time\nlname = '{}.{}'.format(__name__, 'clean')\nself._logger = logging.getLogger(lname)\nself._logger.debug('Initialized cleaner thread')", "for t in self.date_time:\n for v in self.queues.keys():\n self.queues...
<|body_start_0|> threading.Thread.__init__(self, name='cleaner') self.queues = queue self.date_time = date_time lname = '{}.{}'.format(__name__, 'clean') self._logger = logging.getLogger(lname) self._logger.debug('Initialized cleaner thread') <|end_body_0|> <|body_start_...
QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed
QueueCleaner
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueCleaner: """QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed""" def __init__(self, date_time, queue): """Args: date_time: array of date_ti...
stack_v2_sparse_classes_75kplus_train_009386
9,600
permissive
[ { "docstring": "Args: date_time: array of date_time queue: dict of the queue", "name": "__init__", "signature": "def __init__(self, date_time, queue)" }, { "docstring": "Go through the date times and look for when all the queues have that date_time", "name": "run", "signature": "def run(...
2
stack_v2_sparse_classes_30k_train_005721
Implement the Python class `QueueCleaner` described below. Class description: QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed Method signatures and docstrings: - def __init__(s...
Implement the Python class `QueueCleaner` described below. Class description: QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed Method signatures and docstrings: - def __init__(s...
465d42cca85820e76a50bc311d101c7dc506df8c
<|skeleton|> class QueueCleaner: """QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed""" def __init__(self, date_time, queue): """Args: date_time: array of date_ti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QueueCleaner: """QueueCleaner that will go through all the queues and check if they all have a date in common. When this occurs, all the threads will have processed that time step and it's not longer needed""" def __init__(self, date_time, queue): """Args: date_time: array of date_time queue: dic...
the_stack_v2_python_sparse
smrf/utils/queue.py
USDA-ARS-NWRC/smrf
train
9
4b4163e1eca0a5a521cd743c8ecbe6d1c932fdd9
[ "self.vartypes = vartypes\nself.kertypes = dict(c=config.conti_kertype, o=config.ordered_kertype, u=config.unordered_kertype)\nself.bw_methods = dict(c=config.conti_bw_method, o=config.ordered_bw_method, u=config.unordered_bw_method)\nself.conti_bw_temperature = config.conti_bw_temperature\nself._fit(data_ref)", ...
<|body_start_0|> self.vartypes = vartypes self.kertypes = dict(c=config.conti_kertype, o=config.ordered_kertype, u=config.unordered_kertype) self.bw_methods = dict(c=config.conti_bw_method, o=config.ordered_bw_method, u=config.unordered_bw_method) self.conti_bw_temperature = config.conti...
Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html
VanillaProductKernel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VanillaProductKernel: """Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html""" def __init__(self, data_ref: np.ndarray, vartypes: str, config: VanillaProductKernelConf...
stack_v2_sparse_classes_75kplus_train_009387
9,714
permissive
[ { "docstring": "Constructor. Parameters: data_ref : Reference data points for which the kernel values are computed. vartypes : The variable type ('c': continuous, 'o': ordered, 'u': unordered). Example: ``'ccou'``. product_kernel_config : the configuration object.", "name": "__init__", "signature": "def...
3
stack_v2_sparse_classes_30k_train_042846
Implement the Python class `VanillaProductKernel` described below. Class description: Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html Method signatures and docstrings: - def __init__(self, d...
Implement the Python class `VanillaProductKernel` described below. Class description: Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html Method signatures and docstrings: - def __init__(self, d...
11eb7b4bb9c39672ece6177e321f63ce205e0307
<|skeleton|> class VanillaProductKernel: """Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html""" def __init__(self, data_ref: np.ndarray, vartypes: str, config: VanillaProductKernelConf...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VanillaProductKernel: """Product kernel object. Notes: Bandwidth methods: ``statsmodels.nonparametric.bandwidths``: https://www.statsmodels.org/devel/_modules/statsmodels/nonparametric/bandwidths.html""" def __init__(self, data_ref: np.ndarray, vartypes: str, config: VanillaProductKernelConfig=VanillaPro...
the_stack_v2_python_sparse
causal_data_augmentation/causal_data_augmentation/augmenter/admg_tian_augmenter/util/weight_computer/kernel_fn/vanilla.py
diadochos/incorporating-causal-graphical-prior-knowledge-into-predictive-modeling-via-simple-data-augmentation
train
0
13293c47421694a7f4bf05ee9ac8e6031d99a854
[ "queryset = super(ResourceListView, self).get_queryset()\nquery = self.request.GET.get('query', None)\ngroup_id = self.request.GET.get('group_id', None)\nfile_type = self.request.GET.get('file_type', None)\nqueryset = queryset.filter(groups__in=self.request.user.groups_joined)\nif query:\n queryset = queryset.fi...
<|body_start_0|> queryset = super(ResourceListView, self).get_queryset() query = self.request.GET.get('query', None) group_id = self.request.GET.get('group_id', None) file_type = self.request.GET.get('file_type', None) queryset = queryset.filter(groups__in=self.request.user.group...
View for listing Resources.
ResourceListView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceListView: """View for listing Resources.""" def get_queryset(self): """Limit resources to ones posted to groups a user is a member of.""" <|body_0|> def get_context_data(self, **kwargs): """Update view context""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_009388
5,832
permissive
[ { "docstring": "Limit resources to ones posted to groups a user is a member of.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Update view context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_042984
Implement the Python class `ResourceListView` described below. Class description: View for listing Resources. Method signatures and docstrings: - def get_queryset(self): Limit resources to ones posted to groups a user is a member of. - def get_context_data(self, **kwargs): Update view context
Implement the Python class `ResourceListView` described below. Class description: View for listing Resources. Method signatures and docstrings: - def get_queryset(self): Limit resources to ones posted to groups a user is a member of. - def get_context_data(self, **kwargs): Update view context <|skeleton|> class Reso...
a56c0f89df82694bf5db32a04d8b092974791972
<|skeleton|> class ResourceListView: """View for listing Resources.""" def get_queryset(self): """Limit resources to ones posted to groups a user is a member of.""" <|body_0|> def get_context_data(self, **kwargs): """Update view context""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceListView: """View for listing Resources.""" def get_queryset(self): """Limit resources to ones posted to groups a user is a member of.""" queryset = super(ResourceListView, self).get_queryset() query = self.request.GET.get('query', None) group_id = self.request.GET...
the_stack_v2_python_sparse
open_connect/resources/views.py
ofa/connect
train
66
ebf76420f3873e687371e29f074708814bb132ff
[ "option_view = '\\n 1. 列出所有学生\\n 2. 查询\\n '\nprint('学生信息系统'.center(cls.width, '='))\nprint(option_view)\nnumber = input('请选择(Ctrl + c 退出):')\nfunc_dict = {'1': cls.list_student, '2': cls.search}\nif number not in func_dict.keys():\n raise Exception('【提示】:输入有误, 请重新选择')\nfunc = func_dict[numbe...
<|body_start_0|> option_view = '\n 1. 列出所有学生\n 2. 查询\n ' print('学生信息系统'.center(cls.width, '=')) print(option_view) number = input('请选择(Ctrl + c 退出):') func_dict = {'1': cls.list_student, '2': cls.search} if number not in func_dict.keys(): ...
View
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class View: def menu(cls): """主菜单""" <|body_0|> def list_student(cls): """列出所有学生""" <|body_1|> def search(cls): """查询""" <|body_2|> def search_student(cls): """查询学生信息""" <|body_3|> def search_score(cls): """查询成...
stack_v2_sparse_classes_75kplus_train_009389
3,327
no_license
[ { "docstring": "主菜单", "name": "menu", "signature": "def menu(cls)" }, { "docstring": "列出所有学生", "name": "list_student", "signature": "def list_student(cls)" }, { "docstring": "查询", "name": "search", "signature": "def search(cls)" }, { "docstring": "查询学生信息", "na...
5
stack_v2_sparse_classes_30k_train_000681
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def menu(cls): 主菜单 - def list_student(cls): 列出所有学生 - def search(cls): 查询 - def search_student(cls): 查询学生信息 - def search_score(cls): 查询成绩
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def menu(cls): 主菜单 - def list_student(cls): 列出所有学生 - def search(cls): 查询 - def search_student(cls): 查询学生信息 - def search_score(cls): 查询成绩 <|skeleton|> class View: def menu(cls): ...
b7f29743883739e3b298d49a170f367944ee0d9a
<|skeleton|> class View: def menu(cls): """主菜单""" <|body_0|> def list_student(cls): """列出所有学生""" <|body_1|> def search(cls): """查询""" <|body_2|> def search_student(cls): """查询学生信息""" <|body_3|> def search_score(cls): """查询成...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class View: def menu(cls): """主菜单""" option_view = '\n 1. 列出所有学生\n 2. 查询\n ' print('学生信息系统'.center(cls.width, '=')) print(option_view) number = input('请选择(Ctrl + c 退出):') func_dict = {'1': cls.list_student, '2': cls.search} if number not i...
the_stack_v2_python_sparse
16-17/01_界面/src/view.py
ucookie/basic-python
train
0
b8b9cbdd0d22beb943304524fd5bce94486a25d7
[ "self.capacity = capacity\nself.l = DoublyLL()\nself.d = {}", "try:\n n = self.d[key]\nexcept KeyError:\n return -1\nself.l.Remove(n)\nself.l.InsertFirst(n)\nreturn n.value", "if key in self.d:\n node = self.d[key]\n self.l.Remove(node)\n self.l.InsertFirst(node)\n node.value = value\nelse:\n ...
<|body_start_0|> self.capacity = capacity self.l = DoublyLL() self.d = {} <|end_body_0|> <|body_start_1|> try: n = self.d[key] except KeyError: return -1 self.l.Remove(n) self.l.InsertFirst(n) return n.value <|end_body_1|> <|body_...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_009390
2,641
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_017945
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
786e1597b18cf5f16df0a3d7dfa0b80c1435de4d
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.l = DoublyLL() self.d = {} def get(self, key): """:type key: int :rtype: int""" try: n = self.d[key] except KeyError: return -1 ...
the_stack_v2_python_sparse
No_146_LRU_Cache.py
georgewashingturd/leetcode
train
0
4880c4ec6aedda01753fb907e133501d10badef7
[ "if (d, f, target) in self.memo:\n return self.memo[d, f, target]\nmod = 10 ** 9 + 7\nif target < d or target > d * f:\n return 0\nif d == 0:\n return 1 if target == 0 else 0\nself.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f, target - x) for x in range(1, f + 1))) % mod\nreturn self.memo[d, f,...
<|body_start_0|> if (d, f, target) in self.memo: return self.memo[d, f, target] mod = 10 ** 9 + 7 if target < d or target > d * f: return 0 if d == 0: return 1 if target == 0 else 0 self.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_0|> def numRollsToTarget_1(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_1|> def numRolls...
stack_v2_sparse_classes_75kplus_train_009391
4,009
no_license
[ { "docstring": ":type d: int :type f: int :type target: int :rtype: int", "name": "numRollsToTarget", "signature": "def numRollsToTarget(self, d, f, target)" }, { "docstring": ":type d: int :type f: int :type target: int :rtype: int", "name": "numRollsToTarget_1", "signature": "def numRo...
3
stack_v2_sparse_classes_30k_train_049875
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int - def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int - def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_0|> def numRollsToTarget_1(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" <|body_1|> def numRolls...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numRollsToTarget(self, d, f, target): """:type d: int :type f: int :type target: int :rtype: int""" if (d, f, target) in self.memo: return self.memo[d, f, target] mod = 10 ** 9 + 7 if target < d or target > d * f: return 0 if d == 0...
the_stack_v2_python_sparse
Solutions/1155_numRollsToTarget.py
YoupengLi/leetcode-sorting
train
3
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(GroupNormStatic, self).__init__()\nself.num_groups = num_groups\nself.num_channels = num_channels\nself.group_norm = nn.GroupNorm(4 * num_groups, 4 * num_channels, eps)", "batch_size = x.shape[0]\nx = x.view(batch_size, 4 * self.num_channels, -1)\nx = self.group_norm(x)\nx = x.view(batch_size, 4, self.num_...
<|body_start_0|> super(GroupNormStatic, self).__init__() self.num_groups = num_groups self.num_channels = num_channels self.group_norm = nn.GroupNorm(4 * num_groups, 4 * num_channels, eps) <|end_body_0|> <|body_start_1|> batch_size = x.shape[0] x = x.view(batch_size, 4 *...
Group normalization layer with an independent scale and bias factor for each instrument
GroupNormStatic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupNormStatic: """Group normalization layer with an independent scale and bias factor for each instrument""" def __init__(self, _, __, num_groups, num_channels, eps=1e-08): """Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keywor...
stack_v2_sparse_classes_75kplus_train_009392
37,269
no_license
[ { "docstring": "Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keyword Arguments: eps {int} -- Constant for numerical stability (default: {1e-8})", "name": "__init__", "signature": "def __init__(self, _, __, num_groups, num_channels, eps=1e-08)" }, ...
2
stack_v2_sparse_classes_30k_train_005190
Implement the Python class `GroupNormStatic` described below. Class description: Group normalization layer with an independent scale and bias factor for each instrument Method signatures and docstrings: - def __init__(self, _, __, num_groups, num_channels, eps=1e-08): Arguments: num_groups {int} -- Number of normaliz...
Implement the Python class `GroupNormStatic` described below. Class description: Group normalization layer with an independent scale and bias factor for each instrument Method signatures and docstrings: - def __init__(self, _, __, num_groups, num_channels, eps=1e-08): Arguments: num_groups {int} -- Number of normaliz...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class GroupNormStatic: """Group normalization layer with an independent scale and bias factor for each instrument""" def __init__(self, _, __, num_groups, num_channels, eps=1e-08): """Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keywor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupNormStatic: """Group normalization layer with an independent scale and bias factor for each instrument""" def __init__(self, _, __, num_groups, num_channels, eps=1e-08): """Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keyword Arguments: ...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
08e67d9eecf2d713de08fc743d78acf82e33dc21
[ "slow, fast = (nums[0], nums[nums[0]])\nwhile slow != fast:\n slow = nums[slow]\n fast = nums[nums[fast]]\nslow = 0\nwhile slow != fast:\n slow = nums[slow]\n fast = nums[fast]\nreturn slow", "n = len(nums) - 1\nans = 0\nleft, right = (1, n)\nwhile left <= right:\n mid = (left + right) / 2\n cnt...
<|body_start_0|> slow, fast = (nums[0], nums[nums[0]]) while slow != fast: slow = nums[slow] fast = nums[nums[fast]] slow = 0 while slow != fast: slow = nums[slow] fast = nums[fast] return slow <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate_binary_search(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> slow, fast = (nums[0], nums...
stack_v2_sparse_classes_75kplus_train_009393
1,668
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate_binary_search", "signature": "def findDuplicate_binary_search(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_021912
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_binary_search(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_binary_search(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
0a7aa09a2b95e4caca5b5123fb735ceb5c01e992
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate_binary_search(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" slow, fast = (nums[0], nums[nums[0]]) while slow != fast: slow = nums[slow] fast = nums[nums[fast]] slow = 0 while slow != fast: slow = nums[slow] ...
the_stack_v2_python_sparse
find-the-duplicate-number.py
onestarshang/leetcode
train
0
a45746e7aad9986e913794ba933c4b344595fc6b
[ "handshake_protocols = data.get('handshake_protocols')\nrequests_attach = data.get('requests_attach')\nif not handshake_protocols and (not requests_attach):\n raise ValidationError('Model must include non-empty handshake_protocols or requests~attach or both')\ngoal = data.get('goal')\ngoal_code = data.get('goal_...
<|body_start_0|> handshake_protocols = data.get('handshake_protocols') requests_attach = data.get('requests_attach') if not handshake_protocols and (not requests_attach): raise ValidationError('Model must include non-empty handshake_protocols or requests~attach or both') goal...
InvitationMessage schema.
InvitationMessageSchema
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvitationMessageSchema: """InvitationMessage schema.""" def validate_fields(self, data, **kwargs): """Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate""" <|body_0|> def post_dump(self, data, **kwargs)...
stack_v2_sparse_classes_75kplus_train_009394
10,410
permissive
[ { "docstring": "Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate", "name": "validate_fields", "signature": "def validate_fields(self, data, **kwargs)" }, { "docstring": "Post dump hook.", "name": "post_dump", "signatur...
2
stack_v2_sparse_classes_30k_val_001495
Implement the Python class `InvitationMessageSchema` described below. Class description: InvitationMessage schema. Method signatures and docstrings: - def validate_fields(self, data, **kwargs): Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate - def...
Implement the Python class `InvitationMessageSchema` described below. Class description: InvitationMessage schema. Method signatures and docstrings: - def validate_fields(self, data, **kwargs): Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate - def...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class InvitationMessageSchema: """InvitationMessage schema.""" def validate_fields(self, data, **kwargs): """Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate""" <|body_0|> def post_dump(self, data, **kwargs)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InvitationMessageSchema: """InvitationMessage schema.""" def validate_fields(self, data, **kwargs): """Validate schema fields. Args: data: The data to validate Raises: ValidationError: If any of the fields do not validate""" handshake_protocols = data.get('handshake_protocols') re...
the_stack_v2_python_sparse
aries_cloudagent/protocols/out_of_band/v1_0/messages/invitation.py
hyperledger/aries-cloudagent-python
train
370
4454ff3432561f8a37f7dd982561532643992654
[ "super().__init__(self.PARAMS, parameters)\nself.summary_name = parameters['summary_name']\nself.summary_filename = parameters['summary_filename']\nself.tags = parameters['tags']\nself.append_timecode = parameters.get('append_timecode', False)\nself.expand_context = parameters.get('expand_context', False)", "df_n...
<|body_start_0|> super().__init__(self.PARAMS, parameters) self.summary_name = parameters['summary_name'] self.summary_filename = parameters['summary_filename'] self.tags = parameters['tags'] self.append_timecode = parameters.get('append_timecode', False) self.expand_cont...
Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to get_summary separately (e.g. 'condition-variable' or 'task'). Optional remodeling par...
SummarizeHedTagsOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SummarizeHedTagsOp: """Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to get_summary separately (e.g. 'condition...
stack_v2_sparse_classes_75kplus_train_009395
9,731
permissive
[ { "docstring": "Constructor for the summarize hed tags operation. Parameters: parameters (dict): Dictionary with the parameter values for required and optional parameters. :raises KeyError: - If a required parameter is missing. - If an unexpected parameter is provided. :raises TypeError: - If a parameter has th...
2
stack_v2_sparse_classes_30k_train_023937
Implement the Python class `SummarizeHedTagsOp` described below. Class description: Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to ...
Implement the Python class `SummarizeHedTagsOp` described below. Class description: Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to ...
b871cae44bdf0ee68c688562c3b0af50b93343f5
<|skeleton|> class SummarizeHedTagsOp: """Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to get_summary separately (e.g. 'condition...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SummarizeHedTagsOp: """Summarize the HED tags in collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **tags** (*dict*): Type tag to get_summary separately (e.g. 'condition-variable' or...
the_stack_v2_python_sparse
hed/tools/remodeling/operations/summarize_hed_tags_op.py
hed-standard/hed-python
train
5
10c82d658621ac8c1ce4a3c277b33e1a551cc4c5
[ "if not head or not head.next:\n return True\nslow = head\nfast = head\npre = None\nwhile fast and fast.next:\n pre = slow\n slow = slow.next\n fast = fast.next.next\npre.next = None\nslow = self.reverse(slow)\nwhile slow and head:\n if slow.val != head.val:\n return False\n slow = slow.nex...
<|body_start_0|> if not head or not head.next: return True slow = head fast = head pre = None while fast and fast.next: pre = slow slow = slow.next fast = fast.next.next pre.next = None slow = self.reverse(slow) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def reverse(self, head): """:param head: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not head.next: return True ...
stack_v2_sparse_classes_75kplus_train_009396
1,350
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, head)" }, { "docstring": ":param head: :return:", "name": "reverse", "signature": "def reverse(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head): :type head: ListNode :rtype: bool - def reverse(self, head): :param head: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head): :type head: ListNode :rtype: bool - def reverse(self, head): :param head: :return: <|skeleton|> class Solution: def isPalindrome(self, head): ...
a75310a96d2b165b15d5ee10ec409a17cdc880ba
<|skeleton|> class Solution: def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def reverse(self, head): """:param head: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" if not head or not head.next: return True slow = head fast = head pre = None while fast and fast.next: pre = slow slow = slow.next fas...
the_stack_v2_python_sparse
leetcode/offer/review/234.py
skyxyz-lang/CS_Note
train
0
e78985733443a28033ee1b07d656ca07809b5506
[ "train_indices = np.where(train_mask)[0]\ntest_indices = np.where(test_mask)[0]\nval_indices = np.where(val_mask)[0]\nunlabeled_mask = np.logical_not(train_mask | test_mask | val_mask)\nunlabeled_indices = np.where(unlabeled_mask)[0]\nif row_normalize:\n features = PlanetoidDataset.preprocess_features(features)\...
<|body_start_0|> train_indices = np.where(train_mask)[0] test_indices = np.where(test_mask)[0] val_indices = np.where(val_mask)[0] unlabeled_mask = np.logical_not(train_mask | test_mask | val_mask) unlabeled_indices = np.where(unlabeled_mask)[0] if row_normalize: ...
Data container for Planetoid datasets.
PlanetoidDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" <|body_0|> def preprocess_features(features): """...
stack_v2_sparse_classes_75kplus_train_009397
32,682
permissive
[ { "docstring": "Build from adjacency matrix.", "name": "build_from_adjacency_matrix", "signature": "def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False)" }, { "docstring": "Row-normalize feature matrix.", "name": "preprocess_featu...
2
stack_v2_sparse_classes_30k_train_009619
Implement the Python class `PlanetoidDataset` described below. Class description: Data container for Planetoid datasets. Method signatures and docstrings: - def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): Build from adjacency matrix. - def preprocess...
Implement the Python class `PlanetoidDataset` described below. Class description: Data container for Planetoid datasets. Method signatures and docstrings: - def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): Build from adjacency matrix. - def preprocess...
995064233479e806a3187ede8a395319520db75e
<|skeleton|> class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" <|body_0|> def preprocess_features(features): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" train_indices = np.where(train_mask)[0] test_indices = np.where(tes...
the_stack_v2_python_sparse
research/gam/gam/data/dataset.py
RubensZimbres/neural-structured-learning
train
1
b9eed33de91db854fc9bd164b167cff6259a019b
[ "try:\n ho = HomePage(self.driver)\n ho.small_knowlege()\n so = SmallPage(self.driver)\n so.random_play()\nexcept:\n po = Operation(self.driver)\n po.screenShot()\n raise LocateError()", "try:\n ho = HomePage(self.driver)\n ho.small_knowlege()\n so = SmallPage(self.driver)\n so.Su...
<|body_start_0|> try: ho = HomePage(self.driver) ho.small_knowlege() so = SmallPage(self.driver) so.random_play() except: po = Operation(self.driver) po.screenShot() raise LocateError() <|end_body_0|> <|body_start_1|> ...
SmallTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmallTest: def test_Arangdom_play(self): """首页--小知识--随机播放""" <|body_0|> def test_BSubscribe_ok(self): """首页--小知识--订阅成功""" <|body_1|> def test_CSubscribe_noCancel(self): """首页--小知识--暂不取消订阅""" <|body_2|> def test_DSubscribe_cancel(self...
stack_v2_sparse_classes_75kplus_train_009398
2,297
no_license
[ { "docstring": "首页--小知识--随机播放", "name": "test_Arangdom_play", "signature": "def test_Arangdom_play(self)" }, { "docstring": "首页--小知识--订阅成功", "name": "test_BSubscribe_ok", "signature": "def test_BSubscribe_ok(self)" }, { "docstring": "首页--小知识--暂不取消订阅", "name": "test_CSubscribe...
5
stack_v2_sparse_classes_30k_train_023073
Implement the Python class `SmallTest` described below. Class description: Implement the SmallTest class. Method signatures and docstrings: - def test_Arangdom_play(self): 首页--小知识--随机播放 - def test_BSubscribe_ok(self): 首页--小知识--订阅成功 - def test_CSubscribe_noCancel(self): 首页--小知识--暂不取消订阅 - def test_DSubscribe_cancel(sel...
Implement the Python class `SmallTest` described below. Class description: Implement the SmallTest class. Method signatures and docstrings: - def test_Arangdom_play(self): 首页--小知识--随机播放 - def test_BSubscribe_ok(self): 首页--小知识--订阅成功 - def test_CSubscribe_noCancel(self): 首页--小知识--暂不取消订阅 - def test_DSubscribe_cancel(sel...
1a7d0cafc286963c304219cbf7ac3af0eef2cba4
<|skeleton|> class SmallTest: def test_Arangdom_play(self): """首页--小知识--随机播放""" <|body_0|> def test_BSubscribe_ok(self): """首页--小知识--订阅成功""" <|body_1|> def test_CSubscribe_noCancel(self): """首页--小知识--暂不取消订阅""" <|body_2|> def test_DSubscribe_cancel(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmallTest: def test_Arangdom_play(self): """首页--小知识--随机播放""" try: ho = HomePage(self.driver) ho.small_knowlege() so = SmallPage(self.driver) so.random_play() except: po = Operation(self.driver) po.screenShot() ...
the_stack_v2_python_sparse
Testcase/SmallTest.py
Hanlen520/AndroidUIautoTest-1
train
0
769927f73ce205762c9d42f02f081081f09b6cba
[ "path = self.path\npage_name = path[1:]\nif page_name == 'pokemon_page.css':\n content_type = 'text/css'\n contents = '.status_line {\\n margin-top: 30px;\\n margin-bottom: 30px;\\n margin-left: 20px;\\n border: 2px solid #006600;\\n padding: 10...
<|body_start_0|> path = self.path page_name = path[1:] if page_name == 'pokemon_page.css': content_type = 'text/css' contents = '.status_line {\n margin-top: 30px;\n margin-bottom: 30px;\n margin-left: 20px;\n border: 2p...
Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests.
pokemon_handler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pokemon_handler: """Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests.""" def get_router(self): """Generates a GET request response, e.g. from rendered .html templates. Returns a tuple, co...
stack_v2_sparse_classes_75kplus_train_009399
13,618
no_license
[ { "docstring": "Generates a GET request response, e.g. from rendered .html templates. Returns a tuple, content_type (e.g.: html or css) and contents. If url not found, returns string for 404 error message.", "name": "get_router", "signature": "def get_router(self)" }, { "docstring": "Processes a...
2
stack_v2_sparse_classes_30k_train_022799
Implement the Python class `pokemon_handler` described below. Class description: Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests. Method signatures and docstrings: - def get_router(self): Generates a GET request response...
Implement the Python class `pokemon_handler` described below. Class description: Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests. Method signatures and docstrings: - def get_router(self): Generates a GET request response...
da32aa41c50f4baa11e35c838ccf3c78e0e8fa4b
<|skeleton|> class pokemon_handler: """Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests.""" def get_router(self): """Generates a GET request response, e.g. from rendered .html templates. Returns a tuple, co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class pokemon_handler: """Handles application-specific web page construction and user actions. get_router and post_router methods tell the server how to deal with requests.""" def get_router(self): """Generates a GET request response, e.g. from rendered .html templates. Returns a tuple, content_type (e...
the_stack_v2_python_sparse
15. Tabular view/application_code.py
ElAwbery/Lucky_Egg
train
2