blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
1c73c701b5af7bef001d06c85c928c58a35ed7d0
[ "dancer = Dancer.query.get(dancer_id)\nif dancer is not None:\n return dancer.dancer_json()\nabort(404, 'Unknown dancer_id')", "dancer = Dancer.query.get(dancer_id)\nif dancer is not None:\n dancer.name = api.payload['name']\n dancer.number = api.payload['number']\n dancer.role = api.payload['role']\n...
<|body_start_0|> dancer = Dancer.query.get(dancer_id) if dancer is not None: return dancer.dancer_json() abort(404, 'Unknown dancer_id') <|end_body_0|> <|body_start_1|> dancer = Dancer.query.get(dancer_id) if dancer is not None: dancer.name = api.payload[...
DancerAPISpecific
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DancerAPISpecific: def get(self, dancer_id): """Specific couple""" <|body_0|> def patch(self, dancer_id): """Update existing dancer""" <|body_1|> def delete(self, dancer_id): """Delete dancer""" <|body_2|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_010400
5,282
no_license
[ { "docstring": "Specific couple", "name": "get", "signature": "def get(self, dancer_id)" }, { "docstring": "Update existing dancer", "name": "patch", "signature": "def patch(self, dancer_id)" }, { "docstring": "Delete dancer", "name": "delete", "signature": "def delete(se...
3
null
Implement the Python class `DancerAPISpecific` described below. Class description: Implement the DancerAPISpecific class. Method signatures and docstrings: - def get(self, dancer_id): Specific couple - def patch(self, dancer_id): Update existing dancer - def delete(self, dancer_id): Delete dancer
Implement the Python class `DancerAPISpecific` described below. Class description: Implement the DancerAPISpecific class. Method signatures and docstrings: - def get(self, dancer_id): Specific couple - def patch(self, dancer_id): Update existing dancer - def delete(self, dancer_id): Delete dancer <|skeleton|> class ...
079b109fd13683a31d1d632faa5ab72cf0e78ddf
<|skeleton|> class DancerAPISpecific: def get(self, dancer_id): """Specific couple""" <|body_0|> def patch(self, dancer_id): """Update existing dancer""" <|body_1|> def delete(self, dancer_id): """Delete dancer""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DancerAPISpecific: def get(self, dancer_id): """Specific couple""" dancer = Dancer.query.get(dancer_id) if dancer is not None: return dancer.dancer_json() abort(404, 'Unknown dancer_id') def patch(self, dancer_id): """Update existing dancer""" d...
the_stack_v2_python_sparse
backend/apis/dancers/apis.py
AlenAlic/DANCE
train
0
43a012f8beae21a39227fdbf9bf3a1c5af40ea3e
[ "super().__init__()\nself.embeddings = nn.Embedding(vocab_size, embedding_dim, padding_idx=0)\nif word_embeddings is not None:\n self.embeddings = self.embeddings.from_pretrained(word_embeddings, freeze=True, padding_idx=0)\nself.W = nn.Linear(embedding_dim, num_classes)", "word_embeds = self.embeddings(x)\nsu...
<|body_start_0|> super().__init__() self.embeddings = nn.Embedding(vocab_size, embedding_dim, padding_idx=0) if word_embeddings is not None: self.embeddings = self.embeddings.from_pretrained(word_embeddings, freeze=True, padding_idx=0) self.W = nn.Linear(embedding_dim, num_cl...
FastText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastText: def __init__(self, vocab_size, embedding_dim, num_classes, word_embeddings=None): """:param vocab_size: the number of different embeddings to make (need one embedding for every unique word). :param embedding_dim: the dimension of each embedding vector. :param num_classes: the n...
stack_v2_sparse_classes_36k_train_010401
3,809
no_license
[ { "docstring": ":param vocab_size: the number of different embeddings to make (need one embedding for every unique word). :param embedding_dim: the dimension of each embedding vector. :param num_classes: the number of target classes. :param word_embeddings: optional pre-trained word embeddings. If not given wor...
2
stack_v2_sparse_classes_30k_train_004543
Implement the Python class `FastText` described below. Class description: Implement the FastText class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, num_classes, word_embeddings=None): :param vocab_size: the number of different embeddings to make (need one embedding for every uniq...
Implement the Python class `FastText` described below. Class description: Implement the FastText class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, num_classes, word_embeddings=None): :param vocab_size: the number of different embeddings to make (need one embedding for every uniq...
594d5905c09d2e2d7c49e48e6dd4b01de8751684
<|skeleton|> class FastText: def __init__(self, vocab_size, embedding_dim, num_classes, word_embeddings=None): """:param vocab_size: the number of different embeddings to make (need one embedding for every unique word). :param embedding_dim: the dimension of each embedding vector. :param num_classes: the n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastText: def __init__(self, vocab_size, embedding_dim, num_classes, word_embeddings=None): """:param vocab_size: the number of different embeddings to make (need one embedding for every unique word). :param embedding_dim: the dimension of each embedding vector. :param num_classes: the number of targe...
the_stack_v2_python_sparse
A2/A2/models.py
shawnTever/documentAnalysis
train
0
e405d7988a62c1d40b8c40719db965e35556ad29
[ "super(VGG16, self).__init__()\nself.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True)\nself.max_pool = nn.MaxPool2d(kernel_size=2, stride=2)\nself.classifier = VGG16Classfier()\nself.fc3 = _fc(in_channels=4096, out_channels=num_classes)", "feature_maps = self.vgg16_feature_extractor(x)\nx = s...
<|body_start_0|> super(VGG16, self).__init__() self.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True) self.max_pool = nn.MaxPool2d(kernel_size=2, stride=2) self.classifier = VGG16Classfier() self.fc3 = _fc(in_channels=4096, out_channels=num_classes) <|end_body...
VGG16
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" <|body_0|> def construct(self, x): """:param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(VGG16, ...
stack_v2_sparse_classes_36k_train_010402
5,998
permissive
[ { "docstring": "VGG16 construct for training backbone", "name": "__init__", "signature": "def __init__(self, num_classes)" }, { "docstring": ":param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)", "name": "construct", "signature": "def construct(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_008438
Implement the Python class `VGG16` described below. Class description: Implement the VGG16 class. Method signatures and docstrings: - def __init__(self, num_classes): VGG16 construct for training backbone - def construct(self, x): :param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)
Implement the Python class `VGG16` described below. Class description: Implement the VGG16 class. Method signatures and docstrings: - def __init__(self, num_classes): VGG16 construct for training backbone - def construct(self, x): :param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000) <|skeleton|> class V...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" <|body_0|> def construct(self, x): """:param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" super(VGG16, self).__init__() self.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True) self.max_pool = nn.MaxPool2d(kernel_size=2, stride=2) self.classifier = VGG16Clas...
the_stack_v2_python_sparse
official/cv/CTPN/src/CTPN/vgg16.py
mindspore-ai/models
train
301
f7b05c75adc69cfaf45f647370ed1b44ad15f7be
[ "self.token = bot_token\nif proxy_url is None:\n self.proxies = None\nelse:\n self.proxies = {'http': proxy_url, 'https': proxy_url}", "if strip_msg:\n wait_msg = wait_msg.strip()\nres = self.__msg_polling_loop(wait_msg, timeout, strip_msg)\nif res is None:\n return None\nchat_id, update_id = res\nsel...
<|body_start_0|> self.token = bot_token if proxy_url is None: self.proxies = None else: self.proxies = {'http': proxy_url, 'https': proxy_url} <|end_body_0|> <|body_start_1|> if strip_msg: wait_msg = wait_msg.strip() res = self.__msg_polling_l...
Telegram Bot 客户端类。 提供接收消息、发送消息等功能。
TgBotClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TgBotClient: """Telegram Bot 客户端类。 提供接收消息、发送消息等功能。""" def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None: """初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如果要使用代理,可以从此参数传入""" <|body_0|> def wait_for_s...
stack_v2_sparse_classes_36k_train_010403
7,150
no_license
[ { "docstring": "初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如果要使用代理,可以从此参数传入", "name": "__init__", "signature": "def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None" }, { "docstring": "通过 getUpdates 方法获取新消息,直到获取到某条特定的消息才返回。 ...
6
stack_v2_sparse_classes_30k_train_009658
Implement the Python class `TgBotClient` described below. Class description: Telegram Bot 客户端类。 提供接收消息、发送消息等功能。 Method signatures and docstrings: - def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None: 初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如...
Implement the Python class `TgBotClient` described below. Class description: Telegram Bot 客户端类。 提供接收消息、发送消息等功能。 Method signatures and docstrings: - def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None: 初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如...
84668945918c2ed0b5c50491f32694f6a4cf83cd
<|skeleton|> class TgBotClient: """Telegram Bot 客户端类。 提供接收消息、发送消息等功能。""" def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None: """初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如果要使用代理,可以从此参数传入""" <|body_0|> def wait_for_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TgBotClient: """Telegram Bot 客户端类。 提供接收消息、发送消息等功能。""" def __init__(self, bot_token: str, proxy_url: Optional[str]=None) -> None: """初始化 Telegram Bot 客户端类。 :param bot_token: Bot 的 API Token,可以通过 @BotFather 获取 :param proxy_url: 如果要使用代理,可以从此参数传入""" self.token = bot_token if proxy_url...
the_stack_v2_python_sparse
bupt_card_alert_bot/client/tg_bot_client.py
ipid/bupt-card-alert-bot
train
6
295a9f07cc73b6d6b3bff355e50d4709e6b0b662
[ "model_config = self.task_config.model\nmodel_params = model_config.model_params.as_dict()\nmodel = AutosegEdgeTPU(model_params, min_level=model_config.head.min_level, max_level=model_config.head.max_level, fpn_num_filters=model_config.head.fpn_num_filters, num_classes=model_config.num_classes)\nlogging.info(model_...
<|body_start_0|> model_config = self.task_config.model model_params = model_config.model_params.as_dict() model = AutosegEdgeTPU(model_params, min_level=model_config.head.min_level, max_level=model_config.head.max_level, fpn_num_filters=model_config.head.fpn_num_filters, num_classes=model_config...
A task for training the AutosegEdgeTPU models.
AutosegEdgeTPUTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" <|body_0|> def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputContext]=None): """Builds in...
stack_v2_sparse_classes_36k_train_010404
11,868
permissive
[ { "docstring": "Builds model for training task.", "name": "build_model", "signature": "def build_model(self)" }, { "docstring": "Builds inputs for the segmentation task.", "name": "build_inputs", "signature": "def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.dist...
2
null
Implement the Python class `AutosegEdgeTPUTask` described below. Class description: A task for training the AutosegEdgeTPU models. Method signatures and docstrings: - def build_model(self): Builds model for training task. - def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputCont...
Implement the Python class `AutosegEdgeTPUTask` described below. Class description: A task for training the AutosegEdgeTPU models. Method signatures and docstrings: - def build_model(self): Builds model for training task. - def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputCont...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" <|body_0|> def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputContext]=None): """Builds in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" model_config = self.task_config.model model_params = model_config.model_params.as_dict() model = AutosegEdgeTPU(model_params, min_level=mod...
the_stack_v2_python_sparse
official/projects/edgetpu/vision/tasks/semantic_segmentation.py
jianzhnie/models
train
2
a3d5d0bd31588bb087f5f69fd873c142f8c0009a
[ "self.a = a\nself.s = s\nself.a_1 = inverse_x(a, len(alphabet))\nself.s_1 = -self.a_1 * s % len(alphabet)\nself.alphabet = alphabet.lower()", "new_word = []\nfor w in word.lower():\n new_letter_idx = (self.a * self.alphabet.index(w) + self.s) % len(self.alphabet)\n new_word.append(self.alphabet[new_letter_i...
<|body_start_0|> self.a = a self.s = s self.a_1 = inverse_x(a, len(alphabet)) self.s_1 = -self.a_1 * s % len(alphabet) self.alphabet = alphabet.lower() <|end_body_0|> <|body_start_1|> new_word = [] for w in word.lower(): new_letter_idx = (self.a * sel...
AffineCipher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineCipher: def __init__(self, a, s, alphabet): """text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet""" <|body_0|> def encode(self, word): """:param word: input open message :return:...
stack_v2_sparse_classes_36k_train_010405
1,587
no_license
[ { "docstring": "text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet", "name": "__init__", "signature": "def __init__(self, a, s, alphabet)" }, { "docstring": ":param word: input open message :return: encrypted input...
3
stack_v2_sparse_classes_30k_train_012670
Implement the Python class `AffineCipher` described below. Class description: Implement the AffineCipher class. Method signatures and docstrings: - def __init__(self, a, s, alphabet): text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet -...
Implement the Python class `AffineCipher` described below. Class description: Implement the AffineCipher class. Method signatures and docstrings: - def __init__(self, a, s, alphabet): text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet -...
e89fe4fdbcede61c0118c8e61f54fb7350e1631b
<|skeleton|> class AffineCipher: def __init__(self, a, s, alphabet): """text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet""" <|body_0|> def encode(self, word): """:param word: input open message :return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AffineCipher: def __init__(self, a, s, alphabet): """text – повідомлення; crypto – зашифроване повідомлення :param a, :param s: keys for monogram affine cipher :param alphabet: alphabet""" self.a = a self.s = s self.a_1 = inverse_x(a, len(alphabet)) self.s_1 = -self.a_1...
the_stack_v2_python_sparse
lab2/Ex1.py
olexandrkucher/Cryptology
train
0
588f9dbc549cf45e8aa3ef02de3105314dbc53fa
[ "if ty == 'trades':\n reader = BinReader(filePath, '>QIIf', 100)\n self._ts = []\n self._pr = []\n while reader.hasNext():\n now = reader.next()\n self._ts.append(now[0])\n self._pr.append(now[3])\nelif ty == 'quotes':\n reader = BinReader(filePath, '>QIIfIf', 100)\n self._ts ...
<|body_start_0|> if ty == 'trades': reader = BinReader(filePath, '>QIIf', 100) self._ts = [] self._pr = [] while reader.hasNext(): now = reader.next() self._ts.append(now[0]) self._pr.append(now[3]) elif ty =...
A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade price/mid quote price for trade/quote data
Computer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Computer: """A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade price/mid quote price for trade/quote data...
stack_v2_sparse_classes_36k_train_010406
2,886
no_license
[ { "docstring": "Parameters ------ filePath : str The file path of the data ty : str type of the data, either 'trades' or 'quotes'", "name": "__init__", "signature": "def __init__(self, filePath, ty)" }, { "docstring": "Compute the X-minute return Parameters ------ x : int Minute", "name": "c...
2
stack_v2_sparse_classes_30k_train_013577
Implement the Python class `Computer` described below. Class description: A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade pri...
Implement the Python class `Computer` described below. Class description: A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade pri...
4aabbb41b2e9ce18172e010527c59d53ffb95984
<|skeleton|> class Computer: """A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade price/mid quote price for trade/quote data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Computer: """A class to compute X-minute returns of trades and mid-quotes Attributes ------ _ts : list A list of time stamps from the data _pr : list A list of prices from the data Methods ------ computeReturn(x) Return the X-time lag return of the trade price/mid quote price for trade/quote data""" def ...
the_stack_v2_python_sparse
Homework1/PartB/ReturnComputer.py
nateehuang/AlgorTradingGithub
train
0
26248d8cfa9c6560e0d2d720c690751411c8fe8d
[ "if obj == cls.OFF:\n return dataset_options_pb2.AutoShardPolicy.OFF\nif obj == cls.FILE:\n return dataset_options_pb2.AutoShardPolicy.FILE\nif obj == cls.DATA:\n return dataset_options_pb2.AutoShardPolicy.DATA\nif obj == cls.AUTO:\n return dataset_options_pb2.AutoShardPolicy.AUTO\nif obj == cls.HINT:\n...
<|body_start_0|> if obj == cls.OFF: return dataset_options_pb2.AutoShardPolicy.OFF if obj == cls.FILE: return dataset_options_pb2.AutoShardPolicy.FILE if obj == cls.DATA: return dataset_options_pb2.AutoShardPolicy.DATA if obj == cls.AUTO: r...
Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure that there is at least as many files as wor...
AutoShardPolicy
[ "MIT", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure ...
stack_v2_sparse_classes_36k_train_010407
6,002
permissive
[ { "docstring": "Convert enum to proto.", "name": "_to_proto", "signature": "def _to_proto(cls, obj)" }, { "docstring": "Convert proto to enum.", "name": "_from_proto", "signature": "def _from_proto(cls, pb)" } ]
2
stack_v2_sparse_classes_30k_train_019082
Implement the Python class `AutoShardPolicy` described below. Class description: Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). W...
Implement the Python class `AutoShardPolicy` described below. Class description: Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). W...
085b20a4b6287eff8c0b792425d52422ab8cbab3
<|skeleton|> class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoShardPolicy: """Represents the type of auto-sharding to use. OFF: No sharding will be performed. AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. FILE: Shards by input files (i.e. each worker will get a set of files to process). When this option is selected, make sure that there is...
the_stack_v2_python_sparse
tensorflow/python/data/experimental/ops/distribute_options.py
graphcore/tensorflow
train
84
e77a820a86d3222217a9fbe36cc494e583f4c6c5
[ "try:\n date = ElectionDay.objects.get(date=self.kwargs['date'])\nexcept:\n raise APIException('No elections on {}.'.format(self.kwargs['date']))\ndivision_ids = []\nfor election in date.elections.all():\n if election.division.level == STATE_LEVEL and (not election.race.special):\n division_ids.appe...
<|body_start_0|> try: date = ElectionDay.objects.get(date=self.kwargs['date']) except: raise APIException('No elections on {}.'.format(self.kwargs['date'])) division_ids = [] for election in date.elections.all(): if election.division.level == STATE_LEV...
StateMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateMixin: def get_queryset(self): """Returns a queryset of all states holding a non-special election on a date.""" <|body_0|> def get_serializer_context(self): """Adds ``election_day`` to serializer context.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_010408
5,447
no_license
[ { "docstring": "Returns a queryset of all states holding a non-special election on a date.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Adds ``election_day`` to serializer context.", "name": "get_serializer_context", "signature": "def get_serializer_...
2
stack_v2_sparse_classes_30k_train_004013
Implement the Python class `StateMixin` described below. Class description: Implement the StateMixin class. Method signatures and docstrings: - def get_queryset(self): Returns a queryset of all states holding a non-special election on a date. - def get_serializer_context(self): Adds ``election_day`` to serializer con...
Implement the Python class `StateMixin` described below. Class description: Implement the StateMixin class. Method signatures and docstrings: - def get_queryset(self): Returns a queryset of all states holding a non-special election on a date. - def get_serializer_context(self): Adds ``election_day`` to serializer con...
9137a0c59e044d081d6c34f0e9e97b789e69bdbf
<|skeleton|> class StateMixin: def get_queryset(self): """Returns a queryset of all states holding a non-special election on a date.""" <|body_0|> def get_serializer_context(self): """Adds ``election_day`` to serializer context.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateMixin: def get_queryset(self): """Returns a queryset of all states holding a non-special election on a date.""" try: date = ElectionDay.objects.get(date=self.kwargs['date']) except: raise APIException('No elections on {}.'.format(self.kwargs['date'])) ...
the_stack_v2_python_sparse
theshow/viewsets.py
The-Politico/politico-elections
train
0
703dc112382fbf2ddebf10f91d5a2149dd20ca96
[ "self.key = key\nself.conn = conn\nself.major_opcode = 0\nself.first_event = 0\nself.first_error = 0", "if self.conn.synchronous_check and request.is_void:\n request.is_checked = True\nxcb_req = libxcb.xcb_protocol_request_t()\nxcb_req.count = 2\nxcb_req.ext = ctypes.pointer(self.key.key) if self.key is not No...
<|body_start_0|> self.key = key self.conn = conn self.major_opcode = 0 self.first_event = 0 self.first_error = 0 <|end_body_0|> <|body_start_1|> if self.conn.synchronous_check and request.is_void: request.is_checked = True xcb_req = libxcb.xcb_protoco...
A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly.
Extension
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Extension: """A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly.""" def __init__(self, conn, key=None): """:type conn: :class:`ooxcb.conn.Connection` :param key: The correspond...
stack_v2_sparse_classes_36k_train_010409
4,339
no_license
[ { "docstring": ":type conn: :class:`ooxcb.conn.Connection` :param key: The corresponding :class:`ooxcb.extkey.ExtensionKey` instance (optional)", "name": "__init__", "signature": "def __init__(self, conn, key=None)" }, { "docstring": "sends *request* to the X server. Then it provides *cookie* wi...
2
stack_v2_sparse_classes_30k_train_006365
Implement the Python class `Extension` described below. Class description: A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly. Method signatures and docstrings: - def __init__(self, conn, key=None): :type conn: ...
Implement the Python class `Extension` described below. Class description: A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly. Method signatures and docstrings: - def __init__(self, conn, key=None): :type conn: ...
84c922db80c899fb2bc319b1f42d2bc0e3d4bfaa
<|skeleton|> class Extension: """A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly.""" def __init__(self, conn, key=None): """:type conn: :class:`ooxcb.conn.Connection` :param key: The correspond...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Extension: """A wrapper for an X11 extension. This class provides with a :meth:`Extension.send_request` method. You will most likely do not have to use this class directly.""" def __init__(self, conn, key=None): """:type conn: :class:`ooxcb.conn.Connection` :param key: The corresponding :class:`o...
the_stack_v2_python_sparse
ooxcb/ext.py
samurai-x/ooxcb
train
3
232a96c4e366d57231ec990b9065516420ac3e50
[ "result = []\nfor line in lines:\n values = {}\n for name, field in line._fields.items():\n if name in MAGIC_COLUMNS:\n continue\n elif field.type == 'many2one':\n values[name] = line[name].id\n elif field.type not in ['many2many', 'one2many']:\n values[na...
<|body_start_0|> result = [] for line in lines: values = {} for name, field in line._fields.items(): if name in MAGIC_COLUMNS: continue elif field.type == 'many2one': values[name] = line[name].id ...
AccountInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoice: def _refund_cleanup_lines(self, lines): """Override to update amount refunded if user using Refund feature from Membership""" <|body_0|> def write(self, vals): """Update date_from for related membership_line""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_010410
2,094
no_license
[ { "docstring": "Override to update amount refunded if user using Refund feature from Membership", "name": "_refund_cleanup_lines", "signature": "def _refund_cleanup_lines(self, lines)" }, { "docstring": "Update date_from for related membership_line", "name": "write", "signature": "def wr...
2
stack_v2_sparse_classes_30k_train_004227
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def _refund_cleanup_lines(self, lines): Override to update amount refunded if user using Refund feature from Membership - def write(self, vals): Update date_from for ...
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def _refund_cleanup_lines(self, lines): Override to update amount refunded if user using Refund feature from Membership - def write(self, vals): Update date_from for ...
3f4b2ace1692cb3119fc1fd40c1958549fcc6eb8
<|skeleton|> class AccountInvoice: def _refund_cleanup_lines(self, lines): """Override to update amount refunded if user using Refund feature from Membership""" <|body_0|> def write(self, vals): """Update date_from for related membership_line""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInvoice: def _refund_cleanup_lines(self, lines): """Override to update amount refunded if user using Refund feature from Membership""" result = [] for line in lines: values = {} for name, field in line._fields.items(): if name in MAGIC_COL...
the_stack_v2_python_sparse
kingsport_module/models/membership/account_invoice.py
ngothienlo/odoo_12_pharmacy
train
0
080295869809cd72e59d1c2cbee1cb87718ffc18
[ "self.dynamodb = AwsClient().connect('dynamodb', region_name)\ntry:\n self.dynamodb.list_tables()\nexcept EndpointConnectionError:\n print('Dynamodb resource is not available in this aws region')\n return", "for table in self.list_tables(older_than_seconds):\n try:\n self.dynamodb.delete_table(...
<|body_start_0|> self.dynamodb = AwsClient().connect('dynamodb', region_name) try: self.dynamodb.list_tables() except EndpointConnectionError: print('Dynamodb resource is not available in this aws region') return <|end_body_0|> <|body_start_1|> for ta...
Abstract dynamodb nuke in a class.
NukeDynamodb
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NukeDynamodb: """Abstract dynamodb nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize dynamodb nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """Dynamodb table and backup deleting function. Deleting all dynamod...
stack_v2_sparse_classes_36k_train_010411
3,272
permissive
[ { "docstring": "Initialize dynamodb nuke.", "name": "__init__", "signature": "def __init__(self, region_name=None) -> None" }, { "docstring": "Dynamodb table and backup deleting function. Deleting all dynamodb table and backup with a timestamp greater than older_than_seconds. :param int older_th...
4
stack_v2_sparse_classes_30k_train_007864
Implement the Python class `NukeDynamodb` described below. Class description: Abstract dynamodb nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize dynamodb nuke. - def nuke(self, older_than_seconds: float) -> None: Dynamodb table and backup deleting function....
Implement the Python class `NukeDynamodb` described below. Class description: Abstract dynamodb nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize dynamodb nuke. - def nuke(self, older_than_seconds: float) -> None: Dynamodb table and backup deleting function....
25c4159e71935a9903a41540c168992586c5ba0c
<|skeleton|> class NukeDynamodb: """Abstract dynamodb nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize dynamodb nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """Dynamodb table and backup deleting function. Deleting all dynamod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NukeDynamodb: """Abstract dynamodb nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize dynamodb nuke.""" self.dynamodb = AwsClient().connect('dynamodb', region_name) try: self.dynamodb.list_tables() except EndpointConnectionError: ...
the_stack_v2_python_sparse
package/nuke/database/dynamodb.py
diodonfrost/terraform-aws-lambda-nuke
train
20
2f3d8379487f1156f8c6a0f9b7e48a28389e79ca
[ "super().__init__()\nlog.debug('Manager__init__()')\nself.nworkers = self.size - 1\nself.workerIDs = range(1, self.size)\nassert self.nworkers == len(self.workerIDs)\nself.dests = deque(self.workerIDs)\nself.tasks = deque()\nself.nPending = 0\nself.shutItDown = False\nself.pending_futures = dict()\nself.workers = [...
<|body_start_0|> super().__init__() log.debug('Manager__init__()') self.nworkers = self.size - 1 self.workerIDs = range(1, self.size) assert self.nworkers == len(self.workerIDs) self.dests = deque(self.workerIDs) self.tasks = deque() self.nPending = 0 ...
Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher.
Manager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: """Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher.""" def __init__(self): """Initialize different state variables used by Manager....
stack_v2_sparse_classes_36k_train_010412
9,511
permissive
[ { "docstring": "Initialize different state variables used by Manager.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Spawns the dispatcher and receiver threads.", "name": "startup", "signature": "def startup(self)" }, { "docstring": "Continuously dispa...
6
null
Implement the Python class `Manager` described below. Class description: Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher. Method signatures and docstrings: - def __init__(sel...
Implement the Python class `Manager` described below. Class description: Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher. Method signatures and docstrings: - def __init__(sel...
85ed1c54159d639d2fcb9e23c45f93743bfed2e0
<|skeleton|> class Manager: """Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher.""" def __init__(self): """Initialize different state variables used by Manager....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Manager: """Manager of the MPIWorkManage. Distributes tasks to Worker as they are received from the sim_manager. In addition to the main thread, this class spawns two threads, a receiver and a dispatcher.""" def __init__(self): """Initialize different state variables used by Manager.""" s...
the_stack_v2_python_sparse
src/westpa/work_managers/mpi.py
westpa/westpa
train
181
a363da7a4ee66f19b99eade321a5148db2b03678
[ "port = self._client.create(network_id=network['id'])\nif check:\n self.check_presence(port)\nreturn port", "self._client.delete(port['id'])\nif check:\n self.check_presence(port, must_present=False)", "def _check_port_presence():\n is_present = bool(self._client.find_all(id=port['id']))\n return wa...
<|body_start_0|> port = self._client.create(network_id=network['id']) if check: self.check_presence(port) return port <|end_body_0|> <|body_start_1|> self._client.delete(port['id']) if check: self.check_presence(port, must_present=False) <|end_body_1|> <...
Port steps.
PortSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortSteps: """Port steps.""" def create(self, network, check=True): """Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port""" <|body_0|> def delete(self, port, check=True): """St...
stack_v2_sparse_classes_36k_train_010413
2,253
no_license
[ { "docstring": "Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port", "name": "create", "signature": "def create(self, network, check=True)" }, { "docstring": "Step to create port. Args: port (dict): port to del...
3
stack_v2_sparse_classes_30k_train_008972
Implement the Python class `PortSteps` described below. Class description: Port steps. Method signatures and docstrings: - def create(self, network, check=True): Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port - def delete(self, ...
Implement the Python class `PortSteps` described below. Class description: Port steps. Method signatures and docstrings: - def create(self, network, check=True): Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port - def delete(self, ...
2d85917ed9a35ee434d636fbbab60726d44af3a1
<|skeleton|> class PortSteps: """Port steps.""" def create(self, network, check=True): """Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port""" <|body_0|> def delete(self, port, check=True): """St...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortSteps: """Port steps.""" def create(self, network, check=True): """Step to create port. Args: network (dict): network to create port on check (bool): flag whether to check step or not Returns: dict: port""" port = self._client.create(network_id=network['id']) if check: ...
the_stack_v2_python_sparse
stepler/neutron/steps/ports.py
Mirantis/stepler-draft
train
0
232f0cc232bf0a59c7b6e8fad5bad360d9f29daa
[ "if data is None:\n self.n = int(n)\n self.p = float(p)\n if n <= 0:\n raise ValueError('n must be a positive value')\n self.n = int(n)\n if p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\nelse:\n if not isinstance(data, list):\n raise TypeErr...
<|body_start_0|> if data is None: self.n = int(n) self.p = float(p) if n <= 0: raise ValueError('n must be a positive value') self.n = int(n) if p <= 0 or p >= 1: raise ValueError('p must be greater than 0 and less than ...
the binomial distribution class
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """the binomial distribution class""" def __init__(self, data=None, n=1.0, p=0.5): """constructor for binomial distribution n trials, p prob for success""" <|body_0|> def pmf(self, k): """calculates pmf for k successes""" <|body_1|> def cdf...
stack_v2_sparse_classes_36k_train_010414
2,834
no_license
[ { "docstring": "constructor for binomial distribution n trials, p prob for success", "name": "__init__", "signature": "def __init__(self, data=None, n=1.0, p=0.5)" }, { "docstring": "calculates pmf for k successes", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring":...
4
null
Implement the Python class `Binomial` described below. Class description: the binomial distribution class Method signatures and docstrings: - def __init__(self, data=None, n=1.0, p=0.5): constructor for binomial distribution n trials, p prob for success - def pmf(self, k): calculates pmf for k successes - def cdf(sel...
Implement the Python class `Binomial` described below. Class description: the binomial distribution class Method signatures and docstrings: - def __init__(self, data=None, n=1.0, p=0.5): constructor for binomial distribution n trials, p prob for success - def pmf(self, k): calculates pmf for k successes - def cdf(sel...
d86b0e0cae2dd07c761f84a493abc895007873ee
<|skeleton|> class Binomial: """the binomial distribution class""" def __init__(self, data=None, n=1.0, p=0.5): """constructor for binomial distribution n trials, p prob for success""" <|body_0|> def pmf(self, k): """calculates pmf for k successes""" <|body_1|> def cdf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Binomial: """the binomial distribution class""" def __init__(self, data=None, n=1.0, p=0.5): """constructor for binomial distribution n trials, p prob for success""" if data is None: self.n = int(n) self.p = float(p) if n <= 0: raise Val...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
mag389/holbertonschool-machine_learning
train
2
7ccf17dd26b3184ca07d1d88133e67196d4802cd
[ "super().__init__(id_)\nself.store_bias = store_bias\nself.callbacks = callbacks\nself.collect_seqs = collect_seqs\nself.collect_kwargs = {} if collect_kwargs is None else collect_kwargs\nself.compose_summary = compose_summary\nself.summary_kwargs = {} if summary_kwargs is None else summary_kwargs\nself.cleanup: bo...
<|body_start_0|> super().__init__(id_) self.store_bias = store_bias self.callbacks = callbacks self.collect_seqs = collect_seqs self.collect_kwargs = {} if collect_kwargs is None else collect_kwargs self.compose_summary = compose_summary self.summary_kwargs = {} i...
Operator defining the `Worker`'s execution strategy.
GenericExecutor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericExecutor: """Operator defining the `Worker`'s execution strategy.""" def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=...
stack_v2_sparse_classes_36k_train_010415
3,496
no_license
[ { "docstring": ":param id_: Unique Id. Defaults to `id(self)`. :param store_bias: Whether to call `store_bias` method of a `Worker`. :param callbacks: An optional collection of callbacks. `Callback` is an operator accepting and returning a `Worker`. :param collect_seqs: Whether to call `collect_seqs` method of ...
2
stack_v2_sparse_classes_30k_train_012218
Implement the Python class `GenericExecutor` described below. Class description: Operator defining the `Worker`'s execution strategy. Method signatures and docstrings: - def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect...
Implement the Python class `GenericExecutor` described below. Class description: Operator defining the `Worker`'s execution strategy. Method signatures and docstrings: - def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect...
49d002a3aedece4e122f21d55503898774b43c78
<|skeleton|> class GenericExecutor: """Operator defining the `Worker`'s execution strategy.""" def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenericExecutor: """Operator defining the `Worker`'s execution strategy.""" def __init__(self, id_: Id=None, store_bias: bool=True, callbacks: t.Optional[t.Collection[AbstractCallback]]=None, collect_seqs: bool=True, collect_kwargs: t.Optional[t.Dict[str, t.Any]]=None, compose_summary: bool=True, summary...
the_stack_v2_python_sparse
protmc/operators/executor.py
edikedik/ProteusTools
train
0
6a3020cb45ff4f4fef43dbab994fd3d77e7bca37
[ "len_s, len_p = (len(s), len(p))\ndp = [[False] * (len_p + 1) for _ in range(len_s + 1)]\ndp[-1][-1] = True\nfor si in range(len_s, -1, -1):\n for pi in range(len_p - 1, -1, -1):\n first_match = si < len_s and p[pi] in {s[si], '.'}\n if pi + 1 < len_p and p[pi + 1] == '*':\n dp[si][pi] =...
<|body_start_0|> len_s, len_p = (len(s), len(p)) dp = [[False] * (len_p + 1) for _ in range(len_s + 1)] dp[-1][-1] = True for si in range(len_s, -1, -1): for pi in range(len_p - 1, -1, -1): first_match = si < len_s and p[pi] in {s[si], '.'} if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> len_s, len_p = (len(s), len(p)) dp...
stack_v2_sparse_classes_36k_train_010416
2,299
no_license
[ { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch", "signature": "def isMatch(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch2", "signature": "def isMatch2(self, s, p)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool <|skeleton|> class Solution: def isMatch(...
dbdb227e12f329e4ca064b338f1fbdca42f3a848
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" len_s, len_p = (len(s), len(p)) dp = [[False] * (len_p + 1) for _ in range(len_s + 1)] dp[-1][-1] = True for si in range(len_s, -1, -1): for pi in range(len_p - 1, -1, -1): ...
the_stack_v2_python_sparse
LC10.py
Qiao-Liang/LeetCode
train
0
b35a4686778303f92ed7077476f2d3add45e2ddd
[ "if len(nums) < 2:\n return nums\ns0 = 0\nsn = 1\nwhile s0 < len(nums) and sn < len(nums):\n if nums[s0] != 0:\n s0 += 1\n continue\n elif sn <= s0:\n sn = s0 + 1\n continue\n if nums[sn] == 0:\n sn += 1\n continue\n if nums[s0] == 0 and nums[sn] != 0:\n ...
<|body_start_0|> if len(nums) < 2: return nums s0 = 0 sn = 1 while s0 < len(nums) and sn < len(nums): if nums[s0] != 0: s0 += 1 continue elif sn <= s0: sn = s0 + 1 continue if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes2(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""...
stack_v2_sparse_classes_36k_train_010417
1,950
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "moveZeroes2", "signature": "def moveZeroes2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "...
2
stack_v2_sparse_classes_30k_train_017678
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes2(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums): :type nums: List[int] :rtype: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes2(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums): :type nums: List[int] :rtype: ...
0fdc1d60cfb3f4c26698a493da4986bfc873e02a
<|skeleton|> class Solution: def moveZeroes2(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes2(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" if len(nums) < 2: return nums s0 = 0 sn = 1 while s0 < len(nums) and sn < len(nums): if nums[s0] != 0: ...
the_stack_v2_python_sparse
283_MoveZeroes/283_MoveZeroes.py
ranson/leetcode
train
0
3ea6fb833b7088257aeeaf88948364efe7913ad4
[ "if len(nums) < 2:\n return False\ns = sum(nums)\nif s % 2 == 1:\n return False\nhalf = s // 2\ndp = []\nfor i in range(len(nums) + 1):\n dp.append([False for i in range(half + 1)])\nfor j in range(half + 1):\n dp[0][j] = False\nfor i in range(len(nums) + 1):\n dp[i][0] = True\ndp[0][0] = True\nfor i...
<|body_start_0|> if len(nums) < 2: return False s = sum(nums) if s % 2 == 1: return False half = s // 2 dp = [] for i in range(len(nums) + 1): dp.append([False for i in range(half + 1)]) for j in range(half + 1): dp[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartitionV2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) < 2: return Fa...
stack_v2_sparse_classes_36k_train_010418
1,939
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartitionV2", "signature": "def canPartitionV2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartitionV2(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 canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartitionV2(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPa...
d6ddbef76dd8630234f669d272d1f8065c6be128
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartitionV2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" if len(nums) < 2: return False s = sum(nums) if s % 2 == 1: return False half = s // 2 dp = [] for i in range(len(nums) + 1): dp.append([...
the_stack_v2_python_sparse
dp/knapsack/416. Partition Equal Subset Sum.py
Mang0o/leetcode
train
0
fe30943439ddec83a9abea1d44706cc765f750df
[ "try:\n self._rates\nexcept AttributeError:\n self._rates = []\nif kind == 'bin':\n ro = BinRate(neuron=self, **kwargs)\nelif kind == 'nisi':\n ro = nISIRate(neuron=self, **kwargs)\nelif kind == 'wnisi':\n ro = WnISIRate(neuron=self, **kwargs)\nelif kind == 'idp':\n ro = IDPRate(neuron=self, **kwa...
<|body_start_0|> try: self._rates except AttributeError: self._rates = [] if kind == 'bin': ro = BinRate(neuron=self, **kwargs) elif kind == 'nisi': ro = nISIRate(neuron=self, **kwargs) elif kind == 'wnisi': ro = WnISIRa...
Mix-in class that defines the spike rate related Neuron methods
NeuronRate
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuronRate: """Mix-in class that defines the spike rate related Neuron methods""" def rate(self, kind='nisi', **kwargs): """Returns an existing Rate object, or creates a new one if necessary""" <|body_0|> def ratepdf(self, **kwargs): """Returns an existing RatePD...
stack_v2_sparse_classes_36k_train_010419
44,171
permissive
[ { "docstring": "Returns an existing Rate object, or creates a new one if necessary", "name": "rate", "signature": "def rate(self, kind='nisi', **kwargs)" }, { "docstring": "Returns an existing RatePDF object, or creates a new one if necessary", "name": "ratepdf", "signature": "def ratepd...
2
stack_v2_sparse_classes_30k_train_000145
Implement the Python class `NeuronRate` described below. Class description: Mix-in class that defines the spike rate related Neuron methods Method signatures and docstrings: - def rate(self, kind='nisi', **kwargs): Returns an existing Rate object, or creates a new one if necessary - def ratepdf(self, **kwargs): Retur...
Implement the Python class `NeuronRate` described below. Class description: Mix-in class that defines the spike rate related Neuron methods Method signatures and docstrings: - def rate(self, kind='nisi', **kwargs): Returns an existing Rate object, or creates a new one if necessary - def ratepdf(self, **kwargs): Retur...
ab576a41ec00e3c126bca45c2504dd61bd1cda56
<|skeleton|> class NeuronRate: """Mix-in class that defines the spike rate related Neuron methods""" def rate(self, kind='nisi', **kwargs): """Returns an existing Rate object, or creates a new one if necessary""" <|body_0|> def ratepdf(self, **kwargs): """Returns an existing RatePD...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeuronRate: """Mix-in class that defines the spike rate related Neuron methods""" def rate(self, kind='nisi', **kwargs): """Returns an existing Rate object, or creates a new one if necessary""" try: self._rates except AttributeError: self._rates = [] ...
the_stack_v2_python_sparse
neuropy/neuron.py
node2319/neuropy-1
train
0
a4cb066a6f50340b2d4a171e26743012817b3a1a
[ "self.mainframe = parent\nwx.Frame.__init__(self, parent, title=title, size=(400, 250))\nself.panel = wx.Panel(self, pos=(0, 0), size=(400, 250))\nself.panel.SetBackgroundColour('#FFFFFF')\nbookName_tip = wx.StaticText(self.panel, label='书名:', pos=(5, 8), size=(35, 25))\nbookName_tip.SetBackgroundColour('#FFFFFF')\...
<|body_start_0|> self.mainframe = parent wx.Frame.__init__(self, parent, title=title, size=(400, 250)) self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250)) self.panel.SetBackgroundColour('#FFFFFF') bookName_tip = wx.StaticText(self.panel, label='书名:', pos=(5, 8), size=(35, 25...
添加书籍弹出的小窗口
AddFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddFrame: """添加书籍弹出的小窗口""" def __init__(self, parent, title): """初始化该小窗口的布局""" <|body_0|> def saveBook(self, evt): """第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到ListCtrl中""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.mainframe = parent ...
stack_v2_sparse_classes_36k_train_010420
13,549
no_license
[ { "docstring": "初始化该小窗口的布局", "name": "__init__", "signature": "def __init__(self, parent, title)" }, { "docstring": "第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到ListCtrl中", "name": "saveBook", "signature": "def saveBook(self, evt)" } ]
2
stack_v2_sparse_classes_30k_train_006360
Implement the Python class `AddFrame` described below. Class description: 添加书籍弹出的小窗口 Method signatures and docstrings: - def __init__(self, parent, title): 初始化该小窗口的布局 - def saveBook(self, evt): 第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到ListCtrl中
Implement the Python class `AddFrame` described below. Class description: 添加书籍弹出的小窗口 Method signatures and docstrings: - def __init__(self, parent, title): 初始化该小窗口的布局 - def saveBook(self, evt): 第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到ListCtrl中 <|skeleton|> class AddFrame: """添加书籍弹出的小窗口""" def __init__(self...
e19c56fb353e9bc961a568da41dedba6ae6aa05f
<|skeleton|> class AddFrame: """添加书籍弹出的小窗口""" def __init__(self, parent, title): """初始化该小窗口的布局""" <|body_0|> def saveBook(self, evt): """第一步:获取text中文本;第二步,连接数据库;第三步插入并获得主键;第四步添加到ListCtrl中""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddFrame: """添加书籍弹出的小窗口""" def __init__(self, parent, title): """初始化该小窗口的布局""" self.mainframe = parent wx.Frame.__init__(self, parent, title=title, size=(400, 250)) self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250)) self.panel.SetBackgroundColour('#FFFFFF') ...
the_stack_v2_python_sparse
SXB/venv/Tkinter-master/t3.py
sh2268411762/Python_Three
train
1
d9cf2b4323bf234e810412b1ebd20ab94330dea4
[ "super().__init__(group=None, target=None, name='PeriodicCheckpointNotifier')\nself.interval = interval\nself.notify = notify", "self.log.debug('{} started with interval: {} seconds'.format(self.name, self.interval))\nwhile True:\n time.sleep(self.interval)\n self.notify.set()\n self.log.debug('notify ev...
<|body_start_0|> super().__init__(group=None, target=None, name='PeriodicCheckpointNotifier') self.interval = interval self.notify = notify <|end_body_0|> <|body_start_1|> self.log.debug('{} started with interval: {} seconds'.format(self.name, self.interval)) while True: ...
Thread to periodically signal to the worker thread to start saving and staging out checkpoint files.
PeriodicCheckpointNotifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeriodicCheckpointNotifier: """Thread to periodically signal to the worker thread to start saving and staging out checkpoint files.""" def __init__(self, interval: int, notify: threading.Event): """Constructor :param interval: interval in seconds to sleep for :type interval: int :par...
stack_v2_sparse_classes_36k_train_010421
9,748
permissive
[ { "docstring": "Constructor :param interval: interval in seconds to sleep for :type interval: int :param notify: event to set, which will notify checkpoint worker thread to wake up and run :type notify: threading.Event", "name": "__init__", "signature": "def __init__(self, interval: int, notify: threadi...
2
stack_v2_sparse_classes_30k_train_000732
Implement the Python class `PeriodicCheckpointNotifier` described below. Class description: Thread to periodically signal to the worker thread to start saving and staging out checkpoint files. Method signatures and docstrings: - def __init__(self, interval: int, notify: threading.Event): Constructor :param interval: ...
Implement the Python class `PeriodicCheckpointNotifier` described below. Class description: Thread to periodically signal to the worker thread to start saving and staging out checkpoint files. Method signatures and docstrings: - def __init__(self, interval: int, notify: threading.Event): Constructor :param interval: ...
6b7e41d7ebfacca23d853890937e593a248e6a6a
<|skeleton|> class PeriodicCheckpointNotifier: """Thread to periodically signal to the worker thread to start saving and staging out checkpoint files.""" def __init__(self, interval: int, notify: threading.Event): """Constructor :param interval: interval in seconds to sleep for :type interval: int :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PeriodicCheckpointNotifier: """Thread to periodically signal to the worker thread to start saving and staging out checkpoint files.""" def __init__(self, interval: int, notify: threading.Event): """Constructor :param interval: interval in seconds to sleep for :type interval: int :param notify: ev...
the_stack_v2_python_sparse
packages/pegasus-worker/src/Pegasus/cli/pegasus-checkpoint.py
pegasus-isi/pegasus
train
156
65b5f57a3ec5a808f88afb1ddb64dc0fcbff1597
[ "self.acc_w = []\nself.sum = 0\nif w:\n for x in w:\n self.sum += x\n self.acc_w.append(self.sum)", "value = random.randint(1, self.sum)\nleft = 0\nright = len(self.acc_w) - 1\nwhile left < right:\n mid = (left + right) // 2\n if self.acc_w[mid] < value:\n left = mid + 1\n elif se...
<|body_start_0|> self.acc_w = [] self.sum = 0 if w: for x in w: self.sum += x self.acc_w.append(self.sum) <|end_body_0|> <|body_start_1|> value = random.randint(1, self.sum) left = 0 right = len(self.acc_w) - 1 while le...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.acc_w = [] self.sum = 0 if w: for x in w: self....
stack_v2_sparse_classes_36k_train_010422
1,577
permissive
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
6facec2a54d1d9f133f420c9bce1d1043f57ebc6
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.acc_w = [] self.sum = 0 if w: for x in w: self.sum += x self.acc_w.append(self.sum) def pickIndex(self): """:rtype: int""" value = random.randint(1, s...
the_stack_v2_python_sparse
Random Pick with Weight.py
sugia/leetcode
train
1
2f5ed336a7c458ce89b008d253f67e2d3b386072
[ "self.size = size\nself.train = train\nself.pboxes = pboxes\nself.encoder = Encoder(self.pboxes)\nself.crop = SSDCropping(forced_crops)\nself.hflip = RandomHorizontalFlip()\nself.normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\nself.img_train_trans = transforms.Compose([trans...
<|body_start_0|> self.size = size self.train = train self.pboxes = pboxes self.encoder = Encoder(self.pboxes) self.crop = SSDCropping(forced_crops) self.hflip = RandomHorizontalFlip() self.normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0....
Transform input sample into dict of tensors, and optionally perform data augmentation
Transformer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """Transform input sample into dict of tensors, and optionally perform data augmentation""" def __init__(self, pboxes: rock.ssd.prior_boxes.PriorBoxes, size: Tuple[int, int]=(480, 640), train: bool=True, forced_crops: bool=False) -> None: """Args: pboxes: prior boxes siz...
stack_v2_sparse_classes_36k_train_010423
14,566
permissive
[ { "docstring": "Args: pboxes: prior boxes size: input image size (default: (480, 640)) train: indicate whether to apply train transformations or not (default: True) forced_crops: force all train images to be cropped (default: False)", "name": "__init__", "signature": "def __init__(self, pboxes: rock.ssd...
2
stack_v2_sparse_classes_30k_train_007533
Implement the Python class `Transformer` described below. Class description: Transform input sample into dict of tensors, and optionally perform data augmentation Method signatures and docstrings: - def __init__(self, pboxes: rock.ssd.prior_boxes.PriorBoxes, size: Tuple[int, int]=(480, 640), train: bool=True, forced_...
Implement the Python class `Transformer` described below. Class description: Transform input sample into dict of tensors, and optionally perform data augmentation Method signatures and docstrings: - def __init__(self, pboxes: rock.ssd.prior_boxes.PriorBoxes, size: Tuple[int, int]=(480, 640), train: bool=True, forced_...
6f4c86d3fec7fe3b0ce65d2687d144e9698e964f
<|skeleton|> class Transformer: """Transform input sample into dict of tensors, and optionally perform data augmentation""" def __init__(self, pboxes: rock.ssd.prior_boxes.PriorBoxes, size: Tuple[int, int]=(480, 640), train: bool=True, forced_crops: bool=False) -> None: """Args: pboxes: prior boxes siz...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """Transform input sample into dict of tensors, and optionally perform data augmentation""" def __init__(self, pboxes: rock.ssd.prior_boxes.PriorBoxes, size: Tuple[int, int]=(480, 640), train: bool=True, forced_crops: bool=False) -> None: """Args: pboxes: prior boxes size: input imag...
the_stack_v2_python_sparse
rock/datasets/transforms.py
Shweta200126/rock-pytorch
train
0
5e6163f94db5071fae10f61aa7e57f4a8dfd95d0
[ "self._tritonserver_process = None\nself._server_config = config\nself._server_path = path\nself._gpus = gpus\nself._log_path = log_path\nassert self._server_config['model-repository'], 'Triton Server requires --model-repository argument to be set.'", "if self._server_path:\n cmd = [self._server_path]\n cmd...
<|body_start_0|> self._tritonserver_process = None self._server_config = config self._server_path = path self._gpus = gpus self._log_path = log_path assert self._server_config['model-repository'], 'Triton Server requires --model-repository argument to be set.' <|end_body_...
Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess.
TritonServerLocal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TritonServerLocal: """Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess.""" def __init__(self, path, config, gpus, log_path): """Parameters ---------- path : str The absolute path to the tritonserver executable config : TritonServerConf...
stack_v2_sparse_classes_36k_train_010424
5,013
permissive
[ { "docstring": "Parameters ---------- path : str The absolute path to the tritonserver executable config : TritonServerConfig the config object containing arguments for this server instance gpus: list of str List of GPU UUIDs to be made visible to Triton log_path: str Absolute path to the triton log file", ...
4
stack_v2_sparse_classes_30k_train_016300
Implement the Python class `TritonServerLocal` described below. Class description: Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess. Method signatures and docstrings: - def __init__(self, path, config, gpus, log_path): Parameters ---------- path : str The absolute path...
Implement the Python class `TritonServerLocal` described below. Class description: Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess. Method signatures and docstrings: - def __init__(self, path, config, gpus, log_path): Parameters ---------- path : str The absolute path...
374cac9aece9f50c9c9cc2549c0463c16299078f
<|skeleton|> class TritonServerLocal: """Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess.""" def __init__(self, path, config, gpus, log_path): """Parameters ---------- path : str The absolute path to the tritonserver executable config : TritonServerConf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TritonServerLocal: """Concrete Implementation of TritonServer interface that runs tritonserver locally as as subprocess.""" def __init__(self, path, config, gpus, log_path): """Parameters ---------- path : str The absolute path to the tritonserver executable config : TritonServerConfig the config...
the_stack_v2_python_sparse
model_analyzer/triton/server/server_local.py
gavinljj/model_analyzer
train
0
95ebfca58fb2c07c6a5bc486c93789fd97cf69e8
[ "len_n = len(nums)\ndp = [1 for i in range(len_n)]\nmax_v = 0\nfor i in range(1, len_n):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[j] + 1, dp[i])\n max_v = max(dp[i], max_v)\nprint(max_v)\nreturn max(dp)", "len_n = len(nums)\ndp = [1] * len_n\nmax_l = 1\nfor i i...
<|body_start_0|> len_n = len(nums) dp = [1 for i in range(len_n)] max_v = 0 for i in range(1, len_n): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[j] + 1, dp[i]) max_v = max(dp[i], max_v) print(max_v) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS1(self, nums: List[int]) -> int: """执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用""" <|body_0|> def lengthOfLIS(self, nums: List[int]) -> int: """执行用时: 5240 ms , 在所有 Python3 提交中击败了 5.00% 的用户 内存消耗: ...
stack_v2_sparse_classes_36k_train_010425
2,628
no_license
[ { "docstring": "执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用", "name": "lengthOfLIS1", "signature": "def lengthOfLIS1(self, nums: List[int]) -> int" }, { "docstring": "执行用时: 5240 ms , 在所有 Python3 提交中击败了 5.00% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 97...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS1(self, nums: List[int]) -> int: 执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用 - def lengthOfLIS(self, nums: List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS1(self, nums: List[int]) -> int: 执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用 - def lengthOfLIS(self, nums: List[int]...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def lengthOfLIS1(self, nums: List[int]) -> int: """执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用""" <|body_0|> def lengthOfLIS(self, nums: List[int]) -> int: """执行用时: 5240 ms , 在所有 Python3 提交中击败了 5.00% 的用户 内存消耗: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS1(self, nums: List[int]) -> int: """执行用时: 3440 ms , 在所有 Python3 提交中击败了 59.87% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 19.61% 的用""" len_n = len(nums) dp = [1 for i in range(len_n)] max_v = 0 for i in range(1, len_n): for j in range(i):...
the_stack_v2_python_sparse
最长递增子序列.py
nomboy/leetcode
train
0
4ec16cd1678a48de71ff890607408e53ebd386d1
[ "length = numpy.iinfo(dtype).max + 1\nbvFunc = utils.createCompositeFunc(bFunc, vFunc)\nself._bLookupArray = utils.createLookupArray(bvFunc, length)\ngvFunc = utils.createCompositeFunc(bFunc, vFunc)\nself._gLookupArray = utils.createLookupArray(gvFunc, length)\nrvFunc = utils.createCompositeFunc(rFunc, vFunc)\nself...
<|body_start_0|> length = numpy.iinfo(dtype).max + 1 bvFunc = utils.createCompositeFunc(bFunc, vFunc) self._bLookupArray = utils.createLookupArray(bvFunc, length) gvFunc = utils.createCompositeFunc(bFunc, vFunc) self._gLookupArray = utils.createLookupArray(gvFunc, length) ...
BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。
BGRFuncFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BGRFuncFilter: """BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。""" def __init__(self, vFunc=None, bFunc=None, gFunc=None, rFunc=None, dtype=numpy.uint8): """初期化する :param vFunc: RGBすべてのチャンネルに適用する関数 :type vFunc: function :...
stack_v2_sparse_classes_36k_train_010426
13,033
permissive
[ { "docstring": "初期化する :param vFunc: RGBすべてのチャンネルに適用する関数 :type vFunc: function :param bFunc: Bチャンネルに適用する関数 :type bFunc: function :param gFunc: Gチャンネルに適用する関数 :type gFunc: function :param rFunc: Rチャンネルに適用する関数 :type rFunc: function :param dtype: データタイプ。普通はunsigned int 8bit(0-255) :return: BGRFuncFilter", "name"...
2
null
Implement the Python class `BGRFuncFilter` described below. Class description: BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。 Method signatures and docstrings: - def __init__(self, vFunc=None, bFunc=None, gFunc=None, rFunc=None, dtype=numpy.uint8): 初期化する ...
Implement the Python class `BGRFuncFilter` described below. Class description: BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。 Method signatures and docstrings: - def __init__(self, vFunc=None, bFunc=None, gFunc=None, rFunc=None, dtype=numpy.uint8): 初期化する ...
61393fe5ba781a8c1216a5cbe7e0d06149a10190
<|skeleton|> class BGRFuncFilter: """BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。""" def __init__(self, vFunc=None, bFunc=None, gFunc=None, rFunc=None, dtype=numpy.uint8): """初期化する :param vFunc: RGBすべてのチャンネルに適用する関数 :type vFunc: function :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BGRFuncFilter: """BGRチャンネルそれぞれに異なった関数を適用するフィルタ VFuncFilterは一つの関数しか適用できなかったが、 このフィルタでは全体に適用する関数の他に BGRチャンネルそれぞれに適用する関数を使うことができる。""" def __init__(self, vFunc=None, bFunc=None, gFunc=None, rFunc=None, dtype=numpy.uint8): """初期化する :param vFunc: RGBすべてのチャンネルに適用する関数 :type vFunc: function :param bFunc: ...
the_stack_v2_python_sparse
FeelPhysics_p150121-master/Python/filters.py
HotView/PycharmProjects
train
3
5a0ffdeb12d0651a4b18411ecfef31611f3b0e12
[ "self.head = head\nself.length = 0\nit = head\nwhile it:\n self.length += 1\n it = it.next", "rnd = random.randint(1, self.length)\nit = self.head\ncurr = 1\nwhile it:\n if curr == rnd:\n return it.val\n it = it.next\n curr += 1\nreturn self.head.val" ]
<|body_start_0|> self.head = head self.length = 0 it = head while it: self.length += 1 it = it.next <|end_body_0|> <|body_start_1|> rnd = random.randint(1, self.length) it = self.head curr = 1 while it: if curr == rnd: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """:type head: Optional[ListNode]""" <|body_0|> def getRandom(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.head = head self.length = 0 it = head while it: ...
stack_v2_sparse_classes_36k_train_010427
1,039
no_license
[ { "docstring": ":type head: Optional[ListNode]", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": ":rtype: int", "name": "getRandom", "signature": "def getRandom(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): :type head: Optional[ListNode] - def getRandom(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): :type head: Optional[ListNode] - def getRandom(self): :rtype: int <|skeleton|> class Solution: def __init__(self, head): """:type head: Op...
546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9
<|skeleton|> class Solution: def __init__(self, head): """:type head: Optional[ListNode]""" <|body_0|> def getRandom(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head): """:type head: Optional[ListNode]""" self.head = head self.length = 0 it = head while it: self.length += 1 it = it.next def getRandom(self): """:rtype: int""" rnd = random.randint(1, self.l...
the_stack_v2_python_sparse
leetcode/solution_382.py
eselyavka/python
train
0
8827f0c25cbdc0b7e78b07033b627e2cf07a33a2
[ "fn_id = id(fn)\nif cls.tick_threads.get(fn_id, None) is not None:\n logger.warning('{} already registered with PythonTickNotifier'.format(str(fn)))\n return None\nrepeater = cls._tick(fn_id)\ncls.tick_threads[fn_id] = (fn, repeater)\nreturn fn_id", "pair = cls.tick_threads.get(token, None)\nif pair:\n p...
<|body_start_0|> fn_id = id(fn) if cls.tick_threads.get(fn_id, None) is not None: logger.warning('{} already registered with PythonTickNotifier'.format(str(fn))) return None repeater = cls._tick(fn_id) cls.tick_threads[fn_id] = (fn, repeater) return fn_id ...
This notifier implements a Tick notifier
PythonTickCallback
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonTickCallback: """This notifier implements a Tick notifier""" def register(cls, fn): """Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregister the function""" <|body_0|> def unregist...
stack_v2_sparse_classes_36k_train_010428
21,288
permissive
[ { "docstring": "Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregister the function", "name": "register", "signature": "def register(cls, fn)" }, { "docstring": "Unregister the given Python function :param token:...
3
stack_v2_sparse_classes_30k_train_003302
Implement the Python class `PythonTickCallback` described below. Class description: This notifier implements a Tick notifier Method signatures and docstrings: - def register(cls, fn): Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregi...
Implement the Python class `PythonTickCallback` described below. Class description: This notifier implements a Tick notifier Method signatures and docstrings: - def register(cls, fn): Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregi...
a4f77a3fdd981eac494331e429c92bd3e4a87d3b
<|skeleton|> class PythonTickCallback: """This notifier implements a Tick notifier""" def register(cls, fn): """Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregister the function""" <|body_0|> def unregist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PythonTickCallback: """This notifier implements a Tick notifier""" def register(cls, fn): """Register the given Python function :param fn: function, python function to register :return: token of non defined type to later unregister the function""" fn_id = id(fn) if cls.tick_thread...
the_stack_v2_python_sparse
tpDcc/abstract/callback.py
OmniZ3D/tpDcc-core
train
0
49335e0acdf808294b22a3b512c9253280a37a8a
[ "means = np.asarray([0.0, 0.0, 0.0], dtype=np.float32)\nfor n in range(images.shape[0]):\n for h in range(images.shape[1]):\n for w in range(images.shape[2]):\n means += images[n, h, w]\nmeans /= images.shape[0] * images.shape[1] * images.shape[2]\nreturn means", "subtracted = np.zeros(images...
<|body_start_0|> means = np.asarray([0.0, 0.0, 0.0], dtype=np.float32) for n in range(images.shape[0]): for h in range(images.shape[1]): for w in range(images.shape[2]): means += images[n, h, w] means /= images.shape[0] * images.shape[1] * images.s...
Preproc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preproc: def get_means(self, images): """Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB images then the dimensions of the vector are 3-D. :param images: a numpy, NHWC :return means: a nump...
stack_v2_sparse_classes_36k_train_010429
1,945
no_license
[ { "docstring": "Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB images then the dimensions of the vector are 3-D. :param images: a numpy, NHWC :return means: a numpy, C", "name": "get_means", "signature": ...
3
stack_v2_sparse_classes_30k_train_008101
Implement the Python class `Preproc` described below. Class description: Implement the Preproc class. Method signatures and docstrings: - def get_means(self, images): Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB imag...
Implement the Python class `Preproc` described below. Class description: Implement the Preproc class. Method signatures and docstrings: - def get_means(self, images): Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB imag...
aaef3a508c3ce18730c451a235c35471fa5d3a55
<|skeleton|> class Preproc: def get_means(self, images): """Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB images then the dimensions of the vector are 3-D. :param images: a numpy, NHWC :return means: a nump...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Preproc: def get_means(self, images): """Get a mean vector Get a mean vector from images. The element in the vector is calculated in corresponding to each channel. If you will process RGB images then the dimensions of the vector are 3-D. :param images: a numpy, NHWC :return means: a numpy, C""" ...
the_stack_v2_python_sparse
utils/Preproc.py
chatterboy/fracture
train
1
1a27cdab38236ed3698e303e65e4c1e91041dbfc
[ "if not isinstance(data, np.ndarray):\n raise TypeError('data must be a 2D numpy.ndarray')\nif len(data.shape) is not 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nX = data.T\nd = data.shape[0]\nmean = np.mean(X,...
<|body_start_0|> if not isinstance(data, np.ndarray): raise TypeError('data must be a 2D numpy.ndarray') if len(data.shape) is not 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data poi...
Multivariate Normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not...
stack_v2_sparse_classes_36k_train_010430
2,394
no_license
[ { "docstring": "class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray: raise a TypeError: data must be a 2D numpy.ndarray If n is less than 2: ...
2
stack_v2_sparse_classes_30k_test_000811
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is t...
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is t...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """class constructor def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.n...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
zahraaassaad/holbertonschool-machine_learning
train
1
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "user = self.get_user(request, username)\nif user == request.user:\n form_action = reverse('tasks')\nelse:\n form_action = reverse('user_tasks', args=[user.username])\ntasks = Task.objects.filter(user=user).order_by('weight')\nform = TaskForm()\nprofile, _ = Profile.objects.get_or_create(user=user)\npalette =...
<|body_start_0|> user = self.get_user(request, username) if user == request.user: form_action = reverse('tasks') else: form_action = reverse('user_tasks', args=[user.username]) tasks = Task.objects.filter(user=user).order_by('weight') form = TaskForm() ...
TasksView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TasksView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete the task.""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_36k_train_010431
30,576
permissive
[ { "docstring": "Get form.", "name": "get", "signature": "def get(self, request, username=None)" }, { "docstring": "Form submit.", "name": "post", "signature": "def post(self, request, username=None)" }, { "docstring": "Delete the task.", "name": "delete", "signature": "de...
3
stack_v2_sparse_classes_30k_train_003851
Implement the Python class `TasksView` described below. Class description: Implement the TasksView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete the task.
Implement the Python class `TasksView` described below. Class description: Implement the TasksView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete the task. <|skel...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class TasksView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete the task.""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TasksView: def get(self, request, username=None): """Get form.""" user = self.get_user(request, username) if user == request.user: form_action = reverse('tasks') else: form_action = reverse('user_tasks', args=[user.username]) tasks = Task.objects...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
e8d02e4e74764ee0e292909f58fd768a161827fb
[ "self.__logger = get_logger(__name__)\nself.__logger.info(f'Creating Producer for {connection}')\nself.__conn__ = connection\nself.__producer__ = None", "self.__logger.debug(f'Send message, {self.__conn__}')\ntry:\n if self.__producer__ is None:\n self.__producer__ = self.__conn__.create()\n self.__p...
<|body_start_0|> self.__logger = get_logger(__name__) self.__logger.info(f'Creating Producer for {connection}') self.__conn__ = connection self.__producer__ = None <|end_body_0|> <|body_start_1|> self.__logger.debug(f'Send message, {self.__conn__}') try: if s...
Send message to topic. Send messages to a topic and manage the producer connection
Producer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Producer: """Send message to topic. Send messages to a topic and manage the producer connection""" def __init__(self, connection): """Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable of create a producer connection""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_010432
2,359
permissive
[ { "docstring": "Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable of create a producer connection", "name": "__init__", "signature": "def __init__(self, connection)" }, { "docstring": "Send message. Send a message over a producer coonection, and if need...
3
stack_v2_sparse_classes_30k_train_002494
Implement the Python class `Producer` described below. Class description: Send message to topic. Send messages to a topic and manage the producer connection Method signatures and docstrings: - def __init__(self, connection): Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable ...
Implement the Python class `Producer` described below. Class description: Send message to topic. Send messages to a topic and manage the producer connection Method signatures and docstrings: - def __init__(self, connection): Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable ...
f2c958df88c5698148aae4c5314dd39e31e995c3
<|skeleton|> class Producer: """Send message to topic. Send messages to a topic and manage the producer connection""" def __init__(self, connection): """Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable of create a producer connection""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Producer: """Send message to topic. Send messages to a topic and manage the producer connection""" def __init__(self, connection): """Create a Producer object. Parameters ---------- connection: ProducerFactory A object capable of create a producer connection""" self.__logger = get_logger(...
the_stack_v2_python_sparse
kafka_client_decorators/client/producer.py
cdsedson/kafka-decorator
train
1
58a37eed05c3cab0f7ef5a5c6b5987050eb73279
[ "self.session_duration = getenv('SESSION_DURATION', 0)\ntry:\n self.session_duration = int(self.session_duration)\nexcept ValueError:\n self.session_duration = 0", "session_id = super().create_session(user_id=user_id)\nif session_id:\n self.user_id_by_session_id[session_id] = {}\n self.user_id_by_sess...
<|body_start_0|> self.session_duration = getenv('SESSION_DURATION', 0) try: self.session_duration = int(self.session_duration) except ValueError: self.session_duration = 0 <|end_body_0|> <|body_start_1|> session_id = super().create_session(user_id=user_id) ...
session expiration for session id auth system
SessionExpAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionExpAuth: """session expiration for session id auth system""" def __init__(self): """init""" <|body_0|> def create_session(self, user_id=None): """overloads father create_session :param user_id: user's id :return: session id or None""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_010433
2,121
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "overloads father create_session :param user_id: user's id :return: session id or None", "name": "create_session", "signature": "def create_session(self, user_id=None)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_015661
Implement the Python class `SessionExpAuth` described below. Class description: session expiration for session id auth system Method signatures and docstrings: - def __init__(self): init - def create_session(self, user_id=None): overloads father create_session :param user_id: user's id :return: session id or None - d...
Implement the Python class `SessionExpAuth` described below. Class description: session expiration for session id auth system Method signatures and docstrings: - def __init__(self): init - def create_session(self, user_id=None): overloads father create_session :param user_id: user's id :return: session id or None - d...
f6728ac558d8bce58701d47fe7ec2258524b6803
<|skeleton|> class SessionExpAuth: """session expiration for session id auth system""" def __init__(self): """init""" <|body_0|> def create_session(self, user_id=None): """overloads father create_session :param user_id: user's id :return: session id or None""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SessionExpAuth: """session expiration for session id auth system""" def __init__(self): """init""" self.session_duration = getenv('SESSION_DURATION', 0) try: self.session_duration = int(self.session_duration) except ValueError: self.session_duration...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_exp_auth.py
jhonatang1988/holbertonschool-web_back_end
train
0
9fe18658a43d2b99dd84819b1e9aa2b603f41a22
[ "super(CollaQSMACAttentionModule, self).__init__()\nself.self_feature_range = self_feature_range\nself.ally_feature_range = ally_feature_range\nself.attention_layer = CollaQMultiHeadAttention(1, q_dim, v_dim, attention_size, attention_size, attention_size)", "self_features = obs[:, :, :, self.self_feature_range[0...
<|body_start_0|> super(CollaQSMACAttentionModule, self).__init__() self.self_feature_range = self_feature_range self.ally_feature_range = ally_feature_range self.attention_layer = CollaQMultiHeadAttention(1, q_dim, v_dim, attention_size, attention_size, attention_size) <|end_body_0|> <|...
Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward
CollaQSMACAttentionModule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollaQSMACAttentionModule: """Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward""" def __init__(self, q_dim: int,...
stack_v2_sparse_classes_36k_train_010434
27,383
permissive
[ { "docstring": "Overview: initialize collaq attention module Arguments: - q_dim (:obj:`int`): the dimension of transformer output q - v_dim (:obj:`int`): the dimension of transformer output v - self_features (:obj:`torch.Tensor`): output self agent's attention observation - ally_features (:obj:`torch.Tensor`): ...
3
stack_v2_sparse_classes_30k_train_009301
Implement the Python class `CollaQSMACAttentionModule` described below. Class description: Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward...
Implement the Python class `CollaQSMACAttentionModule` described below. Class description: Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class CollaQSMACAttentionModule: """Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward""" def __init__(self, q_dim: int,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollaQSMACAttentionModule: """Overview: Collaq attention module. Used to get agent's attention observation. It includes agent's observation and agent's part of the observation information of the agent's concerned allies Interface: __init__, _cut_obs, forward""" def __init__(self, q_dim: int, v_dim: int, ...
the_stack_v2_python_sparse
ding/model/template/qmix.py
shengxuesun/DI-engine
train
1
761421f7eb2ac13a02c951c5e39deb4a92d242de
[ "self.v = ventana\nself.constantes = Constantes()\nself.titulo_distr_acum_1 = self.constantes.get_titulo_distr_acum_1()\nself.titulo_distr_acum_2 = self.constantes.get_titulo_distr_acum_2()\nself.titulo_distr_acum_3 = self.constantes.get_titulo_distr_acum_3()\nself.hist_plot = HistPlot()", "if self.v.df_db.empty ...
<|body_start_0|> self.v = ventana self.constantes = Constantes() self.titulo_distr_acum_1 = self.constantes.get_titulo_distr_acum_1() self.titulo_distr_acum_2 = self.constantes.get_titulo_distr_acum_2() self.titulo_distr_acum_3 = self.constantes.get_titulo_distr_acum_3() ...
Crea los diagramas de la distribución acumulada y de la densidad de probabilidad.
CntDiagramaDistribucionAcumulada
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CntDiagramaDistribucionAcumulada: """Crea los diagramas de la distribución acumulada y de la densidad de probabilidad.""" def __init__(self, ventana): """Inicializa la ventana de MainWindow.""" <|body_0|> def distribucion_acumulada_1(self): """Diagrama de la dist...
stack_v2_sparse_classes_36k_train_010435
3,536
no_license
[ { "docstring": "Inicializa la ventana de MainWindow.", "name": "__init__", "signature": "def __init__(self, ventana)" }, { "docstring": "Diagrama de la distribución acumulada y de la densidad de probabilidad.", "name": "distribucion_acumulada_1", "signature": "def distribucion_acumulada_...
4
stack_v2_sparse_classes_30k_train_011690
Implement the Python class `CntDiagramaDistribucionAcumulada` described below. Class description: Crea los diagramas de la distribución acumulada y de la densidad de probabilidad. Method signatures and docstrings: - def __init__(self, ventana): Inicializa la ventana de MainWindow. - def distribucion_acumulada_1(self)...
Implement the Python class `CntDiagramaDistribucionAcumulada` described below. Class description: Crea los diagramas de la distribución acumulada y de la densidad de probabilidad. Method signatures and docstrings: - def __init__(self, ventana): Inicializa la ventana de MainWindow. - def distribucion_acumulada_1(self)...
d4db305077551631ef6a2e2e3c6bf90d0d95d8f1
<|skeleton|> class CntDiagramaDistribucionAcumulada: """Crea los diagramas de la distribución acumulada y de la densidad de probabilidad.""" def __init__(self, ventana): """Inicializa la ventana de MainWindow.""" <|body_0|> def distribucion_acumulada_1(self): """Diagrama de la dist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CntDiagramaDistribucionAcumulada: """Crea los diagramas de la distribución acumulada y de la densidad de probabilidad.""" def __init__(self, ventana): """Inicializa la ventana de MainWindow.""" self.v = ventana self.constantes = Constantes() self.titulo_distr_acum_1 = self...
the_stack_v2_python_sparse
diagramadistribucionacumulada/cnt_distribucionacumulada.py
PedroBiel/MazingerZ
train
0
fc180089a871f9feada492a05ec1fe61b431ca2d
[ "if probability is None:\n probability = Probability.conjoint(A, B, key_A, key_B, rows)\nreturn -math.log2(probability) if probability > 0 else 0", "n = Cardinality.personal(A, rows)\njoint = Cardinality.joint({A: key_A, B: key_B}, rows)\nif joint > 0:\n return math.log2(n) - math.log2(joint)\nelse:\n re...
<|body_start_0|> if probability is None: probability = Probability.conjoint(A, B, key_A, key_B, rows) return -math.log2(probability) if probability > 0 else 0 <|end_body_0|> <|body_start_1|> n = Cardinality.personal(A, rows) joint = Cardinality.joint({A: key_A, B: key_B}, ro...
Joint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Joint: def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None): """Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -log2( P(A,B) )""" <|body_0|> def fuzzy(A, key_A, B, key_B, rows: list): ""...
stack_v2_sparse_classes_36k_train_010436
5,153
no_license
[ { "docstring": "Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -log2( P(A,B) )", "name": "bayes", "signature": "def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None)" }, { "docstring": "I(A,B) = log2( M(A) = M(B) ) -...
3
stack_v2_sparse_classes_30k_train_015041
Implement the Python class `Joint` described below. Class description: Implement the Joint class. Method signatures and docstrings: - def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None): Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -l...
Implement the Python class `Joint` described below. Class description: Implement the Joint class. Method signatures and docstrings: - def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None): Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -l...
4168dfc2f3c70bb8f6ca62fc51626cd07829f8d2
<|skeleton|> class Joint: def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None): """Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -log2( P(A,B) )""" <|body_0|> def fuzzy(A, key_A, B, key_B, rows: list): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Joint: def bayes(A=None, B=None, rows=None, key_A=None, key_B=None, probability: float=None): """Conjoint information of 'A' and 'B' describes common uncertainty of these two values. I(A,B) = -log2( P(A,B) )""" if probability is None: probability = Probability.conjoint(A, B, key_A,...
the_stack_v2_python_sparse
Statistics/Information.py
spietre/DAZZ
train
0
f1254f0918c80cd74ecadd51809c100e28d5402b
[ "super(SchNetInteraction, self).__init__()\nself.in2f = Dense(n_atom_basis, n_filters, bias=False, activation=None)\nself.f2out = nn.Sequential(Dense(n_filters, n_atom_basis, activation=activation), Dense(n_atom_basis, n_atom_basis, activation=None))\nself.filter_network = nn.Sequential(Dense(n_rbf, n_filters, acti...
<|body_start_0|> super(SchNetInteraction, self).__init__() self.in2f = Dense(n_atom_basis, n_filters, bias=False, activation=None) self.f2out = nn.Sequential(Dense(n_filters, n_atom_basis, activation=activation), Dense(n_atom_basis, n_atom_basis, activation=None)) self.filter_network = n...
SchNet interaction block for modeling interactions of atomistic systems.
SchNetInteraction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchNetInteraction: """SchNet interaction block for modeling interactions of atomistic systems.""" def __init__(self, n_atom_basis: int, n_rbf: int, n_filters: int, activation: Callable=shifted_softplus): """Args: n_atom_basis: number of features to describe atomic environments. n_rbf...
stack_v2_sparse_classes_36k_train_010437
5,264
permissive
[ { "docstring": "Args: n_atom_basis: number of features to describe atomic environments. n_rbf (int): number of radial basis functions. n_filters: number of filters used in continuous-filter convolution. activation: if None, no activation function is used.", "name": "__init__", "signature": "def __init__...
2
stack_v2_sparse_classes_30k_train_009496
Implement the Python class `SchNetInteraction` described below. Class description: SchNet interaction block for modeling interactions of atomistic systems. Method signatures and docstrings: - def __init__(self, n_atom_basis: int, n_rbf: int, n_filters: int, activation: Callable=shifted_softplus): Args: n_atom_basis: ...
Implement the Python class `SchNetInteraction` described below. Class description: SchNet interaction block for modeling interactions of atomistic systems. Method signatures and docstrings: - def __init__(self, n_atom_basis: int, n_rbf: int, n_filters: int, activation: Callable=shifted_softplus): Args: n_atom_basis: ...
2ed8d1a3b773f4ed2dbd50623d43d578ff0146f6
<|skeleton|> class SchNetInteraction: """SchNet interaction block for modeling interactions of atomistic systems.""" def __init__(self, n_atom_basis: int, n_rbf: int, n_filters: int, activation: Callable=shifted_softplus): """Args: n_atom_basis: number of features to describe atomic environments. n_rbf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchNetInteraction: """SchNet interaction block for modeling interactions of atomistic systems.""" def __init__(self, n_atom_basis: int, n_rbf: int, n_filters: int, activation: Callable=shifted_softplus): """Args: n_atom_basis: number of features to describe atomic environments. n_rbf (int): numbe...
the_stack_v2_python_sparse
src/schnetpack/representation/schnet.py
atomistic-machine-learning/schnetpack
train
653
38373750356321656060508e30f14abf14ddde9f
[ "if not request:\n request = self.request\nif 'history' not in request.session:\n request.session['history'] = []\nif len(request.session['history']) > 10:\n request.session['history'].pop()\npath = request.path\nif request.META.get('QUERY_STRING'):\n path = '%s?%s' % (path, request.META['QUERY_STRING']...
<|body_start_0|> if not request: request = self.request if 'history' not in request.session: request.session['history'] = [] if len(request.session['history']) > 10: request.session['history'].pop() path = request.path if request.META.get('QUER...
HistoryMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistoryMixin: def add_to_history(self, request=None): """Check on session history, and add path if need be""" <|body_0|> def get_redir_url(self): """Get last valid url""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not request: reque...
stack_v2_sparse_classes_36k_train_010438
27,574
no_license
[ { "docstring": "Check on session history, and add path if need be", "name": "add_to_history", "signature": "def add_to_history(self, request=None)" }, { "docstring": "Get last valid url", "name": "get_redir_url", "signature": "def get_redir_url(self)" } ]
2
stack_v2_sparse_classes_30k_train_010802
Implement the Python class `HistoryMixin` described below. Class description: Implement the HistoryMixin class. Method signatures and docstrings: - def add_to_history(self, request=None): Check on session history, and add path if need be - def get_redir_url(self): Get last valid url
Implement the Python class `HistoryMixin` described below. Class description: Implement the HistoryMixin class. Method signatures and docstrings: - def add_to_history(self, request=None): Check on session history, and add path if need be - def get_redir_url(self): Get last valid url <|skeleton|> class HistoryMixin: ...
53a30fd7554b168062cb3ff4168fe5629fcb91aa
<|skeleton|> class HistoryMixin: def add_to_history(self, request=None): """Check on session history, and add path if need be""" <|body_0|> def get_redir_url(self): """Get last valid url""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HistoryMixin: def add_to_history(self, request=None): """Check on session history, and add path if need be""" if not request: request = self.request if 'history' not in request.session: request.session['history'] = [] if len(request.session['history']) >...
the_stack_v2_python_sparse
djinn_contenttypes/views/base.py
PythonUnited/djinn_contenttypes
train
1
c9e9de04bf7de53ae1e655e6eaef9934e20bfc40
[ "l = len(triangle)\nws = [len(i) for i in triangle]\nmemo = {}\n\ndef f(x, y):\n if (x, y) in memo:\n return memo[x, y]\n if x >= l or y >= ws[x]:\n memo[x, y] = 0\n return 0\n memo[x, y] = triangle[x][y] + min(f(x + 1, y), f(x + 1, y + 1))\n return memo[x, y]\nreturn f(0, 0)", "l...
<|body_start_0|> l = len(triangle) ws = [len(i) for i in triangle] memo = {} def f(x, y): if (x, y) in memo: return memo[x, y] if x >= l or y >= ws[x]: memo[x, y] = 0 return 0 memo[x, y] = triangle[x][y]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotalRecursive(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotalDP(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> def minimumTotalDPCompress(self, triangle):...
stack_v2_sparse_classes_36k_train_010439
2,092
no_license
[ { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotalRecursive", "signature": "def minimumTotalRecursive(self, triangle)" }, { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotalDP", "signature": "def minimumTotalDP(self, triang...
4
stack_v2_sparse_classes_30k_train_000043
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotalRecursive(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotalDP(self, triangle): :type triangle: List[List[int]] :rtype: int - def min...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotalRecursive(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotalDP(self, triangle): :type triangle: List[List[int]] :rtype: int - def min...
fabe435f366477ec3526add84accec0b4ac38919
<|skeleton|> class Solution: def minimumTotalRecursive(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotalDP(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> def minimumTotalDPCompress(self, triangle):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotalRecursive(self, triangle): """:type triangle: List[List[int]] :rtype: int""" l = len(triangle) ws = [len(i) for i in triangle] memo = {} def f(x, y): if (x, y) in memo: return memo[x, y] if x >= l or y >...
the_stack_v2_python_sparse
algorithm/leetcode/150_triangle.py
icejoywoo/toys
train
1
e40e2d607eeaaa5ec551e0751db1756407fcf455
[ "def is_prime(num):\n if num < 2 or num == 4:\n return False\n if num in [2, 3, 5, 7]:\n return True\n i = 2\n while i ** 2 <= num:\n if num % i == 0:\n return False\n else:\n i += 1\n return True\nres = 0\nfor i in range(L, R + 1):\n bin_num = bin...
<|body_start_0|> def is_prime(num): if num < 2 or num == 4: return False if num in [2, 3, 5, 7]: return True i = 2 while i ** 2 <= num: if num % i == 0: return False else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_0|> def countPrimeSetBits2(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def is_prime(num): ...
stack_v2_sparse_classes_36k_train_010440
1,199
no_license
[ { "docstring": ":type L: int :type R: int :rtype: int", "name": "countPrimeSetBits", "signature": "def countPrimeSetBits(self, L, R)" }, { "docstring": ":type L: int :type R: int :rtype: int", "name": "countPrimeSetBits2", "signature": "def countPrimeSetBits2(self, L, R)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int - def countPrimeSetBits2(self, L, R): :type L: int :type R: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int - def countPrimeSetBits2(self, L, R): :type L: int :type R: int :rtype: int <|skeleton|> class Solution:...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_0|> def countPrimeSetBits2(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" def is_prime(num): if num < 2 or num == 4: return False if num in [2, 3, 5, 7]: return True i = 2 while i ** 2 <= num: ...
the_stack_v2_python_sparse
countPrimeSetBits.py
NeilWangziyu/Leetcode_py
train
2
4f59881e9e77ee85eb9b80af45c5eb035e528b09
[ "super().__init__(self.PROBLEM_NAME)\nself.input_string = input_string\nself.pattern = pattern", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\npattern_length = len(self.pattern)\npattern_hash = self.bernstein_hash(self.pattern)\nfor i in range(len(self.input_string) - pattern_length):\n if self.b...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.input_string = input_string self.pattern = pattern <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) pattern_length = len(self.pattern) pattern_hash = self.bernstein_hash(se...
Pattern Matching (Rabin Karp)
PatternMatchingRabinKarpAlgorithm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatternMatchingRabinKarpAlgorithm: """Pattern Matching (Rabin Karp)""" def __init__(self, input_string, pattern): """StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the...
stack_v2_sparse_classes_36k_train_010441
1,837
no_license
[ { "docstring": "StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_string, pattern)" }, { "docstring": "Solve the problem Note: The average and best case running time is O(n+m) and th...
3
stack_v2_sparse_classes_30k_train_019328
Implement the Python class `PatternMatchingRabinKarpAlgorithm` described below. Class description: Pattern Matching (Rabin Karp) Method signatures and docstrings: - def __init__(self, input_string, pattern): StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None - def s...
Implement the Python class `PatternMatchingRabinKarpAlgorithm` described below. Class description: Pattern Matching (Rabin Karp) Method signatures and docstrings: - def __init__(self, input_string, pattern): StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None - def s...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class PatternMatchingRabinKarpAlgorithm: """Pattern Matching (Rabin Karp)""" def __init__(self, input_string, pattern): """StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatternMatchingRabinKarpAlgorithm: """Pattern Matching (Rabin Karp)""" def __init__(self, input_string, pattern): """StrStr Args: input_string: haystack pattern: to be searched in the haystack Returns: None Raises: None""" super().__init__(self.PROBLEM_NAME) self.input_string = in...
the_stack_v2_python_sparse
python/problems/string/pattern_matching_rabin_karp.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
e0d6936e8774bbd6832709cb4f6cce141f92cf59
[ "url = '%s?extract-archive=%s' % (upload_path, archive_file_format)\nif headers is None:\n headers = {}\nresp, body = self.put(url, data, headers)\nself.expected_success(200, resp.status)\nreturn rest_client.ResponseBodyData(resp, body)", "url = '?bulk-delete'\nif headers is None:\n headers = {}\nresp, body...
<|body_start_0|> url = '%s?extract-archive=%s' % (upload_path, archive_file_format) if headers is None: headers = {} resp, body = self.put(url, data, headers) self.expected_success(200, resp.status) return rest_client.ResponseBodyData(resp, body) <|end_body_0|> <|bod...
BulkMiddlewareClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BulkMiddlewareClient: def upload_archive(self, upload_path, data, archive_file_format='tar', headers=None): """Expand tar files into a Swift cluster. To extract containers and objects on Swift cluster from uploaded archived file. For More information please check: https://docs.openstack....
stack_v2_sparse_classes_36k_train_010442
2,483
permissive
[ { "docstring": "Expand tar files into a Swift cluster. To extract containers and objects on Swift cluster from uploaded archived file. For More information please check: https://docs.openstack.org/swift/latest/middleware.html#module-swift.common.middleware.bulk", "name": "upload_archive", "signature": "...
3
null
Implement the Python class `BulkMiddlewareClient` described below. Class description: Implement the BulkMiddlewareClient class. Method signatures and docstrings: - def upload_archive(self, upload_path, data, archive_file_format='tar', headers=None): Expand tar files into a Swift cluster. To extract containers and obj...
Implement the Python class `BulkMiddlewareClient` described below. Class description: Implement the BulkMiddlewareClient class. Method signatures and docstrings: - def upload_archive(self, upload_path, data, archive_file_format='tar', headers=None): Expand tar files into a Swift cluster. To extract containers and obj...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class BulkMiddlewareClient: def upload_archive(self, upload_path, data, archive_file_format='tar', headers=None): """Expand tar files into a Swift cluster. To extract containers and objects on Swift cluster from uploaded archived file. For More information please check: https://docs.openstack....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BulkMiddlewareClient: def upload_archive(self, upload_path, data, archive_file_format='tar', headers=None): """Expand tar files into a Swift cluster. To extract containers and objects on Swift cluster from uploaded archived file. For More information please check: https://docs.openstack.org/swift/late...
the_stack_v2_python_sparse
tempest/lib/services/object_storage/bulk_middleware_client.py
openstack/tempest
train
270
0b32b08d5d6182cb9b55e27ffe3c7a94b587c424
[ "if x < 0:\n return False\nstr_x = str(x)\nfor i in range(len(str_x) / 2):\n if str_x[i] != str_x[len(str_x) - 1 - i]:\n return False\nreturn True", "if x < 0:\n return False\nx_copy = x\nlength = 0\ntens = 1\nwhile x_copy > 0:\n x_copy /= 10\n length = length + 1\n tens *= 10\ntens /= 10...
<|body_start_0|> if x < 0: return False str_x = str(x) for i in range(len(str_x) / 2): if str_x[i] != str_x[len(str_x) - 1 - i]: return False return True <|end_body_0|> <|body_start_1|> if x < 0: return False x_copy = x...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False str_x = str(x) ...
stack_v2_sparse_classes_36k_train_010443
898
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome2", "signature": "def isPalindrome2(self, x)" } ]
2
stack_v2_sparse_classes_30k_val_000058
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 isPalindrome2(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 isPalindrome2(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
94d7f5a79a4e517291f035759185fd9f1a03f797
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False str_x = str(x) for i in range(len(str_x) / 2): if str_x[i] != str_x[len(str_x) - 1 - i]: return False return True def isPalindrome2(s...
the_stack_v2_python_sparse
leetcode/isPalindrome.py
SFZhang26/Algorithm
train
3
183370fde921c6500c31865d9ff4823138b107f8
[ "args = dict(is_add=True, vni=int(vni), reid=LispEid.create_eid(deid, deid_prefix if not is_mac else None), leid=LispEid.create_eid(seid, seid_prefix if not is_mac else None))\ncmd = u'lisp_add_del_adjacency'\nerr_msg = f\"Failed to add lisp adjacency on host {node[u'host']}\"\nwith PapiSocketExecutor(node) as papi...
<|body_start_0|> args = dict(is_add=True, vni=int(vni), reid=LispEid.create_eid(deid, deid_prefix if not is_mac else None), leid=LispEid.create_eid(seid, seid_prefix if not is_mac else None)) cmd = u'lisp_add_del_adjacency' err_msg = f"Failed to add lisp adjacency on host {node[u'host']}" ...
Class for lisp adjacency API.
LispAdjacency
[ "GPL-1.0-or-later", "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LispAdjacency: """Class for lisp adjacency API.""" def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False): """Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni: Vni. :param deid: Destination eid address. :param deid_p...
stack_v2_sparse_classes_36k_train_010444
14,690
permissive
[ { "docstring": "Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni: Vni. :param deid: Destination eid address. :param deid_prefix: Destination eid address prefix_len. :param seid: Source eid address. :param seid_prefix: Source eid address prefix_len. :param is_mac: Set to True if ...
2
stack_v2_sparse_classes_30k_train_015951
Implement the Python class `LispAdjacency` described below. Class description: Class for lisp adjacency API. Method signatures and docstrings: - def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False): Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni:...
Implement the Python class `LispAdjacency` described below. Class description: Class for lisp adjacency API. Method signatures and docstrings: - def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False): Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni:...
947057d7310cd1602119258c6b82fbb25fe1b79d
<|skeleton|> class LispAdjacency: """Class for lisp adjacency API.""" def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False): """Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni: Vni. :param deid: Destination eid address. :param deid_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LispAdjacency: """Class for lisp adjacency API.""" def vpp_add_lisp_adjacency(node, vni, deid, deid_prefix, seid, seid_prefix, is_mac=False): """Add lisp adjacency on the VPP node in topology. :param node: VPP node. :param vni: Vni. :param deid: Destination eid address. :param deid_prefix: Destin...
the_stack_v2_python_sparse
resources/libraries/python/LispSetup.py
FDio/csit
train
28
1d0a918f7a28391400a1f83e8899989bbe9d5096
[ "self.reqparser = reqparse.RequestParser()\nself.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form', 'json'])\nself.reqparser.add_argument('new_name', required=True, type=str, help='New theme name required', location=['form', 'json'])", "if not get...
<|body_start_0|> self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form', 'json']) self.reqparser.add_argument('new_name', required=True, type=str, help='New theme name required', location...
Rename an existing Theme
RenameTheme
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" <|body_0|> def post(self) -> ({str: str}, HTTPStatus): """Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument n...
stack_v2_sparse_classes_36k_train_010445
2,853
permissive
[ { "docstring": "Set required arguments for POST request", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument new_name: new name of SubTheme :post_type current_name: str :post_type ...
2
stack_v2_sparse_classes_30k_train_009308
Implement the Python class `RenameTheme` described below. Class description: Rename an existing Theme Method signatures and docstrings: - def __init__(self) -> None: Set required arguments for POST request - def post(self) -> ({str: str}, HTTPStatus): Rename an existing Theme :post_argument current_name: name of SubT...
Implement the Python class `RenameTheme` described below. Class description: Rename an existing Theme Method signatures and docstrings: - def __init__(self) -> None: Set required arguments for POST request - def post(self) -> ({str: str}, HTTPStatus): Rename an existing Theme :post_argument current_name: name of SubT...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" <|body_0|> def post(self) -> ({str: str}, HTTPStatus): """Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form'...
the_stack_v2_python_sparse
Analytics/resources/themes/rename_theme.py
thanosbnt/SharingCitiesDashboard
train
0
219ed1de8394893a3800d36cb6697bb83613d252
[ "self.bits = 0.0\nif self.size < 1:\n return\nif self.max_value <= 0.0:\n raise ValueError(f'Invalid max value: {self!r}')\nmax_value = self.max_value / self.unit\navg = self.avg / self.unit\nself.bits += math.log(self.size * (self.size + 1), 2)\nif self.prev_avg is None:\n self.bits += math.log(max_value ...
<|body_start_0|> self.bits = 0.0 if self.size < 1: return if self.max_value <= 0.0: raise ValueError(f'Invalid max value: {self!r}') max_value = self.max_value / self.unit avg = self.avg / self.unit self.bits += math.log(self.size * (self.size + 1)...
Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data itself is stored elsewhere. The coding needs to know the previous average, and a ma...
BitCountingStats
[ "GPL-1.0-or-later", "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BitCountingStats: """Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data itself is stored elsewhere. The coding ...
stack_v2_sparse_classes_36k_train_010446
6,742
permissive
[ { "docstring": "Construct the stats object by computing from the values needed. The None values are allowed for stats for zero size data, but such stats can report arbitrary avg and max_value. Stats for nonzero size data cannot contain None, else ValueError is raised. The max_value needs to be numeric for nonze...
2
stack_v2_sparse_classes_30k_train_009367
Implement the Python class `BitCountingStats` described below. Class description: Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data ...
Implement the Python class `BitCountingStats` described below. Class description: Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data ...
947057d7310cd1602119258c6b82fbb25fe1b79d
<|skeleton|> class BitCountingStats: """Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data itself is stored elsewhere. The coding ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BitCountingStats: """Class for statistics which include information content of a group. The information content is based on an assumption that the data consists of independent random values from a normal distribution. Instances are only statistics, the data itself is stored elsewhere. The coding needs to know...
the_stack_v2_python_sparse
resources/libraries/python/jumpavg/bit_counting_stats.py
FDio/csit
train
28
fda00fd4f413da4a8981cad9804374bab7e1727b
[ "self.data.seek(0)\ndata = pickle.loads(self.data.read())\nif sample and sample < data.shape[0]:\n idx = np.random.randint(0, data.shape[0], size=sample)\n return data[idx, :]\nreturn data", "if self.data:\n self.data.replace(Binary(pickle.dumps(data, protocol=2)))\nelse:\n self.data.new_file()\n s...
<|body_start_0|> self.data.seek(0) data = pickle.loads(self.data.read()) if sample and sample < data.shape[0]: idx = np.random.randint(0, data.shape[0], size=sample) return data[idx, :] return data <|end_body_0|> <|body_start_1|> if self.data: ...
Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: FileField Numpy array of fcs events data compensated: bool, required, (...
File
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: """Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: FileField Numpy array of fcs events dat...
stack_v2_sparse_classes_36k_train_010447
22,785
permissive
[ { "docstring": "Retrieve single cell data from database Parameters ---------- sample: int, optional If an integer value is given, a random sample of this size is returned Returns ------- Numpy.array Array of single cell data", "name": "pull", "signature": "def pull(self, sample: int or None=None) -> np....
2
stack_v2_sparse_classes_30k_train_008537
Implement the Python class `File` described below. Class description: Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: ...
Implement the Python class `File` described below. Class description: Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: ...
74baea59cfe9e9f664b6b1bf7abf9847f34893eb
<|skeleton|> class File: """Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: FileField Numpy array of fcs events dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class File: """Document representation of a single FCS file. Parameters ----------- file_id: str, required Unique identifier for fcs file file_type: str, required, (default='complete') One of either 'complete' or 'control'; signifies the type of data stored data: FileField Numpy array of fcs events data compensated...
the_stack_v2_python_sparse
CytoPy/data/fcs.py
fabbondanza/CytoPy
train
0
c22eb81a8dc9648194408a02d7232a1ff476f80d
[ "if not root:\n return []\nres = []\nqueue = deque()\nqueue.append(root)\nwhile queue:\n node = []\n child = []\n for item in queue:\n child.append(item.val)\n if root.left:\n node.append(root.left)\n if root.right:\n node.append(root.right)\n res.append(chi...
<|body_start_0|> if not root: return [] res = [] queue = deque() queue.append(root) while queue: node = [] child = [] for item in queue: child.append(item.val) if root.left: node.a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS直接套模板 :param root: :return:""" <|body_0|> def levelOrder2(self, root: TreeNode) -> List[List[int]]: """递归DFS方法,通过记录下深度,来把所有节点放在相应的深度列表中 :param root: :return:""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_010448
1,628
no_license
[ { "docstring": "BFS直接套模板 :param root: :return:", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "递归DFS方法,通过记录下深度,来把所有节点放在相应的深度列表中 :param root: :return:", "name": "levelOrder2", "signature": "def levelOrder2(self, root: TreeN...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: BFS直接套模板 :param root: :return: - def levelOrder2(self, root: TreeNode) -> List[List[int]]: 递归DFS方法,通过记录下深度,来把所有节点放在相应的深度列...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: BFS直接套模板 :param root: :return: - def levelOrder2(self, root: TreeNode) -> List[List[int]]: 递归DFS方法,通过记录下深度,来把所有节点放在相应的深度列...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS直接套模板 :param root: :return:""" <|body_0|> def levelOrder2(self, root: TreeNode) -> List[List[int]]: """递归DFS方法,通过记录下深度,来把所有节点放在相应的深度列表中 :param root: :return:""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """BFS直接套模板 :param root: :return:""" if not root: return [] res = [] queue = deque() queue.append(root) while queue: node = [] child = [] for item ...
the_stack_v2_python_sparse
二叉树的层序遍历.py
cjrzs/MyLeetCode
train
8
f00b97ec69198a6272dacfb6115356d227558ec3
[ "self.screen = screen\nself.image = pygame.image.load(imagePath)\nself.bulletList = []", "self.screen.blit(self.image, (self.x, self.y))\nnewDelItemList = []\nfor item in self.bulletList:\n if item.judge():\n newDelItemList.append(item)\n pass\n pass\nfor i in newDelItemList:\n self.bulletL...
<|body_start_0|> self.screen = screen self.image = pygame.image.load(imagePath) self.bulletList = [] <|end_body_0|> <|body_start_1|> self.screen.blit(self.image, (self.x, self.y)) newDelItemList = [] for item in self.bulletList: if item.judge(): ...
BasePlane
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasePlane: def __init__(self, screen, imagePath): """初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片""" <|body_0|> def display(self): """在主窗口中显示飞机 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.screen = screen self.image = ...
stack_v2_sparse_classes_36k_train_010449
6,268
no_license
[ { "docstring": "初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片", "name": "__init__", "signature": "def __init__(self, screen, imagePath)" }, { "docstring": "在主窗口中显示飞机 :return:", "name": "display", "signature": "def display(self)" } ]
2
null
Implement the Python class `BasePlane` described below. Class description: Implement the BasePlane class. Method signatures and docstrings: - def __init__(self, screen, imagePath): 初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片 - def display(self): 在主窗口中显示飞机 :return:
Implement the Python class `BasePlane` described below. Class description: Implement the BasePlane class. Method signatures and docstrings: - def __init__(self, screen, imagePath): 初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片 - def display(self): 在主窗口中显示飞机 :return: <|skeleton|> class BasePlane: def __init...
3c27a1107c4bcf49227784b9d1e1f329ae4aa3d7
<|skeleton|> class BasePlane: def __init__(self, screen, imagePath): """初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片""" <|body_0|> def display(self): """在主窗口中显示飞机 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasePlane: def __init__(self, screen, imagePath): """初始化基类 :param screen: 主窗体对象 :param imageName: 加载的图片""" self.screen = screen self.image = pygame.image.load(imagePath) self.bulletList = [] def display(self): """在主窗口中显示飞机 :return:""" self.screen.blit(self....
the_stack_v2_python_sparse
day10-飞机大战/搭建界面和键盘检测----优化.py
liuhuanhuan963019/python
train
0
0d7435c9c3f78fea8212d02288beb662458c31ff
[ "position = get_object_or_404(Position, pk=position_id)\nserializer = PositionSerializer(position)\nreturn Response(serializer.data)", "position = get_object_or_404(Position, pk=position_id)\nserializer = PositionSerializer(position, data=request.data)\nif serializer.is_valid():\n serializer.save()\n return...
<|body_start_0|> position = get_object_or_404(Position, pk=position_id) serializer = PositionSerializer(position) return Response(serializer.data) <|end_body_0|> <|body_start_1|> position = get_object_or_404(Position, pk=position_id) serializer = PositionSerializer(position, dat...
PositionDetail
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionDetail: def get(self, request, position_id, format=None): """Get position detail""" <|body_0|> def put(self, request, position_id, format=None): """Edit position --- serializer: administrator.serializers.PositionSerializer""" <|body_1|> def delet...
stack_v2_sparse_classes_36k_train_010450
30,608
permissive
[ { "docstring": "Get position detail", "name": "get", "signature": "def get(self, request, position_id, format=None)" }, { "docstring": "Edit position --- serializer: administrator.serializers.PositionSerializer", "name": "put", "signature": "def put(self, request, position_id, format=Non...
3
stack_v2_sparse_classes_30k_train_000079
Implement the Python class `PositionDetail` described below. Class description: Implement the PositionDetail class. Method signatures and docstrings: - def get(self, request, position_id, format=None): Get position detail - def put(self, request, position_id, format=None): Edit position --- serializer: administrator....
Implement the Python class `PositionDetail` described below. Class description: Implement the PositionDetail class. Method signatures and docstrings: - def get(self, request, position_id, format=None): Get position detail - def put(self, request, position_id, format=None): Edit position --- serializer: administrator....
73728463badb3bfd4413aa0f7aeb44a9606fdfea
<|skeleton|> class PositionDetail: def get(self, request, position_id, format=None): """Get position detail""" <|body_0|> def put(self, request, position_id, format=None): """Edit position --- serializer: administrator.serializers.PositionSerializer""" <|body_1|> def delet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionDetail: def get(self, request, position_id, format=None): """Get position detail""" position = get_object_or_404(Position, pk=position_id) serializer = PositionSerializer(position) return Response(serializer.data) def put(self, request, position_id, format=None): ...
the_stack_v2_python_sparse
administrator/views.py
belatrix/BackendAllStars
train
5
2511a8af35db60015dba0d5b1537075669473edd
[ "ret = []\nfor i in range(numRows):\n row = [1]\n if ret:\n for i in range(len(ret[-1]) - 1):\n row.append(ret[-1][i] + ret[-1][i + 1])\n row.append(1)\n ret.append(row)\nreturn ret", "if numRows == 0:\n return []\nret = [[1]]\nfor i in range(1, numRows):\n row = [1]\n f...
<|body_start_0|> ret = [] for i in range(numRows): row = [1] if ret: for i in range(len(ret[-1]) - 1): row.append(ret[-1][i] + ret[-1][i + 1]) row.append(1) ret.append(row) return ret <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate(self, numRows: int) -> List[List[int]]: """07/17/2021 08:17""" <|body_0|> def generate(self, numRows: int) -> List[List[int]]: """07/31/2022 22:48""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [] for i in range...
stack_v2_sparse_classes_36k_train_010451
1,597
no_license
[ { "docstring": "07/17/2021 08:17", "name": "generate", "signature": "def generate(self, numRows: int) -> List[List[int]]" }, { "docstring": "07/31/2022 22:48", "name": "generate", "signature": "def generate(self, numRows: int) -> List[List[int]]" } ]
2
stack_v2_sparse_classes_30k_train_010030
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows: int) -> List[List[int]]: 07/17/2021 08:17 - def generate(self, numRows: int) -> List[List[int]]: 07/31/2022 22:48
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows: int) -> List[List[int]]: 07/17/2021 08:17 - def generate(self, numRows: int) -> List[List[int]]: 07/31/2022 22:48 <|skeleton|> class Solution: d...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def generate(self, numRows: int) -> List[List[int]]: """07/17/2021 08:17""" <|body_0|> def generate(self, numRows: int) -> List[List[int]]: """07/31/2022 22:48""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generate(self, numRows: int) -> List[List[int]]: """07/17/2021 08:17""" ret = [] for i in range(numRows): row = [1] if ret: for i in range(len(ret[-1]) - 1): row.append(ret[-1][i] + ret[-1][i + 1]) ...
the_stack_v2_python_sparse
leetcode/solved/118_Pascal's_Triangle/solution.py
sungminoh/algorithms
train
0
d1fb5f84538822f6219b18608e3ece32372eef08
[ "super().__init__(max_n_sources)\nself.matching_threshold = matching_threshold\nself.thresh = thresh", "wcs = blend_batch.wcs\nimage = blend_batch.blend_images[ii]\nbkg = sep.Background(image[0])\ncatalog = sep.extract(image[0], self.thresh, err=bkg.globalrms, segmentation_map=False)\nra_coordinates, dec_coordina...
<|body_start_0|> super().__init__(max_n_sources) self.matching_threshold = matching_threshold self.thresh = thresh <|end_body_0|> <|body_start_1|> wcs = blend_batch.wcs image = blend_batch.blend_images[ii] bkg = sep.Background(image[0]) catalog = sep.extract(imag...
This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algorithm to calculate the angular distance ...
SepMultiband
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algo...
stack_v2_sparse_classes_36k_train_010452
24,907
permissive
[ { "docstring": "Initialize the SepMultiband measurement function. Args: max_n_sources: See parent class. matching_threshold: Threshold value for match detections that are close (arcsecs). thresh: See `SepSingleBand` class.", "name": "__init__", "signature": "def __init__(self, max_n_sources: int, matchi...
2
stack_v2_sparse_classes_30k_train_001822
Implement the Python class `SepMultiband` described below. Class description: This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repe...
Implement the Python class `SepMultiband` described below. Class description: This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repe...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SepMultiband: """This class returns centers detected with SEP by combining predictions in different bands. For each band in the input image we run `sep` for detection and append new detections to a running list of detected coordinates. In order to avoid repeating detections, we run a KD-Tree algorithm to calc...
the_stack_v2_python_sparse
btk/deblend.py
LSSTDESC/BlendingToolKit
train
22
9bae58aa8fd472afea8bd1af5ba5b89fa2afbdd9
[ "p0 = nm.array(p0, dtype=nm.float64)\np1 = nm.array(p1, dtype=nm.float64)\nname = 'line [%s, %s]' % (p0, p1)\nProbe.__init__(self, name=name, share_geometry=share_geometry, p0=p0, p1=p1, n_point=n_point)\ndirvec = self.p1 - self.p0\nself.length = nm.linalg.norm(dirvec)\nself.dirvec = dirvec / self.length", "out =...
<|body_start_0|> p0 = nm.array(p0, dtype=nm.float64) p1 = nm.array(p1, dtype=nm.float64) name = 'line [%s, %s]' % (p0, p1) Probe.__init__(self, name=name, share_geometry=share_geometry, p0=p0, p1=p1, n_point=n_point) dirvec = self.p1 - self.p0 self.length = nm.linalg.norm...
Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_point is used as an initial gues...
LineProbe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineProbe: """Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative...
stack_v2_sparse_classes_36k_train_010453
21,182
permissive
[ { "docstring": "Parameters ---------- p0 : array_like The coordinates of the start point. p1 : array_like The coordinates of the end point.", "name": "__init__", "signature": "def __init__(self, p0, p1, n_point, share_geometry=True)" }, { "docstring": "Report the probe parameters.", "name": ...
3
stack_v2_sparse_classes_30k_train_009727
Implement the Python class `LineProbe` described below. Class description: Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are dete...
Implement the Python class `LineProbe` described below. Class description: Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are dete...
0c2d1690e764b601b2687be1e4261b82207ca366
<|skeleton|> class LineProbe: """Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LineProbe: """Probe variables along a line. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_point is...
the_stack_v2_python_sparse
sfepy/discrete/probes.py
sfepy/sfepy
train
651
ff6eff10d22e3e61b171d1ece536147a6a8ed011
[ "if filter_value:\n regexs = [r.strip() for r in filter_value.split(',')]\n filter_value = ','.join(regexs)\nreturn filter_value", "plg_topologcopy = Plugin.objects.filter(meta__name='pl-topologicalcopy').first()\nif not plg_topologcopy:\n raise serializers.ValidationError([f\"Could not find plugin 'pl-t...
<|body_start_0|> if filter_value: regexs = [r.strip() for r in filter_value.split(',')] filter_value = ','.join(regexs) return filter_value <|end_body_0|> <|body_start_1|> plg_topologcopy = Plugin.objects.filter(meta__name='pl-topologicalcopy').first() if not plg...
PluginInstanceSplitSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginInstanceSplitSerializer: def validate_filter(self, filter_value): """Overriden to check that the provided filter is a string of regular expressions separated by commas).""" <|body_0|> def validate_compute_resource_name(self, compute_resource_name): """Overriden...
stack_v2_sparse_classes_36k_train_010454
22,411
permissive
[ { "docstring": "Overriden to check that the provided filter is a string of regular expressions separated by commas).", "name": "validate_filter", "signature": "def validate_filter(self, filter_value)" }, { "docstring": "Overriden to check the provided compute resource name is registered with pl-...
2
stack_v2_sparse_classes_30k_test_001097
Implement the Python class `PluginInstanceSplitSerializer` described below. Class description: Implement the PluginInstanceSplitSerializer class. Method signatures and docstrings: - def validate_filter(self, filter_value): Overriden to check that the provided filter is a string of regular expressions separated by com...
Implement the Python class `PluginInstanceSplitSerializer` described below. Class description: Implement the PluginInstanceSplitSerializer class. Method signatures and docstrings: - def validate_filter(self, filter_value): Overriden to check that the provided filter is a string of regular expressions separated by com...
20d3eedf20610af9182f6cca8db8f0b3546b5336
<|skeleton|> class PluginInstanceSplitSerializer: def validate_filter(self, filter_value): """Overriden to check that the provided filter is a string of regular expressions separated by commas).""" <|body_0|> def validate_compute_resource_name(self, compute_resource_name): """Overriden...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PluginInstanceSplitSerializer: def validate_filter(self, filter_value): """Overriden to check that the provided filter is a string of regular expressions separated by commas).""" if filter_value: regexs = [r.strip() for r in filter_value.split(',')] filter_value = ','.j...
the_stack_v2_python_sparse
chris_backend/plugininstances/serializers.py
FNNDSC/ChRIS_ultron_backEnd
train
36
a8e2a87bb9bccb33e1e97d6e37a9ccf4b46d46c7
[ "binary_x = bin(x)[2:]\nbinary_y = bin(y)[2:]\nmax_digits = max(len(binary_x), len(binary_y))\nmin_digits = min(len(binary_x), len(binary_y))\nif len(binary_x) > len(binary_y):\n binary_y = '0' * (max_digits - min_digits) + binary_y\nelif len(binary_x) < len(binary_y):\n binary_x = '0' * (max_digits - min_dig...
<|body_start_0|> binary_x = bin(x)[2:] binary_y = bin(y)[2:] max_digits = max(len(binary_x), len(binary_y)) min_digits = min(len(binary_x), len(binary_y)) if len(binary_x) > len(binary_y): binary_y = '0' * (max_digits - min_digits) + binary_y elif len(binary_x...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> binary_x = bin(x)[2:] ...
stack_v2_sparse_classes_36k_train_010455
1,458
no_license
[ { "docstring": ":type x: int :type y: int :rtype: int", "name": "hammingDistance", "signature": "def hammingDistance(self, x, y)" }, { "docstring": ":type x: int :type y: int :rtype: int", "name": "hammingDistance", "signature": "def hammingDistance(self, x, y)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int <|skeleton|> class Solution: ...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" binary_x = bin(x)[2:] binary_y = bin(y)[2:] max_digits = max(len(binary_x), len(binary_y)) min_digits = min(len(binary_x), len(binary_y)) if len(binary_x) > len(binary_y): ...
the_stack_v2_python_sparse
461-hamming_distance.py
stevestar888/leetcode-problems
train
2
2e9f82b97bf7ac9725f67a748634c71cc6b7dd0e
[ "cache_key = (calendar_year, market_class_id)\nif cache_key not in PriceModifications._cache:\n price_modification = 0\n start_years = PriceModifications._data['start_year']\n if len(start_years[start_years <= calendar_year]) > 0:\n calendar_year = max(start_years[start_years <= calendar_year])\n ...
<|body_start_0|> cache_key = (calendar_year, market_class_id) if cache_key not in PriceModifications._cache: price_modification = 0 start_years = PriceModifications._data['start_year'] if len(start_years[start_years <= calendar_year]) > 0: calendar_yea...
**Loads and provides access to price modification data by model year and market class ID.**
PriceModifications
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriceModifications: """**Loads and provides access to price modification data by model year and market class ID.**""" def get_price_modification(calendar_year, market_class_id): """Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): ...
stack_v2_sparse_classes_36k_train_010456
6,957
no_license
[ { "docstring": "Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): calendar year to get price modification for market_class_id (str): market class id, e.g. 'hauling.ICE' Returns: The requested price modification, or 0 if there is none.", "name": "get_price...
2
stack_v2_sparse_classes_30k_train_015879
Implement the Python class `PriceModifications` described below. Class description: **Loads and provides access to price modification data by model year and market class ID.** Method signatures and docstrings: - def get_price_modification(calendar_year, market_class_id): Get the price modification (if any) for the gi...
Implement the Python class `PriceModifications` described below. Class description: **Loads and provides access to price modification data by model year and market class ID.** Method signatures and docstrings: - def get_price_modification(calendar_year, market_class_id): Get the price modification (if any) for the gi...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class PriceModifications: """**Loads and provides access to price modification data by model year and market class ID.**""" def get_price_modification(calendar_year, market_class_id): """Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PriceModifications: """**Loads and provides access to price modification data by model year and market class ID.**""" def get_price_modification(calendar_year, market_class_id): """Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): calendar year...
the_stack_v2_python_sparse
omega_model/context/price_modifications.py
USEPA/EPA_OMEGA_Model
train
17
6b187025cf9d1c38b7300733b2ec22406a93ae4a
[ "self.subset_ids = set(subset_ids) if subset_ids is not None else None\nself.base_dataset_builder = base_dataset_builder\nself.info = base_dataset_builder.info", "if read_config is None:\n logging.info('Using an empty ReadConfig!')\n read_config = tfds.ReadConfig()\nread_config = dataclasses.replace(read_co...
<|body_start_0|> self.subset_ids = set(subset_ids) if subset_ids is not None else None self.base_dataset_builder = base_dataset_builder self.info = base_dataset_builder.info <|end_body_0|> <|body_start_1|> if read_config is None: logging.info('Using an empty ReadConfig!') ...
Subset Dataset Builder which is "just right" for clu.
SubsetDatasetBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubsetDatasetBuilder: """Subset Dataset Builder which is "just right" for clu.""" def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *, subset_ids: Optional[Iterable[int]]): """Init function. Args: base_dataset_builder: a DatasetBuilder for the underlying dataset (ess...
stack_v2_sparse_classes_36k_train_010457
7,148
permissive
[ { "docstring": "Init function. Args: base_dataset_builder: a DatasetBuilder for the underlying dataset (essentially an object with a as_dataset method) subset_ids: a dictionary of split: set of ids.", "name": "__init__", "signature": "def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *,...
2
null
Implement the Python class `SubsetDatasetBuilder` described below. Class description: Subset Dataset Builder which is "just right" for clu. Method signatures and docstrings: - def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *, subset_ids: Optional[Iterable[int]]): Init function. Args: base_dataset_...
Implement the Python class `SubsetDatasetBuilder` described below. Class description: Subset Dataset Builder which is "just right" for clu. Method signatures and docstrings: - def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *, subset_ids: Optional[Iterable[int]]): Init function. Args: base_dataset_...
f5f6f50f82bd441339c9d9efbef3f09e72c5fef6
<|skeleton|> class SubsetDatasetBuilder: """Subset Dataset Builder which is "just right" for clu.""" def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *, subset_ids: Optional[Iterable[int]]): """Init function. Args: base_dataset_builder: a DatasetBuilder for the underlying dataset (ess...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubsetDatasetBuilder: """Subset Dataset Builder which is "just right" for clu.""" def __init__(self, base_dataset_builder: tfds.core.DatasetBuilder, *, subset_ids: Optional[Iterable[int]]): """Init function. Args: base_dataset_builder: a DatasetBuilder for the underlying dataset (essentially an o...
the_stack_v2_python_sparse
baselines/jft/al_utils.py
google/uncertainty-baselines
train
1,235
6c3813c56df3525f2046f4581b4145b41071e048
[ "self.board = board\nself.id = data['id']\nself.name = data['name']\nself.health = data['health']\nself.head = Point(data['body'][0]['x'], data['body'][0]['y'])\nself.tail = Point(data['body'][-1]['x'], data['body'][-1]['y'])\nself.body = []\nfor b in data['body'][1:]:\n self.body.append(Point(b['x'], b['y']))\n...
<|body_start_0|> self.board = board self.id = data['id'] self.name = data['name'] self.health = data['health'] self.head = Point(data['body'][0]['x'], data['body'][0]['y']) self.tail = Point(data['body'][-1]['x'], data['body'][-1]['y']) self.body = [] for ...
Simple class to represent a snake
Snake
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" <|body_0|> def valid_moves(self): """Returns a list of moves that will not immediately kill the snake""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_010458
12,450
permissive
[ { "docstring": "Sets up the snake's information", "name": "__init__", "signature": "def __init__(self, board, data)" }, { "docstring": "Returns a list of moves that will not immediately kill the snake", "name": "valid_moves", "signature": "def valid_moves(self)" } ]
2
stack_v2_sparse_classes_30k_train_012427
Implement the Python class `Snake` described below. Class description: Simple class to represent a snake Method signatures and docstrings: - def __init__(self, board, data): Sets up the snake's information - def valid_moves(self): Returns a list of moves that will not immediately kill the snake
Implement the Python class `Snake` described below. Class description: Simple class to represent a snake Method signatures and docstrings: - def __init__(self, board, data): Sets up the snake's information - def valid_moves(self): Returns a list of moves that will not immediately kill the snake <|skeleton|> class Sn...
79495dcb5f84fca1d67b563380f3b9a1e961db02
<|skeleton|> class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" <|body_0|> def valid_moves(self): """Returns a list of moves that will not immediately kill the snake""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Snake: """Simple class to represent a snake""" def __init__(self, board, data): """Sets up the snake's information""" self.board = board self.id = data['id'] self.name = data['name'] self.health = data['health'] self.head = Point(data['body'][0]['x'], data[...
the_stack_v2_python_sparse
app/main.py
CallumBrown743/starter-snake-python
train
0
b911e543559041fe787b815f010ab8106d0880b7
[ "queryset = super(ProjectAttentionManager, self).get_queryset().filter(project=project).filter(user=user)\nif queryset.exists():\n return True\nelse:\n return False", "queryset = super(ProjectAttentionManager, self).get_queryset().filter(project=project).filter(user=user)\nif not queryset.exists():\n sup...
<|body_start_0|> queryset = super(ProjectAttentionManager, self).get_queryset().filter(project=project).filter(user=user) if queryset.exists(): return True else: return False <|end_body_0|> <|body_start_1|> queryset = super(ProjectAttentionManager, self).get_quer...
ProjectAttentionManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectAttentionManager: def is_attention(self, project, user): """返回用户 user 是否关注项目 project""" <|body_0|> def attention(self, project, user): """关注项目""" <|body_1|> def inattention(self, project, user): """取消关注项目""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_36k_train_010459
15,511
no_license
[ { "docstring": "返回用户 user 是否关注项目 project", "name": "is_attention", "signature": "def is_attention(self, project, user)" }, { "docstring": "关注项目", "name": "attention", "signature": "def attention(self, project, user)" }, { "docstring": "取消关注项目", "name": "inattention", "sig...
3
null
Implement the Python class `ProjectAttentionManager` described below. Class description: Implement the ProjectAttentionManager class. Method signatures and docstrings: - def is_attention(self, project, user): 返回用户 user 是否关注项目 project - def attention(self, project, user): 关注项目 - def inattention(self, project, user): 取...
Implement the Python class `ProjectAttentionManager` described below. Class description: Implement the ProjectAttentionManager class. Method signatures and docstrings: - def is_attention(self, project, user): 返回用户 user 是否关注项目 project - def attention(self, project, user): 关注项目 - def inattention(self, project, user): 取...
d52681a84bc75615dcfd7a373e579833e1ebece8
<|skeleton|> class ProjectAttentionManager: def is_attention(self, project, user): """返回用户 user 是否关注项目 project""" <|body_0|> def attention(self, project, user): """关注项目""" <|body_1|> def inattention(self, project, user): """取消关注项目""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectAttentionManager: def is_attention(self, project, user): """返回用户 user 是否关注项目 project""" queryset = super(ProjectAttentionManager, self).get_queryset().filter(project=project).filter(user=user) if queryset.exists(): return True else: return False ...
the_stack_v2_python_sparse
citi/apps/crowdfunding/models.py
doraemonext/citi
train
0
37081236a165401bca921277d405d18d5f852a38
[ "try:\n print('收到获取试题详情的请求')\n body = json.loads(self.request.body)\n self.sqlhandler = None\n self.stuUid = body['stuUid']\n self.practiceId = body['practiceId']\n if self.getPractice():\n self.write({'success': True, 'data': self.examDetail})\n self.finish()\n else:\n rai...
<|body_start_0|> try: print('收到获取试题详情的请求') body = json.loads(self.request.body) self.sqlhandler = None self.stuUid = body['stuUid'] self.practiceId = body['practiceId'] if self.getPractice(): self.write({'success': True, 'da...
StuPracticeRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" <|body_0|> def getPractice(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: print('收到获取试题详情的请求') body = json.loads(self.request.body)...
stack_v2_sparse_classes_36k_train_010460
1,943
no_license
[ { "docstring": "从数据库获取学生练习题返回给客户端", "name": "post", "signature": "def post(self)" }, { "docstring": "从数据库读取学生信息", "name": "getPractice", "signature": "def getPractice(self)" } ]
2
stack_v2_sparse_classes_30k_val_001013
Implement the Python class `StuPracticeRequestHandler` described below. Class description: Implement the StuPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 从数据库获取学生练习题返回给客户端 - def getPractice(self): 从数据库读取学生信息
Implement the Python class `StuPracticeRequestHandler` described below. Class description: Implement the StuPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 从数据库获取学生练习题返回给客户端 - def getPractice(self): 从数据库读取学生信息 <|skeleton|> class StuPracticeRequestHandler: def post(self): ...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" <|body_0|> def getPractice(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" try: print('收到获取试题详情的请求') body = json.loads(self.request.body) self.sqlhandler = None self.stuUid = body['stuUid'] self.practiceId = body['practiceId'] if ...
the_stack_v2_python_sparse
app/src/main/pythonWork/stuRequest/StuPracticeRequestHandler.py
lyh-ADT/edu-app
train
1
969dabc5dd10af54bd649364e4f64d5c5f9e828b
[ "if root:\n if key == root.val:\n if not root.right and (not root.left):\n root = None\n elif root.right:\n tmp = self.get_successor(root)\n root.val = tmp.val\n root.right = self.deleteNode(root.right, tmp.val)\n else:\n tmp = self.get_...
<|body_start_0|> if root: if key == root.val: if not root.right and (not root.left): root = None elif root.right: tmp = self.get_successor(root) root.val = tmp.val root.right = self.delete...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def get_successor(self, root): """Useful when successor is to the right of root.""" <|body_1|> def get_predeccessor(self, root): """U...
stack_v2_sparse_classes_36k_train_010461
2,087
no_license
[ { "docstring": ":type root: TreeNode :type key: int :rtype: TreeNode", "name": "deleteNode", "signature": "def deleteNode(self, root, key)" }, { "docstring": "Useful when successor is to the right of root.", "name": "get_successor", "signature": "def get_successor(self, root)" }, { ...
3
stack_v2_sparse_classes_30k_test_000032
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def get_successor(self, root): Useful when successor is to the right of root. - def get_pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def get_successor(self, root): Useful when successor is to the right of root. - def get_pr...
1639a4b13c692d87c658a7e0a11212bf0e98d443
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def get_successor(self, root): """Useful when successor is to the right of root.""" <|body_1|> def get_predeccessor(self, root): """U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" if root: if key == root.val: if not root.right and (not root.left): root = None elif root.right: tmp = self....
the_stack_v2_python_sparse
medium/delete_node_BST.py
Hashah1/Leetcode-Practice
train
0
04a097418d8a4882ebeeae1fe9d0b8fa44322271
[ "self.model = model\nself.is_dngo = is_dngo\nif cost_model is not None:\n self.cost_model = cost_model\nself.estimators = []\nfor _ in range(self.model.n_hypers):\n estimator = deepcopy(acquisition_func)\n estimator.model = None\n if cost_model is not None:\n estimator.cost_model = None\n self...
<|body_start_0|> self.model = model self.is_dngo = is_dngo if cost_model is not None: self.cost_model = cost_model self.estimators = [] for _ in range(self.model.n_hypers): estimator = deepcopy(acquisition_func) estimator.model = None ...
IntegratedAcquisition
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntegratedAcquisition: def __init__(self, model, acquisition_func, X_lower, X_upper, cost_model=None, is_dngo=False): """Meta acquisition function that allows to marginalise the acquisition function over GP hyperparameter. Parameters ---------- model: Model object The model of the object...
stack_v2_sparse_classes_36k_train_010462
4,715
permissive
[ { "docstring": "Meta acquisition function that allows to marginalise the acquisition function over GP hyperparameter. Parameters ---------- model: Model object The model of the objective function, it has to be an instance of GaussianProcessMCMC or GPyModelMCMC. acquisition_func: BaseAcquisitionFunction object T...
3
null
Implement the Python class `IntegratedAcquisition` described below. Class description: Implement the IntegratedAcquisition class. Method signatures and docstrings: - def __init__(self, model, acquisition_func, X_lower, X_upper, cost_model=None, is_dngo=False): Meta acquisition function that allows to marginalise the ...
Implement the Python class `IntegratedAcquisition` described below. Class description: Implement the IntegratedAcquisition class. Method signatures and docstrings: - def __init__(self, model, acquisition_func, X_lower, X_upper, cost_model=None, is_dngo=False): Meta acquisition function that allows to marginalise the ...
c2ce2e78bd98236618c99fe3453fc24389d48ead
<|skeleton|> class IntegratedAcquisition: def __init__(self, model, acquisition_func, X_lower, X_upper, cost_model=None, is_dngo=False): """Meta acquisition function that allows to marginalise the acquisition function over GP hyperparameter. Parameters ---------- model: Model object The model of the object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntegratedAcquisition: def __init__(self, model, acquisition_func, X_lower, X_upper, cost_model=None, is_dngo=False): """Meta acquisition function that allows to marginalise the acquisition function over GP hyperparameter. Parameters ---------- model: Model object The model of the objective function, ...
the_stack_v2_python_sparse
RoBO/build/lib.linux-x86_64-2.7/robo/acquisition/integrated_acquisition.py
mrenoon/datafreezethaw
train
5
dc5cb189e635387caed48959117facb9fb72e2da
[ "envelope_pb = base_pb2.Envelope()\nenvelope_pb.to = envelope.to\nenvelope_pb.sender = envelope.sender\nenvelope_pb.protocol_id = str(envelope.protocol_specification_id)\nenvelope_pb.message = envelope.message_bytes\nif envelope.context is not None and envelope.context.uri is not None:\n envelope_pb.uri = str(en...
<|body_start_0|> envelope_pb = base_pb2.Envelope() envelope_pb.to = envelope.to envelope_pb.sender = envelope.sender envelope_pb.protocol_id = str(envelope.protocol_specification_id) envelope_pb.message = envelope.message_bytes if envelope.context is not None and envelope...
Envelope serializer using Protobuf.
ProtobufEnvelopeSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtobufEnvelopeSerializer: """Envelope serializer using Protobuf.""" def encode(self, envelope: 'Envelope') -> bytes: """Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope""" <|body_0|> def decode(self, envelope_bytes: bytes) -> '...
stack_v2_sparse_classes_36k_train_010463
15,081
permissive
[ { "docstring": "Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope", "name": "encode", "signature": "def encode(self, envelope: 'Envelope') -> bytes" }, { "docstring": "Decode the envelope. The default serializer doesn't decode the message field. :param en...
2
stack_v2_sparse_classes_30k_train_018966
Implement the Python class `ProtobufEnvelopeSerializer` described below. Class description: Envelope serializer using Protobuf. Method signatures and docstrings: - def encode(self, envelope: 'Envelope') -> bytes: Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope - def decode(s...
Implement the Python class `ProtobufEnvelopeSerializer` described below. Class description: Envelope serializer using Protobuf. Method signatures and docstrings: - def encode(self, envelope: 'Envelope') -> bytes: Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope - def decode(s...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class ProtobufEnvelopeSerializer: """Envelope serializer using Protobuf.""" def encode(self, envelope: 'Envelope') -> bytes: """Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope""" <|body_0|> def decode(self, envelope_bytes: bytes) -> '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtobufEnvelopeSerializer: """Envelope serializer using Protobuf.""" def encode(self, envelope: 'Envelope') -> bytes: """Encode the envelope. :param envelope: the envelope to encode :return: the encoded envelope""" envelope_pb = base_pb2.Envelope() envelope_pb.to = envelope.to ...
the_stack_v2_python_sparse
aea/mail/base.py
fetchai/agents-aea
train
192
af4000b0a08a5693f30be565cde5253bfd462816
[ "super().__init__()\nself.image = image\nself.rect = self.image.get_rect()\nself.rect.topleft = (x, y)\nself._dx = dx\nself._dy = dy", "self.rect.centerx += self._dx\nself.rect.centery += self._dy\nif self.rect.right > screen.get_width():\n self.rect.right = screen.get_width()\n self._dx *= -1\nelif self.re...
<|body_start_0|> super().__init__() self.image = image self.rect = self.image.get_rect() self.rect.topleft = (x, y) self._dx = dx self._dy = dy <|end_body_0|> <|body_start_1|> self.rect.centerx += self._dx self.rect.centery += self._dy if self.rec...
A bouncing ball sprite.
Ball
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ball: """A bouncing ball sprite.""" def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None: """Initialize from parameters.""" <|body_0|> def update(self, screen: pygame.Surface) -> None: """Move the ball and check boundaries.""" ...
stack_v2_sparse_classes_36k_train_010464
2,667
no_license
[ { "docstring": "Initialize from parameters.", "name": "__init__", "signature": "def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None" }, { "docstring": "Move the ball and check boundaries.", "name": "update", "signature": "def update(self, screen: pygame.Su...
2
null
Implement the Python class `Ball` described below. Class description: A bouncing ball sprite. Method signatures and docstrings: - def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None: Initialize from parameters. - def update(self, screen: pygame.Surface) -> None: Move the ball and check...
Implement the Python class `Ball` described below. Class description: A bouncing ball sprite. Method signatures and docstrings: - def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None: Initialize from parameters. - def update(self, screen: pygame.Surface) -> None: Move the ball and check...
0fe17edf6ffcb35265032c6449d866b9434fda00
<|skeleton|> class Ball: """A bouncing ball sprite.""" def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None: """Initialize from parameters.""" <|body_0|> def update(self, screen: pygame.Surface) -> None: """Move the ball and check boundaries.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ball: """A bouncing ball sprite.""" def __init__(self, image: pygame.Surface, x: int, y: int, dx: int, dy: int) -> None: """Initialize from parameters.""" super().__init__() self.image = image self.rect = self.image.get_rect() self.rect.topleft = (x, y) sel...
the_stack_v2_python_sparse
Chapter10TextbookCode/Listing 10-1.py
ProfessorBurke/PythonObjectsGames
train
3
07aa30b259d6d26c3ceddec68d21386c90809c53
[ "user = info.context.user\nif not user.has_perm('releases.list_all_release'):\n raise GraphQLError('Not allowed')\nreturn Release.objects.all()", "user = info.context.user\nif not user.has_perm('releases.list_all_releasetask'):\n raise GraphQLError('Not allowed')\nreturn ReleaseTask.objects.all()", "user ...
<|body_start_0|> user = info.context.user if not user.has_perm('releases.list_all_release'): raise GraphQLError('Not allowed') return Release.objects.all() <|end_body_0|> <|body_start_1|> user = info.context.user if not user.has_perm('releases.list_all_releasetask'):...
Query
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def resolve_all_releases(self, info, **kwargs): """Return all releases""" <|body_0|> def resolve_all_release_tasks(self, info, **kwargs): """Return all release tasks""" <|body_1|> def resolve_all_release_services(self, info, **kwargs): """...
stack_v2_sparse_classes_36k_train_010465
3,584
permissive
[ { "docstring": "Return all releases", "name": "resolve_all_releases", "signature": "def resolve_all_releases(self, info, **kwargs)" }, { "docstring": "Return all release tasks", "name": "resolve_all_release_tasks", "signature": "def resolve_all_release_tasks(self, info, **kwargs)" }, ...
4
null
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_all_releases(self, info, **kwargs): Return all releases - def resolve_all_release_tasks(self, info, **kwargs): Return all release tasks - def resolve_all_release_services(s...
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_all_releases(self, info, **kwargs): Return all releases - def resolve_all_release_tasks(self, info, **kwargs): Return all release tasks - def resolve_all_release_services(s...
ba62b369e6464259ea92dbb9ba49876513f37fba
<|skeleton|> class Query: def resolve_all_releases(self, info, **kwargs): """Return all releases""" <|body_0|> def resolve_all_release_tasks(self, info, **kwargs): """Return all release tasks""" <|body_1|> def resolve_all_release_services(self, info, **kwargs): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Query: def resolve_all_releases(self, info, **kwargs): """Return all releases""" user = info.context.user if not user.has_perm('releases.list_all_release'): raise GraphQLError('Not allowed') return Release.objects.all() def resolve_all_release_tasks(self, info,...
the_stack_v2_python_sparse
creator/releases/queries.py
kids-first/kf-api-study-creator
train
3
43521f506538523eb06306c5cfbdd46471880438
[ "QStandardItem.__init__(self, principal.displayName)\nself._initIcons()\nself.principal = principal\nif principal.type == USER_PRINCIPAL_TYPE:\n self.setIcon(self._userIcon)\nelse:\n self.setIcon(self._groupIcon)\nself.setEditable(False)\nself.setToolTip(self.principal.type.displayName)", "if self._groupIco...
<|body_start_0|> QStandardItem.__init__(self, principal.displayName) self._initIcons() self.principal = principal if principal.type == USER_PRINCIPAL_TYPE: self.setIcon(self._userIcon) else: self.setIcon(self._groupIcon) self.setEditable(False) ...
Principal-specific item.
PrincipalItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" <|body_0|> def _initIcons(self): """Initializes the icon...
stack_v2_sparse_classes_36k_train_010466
4,825
no_license
[ { "docstring": "Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}", "name": "__init__", "signature": "def __init__(self, principal)" }, { "docstring": "Initializes the icons.", "name": "_initIcons", "signature": "d...
2
stack_v2_sparse_classes_30k_train_018519
Implement the Python class `PrincipalItem` described below. Class description: Principal-specific item. Method signatures and docstrings: - def __init__(self, principal): Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal} - def _initIcons(self):...
Implement the Python class `PrincipalItem` described below. Class description: Principal-specific item. Method signatures and docstrings: - def __init__(self, principal): Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal} - def _initIcons(self):...
958fda4f3064f9f6b2034da396a20ac9d9abd52f
<|skeleton|> class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" <|body_0|> def _initIcons(self): """Initializes the icon...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" QStandardItem.__init__(self, principal.displayName) self._initIcons() ...
the_stack_v2_python_sparse
src/datafinder/gui/user/dialogs/privilege_dialog/items.py
DLR-SC/DataFinder
train
9
7c52f6697408f7263ef23d13a4a9dab8c65d2bfe
[ "group_names = set(self.get_var('group_names', default=[]))\nneeds_docker = set(['oo_nodes_to_config'])\nreturn super(DockerHostMixin, self).is_active() and bool(group_names.intersection(needs_docker))", "if self.get_var('openshift_is_atomic'):\n return ('', False)\nresult = self.execute_module_with_retries(se...
<|body_start_0|> group_names = set(self.get_var('group_names', default=[])) needs_docker = set(['oo_nodes_to_config']) return super(DockerHostMixin, self).is_active() and bool(group_names.intersection(needs_docker)) <|end_body_0|> <|body_start_1|> if self.get_var('openshift_is_atomic'):...
Mixin for checks that are only active on hosts that require Docker.
DockerHostMixin
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DockerHostMixin: """Mixin for checks that are only active on hosts that require Docker.""" def is_active(self): """Only run on hosts that depend on Docker.""" <|body_0|> def ensure_dependencies(self): """Ensure that docker-related packages exist, but not on atomi...
stack_v2_sparse_classes_36k_train_010467
2,167
permissive
[ { "docstring": "Only run on hosts that depend on Docker.", "name": "is_active", "signature": "def is_active(self)" }, { "docstring": "Ensure that docker-related packages exist, but not on atomic hosts (which would not be able to install but should already have them). Returns: msg, failed", "...
2
null
Implement the Python class `DockerHostMixin` described below. Class description: Mixin for checks that are only active on hosts that require Docker. Method signatures and docstrings: - def is_active(self): Only run on hosts that depend on Docker. - def ensure_dependencies(self): Ensure that docker-related packages ex...
Implement the Python class `DockerHostMixin` described below. Class description: Mixin for checks that are only active on hosts that require Docker. Method signatures and docstrings: - def is_active(self): Only run on hosts that depend on Docker. - def ensure_dependencies(self): Ensure that docker-related packages ex...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class DockerHostMixin: """Mixin for checks that are only active on hosts that require Docker.""" def is_active(self): """Only run on hosts that depend on Docker.""" <|body_0|> def ensure_dependencies(self): """Ensure that docker-related packages exist, but not on atomi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DockerHostMixin: """Mixin for checks that are only active on hosts that require Docker.""" def is_active(self): """Only run on hosts that depend on Docker.""" group_names = set(self.get_var('group_names', default=[])) needs_docker = set(['oo_nodes_to_config']) return super...
the_stack_v2_python_sparse
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/openshift_health_checker/openshift_checks/mixins.py
openshift/openshift-tools
train
170
64c070e8f9ef5a2096996ed571ccf3ed0d10cef2
[ "super().__init__(layer_identifier, stacks, base_dir, on_code_change)\nlayer = SamLayerProvider(stacks).get(str(layer_identifier))\nif not layer:\n raise ResourceNotFound()\nself._layer = layer\ncode_uri = self._layer.codeuri\nif not code_uri:\n raise MissingCodeUri()\nself._code_uri = code_uri", "dir_path_...
<|body_start_0|> super().__init__(layer_identifier, stacks, base_dir, on_code_change) layer = SamLayerProvider(stacks).get(str(layer_identifier)) if not layer: raise ResourceNotFound() self._layer = layer code_uri = self._layer.codeuri if not code_uri: ...
LambdaLayerCodeTrigger
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LambdaLayerCodeTrigger: def __init__(self, layer_identifier: ResourceIdentifier, stacks: List[Stack], base_dir: Path, on_code_change: OnChangeCallback): """Parameters ---------- layer_identifier : ResourceIdentifier ResourceIdentifier for the layer stacks : List[Stack] List of stacks bas...
stack_v2_sparse_classes_36k_train_010468
13,509
permissive
[ { "docstring": "Parameters ---------- layer_identifier : ResourceIdentifier ResourceIdentifier for the layer stacks : List[Stack] List of stacks base_dir: Path Base directory for the layer. This should be the path to template file in most cases. on_code_change : OnChangeCallback Callback when layer code files a...
2
null
Implement the Python class `LambdaLayerCodeTrigger` described below. Class description: Implement the LambdaLayerCodeTrigger class. Method signatures and docstrings: - def __init__(self, layer_identifier: ResourceIdentifier, stacks: List[Stack], base_dir: Path, on_code_change: OnChangeCallback): Parameters ----------...
Implement the Python class `LambdaLayerCodeTrigger` described below. Class description: Implement the LambdaLayerCodeTrigger class. Method signatures and docstrings: - def __init__(self, layer_identifier: ResourceIdentifier, stacks: List[Stack], base_dir: Path, on_code_change: OnChangeCallback): Parameters ----------...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class LambdaLayerCodeTrigger: def __init__(self, layer_identifier: ResourceIdentifier, stacks: List[Stack], base_dir: Path, on_code_change: OnChangeCallback): """Parameters ---------- layer_identifier : ResourceIdentifier ResourceIdentifier for the layer stacks : List[Stack] List of stacks bas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LambdaLayerCodeTrigger: def __init__(self, layer_identifier: ResourceIdentifier, stacks: List[Stack], base_dir: Path, on_code_change: OnChangeCallback): """Parameters ---------- layer_identifier : ResourceIdentifier ResourceIdentifier for the layer stacks : List[Stack] List of stacks base_dir: Path Ba...
the_stack_v2_python_sparse
samcli/lib/utils/resource_trigger.py
aws/aws-sam-cli
train
1,402
c00317e0cf278c3a0a2cc66ff9f4ca6e6600c8f3
[ "self.cards = []\nfor suit in Suit:\n for i in range(2, 15):\n if i == 11:\n self.cards.append(JackCard(suit))\n elif i == 12:\n self.cards.append(QueenCard(suit))\n elif i == 13:\n self.cards.append(KingCard(suit))\n elif i == 14:\n self.ca...
<|body_start_0|> self.cards = [] for suit in Suit: for i in range(2, 15): if i == 11: self.cards.append(JackCard(suit)) elif i == 12: self.cards.append(QueenCard(suit)) elif i == 13: s...
Creates a standard deck of 52 playing cards.
StandardDeck
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardDeck: """Creates a standard deck of 52 playing cards.""" def __init__(self): """Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing cards in value order Ace-King and suit-order: Spades, He...
stack_v2_sparse_classes_36k_train_010469
29,568
no_license
[ { "docstring": "Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing cards in value order Ace-King and suit-order: Spades, Hearts, Diamonds, Clubs :rtype: StandardDeck", "name": "__init__", "signature": "def __init__(...
3
stack_v2_sparse_classes_30k_train_012736
Implement the Python class `StandardDeck` described below. Class description: Creates a standard deck of 52 playing cards. Method signatures and docstrings: - def __init__(self): Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing...
Implement the Python class `StandardDeck` described below. Class description: Creates a standard deck of 52 playing cards. Method signatures and docstrings: - def __init__(self): Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing...
26375f0d139a91991a13cc4efb37970461ad0466
<|skeleton|> class StandardDeck: """Creates a standard deck of 52 playing cards.""" def __init__(self): """Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing cards in value order Ace-King and suit-order: Spades, He...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardDeck: """Creates a standard deck of 52 playing cards.""" def __init__(self): """Returns an object of `StandardDeck` class of 52 playing cards. :return: Main class StandardDeck. StandardDeck.cards is a list of 52 playing cards in value order Ace-King and suit-order: Spades, Hearts, Diamond...
the_stack_v2_python_sparse
ca2/Resubmission/updated_cardlib.py
satlikh/python21
train
1
330a59239db87d231371ff4cc8e911e78798e705
[ "words = []\nfor i in range(word_num):\n start = indx + int(i * length)\n end = indx + int((i + 1) * length)\n words.append(s[start:end])\nreturn words", "words_dict = copy.deepcopy(words_dict)\nfor word in words:\n count = words_dict.get(word)\n if count is None:\n return False\n words_d...
<|body_start_0|> words = [] for i in range(word_num): start = indx + int(i * length) end = indx + int((i + 1) * length) words.append(s[start:end]) return words <|end_body_0|> <|body_start_1|> words_dict = copy.deepcopy(words_dict) for word in ...
Solution2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: def get_words(s, indx, length, word_num): """return a list of words, starting at indx""" <|body_0|> def match_words(words, words_dict): """Args: words -- list<str> words_dict -- dict<str:int>""" <|body_1|> def findSubstring(self, s: str, words...
stack_v2_sparse_classes_36k_train_010470
17,965
no_license
[ { "docstring": "return a list of words, starting at indx", "name": "get_words", "signature": "def get_words(s, indx, length, word_num)" }, { "docstring": "Args: words -- list<str> words_dict -- dict<str:int>", "name": "match_words", "signature": "def match_words(words, words_dict)" }, ...
3
null
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def get_words(s, indx, length, word_num): return a list of words, starting at indx - def match_words(words, words_dict): Args: words -- list<str> words_dict -- dict<str:int> - ...
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def get_words(s, indx, length, word_num): return a list of words, starting at indx - def match_words(words, words_dict): Args: words -- list<str> words_dict -- dict<str:int> - ...
abb19fa2859634f5260d439812525bb14399ae55
<|skeleton|> class Solution2: def get_words(s, indx, length, word_num): """return a list of words, starting at indx""" <|body_0|> def match_words(words, words_dict): """Args: words -- list<str> words_dict -- dict<str:int>""" <|body_1|> def findSubstring(self, s: str, words...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: def get_words(s, indx, length, word_num): """return a list of words, starting at indx""" words = [] for i in range(word_num): start = indx + int(i * length) end = indx + int((i + 1) * length) words.append(s[start:end]) return words...
the_stack_v2_python_sparse
hashtable/30.substring-with-concatenation-of-all-words.py
caitaozhan/LeetCode
train
6
f19a89ec438223a482fb060b25194ccfd77b3767
[ "self.channels = channels\nself.delay = 0\nself.selected_channels = []\nself.timestamp = None\nself.reading = []\nsuper().__init__()", "try:\n self.timestamp = None\n self.reading = []\n ts = _time.time()\n rl = _multich.get_converted_readings(wait=self.delay)\n if len(rl) == len(self.selected_chan...
<|body_start_0|> self.channels = channels self.delay = 0 self.selected_channels = [] self.timestamp = None self.reading = [] super().__init__() <|end_body_0|> <|body_start_1|> try: self.timestamp = None self.reading = [] ts = _...
Read values worker.
ReadValueWorker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self, channels): """Initialize object.""" <|body_0|> def run(self): """Read values from devices.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.channels = channels self.delay ...
stack_v2_sparse_classes_36k_train_010471
6,709
no_license
[ { "docstring": "Initialize object.", "name": "__init__", "signature": "def __init__(self, channels)" }, { "docstring": "Read values from devices.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_013979
Implement the Python class `ReadValueWorker` described below. Class description: Read values worker. Method signatures and docstrings: - def __init__(self, channels): Initialize object. - def run(self): Read values from devices.
Implement the Python class `ReadValueWorker` described below. Class description: Read values worker. Method signatures and docstrings: - def __init__(self, channels): Initialize object. - def run(self): Read values from devices. <|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self...
25a9256522ea82e181639294e6d23ab2372a76b4
<|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self, channels): """Initialize object.""" <|body_0|> def run(self): """Read values from devices.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadValueWorker: """Read values worker.""" def __init__(self, channels): """Initialize object.""" self.channels = channels self.delay = 0 self.selected_channels = [] self.timestamp = None self.reading = [] super().__init__() def run(self): ...
the_stack_v2_python_sparse
hallbench/gui/temperaturewidget.py
lnls-ima/hall-bench-control
train
1
dca5c635296efc1f3570e95ac47c20d02a396212
[ "assert self.normalized_payload is not None\nvoice_artist = self.normalized_payload['username']\nvoice_artist_id = user_services.get_user_id_from_username(voice_artist)\nif voice_artist_id is None:\n raise self.InvalidInputException('Sorry, we could not find the specified user.')\nrights_manager.assign_role_for_...
<|body_start_0|> assert self.normalized_payload is not None voice_artist = self.normalized_payload['username'] voice_artist_id = user_services.get_user_id_from_username(voice_artist) if voice_artist_id is None: raise self.InvalidInputException('Sorry, we could not find the sp...
Handles assignment of voice artists.
VoiceArtistManagementHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoiceArtistManagementHandler: """Handles assignment of voice artists.""" def post(self, unused_entity_type: str, entity_id: str) -> None: """Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. entity_id: str. The entity ID.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_010472
8,413
permissive
[ { "docstring": "Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. entity_id: str. The entity ID.", "name": "post", "signature": "def post(self, unused_entity_type: str, entity_id: str) -> None" }, { "docstring": "Removes the voice artist role from a user. Args: ...
2
null
Implement the Python class `VoiceArtistManagementHandler` described below. Class description: Handles assignment of voice artists. Method signatures and docstrings: - def post(self, unused_entity_type: str, entity_id: str) -> None: Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. en...
Implement the Python class `VoiceArtistManagementHandler` described below. Class description: Handles assignment of voice artists. Method signatures and docstrings: - def post(self, unused_entity_type: str, entity_id: str) -> None: Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. en...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class VoiceArtistManagementHandler: """Handles assignment of voice artists.""" def post(self, unused_entity_type: str, entity_id: str) -> None: """Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. entity_id: str. The entity ID.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoiceArtistManagementHandler: """Handles assignment of voice artists.""" def post(self, unused_entity_type: str, entity_id: str) -> None: """Assigns a voice artist role. Args: unused_entity_type: str. The unused entity type. entity_id: str. The entity ID.""" assert self.normalized_payload...
the_stack_v2_python_sparse
core/controllers/voice_artist.py
oppia/oppia
train
6,172
13ccdff5a527d889f342af42283f62cd85b5b305
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ServicePrincipalRiskDetection()", "from .activity_type import ActivityType\nfrom .entity import Entity\nfrom .risk_detail import RiskDetail\nfrom .risk_detection_timing_type import RiskDetectionTimingType\nfrom .risk_level import RiskL...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ServicePrincipalRiskDetection() <|end_body_0|> <|body_start_1|> from .activity_type import ActivityType from .entity import Entity from .risk_detail import RiskDetail fro...
ServicePrincipalRiskDetection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServicePrincipalRiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServicePrincipalRiskDetection: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k_train_010473
10,393
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: ServicePrincipalRiskDetection", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
null
Implement the Python class `ServicePrincipalRiskDetection` described below. Class description: Implement the ServicePrincipalRiskDetection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServicePrincipalRiskDetection: Creates a new instance of th...
Implement the Python class `ServicePrincipalRiskDetection` described below. Class description: Implement the ServicePrincipalRiskDetection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServicePrincipalRiskDetection: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ServicePrincipalRiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServicePrincipalRiskDetection: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServicePrincipalRiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServicePrincipalRiskDetection: """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_stack_v2_python_sparse
msgraph/generated/models/service_principal_risk_detection.py
microsoftgraph/msgraph-sdk-python
train
135
49e2e64348c5563e3bedafceb853bf9ffc423d4a
[ "if isinstance(final_states, Qobj) or final_states is None:\n self.final_states = [final_states]\n self.probabilities = [probabilities]\n if cbits:\n self.cbits = [cbits]\nelse:\n inds = list(filter(lambda x: final_states[x] is not None, range(len(final_states))))\n self.final_states = [final_...
<|body_start_0|> if isinstance(final_states, Qobj) or final_states is None: self.final_states = [final_states] self.probabilities = [probabilities] if cbits: self.cbits = [cbits] else: inds = list(filter(lambda x: final_states[x] is not Non...
Result of a quantum circuit simulation.
CircuitResult
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List...
stack_v2_sparse_classes_36k_train_010474
23,944
permissive
[ { "docstring": "Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List of probabilities of obtaining each output state. cbits: list of list of int, optional List of cbits for each output.", "name": "__in...
4
stack_v2_sparse_classes_30k_train_003265
Implement the Python class `CircuitResult` described below. Class description: Result of a quantum circuit simulation. Method signatures and docstrings: - def __init__(self, final_states, probabilities, cbits=None): Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output ket...
Implement the Python class `CircuitResult` described below. Class description: Result of a quantum circuit simulation. Method signatures and docstrings: - def __init__(self, final_states, probabilities, cbits=None): Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output ket...
a5e97023cc84ba7509b0ee65d742b8a0ae19fdf0
<|skeleton|> class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List of probabili...
the_stack_v2_python_sparse
src/qutip_qip/circuit/circuitsimulator.py
qutip/qutip-qip
train
84
9512c8f92b477d95c347589e2744372aab3d978f
[ "self = object.__new__(cls)\nself.name = cls.DEFAULT_NAME\nself.value = value\nself.metadata_type = ActivityMetadataRich\nreturn self", "self.value = value\nself.name = name\nself.metadata_type = metadata_type\nself.INSTANCES[value] = self" ]
<|body_start_0|> self = object.__new__(cls) self.name = cls.DEFAULT_NAME self.value = value self.metadata_type = ActivityMetadataRich return self <|end_body_0|> <|body_start_1|> self.value = value self.name = name self.metadata_type = metadata_type ...
Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The activity type's respective metadata type. Class Attributes ---------------- INST...
ActivityType
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The activity type's respective metadata type...
stack_v2_sparse_classes_36k_train_010475
4,631
permissive
[ { "docstring": "Creates a new activity type with the given value. Parameters ---------- value : `int` The activity type's identifier value. Returns ------- self : ``ActivityType`` The created instance.", "name": "_from_value", "signature": "def _from_value(cls, value)" }, { "docstring": "Creates...
2
null
Implement the Python class `ActivityType` described below. Class description: Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The a...
Implement the Python class `ActivityType` described below. Class description: Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The a...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class ActivityType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The activity type's respective metadata type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActivityType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the activity type. name : `str` The default name of the activity type. metadata_type : `type<ActivityMetadataBase>` The activity type's respective metadata type. Class Attri...
the_stack_v2_python_sparse
hata/discord/activity/activity/preinstanced.py
HuyaneMatsu/hata
train
3
85c97c4e601cdfafcfee858405c5817dc08f35b7
[ "document = Document(document)\ndocText = '\\n\\n'.join([paragraph.text.encode('utf-8') for paragraph in document.paragraphs])\nreturn docText", "document = Document(document)\nresult = []\nfor paragraph in document.paragraphs:\n result.append(paragraph.text.encode('utf-8'))\nreturn result" ]
<|body_start_0|> document = Document(document) docText = '\n\n'.join([paragraph.text.encode('utf-8') for paragraph in document.paragraphs]) return docText <|end_body_0|> <|body_start_1|> document = Document(document) result = [] for paragraph in document.paragraphs: ...
Read text from MS Office .docx document
readdocument
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class readdocument: """Read text from MS Office .docx document""" def read(self, document): """Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string""" <|body_0|> def readParagraph(self, document): """Read ...
stack_v2_sparse_classes_36k_train_010476
948
permissive
[ { "docstring": "Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string", "name": "read", "signature": "def read(self, document)" }, { "docstring": "Read full text from document (link) :param document: document to be loaded into result...
2
stack_v2_sparse_classes_30k_train_017198
Implement the Python class `readdocument` described below. Class description: Read text from MS Office .docx document Method signatures and docstrings: - def read(self, document): Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string - def readParagraph(s...
Implement the Python class `readdocument` described below. Class description: Read text from MS Office .docx document Method signatures and docstrings: - def read(self, document): Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string - def readParagraph(s...
f9608c424c304c4d99ced050b686f54aae011fca
<|skeleton|> class readdocument: """Read text from MS Office .docx document""" def read(self, document): """Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string""" <|body_0|> def readParagraph(self, document): """Read ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class readdocument: """Read text from MS Office .docx document""" def read(self, document): """Read full text from document (link) :param document: document to be loaded into result :return: utf-8 text as string""" document = Document(document) docText = '\n\n'.join([paragraph.text.enco...
the_stack_v2_python_sparse
readdocument.py
gourie/ParkingPlaza
train
0
2bd90eda10d21492d995815eed0a23acbd5f2913
[ "url = BASE_URL + '/users/recovery/ask'\npayload = {'email': 'hotmapstest@gmail.com'}\noutput = requests.post(url, json=payload)\nexpected_output = 'request for recovery successful'\nassert output.json()['message'] == expected_output", "url = BASE_URL + '/users/recovery/ask'\npayload = {'youcantspellemail': 'hotm...
<|body_start_0|> url = BASE_URL + '/users/recovery/ask' payload = {'email': 'hotmapstest@gmail.com'} output = requests.post(url, json=payload) expected_output = 'request for recovery successful' assert output.json()['message'] == expected_output <|end_body_0|> <|body_start_1|> ...
TestAskingPasswordRecovery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAskingPasswordRecovery: def test_post_working(self): """this test will ask for a user recovery""" <|body_0|> def test_post_missing_parameter(self): """this test will fail to activate a user because the parameters are not complete""" <|body_1|> def te...
stack_v2_sparse_classes_36k_train_010477
1,440
permissive
[ { "docstring": "this test will ask for a user recovery", "name": "test_post_working", "signature": "def test_post_working(self)" }, { "docstring": "this test will fail to activate a user because the parameters are not complete", "name": "test_post_missing_parameter", "signature": "def te...
3
null
Implement the Python class `TestAskingPasswordRecovery` described below. Class description: Implement the TestAskingPasswordRecovery class. Method signatures and docstrings: - def test_post_working(self): this test will ask for a user recovery - def test_post_missing_parameter(self): this test will fail to activate a...
Implement the Python class `TestAskingPasswordRecovery` described below. Class description: Implement the TestAskingPasswordRecovery class. Method signatures and docstrings: - def test_post_working(self): this test will ask for a user recovery - def test_post_missing_parameter(self): this test will fail to activate a...
ba1e287dbc63e34bf9feb80b65b02c1db93ce91c
<|skeleton|> class TestAskingPasswordRecovery: def test_post_working(self): """this test will ask for a user recovery""" <|body_0|> def test_post_missing_parameter(self): """this test will fail to activate a user because the parameters are not complete""" <|body_1|> def te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAskingPasswordRecovery: def test_post_working(self): """this test will ask for a user recovery""" url = BASE_URL + '/users/recovery/ask' payload = {'email': 'hotmapstest@gmail.com'} output = requests.post(url, json=payload) expected_output = 'request for recovery su...
the_stack_v2_python_sparse
pytest_suit/routes/user/test_zzaskingPasswordRecovery.py
HotMaps/Hotmaps-toolbox-service
train
4
96c47e6eb04a7dde3aabd3f0291711bd4863275e
[ "assert self.normalized_request is not None\nusername = self.normalized_request['username']\nuser_id = user_services.get_user_id_from_username(username)\nif user_id is None:\n raise self.InvalidInputException('Invalid username: %s' % username)\ntranslation_contribution_stats = suggestion_services.get_all_transla...
<|body_start_0|> assert self.normalized_request is not None username = self.normalized_request['username'] user_id = user_services.get_user_id_from_username(username) if user_id is None: raise self.InvalidInputException('Invalid username: %s' % username) translation_c...
Handler to show the translation contribution stats of a user.
TranslationContributionStatsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslationContributionStatsHandler: """Handler to show the translation contribution stats of a user.""" def get(self) -> None: """Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username.""" <|body_0|> def _get_complete_translation_co...
stack_v2_sparse_classes_36k_train_010478
32,743
permissive
[ { "docstring": "Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username.", "name": "get", "signature": "def get(self) -> None" }, { "docstring": "Returns translation contribution stats dicts with all the necessary information for the frontend. Args: translati...
2
null
Implement the Python class `TranslationContributionStatsHandler` described below. Class description: Handler to show the translation contribution stats of a user. Method signatures and docstrings: - def get(self) -> None: Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username. - ...
Implement the Python class `TranslationContributionStatsHandler` described below. Class description: Handler to show the translation contribution stats of a user. Method signatures and docstrings: - def get(self) -> None: Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username. - ...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class TranslationContributionStatsHandler: """Handler to show the translation contribution stats of a user.""" def get(self) -> None: """Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username.""" <|body_0|> def _get_complete_translation_co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TranslationContributionStatsHandler: """Handler to show the translation contribution stats of a user.""" def get(self) -> None: """Fetches translation contribution statistics. Raises: InvalidInputException. Invalid username.""" assert self.normalized_request is not None username =...
the_stack_v2_python_sparse
core/controllers/contributor_dashboard_admin.py
oppia/oppia
train
6,172
dfe5b57c1f7747701557b2fd3e3d936fbce6c806
[ "video_ids = self.get_video_ids()\nself.save_field_to_hdf5(set_name=self.set_name, field='video_id', data=np.array(video_ids, dtype=np.int32), dtype=np.int32, fillvalue=-1)\nreturn video_ids", "video_ids = []\nimage_fnames = self.get_image_filenames_annotations()\npose_annotations = self.get_pose_annotations()\nv...
<|body_start_0|> video_ids = self.get_video_ids() self.save_field_to_hdf5(set_name=self.set_name, field='video_id', data=np.array(video_ids, dtype=np.int32), dtype=np.int32, fillvalue=-1) return video_ids <|end_body_0|> <|body_start_1|> video_ids = [] image_fnames = self.get_ima...
Video ids field metadata process/save class.
VideoIdsField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoIdsField: """Video ids field metadata process/save class.""" def process(self): """Processes and saves the video ids metadata to hdf5.""" <|body_0|> def get_video_ids(self): """Returns a list of video ids.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_010479
40,392
permissive
[ { "docstring": "Processes and saves the video ids metadata to hdf5.", "name": "process", "signature": "def process(self)" }, { "docstring": "Returns a list of video ids.", "name": "get_video_ids", "signature": "def get_video_ids(self)" } ]
2
stack_v2_sparse_classes_30k_train_002425
Implement the Python class `VideoIdsField` described below. Class description: Video ids field metadata process/save class. Method signatures and docstrings: - def process(self): Processes and saves the video ids metadata to hdf5. - def get_video_ids(self): Returns a list of video ids.
Implement the Python class `VideoIdsField` described below. Class description: Video ids field metadata process/save class. Method signatures and docstrings: - def process(self): Processes and saves the video ids metadata to hdf5. - def get_video_ids(self): Returns a list of video ids. <|skeleton|> class VideoIdsFie...
e0be95d941b50a5b2e27ffa1c5be20dc6aa2d6a1
<|skeleton|> class VideoIdsField: """Video ids field metadata process/save class.""" def process(self): """Processes and saves the video ids metadata to hdf5.""" <|body_0|> def get_video_ids(self): """Returns a list of video ids.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoIdsField: """Video ids field metadata process/save class.""" def process(self): """Processes and saves the video ids metadata to hdf5.""" video_ids = self.get_video_ids() self.save_field_to_hdf5(set_name=self.set_name, field='video_id', data=np.array(video_ids, dtype=np.int32...
the_stack_v2_python_sparse
dbcollection/datasets/mpii_pose/keypoints.py
dbcollection/dbcollection
train
25
b559467732d4f216972378e65f0226dd964e5c3d
[ "super(HashChunker, self).__init__(obj, size)\nself.hash_class = hash_class\nself.last_hash = None", "self.last_hash = self.hash_class()\ngenerator = super(HashChunker, self).chunks(chunk_size)\nfor chunk in generator:\n self.last_hash.update(chunk)\n yield chunk" ]
<|body_start_0|> super(HashChunker, self).__init__(obj, size) self.hash_class = hash_class self.last_hash = None <|end_body_0|> <|body_start_1|> self.last_hash = self.hash_class() generator = super(HashChunker, self).chunks(chunk_size) for chunk in generator: ...
Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data.
HashChunker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashChunker: """Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data.""" def __init__(self, obj, size=None, hash_class=hashlib.md5): """HashChunker constructor. Args: o...
stack_v2_sparse_classes_36k_train_010480
1,068
no_license
[ { "docstring": "HashChunker constructor. Args: obj: object to chunk size: maximum number of bytes to read.", "name": "__init__", "signature": "def __init__(self, obj, size=None, hash_class=hashlib.md5)" }, { "docstring": "Return a chunk generator yielding chunk_size chunks Args: chunk_size: size...
2
stack_v2_sparse_classes_30k_train_003071
Implement the Python class `HashChunker` described below. Class description: Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data. Method signatures and docstrings: - def __init__(self, obj, size=None, ...
Implement the Python class `HashChunker` described below. Class description: Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data. Method signatures and docstrings: - def __init__(self, obj, size=None, ...
af243f342bc46ba0cd2ec54f415d5ba526a036a6
<|skeleton|> class HashChunker: """Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data.""" def __init__(self, obj, size=None, hash_class=hashlib.md5): """HashChunker constructor. Args: o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HashChunker: """Hash chunker class. Extends basic chunker to keep a running hash of chunked data in self.last_hash. This is useful for computing and verifying checksums of chunked data.""" def __init__(self, obj, size=None, hash_class=hashlib.md5): """HashChunker constructor. Args: obj: object to...
the_stack_v2_python_sparse
trpycore/chunk/hash.py
techresidents/trpycore
train
1
b073e00d222c4dc9a4b2f0f6eee0d73d2e9f24f8
[ "data = request.get_json()\nres, info = containerInfo(projectId, data.get('container_list'))\nif res == '0':\n return ({'containerInfo': info}, 200)\nelse:\n return ({'code': res}, 400)", "data = request.get_json()\nres = deleteContainer(projectId, data.get('container_list'))\nif res == '0':\n return ({}...
<|body_start_0|> data = request.get_json() res, info = containerInfo(projectId, data.get('container_list')) if res == '0': return ({'containerInfo': info}, 200) else: return ({'code': res}, 400) <|end_body_0|> <|body_start_1|> data = request.get_json() ...
ManageContainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageContainer: def get(self, projectId): """get container Spec""" <|body_0|> def delete(self, projectId): """delete containers""" <|body_1|> def post(self, projectId): """start, stop containers""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_010481
4,008
no_license
[ { "docstring": "get container Spec", "name": "get", "signature": "def get(self, projectId)" }, { "docstring": "delete containers", "name": "delete", "signature": "def delete(self, projectId)" }, { "docstring": "start, stop containers", "name": "post", "signature": "def po...
3
stack_v2_sparse_classes_30k_train_007072
Implement the Python class `ManageContainer` described below. Class description: Implement the ManageContainer class. Method signatures and docstrings: - def get(self, projectId): get container Spec - def delete(self, projectId): delete containers - def post(self, projectId): start, stop containers
Implement the Python class `ManageContainer` described below. Class description: Implement the ManageContainer class. Method signatures and docstrings: - def get(self, projectId): get container Spec - def delete(self, projectId): delete containers - def post(self, projectId): start, stop containers <|skeleton|> clas...
2cd55cbfb023e79b92dc31a96b9de6d2db138767
<|skeleton|> class ManageContainer: def get(self, projectId): """get container Spec""" <|body_0|> def delete(self, projectId): """delete containers""" <|body_1|> def post(self, projectId): """start, stop containers""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManageContainer: def get(self, projectId): """get container Spec""" data = request.get_json() res, info = containerInfo(projectId, data.get('container_list')) if res == '0': return ({'containerInfo': info}, 200) else: return ({'code': res}, 400) ...
the_stack_v2_python_sparse
src/projectManager/namespaces/views.py
LCTheo/DeployT_PoC
train
0
8812f47eb38f9700810240dff7a326fe915ee01e
[ "sheets = dict(((name, sheet) for name, sheet in kwds.items() if isinstance(sheet, cls.pyre_tabulator)))\nif len(sheets) > 1:\n import journal\n raise journal.firewall('pyre.tabular').log('charts need precisely one sheet')\nfor name in sheets:\n del kwds[name]\nattributes = super().__prepare__(name, bases,...
<|body_start_0|> sheets = dict(((name, sheet) for name, sheet in kwds.items() if isinstance(sheet, cls.pyre_tabulator))) if len(sheets) > 1: import journal raise journal.firewall('pyre.tabular').log('charts need precisely one sheet') for name in sheets: del kw...
Inspect charts and harvest their dimensions
Surveyor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Surveyor: """Inspect charts and harvest their dimensions""" def __prepare__(cls, name, bases, **kwds): """Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This mak...
stack_v2_sparse_classes_36k_train_010482
2,891
permissive
[ { "docstring": "Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This makes it possible to refer to sheets when setting up the chart dimensions", "name": "__prepare__", "signature": "...
2
stack_v2_sparse_classes_30k_train_004494
Implement the Python class `Surveyor` described below. Class description: Inspect charts and harvest their dimensions Method signatures and docstrings: - def __prepare__(cls, name, bases, **kwds): Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available a...
Implement the Python class `Surveyor` described below. Class description: Inspect charts and harvest their dimensions Method signatures and docstrings: - def __prepare__(cls, name, bases, **kwds): Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available a...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Surveyor: """Inspect charts and harvest their dimensions""" def __prepare__(cls, name, bases, **kwds): """Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This mak...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Surveyor: """Inspect charts and harvest their dimensions""" def __prepare__(cls, name, bases, **kwds): """Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This makes it possibl...
the_stack_v2_python_sparse
packages/pyre/tabular/Surveyor.py
pyre/pyre
train
27
8f8b0d900948e6ce06eaffd6c2fd819d84876a02
[ "self.source = source\nself.sink = sink\nself.T = E[source.idxs + sink.idxs,]\nif metric == 'cosine':\n self.costs = cosine_distances(self.T, self.T)\nif metric == 'euclidean':\n self.costs = euclidean_distances(self.T, self.T)\nself.source_mass = np.concatenate((source.nbow[0, source.idxs], np.zeros(len(sink...
<|body_start_0|> self.source = source self.sink = sink self.T = E[source.idxs + sink.idxs,] if metric == 'cosine': self.costs = cosine_distances(self.T, self.T) if metric == 'euclidean': self.costs = euclidean_distances(self.T, self.T) self.source_...
Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document. sink: The sink document. E: Embedding matrix for the words in the voc...
WMD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WMD: """Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document. sink: The sink document. E: Embedding ...
stack_v2_sparse_classes_36k_train_010483
21,755
permissive
[ { "docstring": "Initializes the WMD class.", "name": "__init__", "signature": "def __init__(self, source: Document, sink: Document, E: np.ndarray, metric: str='cosine') -> None" }, { "docstring": "Get the WMD between a pair of documents, with or without decomposed word-level distances. Args: i2w...
2
stack_v2_sparse_classes_30k_train_017455
Implement the Python class `WMD` described below. Class description: Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document....
Implement the Python class `WMD` described below. Class description: Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document....
25d81616aeb6a27cd0511d1e12316bc63673e599
<|skeleton|> class WMD: """Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document. sink: The sink document. E: Embedding ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WMD: """Full Word Mover's Distance calculated for a pair of documents. For details on WMD, see http://proceedings.mlr.press/v37/kusnerb15.html. EMD implemented using the pyemd library: https://github.com/wmayner/pyemd Attributes: source: The source document. sink: The sink document. E: Embedding matrix for th...
the_stack_v2_python_sparse
src/wmdecompose/models.py
maybemkl/wmdecompose
train
5
a698aed45698cc6a9f486be4347c8a08929fcce0
[ "options.skip_list = _sanitize_list_options(options.skip_list)\noptions.warn_list = _sanitize_list_options(options.warn_list)\nself.options = options\nformatter_factory = choose_formatter_factory(options)\nself.formatter = formatter_factory(options.cwd, options.display_relative_path)", "if isinstance(self.formatt...
<|body_start_0|> options.skip_list = _sanitize_list_options(options.skip_list) options.warn_list = _sanitize_list_options(options.warn_list) self.options = options formatter_factory = choose_formatter_factory(options) self.formatter = formatter_factory(options.cwd, options.displa...
App class represents an execution of the linter.
App
[ "MIT", "GPL-1.0-or-later", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """App class represents an execution of the linter.""" def __init__(self, options: 'Namespace'): """Construct app run based on already loaded configuration.""" <|body_0|> def render_matches(self, matches: List[MatchError]) -> None: """Display given matches."...
stack_v2_sparse_classes_36k_train_010484
3,495
permissive
[ { "docstring": "Construct app run based on already loaded configuration.", "name": "__init__", "signature": "def __init__(self, options: 'Namespace')" }, { "docstring": "Display given matches.", "name": "render_matches", "signature": "def render_matches(self, matches: List[MatchError]) -...
2
stack_v2_sparse_classes_30k_train_018612
Implement the Python class `App` described below. Class description: App class represents an execution of the linter. Method signatures and docstrings: - def __init__(self, options: 'Namespace'): Construct app run based on already loaded configuration. - def render_matches(self, matches: List[MatchError]) -> None: Di...
Implement the Python class `App` described below. Class description: App class represents an execution of the linter. Method signatures and docstrings: - def __init__(self, options: 'Namespace'): Construct app run based on already loaded configuration. - def render_matches(self, matches: List[MatchError]) -> None: Di...
f1c64609a023658cb564b66e00ad2296a687aca4
<|skeleton|> class App: """App class represents an execution of the linter.""" def __init__(self, options: 'Namespace'): """Construct app run based on already loaded configuration.""" <|body_0|> def render_matches(self, matches: List[MatchError]) -> None: """Display given matches."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class App: """App class represents an execution of the linter.""" def __init__(self, options: 'Namespace'): """Construct app run based on already loaded configuration.""" options.skip_list = _sanitize_list_options(options.skip_list) options.warn_list = _sanitize_list_options(options.war...
the_stack_v2_python_sparse
src/ansiblelint/app.py
xabinapal/ansible-lint
train
0
77948fd0f40b7bc2cdc08edd44e66349428f8467
[ "study_id = filter_params.pop('study_id', None)\nq = Phenotype.query.filter_by(**filter_params)\nfrom dataservice.api.participant.models import Participant\nif study_id:\n q = q.join(Participant.phenotypes).filter(Participant.study_id == study_id)\nreturn PhenotypeSchema(many=True).jsonify(Pagination(q, after, l...
<|body_start_0|> study_id = filter_params.pop('study_id', None) q = Phenotype.query.filter_by(**filter_params) from dataservice.api.participant.models import Participant if study_id: q = q.join(Participant.phenotypes).filter(Participant.study_id == study_id) return Ph...
Phenotype REST API
PhenotypeListAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhenotypeListAPI: """Phenotype REST API""" def get(self, filter_params, after, limit): """Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype""" <|body_0|> def post(self): """Create a new phenotype -...
stack_v2_sparse_classes_36k_train_010485
4,652
permissive
[ { "docstring": "Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype", "name": "get", "signature": "def get(self, filter_params, after, limit)" }, { "docstring": "Create a new phenotype --- template: path: new_resource.yml properties...
2
null
Implement the Python class `PhenotypeListAPI` described below. Class description: Phenotype REST API Method signatures and docstrings: - def get(self, filter_params, after, limit): Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype - def post(self): Cre...
Implement the Python class `PhenotypeListAPI` described below. Class description: Phenotype REST API Method signatures and docstrings: - def get(self, filter_params, after, limit): Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype - def post(self): Cre...
36ee3fc3d1ba9d1a177274d051fb175c56dd898e
<|skeleton|> class PhenotypeListAPI: """Phenotype REST API""" def get(self, filter_params, after, limit): """Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype""" <|body_0|> def post(self): """Create a new phenotype -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhenotypeListAPI: """Phenotype REST API""" def get(self, filter_params, after, limit): """Get all phenotypes --- description: Get all phenotypes template: path: get_list.yml properties: resource: Phenotype""" study_id = filter_params.pop('study_id', None) q = Phenotype.query.filte...
the_stack_v2_python_sparse
dataservice/api/phenotype/resources.py
kids-first/kf-api-dataservice
train
9
3e027ec03dd5001bb1b73119933c71a9afaaba87
[ "self.address = address\nself.port = port\nself.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock.connect((self.address, self.port))\nself.t = paramiko.Transport(self.sock)\ntry:\n self.t.start_client()\nexcept paramiko.SSHException:\n raise ConnectionError('SSH negotiation failed')\ntry:\n ...
<|body_start_0|> self.address = address self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.address, self.port)) self.t = paramiko.Transport(self.sock) try: self.t.start_client() except paramiko.SSHExc...
FileServerClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileServerClient: def __init__(self, address, port, key_path, print_func): """Opens tcp/ip socket to address:port""" <|body_0|> def close(self): """Closes the transport channel and connection""" <|body_1|> def receive_str(self, buf=1024): """Rece...
stack_v2_sparse_classes_36k_train_010486
5,225
permissive
[ { "docstring": "Opens tcp/ip socket to address:port", "name": "__init__", "signature": "def __init__(self, address, port, key_path, print_func)" }, { "docstring": "Closes the transport channel and connection", "name": "close", "signature": "def close(self)" }, { "docstring": "Rec...
5
stack_v2_sparse_classes_30k_train_017939
Implement the Python class `FileServerClient` described below. Class description: Implement the FileServerClient class. Method signatures and docstrings: - def __init__(self, address, port, key_path, print_func): Opens tcp/ip socket to address:port - def close(self): Closes the transport channel and connection - def ...
Implement the Python class `FileServerClient` described below. Class description: Implement the FileServerClient class. Method signatures and docstrings: - def __init__(self, address, port, key_path, print_func): Opens tcp/ip socket to address:port - def close(self): Closes the transport channel and connection - def ...
ee48a3c8c56d332904030a2b996baa87620c8a79
<|skeleton|> class FileServerClient: def __init__(self, address, port, key_path, print_func): """Opens tcp/ip socket to address:port""" <|body_0|> def close(self): """Closes the transport channel and connection""" <|body_1|> def receive_str(self, buf=1024): """Rece...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileServerClient: def __init__(self, address, port, key_path, print_func): """Opens tcp/ip socket to address:port""" self.address = address self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.address, self.port)) ...
the_stack_v2_python_sparse
aim/engine/aim_protocol.py
Arman-Deghoyan/aim
train
0
e2bfe39e9d5ef6b5d0ceb0f37c0f990f80981e34
[ "if not strs or not strs[0]:\n return ''\nLCP = None\nfor s in strs:\n if LCP == None:\n LCP = s\n else:\n for i, e in enumerate(LCP):\n if i >= len(s) or e != s[i]:\n LCP = s[:i]\n break\nreturn LCP", "if not strs or not strs[0]:\n return ''\nif ...
<|body_start_0|> if not strs or not strs[0]: return '' LCP = None for s in strs: if LCP == None: LCP = s else: for i, e in enumerate(LCP): if i >= len(s) or e != s[i]: LCP = s[:i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix_I(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not strs or not strs[0]:...
stack_v2_sparse_classes_36k_train_010487
1,225
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix_I", "signature": "def longestCommonPrefix_I(self, strs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix_I(self, strs): :type strs: List[str] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix_I(self, strs): :type strs: List[str] :rtype: str <|skeleton|> class Solution: ...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix_I(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" if not strs or not strs[0]: return '' LCP = None for s in strs: if LCP == None: LCP = s else: for i, e in enumerate(LCP): ...
the_stack_v2_python_sparse
Algorithm/014_Longest_Common_Prefix.py
Gi1ia/TechNoteBook
train
7
06be7a0b6b4b912d3a23b177200baac14a71c246
[ "enriched_features = feature_pyramid_network(backbone_features, is_training, depth=DEPTH, min_level=3, add_coarse_features=True, scope='fpn')\nenriched_features = {n: batch_norm_relu(x, is_training, name=f'{n}_batch_norm') for n, x in enriched_features.items()}\nimage_height = image_shape[1]\nimage_width = image_sh...
<|body_start_0|> enriched_features = feature_pyramid_network(backbone_features, is_training, depth=DEPTH, min_level=3, add_coarse_features=True, scope='fpn') enriched_features = {n: batch_norm_relu(x, is_training, name=f'{n}_batch_norm') for n, x in enriched_features.items()} image_height = imag...
RetinaNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetinaNet: def __init__(self, backbone_features, image_shape, is_training, params): """Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. image_shape: an int tensor with shape [4]. is_training: a boolean. params: a dict.""" <|body_...
stack_v2_sparse_classes_36k_train_010488
8,837
permissive
[ { "docstring": "Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. image_shape: an int tensor with shape [4]. is_training: a boolean. params: a dict.", "name": "__init__", "signature": "def __init__(self, backbone_features, image_shape, is_training, param...
4
stack_v2_sparse_classes_30k_train_001921
Implement the Python class `RetinaNet` described below. Class description: Implement the RetinaNet class. Method signatures and docstrings: - def __init__(self, backbone_features, image_shape, is_training, params): Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. ima...
Implement the Python class `RetinaNet` described below. Class description: Implement the RetinaNet class. Method signatures and docstrings: - def __init__(self, backbone_features, image_shape, is_training, params): Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. ima...
0a509a6f217e84342e54219e0ca8d2e4052127e9
<|skeleton|> class RetinaNet: def __init__(self, backbone_features, image_shape, is_training, params): """Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. image_shape: an int tensor with shape [4]. is_training: a boolean. params: a dict.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetinaNet: def __init__(self, backbone_features, image_shape, is_training, params): """Arguments: backbone_features: a dict with float tensors. It contains keys ['c2', 'c3', 'c4', 'c5']. image_shape: an int tensor with shape [4]. is_training: a boolean. params: a dict.""" enriched_features = f...
the_stack_v2_python_sparse
detector/retinanet.py
TropComplique/MultiPoseNet
train
12
5475eac5ee6c07dfb4f3a249692d6cf3baeef30c
[ "ans = []\nq = collections.deque()\nq.append(root)\nwhile q:\n node = q.popleft()\n if node:\n ans.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\n else:\n ans.append('None')\nreturn ','.join(ans)", "nodes_val = data.split(',')\nroot_val = nodes_val[0]\nif ...
<|body_start_0|> ans = [] q = collections.deque() q.append(root) while q: node = q.popleft() if node: ans.append(str(node.val)) q.append(node.left) q.append(node.right) else: ans.append('N...
Codec_bfs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec_bfs: 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|> <|b...
stack_v2_sparse_classes_36k_train_010489
2,727
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_002584
Implement the Python class `Codec_bfs` described below. Class description: Implement the Codec_bfs 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...
Implement the Python class `Codec_bfs` described below. Class description: Implement the Codec_bfs 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...
4f92911896c8b92c51650413b998e0bb1edfa4c0
<|skeleton|> class Codec_bfs: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec_bfs: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ans = [] q = collections.deque() q.append(root) while q: node = q.popleft() if node: ans.append(str(node.val)) ...
the_stack_v2_python_sparse
design/297_serialize.py
chenpengcode/Leetcode
train
1
f7c7b8f1e85dcc4b42c917f4352be00537f8187b
[ "self['user'] = None\nself['use_keyring'] = False\nself['keyring_service'] = 'SR tools'\nself['server'] = 'www.studentrobotics.org'\nself['https_port'] = 443\ntry:\n self.update_from_file(get_config_filename())\nexcept OSError:\n pass", "with open(fname) as file:\n d = yaml.safe_load(file)\nif d is not N...
<|body_start_0|> self['user'] = None self['use_keyring'] = False self['keyring_service'] = 'SR tools' self['server'] = 'www.studentrobotics.org' self['https_port'] = 443 try: self.update_from_file(get_config_filename()) except OSError: pass...
Configuration reader for the tools.
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" <|body_0|> def update_from_file(self, fname): """Update the config from the given YAML file :param str fname: ...
stack_v2_sparse_classes_36k_train_010490
3,258
no_license
[ { "docstring": "Create a new configuration reader with the default configuration values set.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Update the config from the given YAML file :param str fname: The filename of the YAML file. :raises IOError: If the YAML file ca...
4
stack_v2_sparse_classes_30k_train_014227
Implement the Python class `Config` described below. Class description: Configuration reader for the tools. Method signatures and docstrings: - def __init__(self): Create a new configuration reader with the default configuration values set. - def update_from_file(self, fname): Update the config from the given YAML fi...
Implement the Python class `Config` described below. Class description: Configuration reader for the tools. Method signatures and docstrings: - def __init__(self): Create a new configuration reader with the default configuration values set. - def update_from_file(self, fname): Update the config from the given YAML fi...
c97cea716311004129bdbf3651712ba3e970c1ff
<|skeleton|> class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" <|body_0|> def update_from_file(self, fname): """Update the config from the given YAML file :param str fname: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: """Configuration reader for the tools.""" def __init__(self): """Create a new configuration reader with the default configuration values set.""" self['user'] = None self['use_keyring'] = False self['keyring_service'] = 'SR tools' self['server'] = 'www.stude...
the_stack_v2_python_sparse
sr/tools/config.py
srobo/tools
train
4
2219dbc0bf067a7ccb6e3eaf89ce183b2ac5a106
[ "self.jwt_valid = jwt_valid\nself.expired = expired\nself.jwt_payload = jwt_payload\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\njwt_valid = dictionary.get('jwtValid')\nexpired = dictionary.get('expired')\njwt_payload = idfy_rest_client.models.jwt_payload.JwtPayl...
<|body_start_0|> self.jwt_valid = jwt_valid self.expired = expired self.jwt_payload = jwt_payload self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None jwt_valid = dictionary.get('jwtValid') ...
Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid)
JwtValidationResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JwtValidationResponse: """Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid)""" def __init__(self, jwt_valid=...
stack_v2_sparse_classes_36k_train_010491
2,469
permissive
[ { "docstring": "Constructor for the JwtValidationResponse class", "name": "__init__", "signature": "def __init__(self, jwt_valid=None, expired=None, jwt_payload=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): ...
2
null
Implement the Python class `JwtValidationResponse` described below. Class description: Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid...
Implement the Python class `JwtValidationResponse` described below. Class description: Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class JwtValidationResponse: """Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid)""" def __init__(self, jwt_valid=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JwtValidationResponse: """Implementation of the 'JwtValidationResponse' model. TODO: type model description here. Attributes: jwt_valid (bool): True if jwt is valid expired (bool): True if expired jwt_payload (JwtPayload): Payload (valid data if jwt is valid)""" def __init__(self, jwt_valid=None, expired...
the_stack_v2_python_sparse
idfy_rest_client/models/jwt_validation_response.py
dealflowteam/Idfy
train
0
6ff872a7b1c69eacdbf6068b0ebd846c543febe0
[ "copied = copy.deepcopy(data)\nin_secs = data.scan_duration.total_seconds()\ncopied.scan_duration = in_secs\nreturn copied", "scan_duration = timedelta(seconds=data.get('scan_duration'))\ntmc_config = TMCConfiguration(scan_duration=scan_duration)\nreturn tmc_config" ]
<|body_start_0|> copied = copy.deepcopy(data) in_secs = data.scan_duration.total_seconds() copied.scan_duration = in_secs return copied <|end_body_0|> <|body_start_1|> scan_duration = timedelta(seconds=data.get('scan_duration')) tmc_config = TMCConfiguration(scan_duratio...
Create the Schema for ScanDuration using timedelta
TMCConfigurationSchema
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TMCConfigurationSchema: """Create the Schema for ScanDuration using timedelta""" def convert_scan_duration_timedelta_to_float(self, data: TMCConfiguration, **_): """Process scan_duration and convert it to a float :param data: the scan_duration timedelta :param _: kwargs passed by Mar...
stack_v2_sparse_classes_36k_train_010492
1,676
permissive
[ { "docstring": "Process scan_duration and convert it to a float :param data: the scan_duration timedelta :param _: kwargs passed by Marshallow :return: float converted", "name": "convert_scan_duration_timedelta_to_float", "signature": "def convert_scan_duration_timedelta_to_float(self, data: TMCConfigur...
2
stack_v2_sparse_classes_30k_train_019918
Implement the Python class `TMCConfigurationSchema` described below. Class description: Create the Schema for ScanDuration using timedelta Method signatures and docstrings: - def convert_scan_duration_timedelta_to_float(self, data: TMCConfiguration, **_): Process scan_duration and convert it to a float :param data: t...
Implement the Python class `TMCConfigurationSchema` described below. Class description: Create the Schema for ScanDuration using timedelta Method signatures and docstrings: - def convert_scan_duration_timedelta_to_float(self, data: TMCConfiguration, **_): Process scan_duration and convert it to a float :param data: t...
87083655aca8f8f53a26dba253a0189d8519714b
<|skeleton|> class TMCConfigurationSchema: """Create the Schema for ScanDuration using timedelta""" def convert_scan_duration_timedelta_to_float(self, data: TMCConfiguration, **_): """Process scan_duration and convert it to a float :param data: the scan_duration timedelta :param _: kwargs passed by Mar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TMCConfigurationSchema: """Create the Schema for ScanDuration using timedelta""" def convert_scan_duration_timedelta_to_float(self, data: TMCConfiguration, **_): """Process scan_duration and convert it to a float :param data: the scan_duration timedelta :param _: kwargs passed by Marshallow :retu...
the_stack_v2_python_sparse
src/ska_tmc_cdm/schemas/subarray_node/configure/tmc.py
ska-telescope/cdm-shared-library
train
0
83d30966b61bc220354410a654bca38fd81de339
[ "members = ctx.guild.members\nassert len(members) >= 4, 'Member count must be more than 4'\ngenerator = randint(0, len(members) - 1)\nself.members = ctx.guild.members[generator:generator + 4]\nmissing = (len(self.members) - 4) * -1\nfor i in range(missing):\n self.members.append(members[i])\ndel members\nself.ct...
<|body_start_0|> members = ctx.guild.members assert len(members) >= 4, 'Member count must be more than 4' generator = randint(0, len(members) - 1) self.members = ctx.guild.members[generator:generator + 4] missing = (len(self.members) - 4) * -1 for i in range(missing): ...
GuessAvatar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" <|body_0|> async def start(self) -> bool: """begin""" <|body_1|> <|end_skeleton|> <|body_start_0|> members = ctx.guild.members assert len(...
stack_v2_sparse_classes_36k_train_010493
17,718
permissive
[ { "docstring": "Creates a 'guess what avatar this belongs to' game", "name": "__init__", "signature": "def __init__(self, ctx) -> None" }, { "docstring": "begin", "name": "start", "signature": "async def start(self) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_018073
Implement the Python class `GuessAvatar` described below. Class description: Implement the GuessAvatar class. Method signatures and docstrings: - def __init__(self, ctx) -> None: Creates a 'guess what avatar this belongs to' game - async def start(self) -> bool: begin
Implement the Python class `GuessAvatar` described below. Class description: Implement the GuessAvatar class. Method signatures and docstrings: - def __init__(self, ctx) -> None: Creates a 'guess what avatar this belongs to' game - async def start(self) -> bool: begin <|skeleton|> class GuessAvatar: def __init_...
b5309b91b9da49a2a5cee1596084d450b987c17a
<|skeleton|> class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" <|body_0|> async def start(self) -> bool: """begin""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" members = ctx.guild.members assert len(members) >= 4, 'Member count must be more than 4' generator = randint(0, len(members) - 1) self.members = ctx.guild.members[gene...
the_stack_v2_python_sparse
framework/games.py
alexshcer/username601
train
0
7d6244a4a3acfef1ac86bfa6758fdce17d50565c
[ "self.name = name\nmodule = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name))\nself.send_menu = getattr(module, 'send_{menu_name}_menu'.format(menu_name=self.name))", "say_command_manager.register_commands((self.name, '!' + self.name), _send_command_menu)\nsay_command_manager.register_co...
<|body_start_0|> self.name = name module = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name)) self.send_menu = getattr(module, 'send_{menu_name}_menu'.format(menu_name=self.name)) <|end_body_0|> <|body_start_1|> say_command_manager.register_commands((self.name, ...
Class used to register a command to its menu.
_MenuCommand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _MenuCommand: """Class used to register a command to its menu.""" def __init__(self, name): """Store the base name and send_menu callback.""" <|body_0|> def register_commands(self): """Register the public, private, and client commands.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_010494
4,337
no_license
[ { "docstring": "Store the base name and send_menu callback.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Register the public, private, and client commands.", "name": "register_commands", "signature": "def register_commands(self)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_007160
Implement the Python class `_MenuCommand` described below. Class description: Class used to register a command to its menu. Method signatures and docstrings: - def __init__(self, name): Store the base name and send_menu callback. - def register_commands(self): Register the public, private, and client commands. - def ...
Implement the Python class `_MenuCommand` described below. Class description: Class used to register a command to its menu. Method signatures and docstrings: - def __init__(self, name): Store the base name and send_menu callback. - def register_commands(self): Register the public, private, and client commands. - def ...
dd76d1f581a1a8aff18c2194834665fa66a82aab
<|skeleton|> class _MenuCommand: """Class used to register a command to its menu.""" def __init__(self, name): """Store the base name and send_menu callback.""" <|body_0|> def register_commands(self): """Register the public, private, and client commands.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _MenuCommand: """Class used to register a command to its menu.""" def __init__(self, name): """Store the base name and send_menu callback.""" self.name = name module = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name)) self.send_menu = getattr(modu...
the_stack_v2_python_sparse
addons/source-python/plugins/gungame/core/commands.py
Hackmastr/GunGame-SP
train
0
fc4d9ad8e215c1e938d2f9026973001728d902fa
[ "self.name = name\nself.assembly_name = assembly_name\nself.class_name = class_name\nself.signature = signature\nself.signature_2 = signature_2\nself.member_type = member_type\nself.generic_arguments = generic_arguments", "if dictionary is None:\n return None\nname = dictionary.get('Name')\nassembly_name = dic...
<|body_start_0|> self.name = name self.assembly_name = assembly_name self.class_name = class_name self.signature = signature self.signature_2 = signature_2 self.member_type = member_type self.generic_arguments = generic_arguments <|end_body_0|> <|body_start_1|> ...
Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signature (string): TODO: type description here. signature_2 (string): TODO: type de...
TargetSite
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TargetSite: """Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signature (string): TODO: type description her...
stack_v2_sparse_classes_36k_train_010495
2,958
permissive
[ { "docstring": "Constructor for the TargetSite class", "name": "__init__", "signature": "def __init__(self, name=None, assembly_name=None, class_name=None, signature=None, signature_2=None, member_type=None, generic_arguments=None)" }, { "docstring": "Creates an instance of this model from a dic...
2
stack_v2_sparse_classes_30k_train_018566
Implement the Python class `TargetSite` described below. Class description: Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signatu...
Implement the Python class `TargetSite` described below. Class description: Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signatu...
b574a76a8805b306a423229b572c36dae0159def
<|skeleton|> class TargetSite: """Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signature (string): TODO: type description her...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TargetSite: """Implementation of the 'TargetSite' model. TODO: type model description here. Attributes: name (string): TODO: type description here. assembly_name (string): TODO: type description here. class_name (string): TODO: type description here. signature (string): TODO: type description here. signature_...
the_stack_v2_python_sparse
easybimehlanding/models/target_site.py
kmelodi/EasyBimehLanding_Python
train
0
665cd50210d892cde3bfb470e72fdd30c155e934
[ "n = len(nums)\nnums.sort()\nroots = [_ for _ in range(max(nums) + 1)]\nranks = [1] * len(roots)\n\ndef find(i):\n while roots[i] != i:\n roots[i] = roots[roots[i]]\n i = roots[i]\n return i\n\ndef union(i, j):\n x, y = (find(i), find(j))\n if x != y:\n roots[y] = x\n ranks[x...
<|body_start_0|> n = len(nums) nums.sort() roots = [_ for _ in range(max(nums) + 1)] ranks = [1] * len(roots) def find(i): while roots[i] != i: roots[i] = roots[roots[i]] i = roots[i] return i def union(i, j): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def largestComponentSize(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) nu...
stack_v2_sparse_classes_36k_train_010496
15,402
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "largestComponentSizeTLE", "signature": "def largestComponentSizeTLE(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "largestComponentSize", "signature": "def largestComponentSize(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017581
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestComponentSizeTLE(self, nums): :type nums: List[int] :rtype: int - def largestComponentSize(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 largestComponentSizeTLE(self, nums): :type nums: List[int] :rtype: int - def largestComponentSize(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution:...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def largestComponentSize(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestComponentSizeTLE(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) nums.sort() roots = [_ for _ in range(max(nums) + 1)] ranks = [1] * len(roots) def find(i): while roots[i] != i: roots[i] = root...
the_stack_v2_python_sparse
L/LargestComponentSizebyCommonFactor.py
bssrdf/pyleet
train
2
a425112463f85a0527980a9593971101268c27c8
[ "fig = plt.figure(figsize=(8, 8))\nfig.add_subplot(111)\nplt.rcParams['font.sans-serif'] = 'SimHei'\nfrom matplotlib import cm\ncmap = cm.Oranges\nplt.title('生命游戏与matplotlib')\nrunning = True\nwhile running:\n map = plt.imshow(self.source_a, interpolation='nearest', cmap=cmap, aspect='auto', vmin=0, vmax=1)\n ...
<|body_start_0|> fig = plt.figure(figsize=(8, 8)) fig.add_subplot(111) plt.rcParams['font.sans-serif'] = 'SimHei' from matplotlib import cm cmap = cm.Oranges plt.title('生命游戏与matplotlib') running = True while running: map = plt.imshow(self.sourc...
gameofplt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gameofplt: def mainplt(self): """用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspect = 'auto',vmin = 0,vmax = 1) #interpolation 差值 vmin最小值 白色""" <|body_0|> def mainscat...
stack_v2_sparse_classes_36k_train_010497
4,146
no_license
[ { "docstring": "用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspect = 'auto',vmin = 0,vmax = 1) #interpolation 差值 vmin最小值 白色", "name": "mainplt", "signature": "def mainplt(self)" }, { "docs...
3
null
Implement the Python class `gameofplt` described below. Class description: Implement the gameofplt class. Method signatures and docstrings: - def mainplt(self): 用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspec...
Implement the Python class `gameofplt` described below. Class description: Implement the gameofplt class. Method signatures and docstrings: - def mainplt(self): 用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspec...
6e077a6d777d9a339095fb133b7d9a6f9d408743
<|skeleton|> class gameofplt: def mainplt(self): """用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspect = 'auto',vmin = 0,vmax = 1) #interpolation 差值 vmin最小值 白色""" <|body_0|> def mainscat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class gameofplt: def mainplt(self): """用plt.imshow()方法画出gameoflife :return: # data = np.random.randint(0,2,(10,10)) # print(data) map = plt.imshow(data,interpolation = 'nearest', cmap = cmap,aspect = 'auto',vmin = 0,vmax = 1) #interpolation 差值 vmin最小值 白色""" fig = plt.figure(figsize=(8, 8)) f...
the_stack_v2_python_sparse
homework/Alex-赵鑫荣/生命游戏/supergame.py
north-jewel/data_analysis
train
8
aed9312eb9199c8bc90c9589ac95b58a34a48ce0
[ "self.config_path = None\nconfig_path = config_path or CONF.wsgi.api_paste_config\nif not os.path.isabs(config_path):\n self.config_path = CONF.find_file(config_path)\nelif os.path.exists(config_path):\n self.config_path = config_path\nif not self.config_path:\n raise exception.ConfigNotFound(path=config_p...
<|body_start_0|> self.config_path = None config_path = config_path or CONF.wsgi.api_paste_config if not os.path.isabs(config_path): self.config_path = CONF.find_file(config_path) elif os.path.exists(config_path): self.config_path = config_path if not self....
Used to load WSGI applications from paste configurations.
Loader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Loader: """Used to load WSGI applications from paste configurations.""" def __init__(self, config_path=None): """Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None""" <|body_0|> def load_ap...
stack_v2_sparse_classes_36k_train_010498
8,705
permissive
[ { "docstring": "Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None", "name": "__init__", "signature": "def __init__(self, config_path=None)" }, { "docstring": "Return the paste URLMap wrapped WSGI application. :par...
2
null
Implement the Python class `Loader` described below. Class description: Used to load WSGI applications from paste configurations. Method signatures and docstrings: - def __init__(self, config_path=None): Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste conf...
Implement the Python class `Loader` described below. Class description: Used to load WSGI applications from paste configurations. Method signatures and docstrings: - def __init__(self, config_path=None): Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste conf...
065c5906d2da3e2bb6eeb3a7a15d4cd8d98b35e9
<|skeleton|> class Loader: """Used to load WSGI applications from paste configurations.""" def __init__(self, config_path=None): """Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None""" <|body_0|> def load_ap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Loader: """Used to load WSGI applications from paste configurations.""" def __init__(self, config_path=None): """Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None""" self.config_path = None config_p...
the_stack_v2_python_sparse
nova/api/wsgi.py
openstack/nova
train
2,287
47aa1f57f73a71b6781f4bd2c5ae01c28511d41f
[ "u, p = secrets.db.epi\nself._connection = connector_impl.connect(host=secrets.db.host, user=u, password=p, database=Database.DATABASE_NAME)\nself._cursor = self._connection.cursor()", "self._cursor.close()\nif commit:\n self._connection.commit()\nself._connection.close()", "sql = \"\\n SELECT\\n ...
<|body_start_0|> u, p = secrets.db.epi self._connection = connector_impl.connect(host=secrets.db.host, user=u, password=p, database=Database.DATABASE_NAME) self._cursor = self._connection.cursor() <|end_body_0|> <|body_start_1|> self._cursor.close() if commit: self._...
A collection of epicast database operations.
Database
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """A collection of epicast database operations.""" def connect(self, connector_impl=mysql.connector): """Establish a connection to the database.""" <|body_0|> def disconnect(self, commit): """Close the database connection. commit: if true, commit change...
stack_v2_sparse_classes_36k_train_010499
2,444
permissive
[ { "docstring": "Establish a connection to the database.", "name": "connect", "signature": "def connect(self, connector_impl=mysql.connector)" }, { "docstring": "Close the database connection. commit: if true, commit changes, otherwise rollback", "name": "disconnect", "signature": "def di...
3
stack_v2_sparse_classes_30k_train_003775
Implement the Python class `Database` described below. Class description: A collection of epicast database operations. Method signatures and docstrings: - def connect(self, connector_impl=mysql.connector): Establish a connection to the database. - def disconnect(self, commit): Close the database connection. commit: i...
Implement the Python class `Database` described below. Class description: A collection of epicast database operations. Method signatures and docstrings: - def connect(self, connector_impl=mysql.connector): Establish a connection to the database. - def disconnect(self, commit): Close the database connection. commit: i...
23e1b41313f8863a7732b5861df7c70edd1ee3ad
<|skeleton|> class Database: """A collection of epicast database operations.""" def connect(self, connector_impl=mysql.connector): """Establish a connection to the database.""" <|body_0|> def disconnect(self, commit): """Close the database connection. commit: if true, commit change...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: """A collection of epicast database operations.""" def connect(self, connector_impl=mysql.connector): """Establish a connection to the database.""" u, p = secrets.db.epi self._connection = connector_impl.connect(host=secrets.db.host, user=u, password=p, database=Database...
the_stack_v2_python_sparse
src/covid/database.py
cmu-delphi/flu-contest
train
0