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
9e9a5cbfdd434932d9742249705770a7d795518d
[ "if six.PY2:\n buf = io.BytesIO()\n try:\n json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs)\n buf.seek(0, 0)\n if isinstance(stream, io.TextIOBase):\n stream.write(buf.read().decode('utf-8'))\n else:\n stream.write(buf.read())\n finally:\n ...
<|body_start_0|> if six.PY2: buf = io.BytesIO() try: json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs) buf.seek(0, 0) if isinstance(stream, io.TextIOBase): stream.write(buf.read().decode('utf-8')) ...
PROV-JSON serializer for :class:`~prov.model.ProvDocument`
ProvJSONSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out...
stack_v2_sparse_classes_36k_train_012900
13,588
permissive
[ { "docstring": "Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output.", "name": "serialize", "signature": "def serialize(self, stream, **kwargs)" }, { "docstring": "Deserialize from the `P...
2
stack_v2_sparse_classes_30k_train_005165
Implement the Python class `ProvJSONSerializer` described below. Class description: PROV-JSON serializer for :class:`~prov.model.ProvDocument` Method signatures and docstrings: - def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton....
Implement the Python class `ProvJSONSerializer` described below. Class description: PROV-JSON serializer for :class:`~prov.model.ProvDocument` Method signatures and docstrings: - def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton....
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProvJSONSerializer: """PROV-JSON serializer for :class:`~prov.model.ProvDocument`""" def serialize(self, stream, **kwargs): """Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output.""" ...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/prov/serializers/provjson.py
Raniac/NEURO-LEARN
train
9
b8411536625d17745cb8eefb753dcc0a74aaedb0
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\noffset = request.args.get('offset', '0')\nlimit = request.args.get('limit', '10')\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nper_page = request.args.get('per_page', '10'...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offset', '0') limit = request.args.get('limit', '10') order_by = request.args.get('order_by', 'id') order = request.a...
AuditList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditList: def get(self): """To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an audit""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_012901
7,183
no_license
[ { "docstring": "To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages", "name": "get", "signature": "def get(self)" }, { "docstring": "To create an audit", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_019258
Implement the Python class `AuditList` described below. Class description: Implement the AuditList class. Method signatures and docstrings: - def get(self): To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(self): To create an audit
Implement the Python class `AuditList` described below. Class description: Implement the AuditList class. Method signatures and docstrings: - def get(self): To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(self): To create an audit <|skeleton|> class ...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class AuditList: def get(self): """To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an audit""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuditList: def get(self): """To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offs...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/audits.py
Telematica/knight-rider
train
1
b562544176835ff6c5e01f5bbf6eeaac59ff8634
[ "self.primary = None\nself.secondary = None\nself.initialize(jconfig, kwargs)", "cachesize = jconfig.get('cachesize', None)\nadminuser = jconfig.get('adminuser', None)\nif 'primary' in jconfig:\n self.primary = self.create_journal(jconfig['primary'], kwargs, cachesize, adminuser)\nif 'secondary' in jconfig:\n ...
<|body_start_0|> self.primary = None self.secondary = None self.initialize(jconfig, kwargs) <|end_body_0|> <|body_start_1|> cachesize = jconfig.get('cachesize', None) adminuser = jconfig.get('adminuser', None) if 'primary' in jconfig: self.primary = self.crea...
Creates journal objects for primary and secondary
Journal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Journal: """Creates journal objects for primary and secondary""" def __init__(self, jconfig, kwargs): """Constructor for journal""" <|body_0|> def initialize(self, jconfig, kwargs): """creates journal objects""" <|body_1|> def create_journal(self, jc...
stack_v2_sparse_classes_36k_train_012902
2,954
permissive
[ { "docstring": "Constructor for journal", "name": "__init__", "signature": "def __init__(self, jconfig, kwargs)" }, { "docstring": "creates journal objects", "name": "initialize", "signature": "def initialize(self, jconfig, kwargs)" }, { "docstring": "get the name and create obj"...
5
stack_v2_sparse_classes_30k_train_017762
Implement the Python class `Journal` described below. Class description: Creates journal objects for primary and secondary Method signatures and docstrings: - def __init__(self, jconfig, kwargs): Constructor for journal - def initialize(self, jconfig, kwargs): creates journal objects - def create_journal(self, jconf,...
Implement the Python class `Journal` described below. Class description: Creates journal objects for primary and secondary Method signatures and docstrings: - def __init__(self, jconfig, kwargs): Constructor for journal - def initialize(self, jconfig, kwargs): creates journal objects - def create_journal(self, jconf,...
a233ad85b56ff43a81544386a0730bee590de8fc
<|skeleton|> class Journal: """Creates journal objects for primary and secondary""" def __init__(self, jconfig, kwargs): """Constructor for journal""" <|body_0|> def initialize(self, jconfig, kwargs): """creates journal objects""" <|body_1|> def create_journal(self, jc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Journal: """Creates journal objects for primary and secondary""" def __init__(self, jconfig, kwargs): """Constructor for journal""" self.primary = None self.secondary = None self.initialize(jconfig, kwargs) def initialize(self, jconfig, kwargs): """creates jou...
the_stack_v2_python_sparse
lib/python/journal/mjournal.py
lisajoseph/journal
train
0
217a341aee4b7786ca130dac10d7d26db2465c58
[ "ext = []\nif self._is_position(global_step, 'start') or self._is_position(global_step, 'end'):\n ext.append(extensions.BatchGrad())\nreturn ext", "info = {}\nif pos in ['start', 'end']:\n info['f'] = batch_loss.item()\n info['var_f'] = get_individual_losses(global_step).var().item()\n info['params'] ...
<|body_start_0|> ext = [] if self._is_position(global_step, 'start') or self._is_position(global_step, 'end'): ext.append(extensions.BatchGrad()) return ext <|end_body_0|> <|body_start_1|> info = {} if pos in ['start', 'end']: info['f'] = batch_loss.item(...
Compute α but requires storing individual gradients.
AlphaExpensive
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaExpensive: """Compute α but requires storing individual gradients.""" def extensions(self, global_step): """Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration number. Returns: list: (Potentially empty) list with requir...
stack_v2_sparse_classes_36k_train_012903
16,011
permissive
[ { "docstring": "Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration number. Returns: list: (Potentially empty) list with required BackPACK quantities.", "name": "extensions", "signature": "def extensions(self, global_step)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_018631
Implement the Python class `AlphaExpensive` described below. Class description: Compute α but requires storing individual gradients. Method signatures and docstrings: - def extensions(self, global_step): Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration nu...
Implement the Python class `AlphaExpensive` described below. Class description: Compute α but requires storing individual gradients. Method signatures and docstrings: - def extensions(self, global_step): Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration nu...
5bd5ab3cda03eda0b0bf276f29d5c28b83d70b06
<|skeleton|> class AlphaExpensive: """Compute α but requires storing individual gradients.""" def extensions(self, global_step): """Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration number. Returns: list: (Potentially empty) list with requir...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlphaExpensive: """Compute α but requires storing individual gradients.""" def extensions(self, global_step): """Return list of BackPACK extensions required for the computation. Args: global_step (int): The current iteration number. Returns: list: (Potentially empty) list with required BackPACK q...
the_stack_v2_python_sparse
cockpit/quantities/alpha.py
MeNicefellow/cockpit
train
0
456d90e63c256efdb2c3fedddd082180c66e7793
[ "self.transforms = self.trainer.hps.dataset.transforms\nself.transform_interval = self.trainer.epochs // len(self.transforms[0]['all_para'].keys())\nself.hps = self.trainer.hps", "config_id = str(epoch // self.transform_interval)\ntransform_list = self.transforms[0]['all_para'][config_id]\nself.hps.dataset.transf...
<|body_start_0|> self.transforms = self.trainer.hps.dataset.transforms self.transform_interval = self.trainer.epochs // len(self.transforms[0]['all_para'].keys()) self.hps = self.trainer.hps <|end_body_0|> <|body_start_1|> config_id = str(epoch // self.transform_interval) transf...
Construct the trainer of Adelaide-EA.
PbaTrainerCallback
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PbaTrainerCallback: """Construct the trainer of Adelaide-EA.""" def before_train(self, logs=None): """Be called before the training process.""" <|body_0|> def before_epoch(self, epoch, logs=None): """Be called before epoch.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_012904
1,464
permissive
[ { "docstring": "Be called before the training process.", "name": "before_train", "signature": "def before_train(self, logs=None)" }, { "docstring": "Be called before epoch.", "name": "before_epoch", "signature": "def before_epoch(self, epoch, logs=None)" } ]
2
null
Implement the Python class `PbaTrainerCallback` described below. Class description: Construct the trainer of Adelaide-EA. Method signatures and docstrings: - def before_train(self, logs=None): Be called before the training process. - def before_epoch(self, epoch, logs=None): Be called before epoch.
Implement the Python class `PbaTrainerCallback` described below. Class description: Construct the trainer of Adelaide-EA. Method signatures and docstrings: - def before_train(self, logs=None): Be called before the training process. - def before_epoch(self, epoch, logs=None): Be called before epoch. <|skeleton|> clas...
52b53582fe7df95d7aacc8425013fd18645d079f
<|skeleton|> class PbaTrainerCallback: """Construct the trainer of Adelaide-EA.""" def before_train(self, logs=None): """Be called before the training process.""" <|body_0|> def before_epoch(self, epoch, logs=None): """Be called before epoch.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PbaTrainerCallback: """Construct the trainer of Adelaide-EA.""" def before_train(self, logs=None): """Be called before the training process.""" self.transforms = self.trainer.hps.dataset.transforms self.transform_interval = self.trainer.epochs // len(self.transforms[0]['all_para']...
the_stack_v2_python_sparse
vega/algorithms/data_augmentation/pba_trainer_callback.py
yiziqi/vega
train
0
d161974b8923897fd21d8e0879fbee9d8dc65081
[ "auto = input('是否静音(Y/n):').strip()\nif auto in ['y', 'Y', '']:\n OPTIONS().Mute_Audio = True\nelse:\n OPTIONS().Mute_Audio = False", "headless = input('是否显示自动化过程(y/N):').strip()\nif headless in ['y', 'Y']:\n OPTIONS().Headless = False\nelse:\n OPTIONS().Headless = True", "token = input('是否持久化登录(Y/n...
<|body_start_0|> auto = input('是否静音(Y/n):').strip() if auto in ['y', 'Y', '']: OPTIONS().Mute_Audio = True else: OPTIONS().Mute_Audio = False <|end_body_0|> <|body_start_1|> headless = input('是否显示自动化过程(y/N):').strip() if headless in ['y', 'Y']: ...
选项管理类
OPTIONS_MANAGE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OPTIONS_MANAGE: """选项管理类""" def __Auto(cls) -> None: """__Auto() -> None 禁音选项(默认: True) :return: None""" <|body_0|> def __Headless(cls) -> None: """__Headless() -> None 显示过程选项(默认: False) :return: None""" <|body_1|> def __Token(cls) -> None: "...
stack_v2_sparse_classes_36k_train_012905
3,572
permissive
[ { "docstring": "__Auto() -> None 禁音选项(默认: True) :return: None", "name": "__Auto", "signature": "def __Auto(cls) -> None" }, { "docstring": "__Headless() -> None 显示过程选项(默认: False) :return: None", "name": "__Headless", "signature": "def __Headless(cls) -> None" }, { "docstring": "_...
6
stack_v2_sparse_classes_30k_train_016227
Implement the Python class `OPTIONS_MANAGE` described below. Class description: 选项管理类 Method signatures and docstrings: - def __Auto(cls) -> None: __Auto() -> None 禁音选项(默认: True) :return: None - def __Headless(cls) -> None: __Headless() -> None 显示过程选项(默认: False) :return: None - def __Token(cls) -> None: __Token() -> ...
Implement the Python class `OPTIONS_MANAGE` described below. Class description: 选项管理类 Method signatures and docstrings: - def __Auto(cls) -> None: __Auto() -> None 禁音选项(默认: True) :return: None - def __Headless(cls) -> None: __Headless() -> None 显示过程选项(默认: False) :return: None - def __Token(cls) -> None: __Token() -> ...
9e2a023917b86460fb02984aed9fe638c3d38dd4
<|skeleton|> class OPTIONS_MANAGE: """选项管理类""" def __Auto(cls) -> None: """__Auto() -> None 禁音选项(默认: True) :return: None""" <|body_0|> def __Headless(cls) -> None: """__Headless() -> None 显示过程选项(默认: False) :return: None""" <|body_1|> def __Token(cls) -> None: "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OPTIONS_MANAGE: """选项管理类""" def __Auto(cls) -> None: """__Auto() -> None 禁音选项(默认: True) :return: None""" auto = input('是否静音(Y/n):').strip() if auto in ['y', 'Y', '']: OPTIONS().Mute_Audio = True else: OPTIONS().Mute_Audio = False def __Headless...
the_stack_v2_python_sparse
inside/Options/Options_Manage.py
lifansama/learning-power
train
1
7f52605780f16f2091e4ec8303581edb867c3d3a
[ "super().__init__()\nself.every_n_epochs = every_n_epochs\nself.dataloader = dataloader\nself.measures = measures\nself.latest = {measure.name: 0 for measure in measures}", "if (trainer.current_epoch + 1) % self.every_n_epochs == 0:\n msgs = []\n for sender_imgs, receiver_imgs, target in self.dataloader:\n ...
<|body_start_0|> super().__init__() self.every_n_epochs = every_n_epochs self.dataloader = dataloader self.measures = measures self.latest = {measure.name: 0 for measure in measures} <|end_body_0|> <|body_start_1|> if (trainer.current_epoch + 1) % self.every_n_epochs == ...
Creates a plot based around a digit
MeasureCallbacks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasureCallbacks: """Creates a plot based around a digit""" def __init__(self, dataloader, measures, every_n_epochs=1): """Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs (otherwise tensorboard gets quite large) save_to_disk - ...
stack_v2_sparse_classes_36k_train_012906
8,112
no_license
[ { "docstring": "Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs (otherwise tensorboard gets quite large) save_to_disk - If True, the samples and image means should be saved to disk as well.", "name": "__init__", "signature": "def __init__(self, da...
2
stack_v2_sparse_classes_30k_train_004518
Implement the Python class `MeasureCallbacks` described below. Class description: Creates a plot based around a digit Method signatures and docstrings: - def __init__(self, dataloader, measures, every_n_epochs=1): Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs...
Implement the Python class `MeasureCallbacks` described below. Class description: Creates a plot based around a digit Method signatures and docstrings: - def __init__(self, dataloader, measures, every_n_epochs=1): Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs...
5189b65690da28f6a8118b7fc63e24c809e15c0d
<|skeleton|> class MeasureCallbacks: """Creates a plot based around a digit""" def __init__(self, dataloader, measures, every_n_epochs=1): """Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs (otherwise tensorboard gets quite large) save_to_disk - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeasureCallbacks: """Creates a plot based around a digit""" def __init__(self, dataloader, measures, every_n_epochs=1): """Inputs: batch_size - Number of images to generate every_n_epochs - Only save those images every N epochs (otherwise tensorboard gets quite large) save_to_disk - If True, the ...
the_stack_v2_python_sparse
callbacks/msg_callback.py
gersonfoks/NLP2EmergentLanguage
train
0
22c21443c1937c665d36225b929d2e63180b370a
[ "if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/numberbatch_en.gensim'):\n print(colored('Processing the `Numberbatch` dataset for the first time...', 'yellow'))\n if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/raw/numberbat...
<|body_start_0|> if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/numberbatch_en.gensim'): print(colored('Processing the `Numberbatch` dataset for the first time...', 'yellow')) if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilb...
Class to get the Numberbatch embeddings of words
NumberbatchConverter
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberbatchConverter: """Class to get the Numberbatch embeddings of words""" def __init__(self): """Loads the Numberbatch model""" <|body_0|> def convert_word_to_embedding(self, word): """Given a word, returns its Numberbatch embedding""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_012907
4,555
permissive
[ { "docstring": "Loads the Numberbatch model", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Given a word, returns its Numberbatch embedding", "name": "convert_word_to_embedding", "signature": "def convert_word_to_embedding(self, word)" } ]
2
stack_v2_sparse_classes_30k_train_020425
Implement the Python class `NumberbatchConverter` described below. Class description: Class to get the Numberbatch embeddings of words Method signatures and docstrings: - def __init__(self): Loads the Numberbatch model - def convert_word_to_embedding(self, word): Given a word, returns its Numberbatch embedding
Implement the Python class `NumberbatchConverter` described below. Class description: Class to get the Numberbatch embeddings of words Method signatures and docstrings: - def __init__(self): Loads the Numberbatch model - def convert_word_to_embedding(self, word): Given a word, returns its Numberbatch embedding <|ske...
0fb558af7df8c61be47bcf278e30cdf10315b572
<|skeleton|> class NumberbatchConverter: """Class to get the Numberbatch embeddings of words""" def __init__(self): """Loads the Numberbatch model""" <|body_0|> def convert_word_to_embedding(self, word): """Given a word, returns its Numberbatch embedding""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumberbatchConverter: """Class to get the Numberbatch embeddings of words""" def __init__(self): """Loads the Numberbatch model""" if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/numberbatch_en.gensim'): print(colored('Processing ...
the_stack_v2_python_sparse
conceptBert/vilbert/knowledge_graph/create_embedding_files.py
liubo12/ConceptBERT
train
0
51f7383f275e5e661f3bef05fdcf2122d0ab3bb6
[ "values = []\nfor _ in range(5):\n index = random.randint(low, high)\n values.append((index, seq[index]))\nvalues.sort(key=lambda item: item[1])\nreturn values[2][0]", "index = self.five_sample(seq, low, high)\nseq[low], seq[index] = (seq[index], seq[low])\ni, j = (low + 1, high)\nval = seq[low]\nwhile 1:\n...
<|body_start_0|> values = [] for _ in range(5): index = random.randint(low, high) values.append((index, seq[index])) values.sort(key=lambda item: item[1]) return values[2][0] <|end_body_0|> <|body_start_1|> index = self.five_sample(seq, low, high) ...
Quick sort non-recursive version.
QuickSortNonRecursive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuickSortNonRecursive: """Quick sort non-recursive version.""" def five_sample(self, seq: MutableSequence[CT], low: int, high: int) -> int: """Cherry pick median number of randomly picked five numbers between `low` and `high`. Args: seq (MutableSequence[CT]): input array low (int): s...
stack_v2_sparse_classes_36k_train_012908
8,934
no_license
[ { "docstring": "Cherry pick median number of randomly picked five numbers between `low` and `high`. Args: seq (MutableSequence[CT]): input array low (int): start index high (int): end index Returns: int: index of median number of five numbers", "name": "five_sample", "signature": "def five_sample(self, ...
3
stack_v2_sparse_classes_30k_train_011201
Implement the Python class `QuickSortNonRecursive` described below. Class description: Quick sort non-recursive version. Method signatures and docstrings: - def five_sample(self, seq: MutableSequence[CT], low: int, high: int) -> int: Cherry pick median number of randomly picked five numbers between `low` and `high`. ...
Implement the Python class `QuickSortNonRecursive` described below. Class description: Quick sort non-recursive version. Method signatures and docstrings: - def five_sample(self, seq: MutableSequence[CT], low: int, high: int) -> int: Cherry pick median number of randomly picked five numbers between `low` and `high`. ...
d3ccd86c93016c7fee270ad02e1a823d205cea80
<|skeleton|> class QuickSortNonRecursive: """Quick sort non-recursive version.""" def five_sample(self, seq: MutableSequence[CT], low: int, high: int) -> int: """Cherry pick median number of randomly picked five numbers between `low` and `high`. Args: seq (MutableSequence[CT]): input array low (int): s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuickSortNonRecursive: """Quick sort non-recursive version.""" def five_sample(self, seq: MutableSequence[CT], low: int, high: int) -> int: """Cherry pick median number of randomly picked five numbers between `low` and `high`. Args: seq (MutableSequence[CT]): input array low (int): start index hi...
the_stack_v2_python_sparse
chapter_2/module_2_3.py
ChangeMyUsername/algorithms-sedgewick-python
train
330
9b5f91d8280b5fdfd2751839749f1308b94b103a
[ "from math import e, log\nif x < 2:\n return x\nleft = int(e ** (0.5 * log(x)))\nright = left + 1\nreturn left if right * right > x else right", "if x < 2:\n return x\nleft, right = (0, x // 2)\nwhile left <= right:\n pivot = left + (right - left) // 2\n num = pivot * pivot\n if num < x:\n l...
<|body_start_0|> from math import e, log if x < 2: return x left = int(e ** (0.5 * log(x))) right = left + 1 return left if right * right > x else right <|end_body_0|> <|body_start_1|> if x < 2: return x left, right = (0, x // 2) w...
SquareRoot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SquareRoot: def results(self, x: int) -> int: """Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return:""" <|body_0|> def result(self, x: int) -> int: """Approach: Binary Search 2 to x // 2 Time Complexity: O(log N) Space Complexi...
stack_v2_sparse_classes_36k_train_012909
1,829
no_license
[ { "docstring": "Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return:", "name": "results", "signature": "def results(self, x: int) -> int" }, { "docstring": "Approach: Binary Search 2 to x // 2 Time Complexity: O(log N) Space Complexity: O(1) :param x: :retu...
3
null
Implement the Python class `SquareRoot` described below. Class description: Implement the SquareRoot class. Method signatures and docstrings: - def results(self, x: int) -> int: Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return: - def result(self, x: int) -> int: Approach: Bin...
Implement the Python class `SquareRoot` described below. Class description: Implement the SquareRoot class. Method signatures and docstrings: - def results(self, x: int) -> int: Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return: - def result(self, x: int) -> int: Approach: Bin...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class SquareRoot: def results(self, x: int) -> int: """Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return:""" <|body_0|> def result(self, x: int) -> int: """Approach: Binary Search 2 to x // 2 Time Complexity: O(log N) Space Complexi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SquareRoot: def results(self, x: int) -> int: """Approach: Pocket Calculator Time Complexity: O(1) Space Complexity: O(1) :param x: :return:""" from math import e, log if x < 2: return x left = int(e ** (0.5 * log(x))) right = left + 1 return left if...
the_stack_v2_python_sparse
revisited/math_and_strings/math/square_root_x.py
Shiv2157k/leet_code
train
1
82b276e49de0b47e14b4404a108cc2cab7923b18
[ "self.key = 'unknown scr'\nself.interval = 100\nself.start_delay = True\nself.persistent = True", "from evennia.utils.utils import calledby\ncallback = self.db.callback\nif callback:\n callback()\nseconds = real_seconds_until(**self.db.gametime)\nself.start(interval=seconds, force_restart=True)" ]
<|body_start_0|> self.key = 'unknown scr' self.interval = 100 self.start_delay = True self.persistent = True <|end_body_0|> <|body_start_1|> from evennia.utils.utils import calledby callback = self.db.callback if callback: callback() seconds =...
Gametime-sensitive script.
GametimeScript
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GametimeScript: """Gametime-sensitive script.""" def at_script_creation(self): """The script is created.""" <|body_0|> def at_repeat(self): """Call the callback and reset interval.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.key = 'unkn...
stack_v2_sparse_classes_36k_train_012910
10,390
permissive
[ { "docstring": "The script is created.", "name": "at_script_creation", "signature": "def at_script_creation(self)" }, { "docstring": "Call the callback and reset interval.", "name": "at_repeat", "signature": "def at_repeat(self)" } ]
2
null
Implement the Python class `GametimeScript` described below. Class description: Gametime-sensitive script. Method signatures and docstrings: - def at_script_creation(self): The script is created. - def at_repeat(self): Call the callback and reset interval.
Implement the Python class `GametimeScript` described below. Class description: Gametime-sensitive script. Method signatures and docstrings: - def at_script_creation(self): The script is created. - def at_repeat(self): Call the callback and reset interval. <|skeleton|> class GametimeScript: """Gametime-sensitive...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class GametimeScript: """Gametime-sensitive script.""" def at_script_creation(self): """The script is created.""" <|body_0|> def at_repeat(self): """Call the callback and reset interval.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GametimeScript: """Gametime-sensitive script.""" def at_script_creation(self): """The script is created.""" self.key = 'unknown scr' self.interval = 100 self.start_delay = True self.persistent = True def at_repeat(self): """Call the callback and reset ...
the_stack_v2_python_sparse
evennia/contrib/base_systems/custom_gametime/custom_gametime.py
evennia/evennia
train
1,781
01c98ece8d020e1daf205954a6ccbdcf2414de3a
[ "super(PlotsMenuEntry, self).__init__(**params)\nself.plotgroup = plotgroup\nif isinstance(self.plotgroup, FeatureCurvePlotGroup):\n class_ = plotpanel_classes.get(self.plotgroup.name, FeatureCurvePanel)\nself.class_ = plotpanel_classes.get(self.plotgroup.name, class_)", "new_plotgroup = copy.deepcopy(self.plo...
<|body_start_0|> super(PlotsMenuEntry, self).__init__(**params) self.plotgroup = plotgroup if isinstance(self.plotgroup, FeatureCurvePlotGroup): class_ = plotpanel_classes.get(self.plotgroup.name, FeatureCurvePanel) self.class_ = plotpanel_classes.get(self.plotgroup.name, cla...
Stores information about a Plots menu command (including the command itself, and the plotgroup template).
PlotsMenuEntry
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotsMenuEntry: """Stores information about a Plots menu command (including the command itself, and the plotgroup template).""" def __init__(self, plotgroup, class_=TemplatePlotGroupPanel, **params): """Store the template, and set the class that will be created by this menu entry If ...
stack_v2_sparse_classes_36k_train_012911
29,423
permissive
[ { "docstring": "Store the template, and set the class that will be created by this menu entry If users want to extend the Plot Panel classes, then they should add entries to the plotpanel_classes dictionary. If no entry is defined there, then the default class is used. The class_ is overridden for any special c...
2
stack_v2_sparse_classes_30k_train_000908
Implement the Python class `PlotsMenuEntry` described below. Class description: Stores information about a Plots menu command (including the command itself, and the plotgroup template). Method signatures and docstrings: - def __init__(self, plotgroup, class_=TemplatePlotGroupPanel, **params): Store the template, and ...
Implement the Python class `PlotsMenuEntry` described below. Class description: Stores information about a Plots menu command (including the command itself, and the plotgroup template). Method signatures and docstrings: - def __init__(self, plotgroup, class_=TemplatePlotGroupPanel, **params): Store the template, and ...
1e097e2df9938a6ce9f48cefbf25672cbbf9a4db
<|skeleton|> class PlotsMenuEntry: """Stores information about a Plots menu command (including the command itself, and the plotgroup template).""" def __init__(self, plotgroup, class_=TemplatePlotGroupPanel, **params): """Store the template, and set the class that will be created by this menu entry If ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotsMenuEntry: """Stores information about a Plots menu command (including the command itself, and the plotgroup template).""" def __init__(self, plotgroup, class_=TemplatePlotGroupPanel, **params): """Store the template, and set the class that will be created by this menu entry If users want to...
the_stack_v2_python_sparse
topo/tkgui/topoconsole.py
ioam/topographica
train
43
150d86011742bac399d67bd7567753291e52d81f
[ "self.left = []\nself.right = []\nself.lc, self.rc = (0, 0)", "if self.lc == 0:\n heappush(self.left, -num)\n self.lc += 1\nelif num <= -self.left[0] and self.lc == self.rc:\n heappush(self.left, -num)\n self.lc += 1\nelif num <= -self.left[0] and self.lc == self.rc + 1:\n heappush(self.left, -num)...
<|body_start_0|> self.left = [] self.right = [] self.lc, self.rc = (0, 0) <|end_body_0|> <|body_start_1|> if self.lc == 0: heappush(self.left, -num) self.lc += 1 elif num <= -self.left[0] and self.lc == self.rc: heappush(self.left, -num) ...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_012912
1,378
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
null
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
3bfee704adb1d94efc8e531b732cf06c4f8aef0f
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.left = [] self.right = [] self.lc, self.rc = (0, 0) def addNum(self, num): """:type num: int :rtype: void""" if self.lc == 0: heappush(self.left, -num) ...
the_stack_v2_python_sparse
stream_median.py
zopepy/leetcode
train
0
4f4f530cda1eff18842990d24468d879711a7aa1
[ "self.input_type = input_type\nif self.input_type == 'file':\n self.raw_EEG_obj = mne.io.read_raw_fif(file_path, preload=True)\n max_time = self.raw_EEG_obj.times.max()\n self.raw_EEG_obj.crop(28, max_time)\n self.raw_EEG_obj\n self.timestamp = 0.0\n cal_raw = self.raw_EEG_obj.copy()\n cal_raw ...
<|body_start_0|> self.input_type = input_type if self.input_type == 'file': self.raw_EEG_obj = mne.io.read_raw_fif(file_path, preload=True) max_time = self.raw_EEG_obj.times.max() self.raw_EEG_obj.crop(28, max_time) self.raw_EEG_obj self.timest...
This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.
EEGReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'f...
stack_v2_sparse_classes_36k_train_012913
16,328
permissive
[ { "docstring": "Arguments: input_type: 'file' indicates that the stream is from file. In other case, the stream will from the 'Emotiv insight' device.", "name": "__init__", "signature": "def __init__(self, input_type, file_path=None)" }, { "docstring": "Return: EEG data: the EEG data timestamp: ...
2
stack_v2_sparse_classes_30k_train_001879
Implement the Python class `EEGReader` described below. Class description: This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features. Method signatures and docstrings: - def __init__(sel...
Implement the Python class `EEGReader` described below. Class description: This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features. Method signatures and docstrings: - def __init__(sel...
531f646dcb493dce2575af3b9d77403ebc1f4a35
<|skeleton|> class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EEGReader: """This class is used to return the EEG data in real time. Attribute: raw_EEG_obj: the data for file input. MNE object. timestamp: the current time. how much second. features: the EEG features.""" def __init__(self, input_type, file_path=None): """Arguments: input_type: 'file' indicate...
the_stack_v2_python_sparse
MindLink-Eumpy/real_time_detection/GUI/MLE_tool/tool.py
wozu-dichter/MindLink-Explorer
train
0
3e9ec4b03d342eeccacfef72c5a9b35ab1b56fe5
[ "for member in [self.team1_admin, self.team1_member, self.common_member]:\n self.client.force_login(member)\n response = self.client.get(self.list_url)\n self.assertContains(response, 'Categories for %s' % self.team1.name, status_code=200)\n for category in self.team1.categories.all():\n self.ass...
<|body_start_0|> for member in [self.team1_admin, self.team1_member, self.common_member]: self.client.force_login(member) response = self.client.get(self.list_url) self.assertContains(response, 'Categories for %s' % self.team1.name, status_code=200) for category i...
Test CategoryListView
CategoryListViewTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryListViewTest: """Test CategoryListView""" def test_category_list_member(self): """Assert that all the right categories are listed for the team admin and regular members""" <|body_0|> def test_category_list_nonmember(self): """Assert that non-members can n...
stack_v2_sparse_classes_36k_train_012914
9,408
permissive
[ { "docstring": "Assert that all the right categories are listed for the team admin and regular members", "name": "test_category_list_member", "signature": "def test_category_list_member(self)" }, { "docstring": "Assert that non-members can not list categories", "name": "test_category_list_no...
2
stack_v2_sparse_classes_30k_train_010612
Implement the Python class `CategoryListViewTest` described below. Class description: Test CategoryListView Method signatures and docstrings: - def test_category_list_member(self): Assert that all the right categories are listed for the team admin and regular members - def test_category_list_nonmember(self): Assert t...
Implement the Python class `CategoryListViewTest` described below. Class description: Test CategoryListView Method signatures and docstrings: - def test_category_list_member(self): Assert that all the right categories are listed for the team admin and regular members - def test_category_list_nonmember(self): Assert t...
b3a61462d46d33de25fb96c029b2bd822001b669
<|skeleton|> class CategoryListViewTest: """Test CategoryListView""" def test_category_list_member(self): """Assert that all the right categories are listed for the team admin and regular members""" <|body_0|> def test_category_list_nonmember(self): """Assert that non-members can n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoryListViewTest: """Test CategoryListView""" def test_category_list_member(self): """Assert that all the right categories are listed for the team admin and regular members""" for member in [self.team1_admin, self.team1_member, self.common_member]: self.client.force_login(...
the_stack_v2_python_sparse
src/category/tests.py
tykling/socialrating
train
3
10629a5bc786ff7bf58c5ff8c27ddcbe824853a8
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('kobesay', 'kobesay')\nrepo.dropCollection('regionincome')\nrepo.createCollection('regionincome')\nitems = {}\nincome2013 = repo.kobesay.income2013.find()\nincome2014 = repo.kobesay.income2014.find()\nfor...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.dropCollection('regionincome') repo.createCollection('regionincome') items = {} income2013 = repo.kobesa...
trans_income
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class trans_income: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ...
stack_v2_sparse_classes_36k_train_012915
4,374
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `trans_income` described below. Class description: Implement the trans_income class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, end...
Implement the Python class `trans_income` described below. Class description: Implement the trans_income class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, end...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class trans_income: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class trans_income: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.drop...
the_stack_v2_python_sparse
kobesay/trans_income.py
lingyigu/course-2017-spr-proj
train
0
4fb616f1eff0b81462979b726a9daecb203ac7b6
[ "self.url = url\nself.vary_headers = vary_headers\nself.max_age = max_age\nself.etag = etag\nself.local_date = local_date\nself.last_modified = last_modified\nself.mime_type = mime_type\nself.item_mime_type = item_mime_type\nself.response_body = response_body", "if self.vary_headers:\n for header, value in six...
<|body_start_0|> self.url = url self.vary_headers = vary_headers self.max_age = max_age self.etag = etag self.local_date = local_date self.last_modified = last_modified self.mime_type = mime_type self.item_mime_type = item_mime_type self.response_b...
An entry in the API Cache.
CacheEntry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheEntry: """An entry in the API Cache.""" def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body): """Create a new cache entry.""" <|body_0|> def matches_request(self, request): """Determine if ...
stack_v2_sparse_classes_36k_train_012916
22,967
permissive
[ { "docstring": "Create a new cache entry.", "name": "__init__", "signature": "def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body)" }, { "docstring": "Determine if the cache entry matches the given request. This is done by comp...
3
null
Implement the Python class `CacheEntry` described below. Class description: An entry in the API Cache. Method signatures and docstrings: - def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body): Create a new cache entry. - def matches_request(self, re...
Implement the Python class `CacheEntry` described below. Class description: An entry in the API Cache. Method signatures and docstrings: - def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body): Create a new cache entry. - def matches_request(self, re...
b106c84c274c59f7944ba5bf7706d865c78a3408
<|skeleton|> class CacheEntry: """An entry in the API Cache.""" def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body): """Create a new cache entry.""" <|body_0|> def matches_request(self, request): """Determine if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CacheEntry: """An entry in the API Cache.""" def __init__(self, url, vary_headers, max_age, etag, local_date, last_modified, mime_type, item_mime_type, response_body): """Create a new cache entry.""" self.url = url self.vary_headers = vary_headers self.max_age = max_age ...
the_stack_v2_python_sparse
rbtools/api/cache.py
anirudha-banerjee/rbtools
train
1
689753e528cb848070184d6cf67cc9fefa97ba26
[ "player_index = 11\nconst.CENTER_SEER_PROB = 1\ngame_roles = list(large_game_roles)\nexpected = (Statement('I am a Seer and I saw that Center 1 was a Insomniac and that Center 0 was a Troublemaker.', ((11, frozenset({Role.SEER})), (13, frozenset({Role.INSOMNIAC})), (12, frozenset({Role.TROUBLEMAKER})))),)\nseer = S...
<|body_start_0|> player_index = 11 const.CENTER_SEER_PROB = 1 game_roles = list(large_game_roles) expected = (Statement('I am a Seer and I saw that Center 1 was a Insomniac and that Center 0 was a Troublemaker.', ((11, frozenset({Role.SEER})), (13, frozenset({Role.INSOMNIAC})), (12, froz...
Tests for the Seer player class.
TestSeer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSeer: """Tests for the Seer player class.""" def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None: """Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index where the true Seer is located.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012917
5,203
permissive
[ { "docstring": "Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index where the true Seer is located.", "name": "test_awake_init_center_choice", "signature": "def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_007844
Implement the Python class `TestSeer` described below. Class description: Tests for the Seer player class. Method signatures and docstrings: - def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None: Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index wh...
Implement the Python class `TestSeer` described below. Class description: Tests for the Seer player class. Method signatures and docstrings: - def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None: Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index wh...
6e91c2f24e72f9374c4f703bd966963ea6626e8e
<|skeleton|> class TestSeer: """Tests for the Seer player class.""" def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None: """Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index where the true Seer is located.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSeer: """Tests for the Seer player class.""" def test_awake_init_center_choice(large_game_roles: tuple[Role, ...]) -> None: """Should initialize a Seer. Note that the player_index of the Seer is not necessarily the index where the true Seer is located.""" player_index = 11 con...
the_stack_v2_python_sparse
unit_test/roles/village/seer_test.py
srijan-deepsource/wolfbot
train
0
cb73cea591e0d168961d515e34ec60e34661ebfb
[ "if not string or len(string) != 2:\n return None\nvalue, suit = (string[0], string[1])\nmapped_value = self.VALUE_MAP.get(value)\nif not mapped_value:\n mapped_value = int(value)\nmapped_suit = self.SUIT_MAP.get(suit)\ntry:\n return Card(mapped_value, mapped_suit)\nexcept:\n return None", "if not tok...
<|body_start_0|> if not string or len(string) != 2: return None value, suit = (string[0], string[1]) mapped_value = self.VALUE_MAP.get(value) if not mapped_value: mapped_value = int(value) mapped_suit = self.SUIT_MAP.get(suit) try: retu...
Creates our internal cards from text strings
CardBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CardBuilder: """Creates our internal cards from text strings""" def from_2char(self, string): """Returns a Card from a 2-char token like 9c""" <|body_0|> def from_list(self, token_string): """Returns a list of Cards from a string token like [Ah,9d]""" <|b...
stack_v2_sparse_classes_36k_train_012918
8,250
permissive
[ { "docstring": "Returns a Card from a 2-char token like 9c", "name": "from_2char", "signature": "def from_2char(self, string)" }, { "docstring": "Returns a list of Cards from a string token like [Ah,9d]", "name": "from_list", "signature": "def from_list(self, token_string)" }, { ...
3
stack_v2_sparse_classes_30k_train_011830
Implement the Python class `CardBuilder` described below. Class description: Creates our internal cards from text strings Method signatures and docstrings: - def from_2char(self, string): Returns a Card from a 2-char token like 9c - def from_list(self, token_string): Returns a list of Cards from a string token like [...
Implement the Python class `CardBuilder` described below. Class description: Creates our internal cards from text strings Method signatures and docstrings: - def from_2char(self, string): Returns a Card from a 2-char token like 9c - def from_list(self, token_string): Returns a list of Cards from a string token like [...
5e7241efac1b0757f39c28f6d485f4d79960095b
<|skeleton|> class CardBuilder: """Creates our internal cards from text strings""" def from_2char(self, string): """Returns a Card from a 2-char token like 9c""" <|body_0|> def from_list(self, token_string): """Returns a list of Cards from a string token like [Ah,9d]""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CardBuilder: """Creates our internal cards from text strings""" def from_2char(self, string): """Returns a Card from a 2-char token like 9c""" if not string or len(string) != 2: return None value, suit = (string[0], string[1]) mapped_value = self.VALUE_MAP.get(...
the_stack_v2_python_sparse
pokeher/theaigame.py
gnmerritt/poker
train
5
312ccc24cdc8f42b27148182b20509d11ae9afc8
[ "self.orgnr_field = orgnr_field\nself.status_kode_field = status_kode_field\nself.status_tekst_field = status_tekst_field\nself.status_dato_field = APIHelper.RFC3339DateTime(status_dato_field) if status_dato_field else None\nself.navn_field = navn_field\nself.selsk_form_field = selsk_form_field\nself.rolle_field = ...
<|body_start_0|> self.orgnr_field = orgnr_field self.status_kode_field = status_kode_field self.status_tekst_field = status_tekst_field self.status_dato_field = APIHelper.RFC3339DateTime(status_dato_field) if status_dato_field else None self.navn_field = navn_field self.s...
Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (string): TODO: type description here. status_dato_field (datetime): TODO: type description h...
PersonNaringsInteresser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonNaringsInteresser: """Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (string): TODO: type description here. sta...
stack_v2_sparse_classes_36k_train_012919
4,712
permissive
[ { "docstring": "Constructor for the PersonNaringsInteresser class", "name": "__init__", "signature": "def __init__(self, orgnr_field=None, status_kode_field=None, status_tekst_field=None, status_dato_field=None, navn_field=None, selsk_form_field=None, rolle_field=None, eierandel_field=None, verv_kode_fi...
2
null
Implement the Python class `PersonNaringsInteresser` described below. Class description: Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (st...
Implement the Python class `PersonNaringsInteresser` described below. Class description: Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (st...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PersonNaringsInteresser: """Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (string): TODO: type description here. sta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonNaringsInteresser: """Implementation of the 'Person.NaringsInteresser' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. status_kode_field (string): TODO: type description here. status_tekst_field (string): TODO: type description here. status_dato_fiel...
the_stack_v2_python_sparse
idfy_rest_client/models/person_narings_interesser.py
dealflowteam/Idfy
train
0
3248b044a38f8f177a84c24d2eda205f09e9c038
[ "diagnostic = DuctStaticAIRCx()\nif isinstance(diagnostic, DuctStaticAIRCx):\n assert True\nelse:\n assert False", "diagnostic = DuctStaticAIRCx()\ndata_window = td(minutes=1)\ndiagnostic.set_class_values({}, 1, data_window, False, {}, 4.0, 4.0, {}, {}, {}, 3, 'test', 'test_c', [])\nassert diagnostic.data_w...
<|body_start_0|> diagnostic = DuctStaticAIRCx() if isinstance(diagnostic, DuctStaticAIRCx): assert True else: assert False <|end_body_0|> <|body_start_1|> diagnostic = DuctStaticAIRCx() data_window = td(minutes=1) diagnostic.set_class_values({}, 1...
Contains all the tests for DuctStaticAIRCx Diagnostic
TestDiagnosticsDuctStaticAIRCx
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDiagnosticsDuctStaticAIRCx: """Contains all the tests for DuctStaticAIRCx Diagnostic""" def test_duct_static_dx_creation(self): """test the creation of duct static diagnostic class""" <|body_0|> def test_duct_static_dx_set_class_values(self): """test the crea...
stack_v2_sparse_classes_36k_train_012920
14,928
permissive
[ { "docstring": "test the creation of duct static diagnostic class", "name": "test_duct_static_dx_creation", "signature": "def test_duct_static_dx_creation(self)" }, { "docstring": "test the creation of duct static diagnostic class", "name": "test_duct_static_dx_set_class_values", "signat...
6
null
Implement the Python class `TestDiagnosticsDuctStaticAIRCx` described below. Class description: Contains all the tests for DuctStaticAIRCx Diagnostic Method signatures and docstrings: - def test_duct_static_dx_creation(self): test the creation of duct static diagnostic class - def test_duct_static_dx_set_class_values...
Implement the Python class `TestDiagnosticsDuctStaticAIRCx` described below. Class description: Contains all the tests for DuctStaticAIRCx Diagnostic Method signatures and docstrings: - def test_duct_static_dx_creation(self): test the creation of duct static diagnostic class - def test_duct_static_dx_set_class_values...
24d50729aef8d91036cc13b0f5c03be76f3237ed
<|skeleton|> class TestDiagnosticsDuctStaticAIRCx: """Contains all the tests for DuctStaticAIRCx Diagnostic""" def test_duct_static_dx_creation(self): """test the creation of duct static diagnostic class""" <|body_0|> def test_duct_static_dx_set_class_values(self): """test the crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDiagnosticsDuctStaticAIRCx: """Contains all the tests for DuctStaticAIRCx Diagnostic""" def test_duct_static_dx_creation(self): """test the creation of duct static diagnostic class""" diagnostic = DuctStaticAIRCx() if isinstance(diagnostic, DuctStaticAIRCx): assert...
the_stack_v2_python_sparse
EnergyEfficiency/AirsideRCxAgent/airside/test.py
shwethanidd/volttron-pnnl-applications-2
train
0
04164599d53bdbebca30700f26d746cfa9a95deb
[ "l = len(xy)\nif l > 1:\n raise Exception('too many points provided\\ninstance should only be located at one point')\nelif l < 1:\n raise Exception('no point provided\\ninstance should be located at a point')\nself.layer = layer\nself.textType = textType\nself.xy = xy[0]\nself.string = string\nself.strans = 0...
<|body_start_0|> l = len(xy) if l > 1: raise Exception('too many points provided\ninstance should only be located at one point') elif l < 1: raise Exception('no point provided\ninstance should be located at a point') self.layer = layer self.textType = text...
Text object for GDSIO
Text
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Text: """Text object for GDSIO""" def __init__(self, layer, textType, xy, string, textHeight=100): """Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array xy coordinates for Text Object string : str Text object d...
stack_v2_sparse_classes_36k_train_012921
18,791
permissive
[ { "docstring": "Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array xy coordinates for Text Object string : str Text object display string", "name": "__init__", "signature": "def __init__(self, layer, textType, xy, string, textHeig...
2
null
Implement the Python class `Text` described below. Class description: Text object for GDSIO Method signatures and docstrings: - def __init__(self, layer, textType, xy, string, textHeight=100): Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array ...
Implement the Python class `Text` described below. Class description: Text object for GDSIO Method signatures and docstrings: - def __init__(self, layer, textType, xy, string, textHeight=100): Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array ...
8f62ec1971480cb27cb592421fd97f590379cff9
<|skeleton|> class Text: """Text object for GDSIO""" def __init__(self, layer, textType, xy, string, textHeight=100): """Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array xy coordinates for Text Object string : str Text object d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Text: """Text object for GDSIO""" def __init__(self, layer, textType, xy, string, textHeight=100): """Initialize Text object Parameters ---------- layer : int Layer id textType : int I'm not really sure what this is xy : array xy coordinates for Text Object string : str Text object display string...
the_stack_v2_python_sparse
GDSIO.py
ucb-art/laygo
train
24
8afbcf0cd7c8848a88f3a9e7f9f17a090479c30d
[ "category = Category.objects.all()\nserializer = CategorySerializer(category, many=True)\nreturn Response(serializer.data)", "serializer = CategorySerializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREATED)\nreturn Response(...
<|body_start_0|> category = Category.objects.all() serializer = CategorySerializer(category, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> serializer = CategorySerializer(data=request.data) if serializer.is_valid(): serializer.save() ...
List all categories, or create a new category.
CategoryList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryList: """List all categories, or create a new category.""" def get(self, request, format=None): """The default get method, i.e on page load""" <|body_0|> def post(self, request, format=None): """The default post method.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_012922
4,310
permissive
[ { "docstring": "The default get method, i.e on page load", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "The default post method.", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_017646
Implement the Python class `CategoryList` described below. Class description: List all categories, or create a new category. Method signatures and docstrings: - def get(self, request, format=None): The default get method, i.e on page load - def post(self, request, format=None): The default post method.
Implement the Python class `CategoryList` described below. Class description: List all categories, or create a new category. Method signatures and docstrings: - def get(self, request, format=None): The default get method, i.e on page load - def post(self, request, format=None): The default post method. <|skeleton|> ...
b0635e72338e14dad24f1ee0329212cd60a3e83a
<|skeleton|> class CategoryList: """List all categories, or create a new category.""" def get(self, request, format=None): """The default get method, i.e on page load""" <|body_0|> def post(self, request, format=None): """The default post method.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoryList: """List all categories, or create a new category.""" def get(self, request, format=None): """The default get method, i.e on page load""" category = Category.objects.all() serializer = CategorySerializer(category, many=True) return Response(serializer.data) ...
the_stack_v2_python_sparse
links/views.py
faisaltheparttimecoder/carelogBackend
train
1
edcf493c7fba8c06cb7cb56c049b26e05fe694bc
[ "super().__init__(env, learner_config, session_config)\nself._ob = None\nself.n_step = self.learner_config.algo.n_step\nself.stride = self.learner_config.algo.stride\nif self.stride < 1:\n raise ConfigError('stride {} for experience generation cannot be less than 1'.format(self.learner_config.algo.stride))\nself...
<|body_start_0|> super().__init__(env, learner_config, session_config) self._ob = None self.n_step = self.learner_config.algo.n_step self.stride = self.learner_config.algo.stride if self.stride < 1: raise ConfigError('stride {} for experience generation cannot be less...
Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persistent_infos': [infolist_1, ...], 'onetime_infos': [infos], 'infos': [info_1, ...], 'n_step': n } Note: distinction ...
ExpSenderWrapperMultiStepMovingWindowWithInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpSenderWrapperMultiStepMovingWindowWithInfo: """Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persistent_infos': [infolist_1, ...], 'onetime_...
stack_v2_sparse_classes_36k_train_012923
11,762
permissive
[ { "docstring": "Consturctor for ExpSenderWrapperMultiStepMovingWindowWithInfo class Important Attributes: _ob: holds the state at current timestep n_step: maximum number of previous states to keep stride: stride for moving window last_n: queue of max size n_step to hold previous states env: environment to inter...
4
stack_v2_sparse_classes_30k_train_010749
Implement the Python class `ExpSenderWrapperMultiStepMovingWindowWithInfo` described below. Class description: Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persiste...
Implement the Python class `ExpSenderWrapperMultiStepMovingWindowWithInfo` described below. Class description: Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persiste...
2556bd9c362a53e0a94da914ba59b5d4621c4081
<|skeleton|> class ExpSenderWrapperMultiStepMovingWindowWithInfo: """Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persistent_infos': [infolist_1, ...], 'onetime_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpSenderWrapperMultiStepMovingWindowWithInfo: """Base class for all classes that send experience in format { 'obs': [state_1, ..., state_n] 'obs_next': [state_{n + 1}] 'actions': [action_1, ...], 'rewards': [reward_1, ...], 'dones': [done_1, ...], 'persistent_infos': [infolist_1, ...], 'onetime_infos': [info...
the_stack_v2_python_sparse
surreal/env/exp_sender_wrapper.py
PeihongYu/surreal
train
0
7586fb2707608a5bf00216bc9b9672e78b73bddc
[ "bdm = block_matrix.BlockDiagonalMatrix(block_shape=(2, 3), block_rows=3)\nself.assertEqual(bdm.num_blocks, 3)\nself.assertEqual(bdm.block_size, 6)\nself.assertEqual(bdm.input_size, 18)\noutput = bdm(create_input(bdm.input_size))\nwith self.test_session() as sess:\n result = sess.run(output)\nexpected = np.array...
<|body_start_0|> bdm = block_matrix.BlockDiagonalMatrix(block_shape=(2, 3), block_rows=3) self.assertEqual(bdm.num_blocks, 3) self.assertEqual(bdm.block_size, 6) self.assertEqual(bdm.input_size, 18) output = bdm(create_input(bdm.input_size)) with self.test_session() as se...
BlockDiagonalMatrixTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockDiagonalMatrixTest: def test_default(self): """Tests BlockDiagonalMatrix.""" <|body_0|> def test_properties(self): """Tests properties of BlockDiagonalMatrix.""" <|body_1|> <|end_skeleton|> <|body_start_0|> bdm = block_matrix.BlockDiagonalMatri...
stack_v2_sparse_classes_36k_train_012924
6,567
permissive
[ { "docstring": "Tests BlockDiagonalMatrix.", "name": "test_default", "signature": "def test_default(self)" }, { "docstring": "Tests properties of BlockDiagonalMatrix.", "name": "test_properties", "signature": "def test_properties(self)" } ]
2
null
Implement the Python class `BlockDiagonalMatrixTest` described below. Class description: Implement the BlockDiagonalMatrixTest class. Method signatures and docstrings: - def test_default(self): Tests BlockDiagonalMatrix. - def test_properties(self): Tests properties of BlockDiagonalMatrix.
Implement the Python class `BlockDiagonalMatrixTest` described below. Class description: Implement the BlockDiagonalMatrixTest class. Method signatures and docstrings: - def test_default(self): Tests BlockDiagonalMatrix. - def test_properties(self): Tests properties of BlockDiagonalMatrix. <|skeleton|> class BlockDi...
4e28fdf2ffd0eaefc0d23049106609421c9290b0
<|skeleton|> class BlockDiagonalMatrixTest: def test_default(self): """Tests BlockDiagonalMatrix.""" <|body_0|> def test_properties(self): """Tests properties of BlockDiagonalMatrix.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockDiagonalMatrixTest: def test_default(self): """Tests BlockDiagonalMatrix.""" bdm = block_matrix.BlockDiagonalMatrix(block_shape=(2, 3), block_rows=3) self.assertEqual(bdm.num_blocks, 3) self.assertEqual(bdm.block_size, 6) self.assertEqual(bdm.input_size, 18) ...
the_stack_v2_python_sparse
sunset/sunset/python/modules/block_matrix_test.py
SynthAI/SynthAI
train
3
5b9818a598ab106f3ecb355efacb3e99c5cf1a75
[ "num_rows = args.get('rows') or 100\nquery = g.db.query(MachineGroup)\nif args.get('name'):\n query = query.filter(MachineGroup.name == args['name'])\nquery = query.order_by(-MachineGroup.machinegroup_id)\nquery = query.limit(num_rows)\nrows = query.all()\nret = []\nfor row in rows:\n record = row.as_dict()\n...
<|body_start_0|> num_rows = args.get('rows') or 100 query = g.db.query(MachineGroup) if args.get('name'): query = query.filter(MachineGroup.name == args['name']) query = query.order_by(-MachineGroup.machinegroup_id) query = query.limit(num_rows) rows = query.a...
MachineGroupsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineGroupsAPI: def get(self, args): """Get a list of machine groups""" <|body_0|> def post(self, args): """Create machine group""" <|body_1|> <|end_skeleton|> <|body_start_0|> num_rows = args.get('rows') or 100 query = g.db.query(MachineG...
stack_v2_sparse_classes_36k_train_012925
4,597
permissive
[ { "docstring": "Get a list of machine groups", "name": "get", "signature": "def get(self, args)" }, { "docstring": "Create machine group", "name": "post", "signature": "def post(self, args)" } ]
2
stack_v2_sparse_classes_30k_train_003458
Implement the Python class `MachineGroupsAPI` described below. Class description: Implement the MachineGroupsAPI class. Method signatures and docstrings: - def get(self, args): Get a list of machine groups - def post(self, args): Create machine group
Implement the Python class `MachineGroupsAPI` described below. Class description: Implement the MachineGroupsAPI class. Method signatures and docstrings: - def get(self, args): Get a list of machine groups - def post(self, args): Create machine group <|skeleton|> class MachineGroupsAPI: def get(self, args): ...
2771bb46db7fd331448f9db3cfb257fab7f89bcc
<|skeleton|> class MachineGroupsAPI: def get(self, args): """Get a list of machine groups""" <|body_0|> def post(self, args): """Create machine group""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineGroupsAPI: def get(self, args): """Get a list of machine groups""" num_rows = args.get('rows') or 100 query = g.db.query(MachineGroup) if args.get('name'): query = query.filter(MachineGroup.name == args['name']) query = query.order_by(-MachineGroup.ma...
the_stack_v2_python_sparse
driftbase/api/machinegroups.py
directivegames/drift-base
train
1
4d2f34ae516b50bcbba723eda24108ad92f8ce14
[ "if not board or len(board) != 9 or len(board[0]) != 9:\n return False\nfor i in range(9):\n rowFlag = set([])\n colFlag = set([])\n for j in range(9):\n if board[i][j] != '.':\n if board[i][j] in rowFlag:\n return False\n else:\n rowFlag.add(bo...
<|body_start_0|> if not board or len(board) != 9 or len(board[0]) != 9: return False for i in range(9): rowFlag = set([]) colFlag = set([]) for j in range(9): if board[i][j] != '.': if board[i][j] in rowFlag: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字""" <|body_0|> def isValidSudoku2(self, board): """:type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的...
stack_v2_sparse_classes_36k_train_012926
2,678
no_license
[ { "docstring": ":type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字", "name": "isValidSudoku", "signature": "def isValidSudoku(self, board)" }, { "docstring": ":type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不...
2
stack_v2_sparse_classes_30k_train_005530
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字 - def isValidSudoku2(self, board): :type board: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字 - def isValidSudoku2(self, board): :type board: ...
96adb6c04c344e792e35dc70dc45eb76b5402008
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字""" <|body_0|> def isValidSudoku2(self, board): """:type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool 暴力统计Sudoku的两个条件 1. 每一行每一列都不能有相同的数字 2. 每个3*3 的格子不能有相同的数字""" if not board or len(board) != 9 or len(board[0]) != 9: return False for i in range(9): rowFlag = set([]) ...
the_stack_v2_python_sparse
JiQiang/leetcode_py/regular/ValidSudoku36.py
Hearen/AlgorithmHackers
train
10
9ccc326414214310c4e2855ff3a295810c1abcac
[ "text = err_text\nif not fixable:\n option = 'unfixable'\nif option in ['warn', 'exception']:\n pass\nelif option == 'unfixable':\n text = 'Unfixable error: %s' % text\nelse:\n if fix:\n fix()\n text += ' ' + fix_text\nreturn text", "opt = option.lower()\nif opt not in ['fix', 'silentfix', ...
<|body_start_0|> text = err_text if not fixable: option = 'unfixable' if option in ['warn', 'exception']: pass elif option == 'unfixable': text = 'Unfixable error: %s' % text else: if fix: fix() text += '...
Shared methods for verification.
_Verify
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" <|body_0|> def verify(self, option='warn'): """Verify all values in t...
stack_v2_sparse_classes_36k_train_012927
3,589
permissive
[ { "docstring": "Execute the verification with selected option.", "name": "run_option", "signature": "def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True)" }, { "docstring": "Verify all values in the instance. Parameters ---------- option : str Output verifi...
2
stack_v2_sparse_classes_30k_train_010124
Implement the Python class `_Verify` described below. Class description: Shared methods for verification. Method signatures and docstrings: - def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): Execute the verification with selected option. - def verify(self, option='warn'): V...
Implement the Python class `_Verify` described below. Class description: Shared methods for verification. Method signatures and docstrings: - def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): Execute the verification with selected option. - def verify(self, option='warn'): V...
8876e902f5efa02a3fc27d82fe15c16001d4df5e
<|skeleton|> class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" <|body_0|> def verify(self, option='warn'): """Verify all values in t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" text = err_text if not fixable: option = 'unfixable' if option in [...
the_stack_v2_python_sparse
astropy/io/fits/verify.py
xiaomi1122/astropy
train
0
95267be1237e8d6ef46e64da9f04253cf00d8c79
[ "sum_a = sum(A)\nsum_b = sum(B)\ndiff = (sum_a - sum_b) // 2\nfor i in A:\n if i - diff in B:\n return [i, i - diff]", "sum_a = sum(A)\nsum_b = sum(B)\nd = {}\ndiff = (sum_a - sum_b) // 2\nfor i in A:\n d[i - diff] = i\nfor j in B:\n if j in d:\n return [d[j], j]" ]
<|body_start_0|> sum_a = sum(A) sum_b = sum(B) diff = (sum_a - sum_b) // 2 for i in A: if i - diff in B: return [i, i - diff] <|end_body_0|> <|body_start_1|> sum_a = sum(A) sum_b = sum(B) d = {} diff = (sum_a - sum_b) // 2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fairCandySwap(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int] TLE""" <|body_0|> def fairCandySwap2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int] 88ms beats: ?""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_012928
730
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int] TLE", "name": "fairCandySwap", "signature": "def fairCandySwap(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int] 88ms beats: ?", "name": "fairCandySwap2", "signature": "def fairC...
2
stack_v2_sparse_classes_30k_train_015714
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fairCandySwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] TLE - def fairCandySwap2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fairCandySwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] TLE - def fairCandySwap2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[in...
624975f767f6efa1d7361cc077eaebc344d57210
<|skeleton|> class Solution: def fairCandySwap(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int] TLE""" <|body_0|> def fairCandySwap2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int] 88ms beats: ?""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fairCandySwap(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int] TLE""" sum_a = sum(A) sum_b = sum(B) diff = (sum_a - sum_b) // 2 for i in A: if i - diff in B: return [i, i - diff] def fairCandySwap2(se...
the_stack_v2_python_sparse
888. 公平的糖果交换.py
dx19910707/LeetCode
train
0
45da954dc536c1850bf94b989c475679d214e3f6
[ "ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance)\nself.component_name = BLINKER\nself.CREATION_EXTENSION = 'bli.i'\nself.RETRIEVAL_EXTENSION = 'bli.o'", "for fragment in self.fragments:\n base = fragment[0]\n infile = '%s%s%s.%s' % (self.DIR_DATA, os.sep, base, self.CREATION_EXTENSION)\n ou...
<|body_start_0|> ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance) self.component_name = BLINKER self.CREATION_EXTENSION = 'bli.i' self.RETRIEVAL_EXTENSION = 'bli.o' <|end_body_0|> <|body_start_1|> for fragment in self.fragments: base = fragment[0] ...
Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.
BlinkerWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlinkerWrapper: """Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEV...
stack_v2_sparse_classes_36k_train_012929
1,286
no_license
[ { "docstring": "Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEVAL_EXTENSION.", "name": "__init__", "signature": "def __init__(self, tag, xmldoc, tarsqi_instance)" }, { "docstring": "Apply the Blinker parser to each fragment. No arguments and no return val...
2
stack_v2_sparse_classes_30k_train_014464
Implement the Python class `BlinkerWrapper` described below. Class description: Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables. Method signatures and docstrings: - def __init__(self, tag, xmldoc, tarsqi_instance): Calls __init__ of the base clas...
Implement the Python class `BlinkerWrapper` described below. Class description: Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables. Method signatures and docstrings: - def __init__(self, tag, xmldoc, tarsqi_instance): Calls __init__ of the base clas...
efb55fa054e2313fd710939330a4fbda5634cb41
<|skeleton|> class BlinkerWrapper: """Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEV...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlinkerWrapper: """Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEVAL_EXTENSION....
the_stack_v2_python_sparse
code/components/blinker/wrapper.py
tankle/TARSQI
train
1
493b5ebb86f39fa11f2df305496426af85eb74ee
[ "size = _reset_df_and_get_size(df)\nwith tf.python_io.TFRecordWriter(path) as writer, get_tqdm(total=size) as pbar:\n for dp in df:\n writer.write(dumps(dp))\n pbar.update()", "gen = tf.python_io.tf_record_iterator(path)\nds = DataFromGenerator(gen)\nds = MapData(ds, loads)\nif size is not None:\...
<|body_start_0|> size = _reset_df_and_get_size(df) with tf.python_io.TFRecordWriter(path) as writer, get_tqdm(total=size) as pbar: for dp in df: writer.write(dumps(dp)) pbar.update() <|end_body_0|> <|body_start_1|> gen = tf.python_io.tf_record_iterato...
Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`.
TFRecordSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFRecordSerializer: """Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`.""" def save(df, path): """Args: df...
stack_v2_sparse_classes_36k_train_012930
10,978
permissive
[ { "docstring": "Args: df (DataFlow): the DataFlow to serialize. path (str): output tfrecord file.", "name": "save", "signature": "def save(df, path)" }, { "docstring": "Args: size (int): total number of records. If not provided, the returned dataflow will have no `__len__()`. It's needed because...
2
null
Implement the Python class `TFRecordSerializer` described below. Class description: Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`. Method ...
Implement the Python class `TFRecordSerializer` described below. Class description: Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`. Method ...
1547a54e8546494614ca31c984a1bfd1d0e24b77
<|skeleton|> class TFRecordSerializer: """Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`.""" def save(df, path): """Args: df...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFRecordSerializer: """Serialize datapoints to bytes (by tensorpack's default serializer) and write to a TFRecord file. Note that TFRecord does not support random access and is in fact not very performant. It's better to use :class:`LMDBSerializer`.""" def save(df, path): """Args: df (DataFlow): ...
the_stack_v2_python_sparse
tensorpack/dataflow/serialize.py
tensorpack/tensorpack
train
4,600
8e09b3c90ae813ea92a0fea935d9497c4608d498
[ "super(Encoder, self).__init__()\nself.layers = clones(layer, N)\nself.norm = LayerNorm(layer.size)", "for layer in self.layers:\n x = layer(x, mask)\nreturn self.norm(x)" ]
<|body_start_0|> super(Encoder, self).__init__() self.layers = clones(layer, N) self.norm = LayerNorm(layer.size) <|end_body_0|> <|body_start_1|> for layer in self.layers: x = layer(x, mask) return self.norm(x) <|end_body_1|>
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, layer, N): """param layer: layer to use for Encoer param N: number of layers""" <|body_0|> def forward(self, x, mask): """Encodes the input using self attention param qry_embs: query embeddings param cnd_emb: candidate embedding param qry_...
stack_v2_sparse_classes_36k_train_012931
11,359
no_license
[ { "docstring": "param layer: layer to use for Encoer param N: number of layers", "name": "__init__", "signature": "def __init__(self, layer, N)" }, { "docstring": "Encodes the input using self attention param qry_embs: query embeddings param cnd_emb: candidate embedding param qry_mask: query mas...
2
stack_v2_sparse_classes_30k_train_006635
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, layer, N): param layer: layer to use for Encoer param N: number of layers - def forward(self, x, mask): Encodes the input using self attention param qry_embs: qu...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, layer, N): param layer: layer to use for Encoer param N: number of layers - def forward(self, x, mask): Encodes the input using self attention param qry_embs: qu...
c0b2f83a7d4c0d5fa5effb7584e0e0acc6f877a0
<|skeleton|> class Encoder: def __init__(self, layer, N): """param layer: layer to use for Encoer param N: number of layers""" <|body_0|> def forward(self, x, mask): """Encodes the input using self attention param qry_embs: query embeddings param cnd_emb: candidate embedding param qry_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: def __init__(self, layer, N): """param layer: layer to use for Encoer param N: number of layers""" super(Encoder, self).__init__() self.layers = clones(layer, N) self.norm = LayerNorm(layer.size) def forward(self, x, mask): """Encodes the input using self ...
the_stack_v2_python_sparse
src/main/base_models/architectures/Transformer.py
iesl/institution_hierarchies
train
3
1ff5cf19221fcaf3017c0cc3f48325da8afe2ce5
[ "try:\n db.show_by_id(show_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('show with ID %s not found' % show_id)\ntry:\n episode = db.episode_by_id(ep_id, session)\nexcept NoResultFound:\n raise NotFoundError('episode with ID %s not found' % ep_id)\nif not db.episode_in_show(show_id, ...
<|body_start_0|> try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: episode = db.episode_by_id(ep_id, session) except NoResultFound: raise NotFoundError('episod...
SeriesEpisodeAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesEpisodeAPI: def get(self, show_id, ep_id, session): """Get episode by show ID and episode ID""" <|body_0|> def delete(self, show_id, ep_id, session): """Forgets episode by show ID and episode ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012932
47,001
permissive
[ { "docstring": "Get episode by show ID and episode ID", "name": "get", "signature": "def get(self, show_id, ep_id, session)" }, { "docstring": "Forgets episode by show ID and episode ID", "name": "delete", "signature": "def delete(self, show_id, ep_id, session)" } ]
2
stack_v2_sparse_classes_30k_train_013740
Implement the Python class `SeriesEpisodeAPI` described below. Class description: Implement the SeriesEpisodeAPI class. Method signatures and docstrings: - def get(self, show_id, ep_id, session): Get episode by show ID and episode ID - def delete(self, show_id, ep_id, session): Forgets episode by show ID and episode ...
Implement the Python class `SeriesEpisodeAPI` described below. Class description: Implement the SeriesEpisodeAPI class. Method signatures and docstrings: - def get(self, show_id, ep_id, session): Get episode by show ID and episode ID - def delete(self, show_id, ep_id, session): Forgets episode by show ID and episode ...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class SeriesEpisodeAPI: def get(self, show_id, ep_id, session): """Get episode by show ID and episode ID""" <|body_0|> def delete(self, show_id, ep_id, session): """Forgets episode by show ID and episode ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeriesEpisodeAPI: def get(self, show_id, ep_id, session): """Get episode by show ID and episode ID""" try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: episode =...
the_stack_v2_python_sparse
flexget/components/series/api.py
BrutuZ/Flexget
train
1
22594d9ac41c808537f74574c0e23af762d5b436
[ "num = [i for i in range(n)]\nstart = 0\nwhile len(num) > 1:\n idx = (start + m - 1) % len(num)\n num.pop(idx)\n start = idx\nreturn num[0]", "def f(n, m):\n if n == 1:\n return 0\n x = f(n - 1, m)\n return (m + x) % n\nreturn f(n, m)", "x = 0\nfor i in range(2, n + 1):\n x = (m + x)...
<|body_start_0|> num = [i for i in range(n)] start = 0 while len(num) > 1: idx = (start + m - 1) % len(num) num.pop(idx) start = idx return num[0] <|end_body_0|> <|body_start_1|> def f(n, m): if n == 1: return 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastRemaining(self, n: int, m: int) -> int: """构建数组,计算索引依次删除,时间复杂度较高,待优化""" <|body_0|> def lastRemaining_2(self, n: int, m: int) -> int: """数学+递归""" <|body_1|> def lastRemaining_3(self, n: int, m: int) -> int: """数学+迭代:基于方法2优化而来,节省了...
stack_v2_sparse_classes_36k_train_012933
1,505
no_license
[ { "docstring": "构建数组,计算索引依次删除,时间复杂度较高,待优化", "name": "lastRemaining", "signature": "def lastRemaining(self, n: int, m: int) -> int" }, { "docstring": "数学+递归", "name": "lastRemaining_2", "signature": "def lastRemaining_2(self, n: int, m: int) -> int" }, { "docstring": "数学+迭代:基于方法2优...
3
stack_v2_sparse_classes_30k_train_021674
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastRemaining(self, n: int, m: int) -> int: 构建数组,计算索引依次删除,时间复杂度较高,待优化 - def lastRemaining_2(self, n: int, m: int) -> int: 数学+递归 - def lastRemaining_3(self, n: int, m: int) ->...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastRemaining(self, n: int, m: int) -> int: 构建数组,计算索引依次删除,时间复杂度较高,待优化 - def lastRemaining_2(self, n: int, m: int) -> int: 数学+递归 - def lastRemaining_3(self, n: int, m: int) ->...
0ec1a89e5b1e3d32af4da9693e9e5c36d4cd42eb
<|skeleton|> class Solution: def lastRemaining(self, n: int, m: int) -> int: """构建数组,计算索引依次删除,时间复杂度较高,待优化""" <|body_0|> def lastRemaining_2(self, n: int, m: int) -> int: """数学+递归""" <|body_1|> def lastRemaining_3(self, n: int, m: int) -> int: """数学+迭代:基于方法2优化而来,节省了...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lastRemaining(self, n: int, m: int) -> int: """构建数组,计算索引依次删除,时间复杂度较高,待优化""" num = [i for i in range(n)] start = 0 while len(num) > 1: idx = (start + m - 1) % len(num) num.pop(idx) start = idx return num[0] def lastR...
the_stack_v2_python_sparse
offer/62.py
zhiweiguo/my_leetcode
train
1
656ec15ad24980c88a29429dab8f883bb5d70b9c
[ "self.excluded_disks = excluded_disks\nself.fallback_to_crash_consistent = fallback_to_crash_consistent\nself.skip_physical_rdm_disks = skip_physical_rdm_disks", "if dictionary is None:\n return None\nexcluded_disks = None\nif dictionary.get('excludedDisks') != None:\n excluded_disks = list()\n for struc...
<|body_start_0|> self.excluded_disks = excluded_disks self.fallback_to_crash_consistent = fallback_to_crash_consistent self.skip_physical_rdm_disks = skip_physical_rdm_disks <|end_body_0|> <|body_start_1|> if dictionary is None: return None excluded_disks = None ...
Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list of Disks to be excluded from backing up. These disks are excluded from all Protection Sou...
VmwareEnvJobParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmwareEnvJobParameters: """Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list of Disks to be excluded from backing up...
stack_v2_sparse_classes_36k_train_012934
2,853
permissive
[ { "docstring": "Constructor for the VmwareEnvJobParameters class", "name": "__init__", "signature": "def __init__(self, excluded_disks=None, fallback_to_crash_consistent=None, skip_physical_rdm_disks=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (...
2
null
Implement the Python class `VmwareEnvJobParameters` described below. Class description: Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list ...
Implement the Python class `VmwareEnvJobParameters` described below. Class description: Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VmwareEnvJobParameters: """Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list of Disks to be excluded from backing up...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VmwareEnvJobParameters: """Implementation of the 'VmwareEnvJobParameters' model. Specifies job parameters applicable for all 'kVMware' Environment type Protection Sources in a Protection Job. Attributes: excluded_disks (list of DiskUnit): Specifies the list of Disks to be excluded from backing up. These disks...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vmware_env_job_parameters.py
cohesity/management-sdk-python
train
24
1a2d789c1e15c6edd14e23f3f8e02d9ff93a6dc4
[ "self.jsonld = {'@type': 'ssn-ext:ObservationCollection', 'hasFeatureOfInterest': 'http://example.org/Sample_2', 'madeBySensor': 'http://example.org/s4', 'observedProperty': 'http://example.org/op2', 'phenomenonTime': '_:b13', 'usedProcedure': 'http://example.org/p3', 'hasMember': ['http://example.org/O5', 'http://...
<|body_start_0|> self.jsonld = {'@type': 'ssn-ext:ObservationCollection', 'hasFeatureOfInterest': 'http://example.org/Sample_2', 'madeBySensor': 'http://example.org/s4', 'observedProperty': 'http://example.org/op2', 'phenomenonTime': '_:b13', 'usedProcedure': 'http://example.org/p3', 'hasMember': ['http://examp...
Create SSN-EXT Observation Collection
ObservationCollection
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservationCollection: """Create SSN-EXT Observation Collection""" def __init__(self, comment): """instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: an observation collection: a collection of all observation...
stack_v2_sparse_classes_36k_train_012935
2,121
permissive
[ { "docstring": "instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: an observation collection: a collection of all observations performed", "name": "__init__", "signature": "def __init__(self, comment)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_test_000298
Implement the Python class `ObservationCollection` described below. Class description: Create SSN-EXT Observation Collection Method signatures and docstrings: - def __init__(self, comment): instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: a...
Implement the Python class `ObservationCollection` described below. Class description: Create SSN-EXT Observation Collection Method signatures and docstrings: - def __init__(self, comment): instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: a...
1993668bd75bc882286da818955a40dd01d2f7c6
<|skeleton|> class ObservationCollection: """Create SSN-EXT Observation Collection""" def __init__(self, comment): """instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: an observation collection: a collection of all observation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservationCollection: """Create SSN-EXT Observation Collection""" def __init__(self, comment): """instantiating Observation Collection Args: label, comment (literal): label and comment for the observation collection Returns: an observation collection: a collection of all observations performed""...
the_stack_v2_python_sparse
PySOSA/ObservationCollection.py
landrs-toolkit/PySOSA
train
1
863777be6a8136dd8144abda04eea8a9265533b8
[ "data = {}\nif command is not None:\n data['_command'] = command\nfor size, name, _opt in payload_option:\n if size == SMPayloadType.PACKET and name in values:\n data[name] = values[name].json\n continue\n if isinstance(size.value, int):\n default = 0\n else:\n default = size...
<|body_start_0|> data = {} if command is not None: data['_command'] = command for size, name, _opt in payload_option: if size == SMPayloadType.PACKET and name in values: data[name] = values[name].json continue if isinstance(size...
JSON encoder to encode data in the stepmania protocol
JSONEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONEncoder: """JSON encoder to encode data in the stepmania protocol""" def encode(cls, values, payload_option, command=None): """Encode values in a correct json payload""" <|body_0|> def decode(cls, payload, payload_option): """Decode a payload in a valid dict ...
stack_v2_sparse_classes_36k_train_012936
14,049
permissive
[ { "docstring": "Encode values in a correct json payload", "name": "encode", "signature": "def encode(cls, values, payload_option, command=None)" }, { "docstring": "Decode a payload in a valid dict given the payload option", "name": "decode", "signature": "def decode(cls, payload, payload...
2
stack_v2_sparse_classes_30k_train_010343
Implement the Python class `JSONEncoder` described below. Class description: JSON encoder to encode data in the stepmania protocol Method signatures and docstrings: - def encode(cls, values, payload_option, command=None): Encode values in a correct json payload - def decode(cls, payload, payload_option): Decode a pay...
Implement the Python class `JSONEncoder` described below. Class description: JSON encoder to encode data in the stepmania protocol Method signatures and docstrings: - def encode(cls, values, payload_option, command=None): Encode values in a correct json payload - def decode(cls, payload, payload_option): Decode a pay...
cf20b363ed3d7bcb75101b17870e876a857ecd66
<|skeleton|> class JSONEncoder: """JSON encoder to encode data in the stepmania protocol""" def encode(cls, values, payload_option, command=None): """Encode values in a correct json payload""" <|body_0|> def decode(cls, payload, payload_option): """Decode a payload in a valid dict ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONEncoder: """JSON encoder to encode data in the stepmania protocol""" def encode(cls, values, payload_option, command=None): """Encode values in a correct json payload""" data = {} if command is not None: data['_command'] = command for size, name, _opt in pa...
the_stack_v2_python_sparse
smserver/smutils/smpacket/smencoder.py
Moutix/stepmania-server
train
4
86ad86dc5c5dd74a17fd41fd0ddb73160d3f284f
[ "result = ''\nfor ch in mystring:\n if ch.isdigit() or ch == '-':\n result += ch\nreturn result", "schools_urls_xpath = '//*[@id=\"phmain_0_AllResults\"]/ul/li/span[1]/a/@href'\nschools_urls = response.xpath(schools_urls_xpath).extract()\nfor url in schools_urls:\n yield scrapy.Request(response.urljo...
<|body_start_0|> result = '' for ch in mystring: if ch.isdigit() or ch == '-': result += ch return result <|end_body_0|> <|body_start_1|> schools_urls_xpath = '//*[@id="phmain_0_AllResults"]/ul/li/span[1]/a/@href' schools_urls = response.xpath(schools...
a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found
MontrealCsmbSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it ta...
stack_v2_sparse_classes_36k_train_012937
3,988
no_license
[ { "docstring": "it takes a sting conains some digits then return the only digits", "name": "digits_only", "signature": "def digits_only(self, mystring)" }, { "docstring": "get all schools urls then yield a Request for each one.", "name": "parse", "signature": "def parse(self, response)" ...
3
stack_v2_sparse_classes_30k_train_011228
Implement the Python class `MontrealCsmbSpider` described below. Class description: a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatures...
Implement the Python class `MontrealCsmbSpider` described below. Class description: a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method signatures...
350264cf6da323692c2838d8cb235ef61085851b
<|skeleton|> class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it ta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MontrealCsmbSpider: """a scrapy spider to crawl csmb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def digits_only(self, mystring): """it takes a sting c...
the_stack_v2_python_sparse
school_scraping/spiders/montreal_csmb.py
ramadanmostafa/canada_school_scraping
train
0
e3d08c81142929b34f52d3bab71457e6b8894706
[ "idx1, idx2 = (-1, -1)\nrst = len(words)\nfor idx, word in enumerate(words):\n if word == word1:\n idx1 = idx\n if idx2 != -1:\n rst = min(rst, abs(idx1 - idx2))\n elif word == word2:\n idx2 = idx\n if idx1 != -1:\n rst = min(rst, abs(idx1 - idx2))\nreturn rst...
<|body_start_0|> idx1, idx2 = (-1, -1) rst = len(words) for idx, word in enumerate(words): if word == word1: idx1 = idx if idx2 != -1: rst = min(rst, abs(idx1 - idx2)) elif word == word2: idx2 = idx ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestDistance(self, words, word1, word2): """:type words: List[str] :type word1: str :type word2: str :rtype: int""" <|body_0|> def shortestDistance2(self, words, word1, word2): """:type words: List[str] :type word1: str :type word2: str :rtype: int"...
stack_v2_sparse_classes_36k_train_012938
1,628
no_license
[ { "docstring": ":type words: List[str] :type word1: str :type word2: str :rtype: int", "name": "shortestDistance", "signature": "def shortestDistance(self, words, word1, word2)" }, { "docstring": ":type words: List[str] :type word1: str :type word2: str :rtype: int", "name": "shortestDistanc...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestDistance(self, words, word1, word2): :type words: List[str] :type word1: str :type word2: str :rtype: int - def shortestDistance2(self, words, word1, word2): :type wo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestDistance(self, words, word1, word2): :type words: List[str] :type word1: str :type word2: str :rtype: int - def shortestDistance2(self, words, word1, word2): :type wo...
41365b549f1e6b04aac9f1632a66e71c1e05b322
<|skeleton|> class Solution: def shortestDistance(self, words, word1, word2): """:type words: List[str] :type word1: str :type word2: str :rtype: int""" <|body_0|> def shortestDistance2(self, words, word1, word2): """:type words: List[str] :type word1: str :type word2: str :rtype: int"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestDistance(self, words, word1, word2): """:type words: List[str] :type word1: str :type word2: str :rtype: int""" idx1, idx2 = (-1, -1) rst = len(words) for idx, word in enumerate(words): if word == word1: idx1 = idx ...
the_stack_v2_python_sparse
python practice/Array/243_shortest_word_distance.py
SuzyWu2014/coding-practice
train
1
4eb8ea7c1b562ff154bfa60141a6834c119fc649
[ "i, j = (0, len(node_list) - 1)\nwhile i < j:\n if node_list[i] != node_list[j]:\n return False\n i += 1\n j -= 1\nreturn True", "node_list = []\nif not head:\n return True\nwhile head:\n node_list.append(head.val)\n head = head.next\nreturn self.is_palindrome_list(node_list)" ]
<|body_start_0|> i, j = (0, len(node_list) - 1) while i < j: if node_list[i] != node_list[j]: return False i += 1 j -= 1 return True <|end_body_0|> <|body_start_1|> node_list = [] if not head: return True wh...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_palindrome_list(self, node_list: ListNode) -> bool: """判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值""" <|body_0|> def is_palindrome(self, head: ListNode) -> bool: """返回交点 Args: head: 节点head Returns: 布尔值""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_012939
2,023
permissive
[ { "docstring": "判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值", "name": "is_palindrome_list", "signature": "def is_palindrome_list(self, node_list: ListNode) -> bool" }, { "docstring": "返回交点 Args: head: 节点head Returns: 布尔值", "name": "is_palindrome", "signature": "def is_palindrome(self...
2
stack_v2_sparse_classes_30k_train_013249
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome_list(self, node_list: ListNode) -> bool: 判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值 - def is_palindrome(self, head: ListNode) -> bool: 返回交点 Args: head: 节点h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome_list(self, node_list: ListNode) -> bool: 判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值 - def is_palindrome(self, head: ListNode) -> bool: 返回交点 Args: head: 节点h...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def is_palindrome_list(self, node_list: ListNode) -> bool: """判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值""" <|body_0|> def is_palindrome(self, head: ListNode) -> bool: """返回交点 Args: head: 节点head Returns: 布尔值""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_palindrome_list(self, node_list: ListNode) -> bool: """判断链表是否是回文串 Args: node_list: node链表 Returns: 布尔值""" i, j = (0, len(node_list) - 1) while i < j: if node_list[i] != node_list[j]: return False i += 1 j -= 1 ...
the_stack_v2_python_sparse
src/leetcodepython/list/palindrome_linked_list_234.py
zhangyu345293721/leetcode
train
101
ed4a8d4e4bac5645ff2541d4a57d40adafd1545b
[ "self.graph_creator = create_molecular_torch_geometric_graph\nsuper().__init__(data_path, properties=properties, sanitize=sanitize, file_geometries=file_geometries, optimize_molecule=optimize_molecule)\nself.dataset = TorchGeometricGraphDataset(self.molecular_graphs)\nself.data_loader_fun = tg.data.DataLoader", "...
<|body_start_0|> self.graph_creator = create_molecular_torch_geometric_graph super().__init__(data_path, properties=properties, sanitize=sanitize, file_geometries=file_geometries, optimize_molecule=optimize_molecule) self.dataset = TorchGeometricGraphDataset(self.molecular_graphs) self.d...
Data loader for graph data.
TorchGeometricGraphData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchGeometricGraphData: """Data loader for graph data.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset using grap...
stack_v2_sparse_classes_36k_train_012940
3,077
permissive
[ { "docstring": "Generate a dataset using graphs Parameters ---------- data_path path of the csv file properties Labels names sanitize Check that molecules have a valid conformer file_geometries Path to a file with the geometries in PDB format optimize_molecule Optimize the geometry if the ``file_geometries`` is...
2
stack_v2_sparse_classes_30k_train_002527
Implement the Python class `TorchGeometricGraphData` described below. Class description: Data loader for graph data. Method signatures and docstrings: - def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_mol...
Implement the Python class `TorchGeometricGraphData` described below. Class description: Data loader for graph data. Method signatures and docstrings: - def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_mol...
4edc9dc363ce901b1fcc19444bec42fc5930c4b9
<|skeleton|> class TorchGeometricGraphData: """Data loader for graph data.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset using grap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchGeometricGraphData: """Data loader for graph data.""" def __init__(self, data_path: PathLike, properties: Optional[Union[str, List[str]]]=None, sanitize: bool=True, file_geometries: Optional[PathLike]=None, optimize_molecule: bool=False) -> None: """Generate a dataset using graphs Parameters...
the_stack_v2_python_sparse
swan/dataset/torch_geometric_graph_data.py
nlesc-nano/swan
train
15
581ec5db4a01dac41a9d66756a7b5da45b83e275
[ "namespaces = {'xsi': LT_XSI_NS}\nschemaLocation = etree.QName(LT_XSI_NS, 'schemaLocation')\npayload = etree.Element('RTML', {schemaLocation: LT_SCHEMA_LOCATION}, xmlns=LT_XML_NS, mode='request', uid=format(str(request.id)), version='3.1a', nsmap=namespaces)\nreturn payload", "altdata = request.allocation.altdata...
<|body_start_0|> namespaces = {'xsi': LT_XSI_NS} schemaLocation = etree.QName(LT_XSI_NS, 'schemaLocation') payload = etree.Element('RTML', {schemaLocation: LT_SCHEMA_LOCATION}, xmlns=LT_XML_NS, mode='request', uid=format(str(request.id)), version='3.1a', nsmap=namespaces) return payload ...
An XML structure for LT requests.
LTRequest
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LTRequest: """An XML structure for LT requests.""" def _build_prolog(self, request): """Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.""" <|body_0|> def _build_project(self, payload, request): ...
stack_v2_sparse_classes_36k_train_012941
27,052
permissive
[ { "docstring": "Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.", "name": "_build_prolog", "signature": "def _build_prolog(self, request)" }, { "docstring": "Payload header for all LT queue requests. Parameters ---------- payl...
4
null
Implement the Python class `LTRequest` described below. Class description: An XML structure for LT requests. Method signatures and docstrings: - def _build_prolog(self, request): Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests. - def _build_project(...
Implement the Python class `LTRequest` described below. Class description: An XML structure for LT requests. Method signatures and docstrings: - def _build_prolog(self, request): Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests. - def _build_project(...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class LTRequest: """An XML structure for LT requests.""" def _build_prolog(self, request): """Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.""" <|body_0|> def _build_project(self, payload, request): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LTRequest: """An XML structure for LT requests.""" def _build_prolog(self, request): """Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.""" namespaces = {'xsi': LT_XSI_NS} schemaLocation = etree.QName(LT_XSI_NS, ...
the_stack_v2_python_sparse
skyportal/facility_apis/lt.py
skyportal/skyportal
train
80
fae61a9443a2b013bfcaf57539c0c6bbbdfacb38
[ "self.users = {}\nself.tweetTime = {}\nself.recentMax = 0\nself.time = 0", "if userId not in self.users.keys():\n self.users[userId] = user()\nself.users[userId].tweets.append(tweetId)\nself.tweetTime[tweetId] = self.time\nself.time += 1", "if userId not in self.users.keys():\n return []\nmine = self.user...
<|body_start_0|> self.users = {} self.tweetTime = {} self.recentMax = 0 self.time = 0 <|end_body_0|> <|body_start_1|> if userId not in self.users.keys(): self.users[userId] = user() self.users[userId].tweets.append(tweetId) self.tweetTime[tweetId] = s...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_36k_train_012942
3,131
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet.", "name": "postTweet", "signature": "def postTweet(self, userId: int, tweetId: int) -> None" }, { "docstring": "Retrieve the 10 mos...
5
stack_v2_sparse_classes_30k_train_015150
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
6b24a99e5ce87bca5ec487a996fea80991380293
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.users = {} self.tweetTime = {} self.recentMax = 0 self.time = 0 def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" if userId not in self.use...
the_stack_v2_python_sparse
355设计推特.py
Frodoooo/MyLeetCode
train
0
16d5c13fe9713e83a50b237a68bcdfce220bbacc
[ "scheduler_instance = getattr(self, self._scheduler_field, None)\nif scheduler_instance is None:\n raise WechatyPluginError('there is an error')\nassert isinstance(scheduler_instance, AsyncIOScheduler)\nreturn scheduler_instance", "if getattr(self, self._scheduler_field, None) is not None:\n raise WechatyPu...
<|body_start_0|> scheduler_instance = getattr(self, self._scheduler_field, None) if scheduler_instance is None: raise WechatyPluginError('there is an error') assert isinstance(scheduler_instance, AsyncIOScheduler) return scheduler_instance <|end_body_0|> <|body_start_1|> ...
scheduler mixin for wechaty
WechatySchedulerMixin
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WechatySchedulerMixin: """scheduler mixin for wechaty""" def scheduler(self) -> AsyncIOScheduler: """get the scheduler""" <|body_0|> def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: """set the scheduler Args: scheduler_instance (AsyncIOScheduler...
stack_v2_sparse_classes_36k_train_012943
35,609
permissive
[ { "docstring": "get the scheduler", "name": "scheduler", "signature": "def scheduler(self) -> AsyncIOScheduler" }, { "docstring": "set the scheduler Args: scheduler_instance (AsyncIOScheduler): the instance of the scheduler", "name": "scheduler", "signature": "def scheduler(self, schedul...
4
stack_v2_sparse_classes_30k_train_017196
Implement the Python class `WechatySchedulerMixin` described below. Class description: scheduler mixin for wechaty Method signatures and docstrings: - def scheduler(self) -> AsyncIOScheduler: get the scheduler - def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: set the scheduler Args: scheduler_insta...
Implement the Python class `WechatySchedulerMixin` described below. Class description: scheduler mixin for wechaty Method signatures and docstrings: - def scheduler(self) -> AsyncIOScheduler: get the scheduler - def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: set the scheduler Args: scheduler_insta...
e9a04a98a3b01f287760e2d2a4514e4a80ecd15f
<|skeleton|> class WechatySchedulerMixin: """scheduler mixin for wechaty""" def scheduler(self) -> AsyncIOScheduler: """get the scheduler""" <|body_0|> def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: """set the scheduler Args: scheduler_instance (AsyncIOScheduler...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WechatySchedulerMixin: """scheduler mixin for wechaty""" def scheduler(self) -> AsyncIOScheduler: """get the scheduler""" scheduler_instance = getattr(self, self._scheduler_field, None) if scheduler_instance is None: raise WechatyPluginError('there is an error') ...
the_stack_v2_python_sparse
src/wechaty/plugin.py
wechaty/python-wechaty
train
1,266
387472346d0461269a4b94016b8f09059d456161
[ "self.w = w\nself.total = sum(w)\nself.l = len(w)", "seed = random.randint(1, self.total)\ncur = 0\nfor i in range(self.l):\n cur += self.w[i]\n if cur >= seed:\n return i" ]
<|body_start_0|> self.w = w self.total = sum(w) self.l = len(w) <|end_body_0|> <|body_start_1|> seed = random.randint(1, self.total) cur = 0 for i in range(self.l): cur += self.w[i] if cur >= seed: return i <|end_body_1|>
Solution
[]
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.w = w self.total = sum(w) self.l = len(w) <|end_body_0|> <|body_start_1|> ...
stack_v2_sparse_classes_36k_train_012944
1,297
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_012985
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]""" <|...
fd310ec0a989e003242f1840230aaac150f006f0
<|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.w = w self.total = sum(w) self.l = len(w) def pickIndex(self): """:rtype: int""" seed = random.randint(1, self.total) cur = 0 for i in range(self.l): cur += self.w[i]...
the_stack_v2_python_sparse
900plus/RandomPickwithWeight528.py
jing1988a/python_fb
train
0
04a36bcdfda888677e735b3eb761cf5833ed0641
[ "self.v_deprecate = v_deprecate\nself.v_remove = v_remove\nself.v_current = v_current\nself.details = details\nif self.v_deprecate is None and self.v_remove is not None:\n raise TypeError('Cannot set `v_remove` without also setting `v_deprecate`')\nself.is_deprecated = False\nself.is_unsupported = False\nif self...
<|body_start_0|> self.v_deprecate = v_deprecate self.v_remove = v_remove self.v_current = v_current self.details = details if self.v_deprecate is None and self.v_remove is not None: raise TypeError('Cannot set `v_remove` without also setting `v_deprecate`') se...
Deprecated
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Deprecated: def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=''): """Decorator to mark a function or class as deprecated. Issue warning when the function is called or the class is instantiated, and add a warning to the docstring. The optional `details` argument...
stack_v2_sparse_classes_36k_train_012945
16,173
permissive
[ { "docstring": "Decorator to mark a function or class as deprecated. Issue warning when the function is called or the class is instantiated, and add a warning to the docstring. The optional `details` argument will be appended to the deprecation message and the docstring Parameters ---------- v_deprecate: String...
6
stack_v2_sparse_classes_30k_train_013915
Implement the Python class `Deprecated` described below. Class description: Implement the Deprecated class. Method signatures and docstrings: - def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=''): Decorator to mark a function or class as deprecated. Issue warning when the function is calle...
Implement the Python class `Deprecated` described below. Class description: Implement the Deprecated class. Method signatures and docstrings: - def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=''): Decorator to mark a function or class as deprecated. Issue warning when the function is calle...
3709d5e97dd23efa0df1b79982ae029789e1af57
<|skeleton|> class Deprecated: def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=''): """Decorator to mark a function or class as deprecated. Issue warning when the function is called or the class is instantiated, and add a warning to the docstring. The optional `details` argument...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Deprecated: def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=''): """Decorator to mark a function or class as deprecated. Issue warning when the function is called or the class is instantiated, and add a warning to the docstring. The optional `details` argument will be appen...
the_stack_v2_python_sparse
hyperparameter_hunter/utils/version_utils.py
shaoeric/hyperparameter_hunter
train
0
04c66899a1645a2cd689f3fc5b87d142256ecd7e
[ "def get_mix_max(node):\n l_min_v = r_max_v = node.val\n if node.left:\n is_bst, l_min_v, l_max_v = get_mix_max(node.left)\n if not is_bst or l_max_v >= node.val:\n return (False, 0, 0)\n if node.right:\n is_bst, r_min_v, r_max_v = get_mix_max(node.right)\n if not is_...
<|body_start_0|> def get_mix_max(node): l_min_v = r_max_v = node.val if node.left: is_bst, l_min_v, l_max_v = get_mix_max(node.left) if not is_bst or l_max_v >= node.val: return (False, 0, 0) if node.right: i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST1(self, root: TreeNode) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户""" <|body_0|> def isValidBST(self, root: TreeNode) -> bool: """执行用时: 56 ms , 在所有 Python3 提交中击败了 54.71% 的用户 内存消耗: 17.8...
stack_v2_sparse_classes_36k_train_012946
3,014
no_license
[ { "docstring": "执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户", "name": "isValidBST1", "signature": "def isValidBST1(self, root: TreeNode) -> bool" }, { "docstring": "执行用时: 56 ms , 在所有 Python3 提交中击败了 54.71% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 18.29%...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root: TreeNode) -> bool: 执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户 - def isValidBST(self, root: TreeNode) ->...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root: TreeNode) -> bool: 执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户 - def isValidBST(self, root: TreeNode) ->...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def isValidBST1(self, root: TreeNode) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户""" <|body_0|> def isValidBST(self, root: TreeNode) -> bool: """执行用时: 56 ms , 在所有 Python3 提交中击败了 54.71% 的用户 内存消耗: 17.8...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST1(self, root: TreeNode) -> bool: """执行用时: 52 ms , 在所有 Python3 提交中击败了 75.68% 的用户 内存消耗: 17.8 MB , 在所有 Python3 提交中击败了 13.91% 的用户""" def get_mix_max(node): l_min_v = r_max_v = node.val if node.left: is_bst, l_min_v, l_max_v = get_mix_...
the_stack_v2_python_sparse
验证二叉搜索树.py
nomboy/leetcode
train
0
02774c1261595edc12f3a21ea68dcdbe2bf3c05f
[ "identities = {'identity-uuid': {'uuid': 'identity-uuid'}}\nprocess_optout(identities, 'identity-uuid', datetime.datetime(2020, 1, 1), 'babyloss')\nself.assertEqual(identities, {'identity-uuid': {'uuid': 'identity-uuid', 'optout_timestamp': '2020-01-01T00:00:00', 'optout_reason': 'babyloss'}})", "identities = {'i...
<|body_start_0|> identities = {'identity-uuid': {'uuid': 'identity-uuid'}} process_optout(identities, 'identity-uuid', datetime.datetime(2020, 1, 1), 'babyloss') self.assertEqual(identities, {'identity-uuid': {'uuid': 'identity-uuid', 'optout_timestamp': '2020-01-01T00:00:00', 'optout_reason': '...
ProcessOptOutTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessOptOutTests: def test_optout_added(self): """Adds the optout to the identity if there is none""" <|body_0|> def test_replace_optout(self): """If this optout is newer than the one on the identity, it should be replaced""" <|body_1|> def test_skip_o...
stack_v2_sparse_classes_36k_train_012947
17,808
permissive
[ { "docstring": "Adds the optout to the identity if there is none", "name": "test_optout_added", "signature": "def test_optout_added(self)" }, { "docstring": "If this optout is newer than the one on the identity, it should be replaced", "name": "test_replace_optout", "signature": "def tes...
3
stack_v2_sparse_classes_30k_val_000851
Implement the Python class `ProcessOptOutTests` described below. Class description: Implement the ProcessOptOutTests class. Method signatures and docstrings: - def test_optout_added(self): Adds the optout to the identity if there is none - def test_replace_optout(self): If this optout is newer than the one on the ide...
Implement the Python class `ProcessOptOutTests` described below. Class description: Implement the ProcessOptOutTests class. Method signatures and docstrings: - def test_optout_added(self): Adds the optout to the identity if there is none - def test_replace_optout(self): If this optout is newer than the one on the ide...
e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f
<|skeleton|> class ProcessOptOutTests: def test_optout_added(self): """Adds the optout to the identity if there is none""" <|body_0|> def test_replace_optout(self): """If this optout is newer than the one on the identity, it should be replaced""" <|body_1|> def test_skip_o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessOptOutTests: def test_optout_added(self): """Adds the optout to the identity if there is none""" identities = {'identity-uuid': {'uuid': 'identity-uuid'}} process_optout(identities, 'identity-uuid', datetime.datetime(2020, 1, 1), 'babyloss') self.assertEqual(identities, ...
the_stack_v2_python_sparse
scripts/migrate_to_rapidpro/test_collect_information.py
praekeltfoundation/ndoh-hub
train
0
e02af291c7ac26f913dcba28c1949fa44d17c552
[ "self.X = X\nself.y = y\nself.pipeline_map = pipeline_map", "if any([isinstance(item, CategoricalEncoder) for item in transforms]):\n categories = dict()\n for cat_col in columns:\n cats = X[~X[cat_col].isnull()][cat_col].unique().tolist()\n categories.update({cat_col: cats})\n transforms =...
<|body_start_0|> self.X = X self.y = y self.pipeline_map = pipeline_map <|end_body_0|> <|body_start_1|> if any([isinstance(item, CategoricalEncoder) for item in transforms]): categories = dict() for cat_col in columns: cats = X[~X[cat_col].isnull(...
DataFrameTransformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFrameTransformer: def __init__(self, X, pipeline_map, y=None): """:param X: a Pandas DataFrame object. :param pipeline_map: :param y:""" <|body_0|> def column_transformer(self, X, columns, transforms): """Perform fit-and-transform on `columns` of DataFrame `X` ac...
stack_v2_sparse_classes_36k_train_012948
4,618
permissive
[ { "docstring": ":param X: a Pandas DataFrame object. :param pipeline_map: :param y:", "name": "__init__", "signature": "def __init__(self, X, pipeline_map, y=None)" }, { "docstring": "Perform fit-and-transform on `columns` of DataFrame `X` according to `transforms`, returns the transformed DataF...
3
stack_v2_sparse_classes_30k_train_004784
Implement the Python class `DataFrameTransformer` described below. Class description: Implement the DataFrameTransformer class. Method signatures and docstrings: - def __init__(self, X, pipeline_map, y=None): :param X: a Pandas DataFrame object. :param pipeline_map: :param y: - def column_transformer(self, X, columns...
Implement the Python class `DataFrameTransformer` described below. Class description: Implement the DataFrameTransformer class. Method signatures and docstrings: - def __init__(self, X, pipeline_map, y=None): :param X: a Pandas DataFrame object. :param pipeline_map: :param y: - def column_transformer(self, X, columns...
1121443bef901fc6c9ed9f7d3ac60a0885189753
<|skeleton|> class DataFrameTransformer: def __init__(self, X, pipeline_map, y=None): """:param X: a Pandas DataFrame object. :param pipeline_map: :param y:""" <|body_0|> def column_transformer(self, X, columns, transforms): """Perform fit-and-transform on `columns` of DataFrame `X` ac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFrameTransformer: def __init__(self, X, pipeline_map, y=None): """:param X: a Pandas DataFrame object. :param pipeline_map: :param y:""" self.X = X self.y = y self.pipeline_map = pipeline_map def column_transformer(self, X, columns, transforms): """Perform fit-...
the_stack_v2_python_sparse
titanic/sk_util.py
comsaint/Data-Practice
train
0
99a588fd1b3c8e7defae24d01c4ae7e08c5fb5c1
[ "if num_pixels is None and quantile is None:\n raise ValueError('either num_pixels or quantile must be given')\nself.num_pixels: float = num_pixels\n'Number of pixels with highest values to set to one.'\nself.quantile: float = quantile\n'Quantile of pixels to set to one, rest is set to 0;\\n overridden by...
<|body_start_0|> if num_pixels is None and quantile is None: raise ValueError('either num_pixels or quantile must be given') self.num_pixels: float = num_pixels 'Number of pixels with highest values to set to one.' self.quantile: float = quantile 'Quantile of pixels t...
Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel.
BinarizeByQuantile
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarizeByQuantile: """Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel.""" def __init__(self, quantile: float=None, num_pixels: int=None): """Init. :param quantile: quantile ...
stack_v2_sparse_classes_36k_train_012949
14,707
permissive
[ { "docstring": "Init. :param quantile: quantile of pixels to set to 1, rest is set to 0; overridden by ``num_pixels`` :param num_pixels: number of pixels with highest value to set to one, rest is set to 0", "name": "__init__", "signature": "def __init__(self, quantile: float=None, num_pixels: int=None)"...
3
stack_v2_sparse_classes_30k_train_009952
Implement the Python class `BinarizeByQuantile` described below. Class description: Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel. Method signatures and docstrings: - def __init__(self, quantile: float=None...
Implement the Python class `BinarizeByQuantile` described below. Class description: Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel. Method signatures and docstrings: - def __init__(self, quantile: float=None...
37b9fc83d7b14902dfe92e0c45071c150bcf3779
<|skeleton|> class BinarizeByQuantile: """Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel.""" def __init__(self, quantile: float=None, num_pixels: int=None): """Init. :param quantile: quantile ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinarizeByQuantile: """Set all but the given highest number of pixels / q-th quantile in an image to zero, rest to 1. Mind for RGB images: A pixel here means a pixel in one channel.""" def __init__(self, quantile: float=None, num_pixels: int=None): """Init. :param quantile: quantile of pixels to ...
the_stack_v2_python_sparse
hybrid_learning/datasets/transforms/image_transforms.py
JohnnyZhang917/hybrid_learning
train
0
5b35ea4a5af61cc3193bbce9aee11e51dc5aa233
[ "subscription.is_active = self.instance.expiration_time > timezone.now()\nsubscription.save()\nself.instance.subscription = subscription\nself.instance.save()", "self.instance = self.instance or models.AppleReceipt()\nself.instance.receipt_data = data['receipt_data']\ntry:\n self.instance.update_info()\nexcept...
<|body_start_0|> subscription.is_active = self.instance.expiration_time > timezone.now() subscription.save() self.instance.subscription = subscription self.instance.save() <|end_body_0|> <|body_start_1|> self.instance = self.instance or models.AppleReceipt() self.instanc...
Serializer for an Apple receipt.
AppleReceiptSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_012950
8,796
permissive
[ { "docstring": "Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.", "name": "save", "signature": "def save(self, subscription)" }, { "docstring": "Validate that the provided receipt data c...
2
stack_v2_sparse_classes_30k_train_012359
Implement the Python class `AppleReceiptSerializer` described below. Class description: Serializer for an Apple receipt. Method signatures and docstrings: - def save(self, subscription): Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple...
Implement the Python class `AppleReceiptSerializer` described below. Class description: Serializer for an Apple receipt. Method signatures and docstrings: - def save(self, subscription): Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple...
e4b72484c42e88a6c0087c9b1d5fef240e66cbb0
<|skeleton|> class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" subscription.is_active = self.in...
the_stack_v2_python_sparse
km_api/know_me/serializers/subscription_serializers.py
knowmetools/km-api
train
4
e7e6af78d8ff9f7292f929d08e326a621a8b1fdc
[ "asserts.type_of(job_api, JobApiModel)\njob_dto = JobDto()\nmap_props(job_dto, job_api, JobDto._props)\nreturn job_dto", "asserts.type_of(job_dto, JobDto)\njob_api = JobApiModel()\nmap_props(job_api, job_dto, JobDto._props)\nreturn job_api.ToMessage()" ]
<|body_start_0|> asserts.type_of(job_api, JobApiModel) job_dto = JobDto() map_props(job_dto, job_api, JobDto._props) return job_dto <|end_body_0|> <|body_start_1|> asserts.type_of(job_dto, JobDto) job_api = JobApiModel() map_props(job_api, job_dto, JobDto._props)...
Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request.
JobApiModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobApiModel: """Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request.""" def to_job_dto(cls, job_api): """Translates the given JobApiModel to a JobDto. :param job_api: (api.jobs.JobApiModel) :return: (dto.jobs.JobDto)""" ...
stack_v2_sparse_classes_36k_train_012951
1,781
no_license
[ { "docstring": "Translates the given JobApiModel to a JobDto. :param job_api: (api.jobs.JobApiModel) :return: (dto.jobs.JobDto)", "name": "to_job_dto", "signature": "def to_job_dto(cls, job_api)" }, { "docstring": "Translates the given JobDto to an JobApiModel. :param job_dto: (dto.jobs.JobDto) ...
2
null
Implement the Python class `JobApiModel` described below. Class description: Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request. Method signatures and docstrings: - def to_job_dto(cls, job_api): Translates the given JobApiModel to a JobDto. :param job_a...
Implement the Python class `JobApiModel` described below. Class description: Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request. Method signatures and docstrings: - def to_job_dto(cls, job_api): Translates the given JobApiModel to a JobDto. :param job_a...
1d6522069da3e5a6de41ce948b04872d0a994cca
<|skeleton|> class JobApiModel: """Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request.""" def to_job_dto(cls, job_api): """Translates the given JobApiModel to a JobDto. :param job_api: (api.jobs.JobApiModel) :return: (dto.jobs.JobDto)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobApiModel: """Represents job details. `selected_applicant` and `applicants` are only populated when the job owner makes a request.""" def to_job_dto(cls, job_api): """Translates the given JobApiModel to a JobDto. :param job_api: (api.jobs.JobApiModel) :return: (dto.jobs.JobDto)""" asser...
the_stack_v2_python_sparse
models/api/jobs.py
venvadlamani/HumanLink
train
0
f3a4d41e75f6def5ca56c1e955dc41618d7087d8
[ "self.safe_update(**kwargs)\nif butler is not None:\n self.log.warn('Ignoring butler in extract()')\ndtables = stack_summary_table(data, self, tablename='outliers', keep_cols=['nbad_total', 'nbad_rows', 'nbad_cols', 'slot', 'amp'])\nreturn dtables", "self.safe_update(**kwargs)\nconfig_table = get_run_config_ta...
<|body_start_0|> self.safe_update(**kwargs) if butler is not None: self.log.warn('Ignoring butler in extract()') dtables = stack_summary_table(data, self, tablename='outliers', keep_cols=['nbad_total', 'nbad_rows', 'nbad_cols', 'slot', 'amp']) return dtables <|end_body_0|> <...
Summarize the results for the superbias outlier analysis
SuperbiasOutlierSummaryTask
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperbiasOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) con...
stack_v2_sparse_classes_36k_train_012952
15,893
permissive
[ { "docstring": "Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input data kwargs Used to override default configuration Returns ------- dtables : `TableDict` The resulting data", "name": "extract", ...
2
stack_v2_sparse_classes_30k_train_016552
Implement the Python class `SuperbiasOutlierSummaryTask` described below. Class description: Summarize the results for the superbias outlier analysis Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data...
Implement the Python class `SuperbiasOutlierSummaryTask` described below. Class description: Summarize the results for the superbias outlier analysis Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data...
28418284fdaf2b2fb0afbeccd4324f7ad3e676c8
<|skeleton|> class SuperbiasOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperbiasOutlierSummaryTask: """Summarize the results for the superbias outlier analysis""" def extract(self, butler, data, **kwargs): """Make a summry table of the bias FFT data Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the inpu...
the_stack_v2_python_sparse
python/lsst/eo_utils/bias/superbias.py
lsst-camera-dh/EO-utilities
train
2
f7c0bbb599f37d27466eb0c58d11d34cd7dd0d74
[ "super(RemoteMonitor, self).__init__()\nif requests is None:\n raise ImportError(\"RemoteMonitor requires the 'requests' library.Run pip install requests.\")\nself.root = root\nself.path = path\nself.field = field\nself.headers = headers\nself.monitors = monitors\nself.send_as_json = send_as_json", "monitors =...
<|body_start_0|> super(RemoteMonitor, self).__init__() if requests is None: raise ImportError("RemoteMonitor requires the 'requests' library.Run pip install requests.") self.root = root self.path = path self.field = field self.headers = headers self.mo...
Callback to stream training events to a server with the same interface as Keras RemoteMonitor.
RemoteMonitor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteMonitor: """Callback to stream training events to a server with the same interface as Keras RemoteMonitor.""" def __init__(self, root='http://localhost:9000', path='/publish/epoch/end/', field='data', headers=None, send_as_json=False, monitors=None): """Constructor Arguments: r...
stack_v2_sparse_classes_36k_train_012953
2,291
permissive
[ { "docstring": "Constructor Arguments: root (str): Root server url path (str): Relative path to root to post events field (str): Json field of post data headers (str): Http headers send_as_json (bool): If false sends data as plain json. Otherwise sends as json. monitors (list): List of monitors names to include...
2
stack_v2_sparse_classes_30k_val_001075
Implement the Python class `RemoteMonitor` described below. Class description: Callback to stream training events to a server with the same interface as Keras RemoteMonitor. Method signatures and docstrings: - def __init__(self, root='http://localhost:9000', path='/publish/epoch/end/', field='data', headers=None, sen...
Implement the Python class `RemoteMonitor` described below. Class description: Callback to stream training events to a server with the same interface as Keras RemoteMonitor. Method signatures and docstrings: - def __init__(self, root='http://localhost:9000', path='/publish/epoch/end/', field='data', headers=None, sen...
d1440b7a9c3ab2c1d3abbb282abb9ee1ea240797
<|skeleton|> class RemoteMonitor: """Callback to stream training events to a server with the same interface as Keras RemoteMonitor.""" def __init__(self, root='http://localhost:9000', path='/publish/epoch/end/', field='data', headers=None, send_as_json=False, monitors=None): """Constructor Arguments: r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteMonitor: """Callback to stream training events to a server with the same interface as Keras RemoteMonitor.""" def __init__(self, root='http://localhost:9000', path='/publish/epoch/end/', field='data', headers=None, send_as_json=False, monitors=None): """Constructor Arguments: root (str): Ro...
the_stack_v2_python_sparse
torchero/callbacks/remote.py
juancruzsosa/torchero
train
10
283747594be99f60c67c39cedfd101a9d2d4dd78
[ "self.input_type = input_type\nself.input_shape = input_shape\nself.channel_axes = channel_axes", "if self.per_channel and (self.input_shape is None or self.channel_axes is None):\n raise ValueError('The `input_shape` and `channel_axes` arguments are required when using per-channel quantization.')\nprefix = se...
<|body_start_0|> self.input_type = input_type self.input_shape = input_shape self.channel_axes = channel_axes <|end_body_0|> <|body_start_1|> if self.per_channel and (self.input_shape is None or self.channel_axes is None): raise ValueError('The `input_shape` and `channel_axe...
AsymmetricQuantizerV2
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsymmetricQuantizerV2: def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): """Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param inpu...
stack_v2_sparse_classes_36k_train_012954
5,442
permissive
[ { "docstring": "Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input_shape: Shape of the input tensor for which the quantization is applied. Required only for per-channel quantization. :param channel_axes: Axes numbers of t...
2
null
Implement the Python class `AsymmetricQuantizerV2` described below. Class description: Implement the AsymmetricQuantizerV2 class. Method signatures and docstrings: - def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): Sets input tensor specificatio...
Implement the Python class `AsymmetricQuantizerV2` described below. Class description: Implement the AsymmetricQuantizerV2 class. Method signatures and docstrings: - def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): Sets input tensor specificatio...
c027c8b43c4865d46b8de01d8350dd338ec5a874
<|skeleton|> class AsymmetricQuantizerV2: def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): """Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param inpu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsymmetricQuantizerV2: def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): """Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input_shape: Shape...
the_stack_v2_python_sparse
nncf/experimental/tensorflow/quantization/quantizers.py
openvinotoolkit/nncf
train
558
b9d3e235d9f24444f8a5c3ab2580c9e007696479
[ "if not TTS:\n raise ImportError('TextToSpeech pipeline is not available - install \"pipeline\" extra to enable')\npath = path if path else 'neuml/ljspeech-jets-onnx'\nconfig = hf_hub_download(path, filename='config.yaml')\nmodel = hf_hub_download(path, filename='model.onnx')\nwith open(config, 'r', encoding='ut...
<|body_start_0|> if not TTS: raise ImportError('TextToSpeech pipeline is not available - install "pipeline" extra to enable') path = path if path else 'neuml/ljspeech-jets-onnx' config = hf_hub_download(path, filename='config.yaml') model = hf_hub_download(path, filename='mod...
Generates speech from text
TextToSpeech
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" <|body_0|> def __...
stack_v2_sparse_classes_36k_train_012955
3,823
permissive
[ { "docstring": "Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512", "name": "__init__", "signature": "def __init__(self, path=None, maxtokens=512)" }, { "docstring": "Generates speech from te...
4
null
Implement the Python class `TextToSpeech` described below. Class description: Generates speech from text Method signatures and docstrings: - def __init__(self, path=None, maxtokens=512): Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can p...
Implement the Python class `TextToSpeech` described below. Class description: Generates speech from text Method signatures and docstrings: - def __init__(self, path=None, maxtokens=512): Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can p...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" <|body_0|> def __...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" if not TTS: raise Impor...
the_stack_v2_python_sparse
src/python/txtai/pipeline/audio/texttospeech.py
neuml/txtai
train
4,804
f0349ce7de8159d47191604fab68f67922246401
[ "for prop in self.__dict__.values():\n if issubclass(prop.__class__, JobPropertyContainer) and 'signatures' in prop.__dict__.keys():\n prop.setL2()", "for prop in self.__dict__.values():\n if issubclass(prop.__class__, JobPropertyContainer) and 'signatures' in prop.__dict__.keys():\n prop.setE...
<|body_start_0|> for prop in self.__dict__.values(): if issubclass(prop.__class__, JobPropertyContainer) and 'signatures' in prop.__dict__.keys(): prop.setL2() <|end_body_0|> <|body_start_1|> for prop in self.__dict__.values(): if issubclass(prop.__class__, JobPr...
Trigger top flags
Trigger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trigger: """Trigger top flags""" def Slices_LVL2_setOn(self): """Runs setL2 flags in all slices. Effectivelly enable LVL2.""" <|body_0|> def Slices_EF_setOn(self): """Runs setEF flags in all slices. Effectivelly enable EF.""" <|body_1|> def Slices_al...
stack_v2_sparse_classes_36k_train_012956
43,775
permissive
[ { "docstring": "Runs setL2 flags in all slices. Effectivelly enable LVL2.", "name": "Slices_LVL2_setOn", "signature": "def Slices_LVL2_setOn(self)" }, { "docstring": "Runs setEF flags in all slices. Effectivelly enable EF.", "name": "Slices_EF_setOn", "signature": "def Slices_EF_setOn(se...
6
stack_v2_sparse_classes_30k_test_000647
Implement the Python class `Trigger` described below. Class description: Trigger top flags Method signatures and docstrings: - def Slices_LVL2_setOn(self): Runs setL2 flags in all slices. Effectivelly enable LVL2. - def Slices_EF_setOn(self): Runs setEF flags in all slices. Effectivelly enable EF. - def Slices_all_se...
Implement the Python class `Trigger` described below. Class description: Trigger top flags Method signatures and docstrings: - def Slices_LVL2_setOn(self): Runs setL2 flags in all slices. Effectivelly enable LVL2. - def Slices_EF_setOn(self): Runs setEF flags in all slices. Effectivelly enable EF. - def Slices_all_se...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class Trigger: """Trigger top flags""" def Slices_LVL2_setOn(self): """Runs setL2 flags in all slices. Effectivelly enable LVL2.""" <|body_0|> def Slices_EF_setOn(self): """Runs setEF flags in all slices. Effectivelly enable EF.""" <|body_1|> def Slices_al...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trigger: """Trigger top flags""" def Slices_LVL2_setOn(self): """Runs setL2 flags in all slices. Effectivelly enable LVL2.""" for prop in self.__dict__.values(): if issubclass(prop.__class__, JobPropertyContainer) and 'signatures' in prop.__dict__.keys(): prop....
the_stack_v2_python_sparse
Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
strigazi/athena
train
0
a5fd758fbb082befc19b53f8003cf2fdbbe2b7c8
[ "if rng is None:\n self.rng = np.random.RandomState(np.random.randint(0, 10000))\nelse:\n self.rng = rng\nself.scale = scale", "if np.any(theta == 0.0):\n return np.inf\nwith np.errstate(divide='ignore'):\n return np.log(np.log(1 + 3.0 * (self.scale / np.exp(theta)) ** 2))", "lamda = np.abs(self.rng...
<|body_start_0|> if rng is None: self.rng = np.random.RandomState(np.random.randint(0, 10000)) else: self.rng = rng self.scale = scale <|end_body_0|> <|body_start_1|> if np.any(theta == 0.0): return np.inf with np.errstate(divide='ignore'): ...
HorseshoePrior
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HorseshoePrior: def __init__(self, scale=0.1, rng=None): """Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. :type scale: float :param rng: Random number generator :type rng: np.random.RandomState""" <|bo...
stack_v2_sparse_classes_36k_train_012957
11,290
no_license
[ { "docstring": "Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. :type scale: float :param rng: Random number generator :type rng: np.random.RandomState", "name": "__init__", "signature": "def __init__(self, scale=0.1, rng=None)...
4
stack_v2_sparse_classes_30k_train_002320
Implement the Python class `HorseshoePrior` described below. Class description: Implement the HorseshoePrior class. Method signatures and docstrings: - def __init__(self, scale=0.1, rng=None): Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. ...
Implement the Python class `HorseshoePrior` described below. Class description: Implement the HorseshoePrior class. Method signatures and docstrings: - def __init__(self, scale=0.1, rng=None): Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. ...
5e2a2996bdae632c92a3bb8f891cfac81c65380d
<|skeleton|> class HorseshoePrior: def __init__(self, scale=0.1, rng=None): """Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. :type scale: float :param rng: Random number generator :type rng: np.random.RandomState""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HorseshoePrior: def __init__(self, scale=0.1, rng=None): """Horseshoe Prior as it is used in spearmint :param scale: Scaling parameter. See below how it is influenced the distribution. :type scale: float :param rng: Random number generator :type rng: np.random.RandomState""" if rng is None: ...
the_stack_v2_python_sparse
photonai/optimization/fabolas/Priors.py
bcottman/photon
train
7
6cfee43b0338e9d172c4ca80bc8a6451963240fd
[ "super(FeatureFusionBlock, self).__init__()\nself.resConfUnit1 = ResidualConvUnit(features)\nself.resConfUnit2 = ResidualConvUnit(features)", "output = xs[0]\nif len(xs) == 2:\n output += self.resConfUnit1(xs[1])\noutput = self.resConfUnit2(output)\noutput = nn.functional.interpolate(output, scale_factor=2, mo...
<|body_start_0|> super(FeatureFusionBlock, self).__init__() self.resConfUnit1 = ResidualConvUnit(features) self.resConfUnit2 = ResidualConvUnit(features) <|end_body_0|> <|body_start_1|> output = xs[0] if len(xs) == 2: output += self.resConfUnit1(xs[1]) output...
Feature fusion block.
FeatureFusionBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, *xs): """Forward pass. Returns: tensor: output""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_012958
17,410
permissive
[ { "docstring": "Init. Args: features (int): number of features", "name": "__init__", "signature": "def __init__(self, features)" }, { "docstring": "Forward pass. Returns: tensor: output", "name": "forward", "signature": "def forward(self, *xs)" } ]
2
null
Implement the Python class `FeatureFusionBlock` described below. Class description: Feature fusion block. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, *xs): Forward pass. Returns: tensor: output
Implement the Python class `FeatureFusionBlock` described below. Class description: Feature fusion block. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, *xs): Forward pass. Returns: tensor: output <|skeleton|> class FeatureFusionBl...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class FeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, *xs): """Forward pass. Returns: tensor: output""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" super(FeatureFusionBlock, self).__init__() self.resConfUnit1 = ResidualConvUnit(features) self.resConfUnit2 = ResidualConvUnit(features) ...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/blocks.py
kcyu2014/nas-landmarkreg
train
10
25de847bee622f603c90072a90a519b5c01b37b2
[ "if mode == 'python':\n from ..python.tags import tag_manager as tmgr\n return tmgr.register(tag_class_or_alias)\n\ndef decorator(tag_class):\n \"\"\"The decorator for the tag class\"\"\"\n name = tag_class.__name__\n if name.startswith('Tag'):\n name = name[3:]\n if not name.isupper():...
<|body_start_0|> if mode == 'python': from ..python.tags import tag_manager as tmgr return tmgr.register(tag_class_or_alias) def decorator(tag_class): """The decorator for the tag class""" name = tag_class.__name__ if name.startswith('Tag'): ...
The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database
TagManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagManager: """The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database""" def register(self, tag_class_or_alias=None, mode='standard'): """Register a tag This can be worked as a decorator Args: tag_class_or_alias: The tag class or the alias ...
stack_v2_sparse_classes_36k_train_012959
3,349
permissive
[ { "docstring": "Register a tag This can be worked as a decorator Args: tag_class_or_alias: The tag class or the alias for the tag class to decorate mode: Whether do it for given mode Returns: The decorator or the decorated class", "name": "register", "signature": "def register(self, tag_class_or_alias=N...
3
stack_v2_sparse_classes_30k_train_011318
Implement the Python class `TagManager` described below. Class description: The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database Method signatures and docstrings: - def register(self, tag_class_or_alias=None, mode='standard'): Register a tag This can be worked as a decora...
Implement the Python class `TagManager` described below. Class description: The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database Method signatures and docstrings: - def register(self, tag_class_or_alias=None, mode='standard'): Register a tag This can be worked as a decora...
bf84d631a2ecab0c020ba883bf2a09042715f772
<|skeleton|> class TagManager: """The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database""" def register(self, tag_class_or_alias=None, mode='standard'): """Register a tag This can be worked as a decorator Args: tag_class_or_alias: The tag class or the alias ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagManager: """The tag manager Attributes: INSTANCE: The instance of this singleton class tags: The tags database""" def register(self, tag_class_or_alias=None, mode='standard'): """Register a tag This can be worked as a decorator Args: tag_class_or_alias: The tag class or the alias for the tag c...
the_stack_v2_python_sparse
liquid/tags/manager.py
lingfromSh/liquidpy
train
0
e25b931e66355b4617b284a97d6995df088166b1
[ "self._logger = logger\nself._aliases = aliases\nself._model_context = model_context", "model_path_tokens = self._parse_model_path(model_path)\nfolder_path = '/'.join(model_path_tokens[1:])\nmodel_path = '%s:/%s' % (model_path_tokens[0], folder_path)\nprint('')\nif control_option == ControlOptions.RECURSIVE:\n ...
<|body_start_0|> self._logger = logger self._aliases = aliases self._model_context = model_context <|end_body_0|> <|body_start_1|> model_path_tokens = self._parse_model_path(model_path) folder_path = '/'.join(model_path_tokens[1:]) model_path = '%s:/%s' % (model_path_tok...
Class for printing the recognized model metadata to STDOUT.
ModelHelpPrinter
[ "UPL-1.0", "LicenseRef-scancode-other-copyleft", "MIT", "GPL-2.0-only", "Classpath-exception-2.0", "Apache-2.0", "CDDL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelHelpPrinter: """Class for printing the recognized model metadata to STDOUT.""" def __init__(self, model_context, aliases, logger): """:param model_context: The model context :param aliases: A reference to an Aliases class instance :param logger: A reference to the platform logge...
stack_v2_sparse_classes_36k_train_012960
6,818
permissive
[ { "docstring": ":param model_context: The model context :param aliases: A reference to an Aliases class instance :param logger: A reference to the platform logger to write to, if a log entry needs to be made", "name": "__init__", "signature": "def __init__(self, model_context, aliases, logger)" }, {...
4
null
Implement the Python class `ModelHelpPrinter` described below. Class description: Class for printing the recognized model metadata to STDOUT. Method signatures and docstrings: - def __init__(self, model_context, aliases, logger): :param model_context: The model context :param aliases: A reference to an Aliases class ...
Implement the Python class `ModelHelpPrinter` described below. Class description: Class for printing the recognized model metadata to STDOUT. Method signatures and docstrings: - def __init__(self, model_context, aliases, logger): :param model_context: The model context :param aliases: A reference to an Aliases class ...
9fd74ae578a5b1353662facb0405e5672ecc5191
<|skeleton|> class ModelHelpPrinter: """Class for printing the recognized model metadata to STDOUT.""" def __init__(self, model_context, aliases, logger): """:param model_context: The model context :param aliases: A reference to an Aliases class instance :param logger: A reference to the platform logge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelHelpPrinter: """Class for printing the recognized model metadata to STDOUT.""" def __init__(self, model_context, aliases, logger): """:param model_context: The model context :param aliases: A reference to an Aliases class instance :param logger: A reference to the platform logger to write to...
the_stack_v2_python_sparse
core/src/main/python/wlsdeploy/tool/modelhelp/model_help_printer.py
oracle/weblogic-deploy-tooling
train
148
79c6fd96ee3fa40e17e393494783294e2869252f
[ "if not any(values.values()):\n values['eia860'] = Eia860Settings()\n values['eia861'] = Eia861Settings()\n values['eia923'] = Eia923Settings()\nreturn values", "eia923 = values.get('eia923')\neia860 = values.get('eia860')\nif not eia923 and eia860:\n values['eia923'] = Eia923Settings(years=eia860.yea...
<|body_start_0|> if not any(values.values()): values['eia860'] = Eia860Settings() values['eia861'] = Eia861Settings() values['eia923'] = Eia923Settings() return values <|end_body_0|> <|body_start_1|> eia923 = values.get('eia923') eia860 = values.get('...
An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings.
EiaSettings
[ "CC-BY-4.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EiaSettings: """An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings.""" def default_load_all(cls, values): """If no datasets are specified defau...
stack_v2_sparse_classes_36k_train_012961
24,804
permissive
[ { "docstring": "If no datasets are specified default to all. Args: values (Dict[str, BaseModel]): dataset settings. Returns: values (Dict[str, BaseModel]): dataset settings.", "name": "default_load_all", "signature": "def default_load_all(cls, values)" }, { "docstring": "Make sure the dependenci...
2
stack_v2_sparse_classes_30k_train_016808
Implement the Python class `EiaSettings` described below. Class description: An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings. Method signatures and docstrings: - def default_...
Implement the Python class `EiaSettings` described below. Class description: An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings. Method signatures and docstrings: - def default_...
6afae8aade053408f23ac4332d5cbb438ab72dc6
<|skeleton|> class EiaSettings: """An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings.""" def default_load_all(cls, values): """If no datasets are specified defau...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EiaSettings: """An immutable pydantic model to validate EIA datasets settings. Args: eia860: Immutable pydantic model to validate eia860 settings. eia923: Immutable pydantic model to validate eia923 settings.""" def default_load_all(cls, values): """If no datasets are specified default to all. Ar...
the_stack_v2_python_sparse
src/pudl/settings.py
catalyst-cooperative/pudl
train
382
de929544ed0a313e8ec5677b900bf543f2addd8a
[ "elem = self.root.find(\"./data[@category='%s']/%s\" % (category, setting))\nif elem is not None:\n text = elem.text\n if text is not None:\n if type == 'str':\n return text\n elif type == 'int':\n return int(text)\n elif type == 'float':\n return float(te...
<|body_start_0|> elem = self.root.find("./data[@category='%s']/%s" % (category, setting)) if elem is not None: text = elem.text if text is not None: if type == 'str': return text elif type == 'int': return in...
Manipulates XML database to store job settings. Inherits XMLData class.
Metadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Metadata: """Manipulates XML database to store job settings. Inherits XMLData class.""" def get_attr(self, category, setting, type='str'): """Get the specified value. 'type' can be specified in order to return a value of a given type, valid values are 'str', 'int', 'float', 'bool'.""...
stack_v2_sparse_classes_36k_train_012962
3,485
permissive
[ { "docstring": "Get the specified value. 'type' can be specified in order to return a value of a given type, valid values are 'str', 'int', 'float', 'bool'.", "name": "get_attr", "signature": "def get_attr(self, category, setting, type='str')" }, { "docstring": "Set value. Create elements if the...
4
stack_v2_sparse_classes_30k_train_016260
Implement the Python class `Metadata` described below. Class description: Manipulates XML database to store job settings. Inherits XMLData class. Method signatures and docstrings: - def get_attr(self, category, setting, type='str'): Get the specified value. 'type' can be specified in order to return a value of a give...
Implement the Python class `Metadata` described below. Class description: Manipulates XML database to store job settings. Inherits XMLData class. Method signatures and docstrings: - def get_attr(self, category, setting, type='str'): Get the specified value. 'type' can be specified in order to return a value of a give...
a05abc916f0b6a9ee2c00e9f9b3dec12c09e6abe
<|skeleton|> class Metadata: """Manipulates XML database to store job settings. Inherits XMLData class.""" def get_attr(self, category, setting, type='str'): """Get the specified value. 'type' can be specified in order to return a value of a given type, valid values are 'str', 'int', 'float', 'bool'.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Metadata: """Manipulates XML database to store job settings. Inherits XMLData class.""" def get_attr(self, category, setting, type='str'): """Get the specified value. 'type' can be specified in order to return a value of a given type, valid values are 'str', 'int', 'float', 'bool'.""" ele...
the_stack_v2_python_sparse
shared/xml_metadata.py
mjbonnington/icarus-gps
train
0
a9188772bdeaf566e1306eed78f49340149fae17
[ "self._server = server\nself._port = port\nself._timeout = timeout\nself._sender = sender\nself.encryption = encryption\nself.username = username\nself.password = password\nself.recipients = recipients\nself._sender_name = sender_name\nself.debug = debug\nself._verify_ssl = verify_ssl\nself.tries = 2", "ssl_conte...
<|body_start_0|> self._server = server self._port = port self._timeout = timeout self._sender = sender self.encryption = encryption self.username = username self.password = password self.recipients = recipients self._sender_name = sender_name ...
Implement the notification service for E-mail messages.
MailNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailNotificationService: """Implement the notification service for E-mail messages.""" def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl): """Initialize the SMTP service.""" <|body_0|> def connect...
stack_v2_sparse_classes_36k_train_012963
9,634
permissive
[ { "docstring": "Initialize the SMTP service.", "name": "__init__", "signature": "def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl)" }, { "docstring": "Connect/authenticate to SMTP Server.", "name": "connect", "si...
5
null
Implement the Python class `MailNotificationService` described below. Class description: Implement the notification service for E-mail messages. Method signatures and docstrings: - def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl): Initialize...
Implement the Python class `MailNotificationService` described below. Class description: Implement the notification service for E-mail messages. Method signatures and docstrings: - def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl): Initialize...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MailNotificationService: """Implement the notification service for E-mail messages.""" def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl): """Initialize the SMTP service.""" <|body_0|> def connect...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailNotificationService: """Implement the notification service for E-mail messages.""" def __init__(self, server, port, timeout, sender, encryption, username, password, recipients, sender_name, debug, verify_ssl): """Initialize the SMTP service.""" self._server = server self._port...
the_stack_v2_python_sparse
homeassistant/components/smtp/notify.py
home-assistant/core
train
35,501
471d2f791f86f996fa061967d95ecb388b1d6f8f
[ "self.algorithm = algorithm\nself._input_length = input_length\nself.hash_algorithm = hash_algorithm", "if self._input_length is None:\n return encryption.data_key_length\nreturn self._input_length" ]
<|body_start_0|> self.algorithm = algorithm self._input_length = input_length self.hash_algorithm = hash_algorithm <|end_body_0|> <|body_start_1|> if self._input_length is None: return encryption.data_key_length return self._input_length <|end_body_1|>
Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF function :param hash_algorithm: Has...
KDFSuite
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF...
stack_v2_sparse_classes_36k_train_012964
14,661
permissive
[ { "docstring": "Prepare a new KDFSuite.", "name": "__init__", "signature": "def __init__(self, algorithm, input_length, hash_algorithm)" }, { "docstring": "Determine the correct KDF input value length for this KDFSuite when used with a specific EncryptionSuite. :param encryption: EncryptionSuite...
2
stack_v2_sparse_classes_30k_train_015803
Implement the Python class `KDFSuite` described below. Class description: Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number ...
Implement the Python class `KDFSuite` described below. Class description: Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number ...
3ba8019681ed95c41bb9448f0c3897d1aecc7559
<|skeleton|> class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KDFSuite: """Static definition of key derivation algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: KDF algorithm to use :type algorithm: cryptography.io KDF object :param int input_length: Number of bytes of input data to feed into KDF function :pa...
the_stack_v2_python_sparse
src/aws_encryption_sdk/identifiers.py
aws/aws-encryption-sdk-python
train
137
ccf07ef6681043d2cfc58b36c44047761c2ec5bc
[ "if rowIndex == 0:\n return [1]\nresults = [1, 1]\ni = 2\nwhile i <= rowIndex:\n results.append(results[0])\n for j in range(1, len(results) - 1):\n results[j], results[-1] = (results[-1] + results[j], results[j])\n i += 1\nreturn results", "results = [0 for i in range(rowIndex + 1)]\nresults[0...
<|body_start_0|> if rowIndex == 0: return [1] results = [1, 1] i = 2 while i <= rowIndex: results.append(results[0]) for j in range(1, len(results) - 1): results[j], results[-1] = (results[-1] + results[j], results[j]) i += ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow1(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if rowIndex == 0: return [...
stack_v2_sparse_classes_36k_train_012965
1,237
no_license
[ { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" }, { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow1", "signature": "def getRow1(self, rowIndex)" } ]
2
stack_v2_sparse_classes_30k_train_012349
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow1(self, rowIndex): :type rowIndex: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow1(self, rowIndex): :type rowIndex: int :rtype: List[int] <|skeleton|> class Solution: def getR...
eedf73b5f167025a97f0905d3718b6eab2ee3e09
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow1(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" if rowIndex == 0: return [1] results = [1, 1] i = 2 while i <= rowIndex: results.append(results[0]) for j in range(1, len(results) - 1): ...
the_stack_v2_python_sparse
Array/119_Pascal's_Triangle_II.py
xiaomojie/LeetCode
train
0
690d8df99963f2c2fb15488e5f0c9ed73244cbd1
[ "prev_control_input = self.system.control_input\ncloud_node = self.system.cloud_node\nselected_nodes = None\nsolution = None\nif prev_control_input is None:\n solution, selected_nodes = MOGAOperator._decode_part_1(self, individual)\nelse:\n solution = OptSolution.create_empty(self.system)\n selected_nodes ...
<|body_start_0|> prev_control_input = self.system.control_input cloud_node = self.system.cloud_node selected_nodes = None solution = None if prev_control_input is None: solution, selected_nodes = MOGAOperator._decode_part_1(self, individual) else: ...
No Migration GA Operator
NoMigrationGAOperator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" ...
stack_v2_sparse_classes_36k_train_012966
5,124
no_license
[ { "docstring": "Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application", "name": "_decode_part_1", "signature": "def _decode_part_1(self, individual)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_val_000754
Implement the Python class `NoMigrationGAOperator` described below. Class description: No Migration GA Operator Method signatures and docstrings: - def _decode_part_1(self, individual): Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, di...
Implement the Python class `NoMigrationGAOperator` described below. Class description: No Migration GA Operator Method signatures and docstrings: - def _decode_part_1(self, individual): Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, di...
ce7045918f60c92ce1ed5ca4389b969bf28e6b82
<|skeleton|> class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" prev_...
the_stack_v2_python_sparse
sp/system_controller/optimizer/no_migration.py
adysonmaia/phd-sp-dynamic
train
0
7a567786be016aa8e52f9996d18bbae469960405
[ "import pandas as pd\nraw_data = pd.read_excel(filename_1, sheet_name)\nself.df1 = raw_data[raw_data[' Whether or not metasomatism'] == 1].drop(['Whether or not metasomatism', 'CITATION'], axis=1)\nself.df2 = raw_data[raw_data['Whether or not metasomatism'] == -1].drop(['Whether or not metasomatism', 'CITATION'], a...
<|body_start_0|> import pandas as pd raw_data = pd.read_excel(filename_1, sheet_name) self.df1 = raw_data[raw_data[' Whether or not metasomatism'] == 1].drop(['Whether or not metasomatism', 'CITATION'], axis=1) self.df2 = raw_data[raw_data['Whether or not metasomatism'] == -1].drop(['Whe...
ElementsInCurve
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElementsInCurve: def __init__(self, filename_1, filename_2, sheet_name): """Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi elemen...
stack_v2_sparse_classes_36k_train_012967
3,811
permissive
[ { "docstring": "Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi element", "name": "__init__", "signature": "def __init__(self, filename_1, filenam...
2
stack_v2_sparse_classes_30k_train_016488
Implement the Python class `ElementsInCurve` described below. Class description: Implement the ElementsInCurve class. Method signatures and docstrings: - def __init__(self, filename_1, filename_2, sheet_name): Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filena...
Implement the Python class `ElementsInCurve` described below. Class description: Implement the ElementsInCurve class. Method signatures and docstrings: - def __init__(self, filename_1, filename_2, sheet_name): Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filena...
ca0f220598ee156028646fbefccde08b2ece62ea
<|skeleton|> class ElementsInCurve: def __init__(self, filename_1, filename_2, sheet_name): """Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi elemen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElementsInCurve: def __init__(self, filename_1, filename_2, sheet_name): """Input the file containing the elements data :param filename_1: Trace elements total 700 + data :param filename_2: trace Standardized values (ppm) :param sheet_name: 0 = Rare earth elements; 1 = Trace multi element""" i...
the_stack_v2_python_sparse
english/others/Elements_in_Curve.py
Lyuyangdaisy/DS_package
train
0
d6afcc23d03e1975bdc65ebe37b80153f54ddd14
[ "res = super(stock_move, self)._create_chained_picking(cr, uid, pick_name, picking, purchase_type, move, context=context)\nif picking.purchase_id:\n self.pool.get('stock.picking').write(cr, uid, [res], {'purchase_id': picking.purchase_id.id})\n self.pool.get('stock.picking').write(cr, uid, [res], {'invoice_st...
<|body_start_0|> res = super(stock_move, self)._create_chained_picking(cr, uid, pick_name, picking, purchase_type, move, context=context) if picking.purchase_id: self.pool.get('stock.picking').write(cr, uid, [res], {'purchase_id': picking.purchase_id.id}) self.pool.get('stock.pic...
TO remove pricelist
stock_move
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_move: """TO remove pricelist""" def _create_chained_picking(self, cr, uid, pick_name, picking, purchase_type, move, context=None): """This method creates chained picking and fix the problem of adding accounts for picking. @param pick_name: The name from the picking which is cre...
stack_v2_sparse_classes_36k_train_012968
5,611
no_license
[ { "docstring": "This method creates chained picking and fix the problem of adding accounts for picking. @param pick_name: The name from the picking which is created @param picking: The id of the picking which is created @param purchase_type: Purchase type @param move: The move id @return: id of creating picking...
2
stack_v2_sparse_classes_30k_test_001189
Implement the Python class `stock_move` described below. Class description: TO remove pricelist Method signatures and docstrings: - def _create_chained_picking(self, cr, uid, pick_name, picking, purchase_type, move, context=None): This method creates chained picking and fix the problem of adding accounts for picking....
Implement the Python class `stock_move` described below. Class description: TO remove pricelist Method signatures and docstrings: - def _create_chained_picking(self, cr, uid, pick_name, picking, purchase_type, move, context=None): This method creates chained picking and fix the problem of adding accounts for picking....
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class stock_move: """TO remove pricelist""" def _create_chained_picking(self, cr, uid, pick_name, picking, purchase_type, move, context=None): """This method creates chained picking and fix the problem of adding accounts for picking. @param pick_name: The name from the picking which is cre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_move: """TO remove pricelist""" def _create_chained_picking(self, cr, uid, pick_name, picking, purchase_type, move, context=None): """This method creates chained picking and fix the problem of adding accounts for picking. @param pick_name: The name from the picking which is created @param p...
the_stack_v2_python_sparse
v_7/GDS/shamil_v3/purchase_no_pricelist/stock.py
musabahmed/baba
train
0
efaf94f3c6b79f9294ae7f7e7a070a7902cf9c12
[ "@wraps(self)\ndef decorated(*args, **kwargs):\n token = None\n if 'token' in request.headers:\n token = request.headers['token']\n if not token:\n return (jsonify({'message': 'Token is missing!'}), 401)\n try:\n data = jwt.decode(token, app.config['SECRET_KEY'])\n User.query...
<|body_start_0|> @wraps(self) def decorated(*args, **kwargs): token = None if 'token' in request.headers: token = request.headers['token'] if not token: return (jsonify({'message': 'Token is missing!'}), 401) try: ...
Search_note
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search_note: def token_required(self): """Decorator meant to check if the token exists or not If the token exists check if it is valid""" <|body_0|> def get_user_by_token(self): """:param token: has to be a jwt token :return: the user based on the public_id supplied ...
stack_v2_sparse_classes_36k_train_012969
8,581
permissive
[ { "docstring": "Decorator meant to check if the token exists or not If the token exists check if it is valid", "name": "token_required", "signature": "def token_required(self)" }, { "docstring": ":param token: has to be a jwt token :return: the user based on the public_id supplied by the token",...
3
stack_v2_sparse_classes_30k_train_018154
Implement the Python class `Search_note` described below. Class description: Implement the Search_note class. Method signatures and docstrings: - def token_required(self): Decorator meant to check if the token exists or not If the token exists check if it is valid - def get_user_by_token(self): :param token: has to b...
Implement the Python class `Search_note` described below. Class description: Implement the Search_note class. Method signatures and docstrings: - def token_required(self): Decorator meant to check if the token exists or not If the token exists check if it is valid - def get_user_by_token(self): :param token: has to b...
db351b2053be5e9568d731006fd2af7002a40ca0
<|skeleton|> class Search_note: def token_required(self): """Decorator meant to check if the token exists or not If the token exists check if it is valid""" <|body_0|> def get_user_by_token(self): """:param token: has to be a jwt token :return: the user based on the public_id supplied ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Search_note: def token_required(self): """Decorator meant to check if the token exists or not If the token exists check if it is valid""" @wraps(self) def decorated(*args, **kwargs): token = None if 'token' in request.headers: token = request.hea...
the_stack_v2_python_sparse
server2/api/endpoints/stand_alone_views.py
Terkea/beds-uni-hackathon-4-notes
train
0
3113ed14b9c409e7465a6ae34adf6e61968ac811
[ "self.eps0_inv_diag = None\nself.eps_inv_diag = None\nself.eps0_file = None\nself.eps_file = None", "tmp = DielectricMatrix()\ntmp.read_from_hdf5_db(eps0, eps, mode)\nreturn tmp", "from netCDF4 import Dataset\nf = Dataset(fname, 'r')\ndata = f.variables['matrix-diagonal'][:, :, :]\nf.close()\nif data.shape[2] =...
<|body_start_0|> self.eps0_inv_diag = None self.eps_inv_diag = None self.eps0_file = None self.eps_file = None <|end_body_0|> <|body_start_1|> tmp = DielectricMatrix() tmp.read_from_hdf5_db(eps0, eps, mode) return tmp <|end_body_1|> <|body_start_2|> from...
Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5
DielectricMatrix
[ "LGPL-2.1-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DielectricMatrix: """Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5""" def __init__(self): """Set up dielectric matrix .""" <|body_0|> def from_hdf5_db(cls, eps0=None, eps=None, mode='diagonal'): """Load diele...
stack_v2_sparse_classes_36k_train_012970
11,705
permissive
[ { "docstring": "Set up dielectric matrix .", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Load dielectric matrix from eps0mat.h5 file These files are written by epsilon.x", "name": "from_hdf5_db", "signature": "def from_hdf5_db(cls, eps0=None, eps=None, mode='...
5
null
Implement the Python class `DielectricMatrix` described below. Class description: Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5 Method signatures and docstrings: - def __init__(self): Set up dielectric matrix . - def from_hdf5_db(cls, eps0=None, eps=None, mode='d...
Implement the Python class `DielectricMatrix` described below. Class description: Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5 Method signatures and docstrings: - def __init__(self): Set up dielectric matrix . - def from_hdf5_db(cls, eps0=None, eps=None, mode='d...
bdb31934a5eb49d601e492fc98078d27f5dd2ebd
<|skeleton|> class DielectricMatrix: """Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5""" def __init__(self): """Set up dielectric matrix .""" <|body_0|> def from_hdf5_db(cls, eps0=None, eps=None, mode='diagonal'): """Load diele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DielectricMatrix: """Dielectric matrix epsilon_GG'(q,omega) Provides interface to data stored in eps0mat.h5 and epsmat.h5""" def __init__(self): """Set up dielectric matrix .""" self.eps0_inv_diag = None self.eps_inv_diag = None self.eps0_file = None self.eps_file ...
the_stack_v2_python_sparse
asetk/format/bgw.py
ltalirz/asetk
train
20
aaef45a115598a156e2f341e07867bcefa8d3cea
[ "conn = SFTPOnlyClient.from_ssh_client(gateway.ssh_connect())\nif gateway.timeout:\n conn.get_channel().settimeout(gateway.timeout)\nreturn closing(conn)", "Attachment = self.env['ir.attachment']\ninputs = Attachment.browse()\nattachment_data = []\nmin_date = datetime.now() - timedelta(hours=path.age_window)\n...
<|body_start_0|> conn = SFTPOnlyClient.from_ssh_client(gateway.ssh_connect()) if gateway.timeout: conn.get_channel().settimeout(gateway.timeout) return closing(conn) <|end_body_0|> <|body_start_1|> Attachment = self.env['ir.attachment'] inputs = Attachment.browse() ...
EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents.
EdiConnectionSFTP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdiConnectionSFTP: """EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents.""" def connect(self, gateway): """Connect to SFTP server""" <|body_0|> def receive_inputs(self, conn, path, transfer): """Receive inpu...
stack_v2_sparse_classes_36k_train_012971
6,375
no_license
[ { "docstring": "Connect to SFTP server", "name": "connect", "signature": "def connect(self, gateway)" }, { "docstring": "Receive input attachments", "name": "receive_inputs", "signature": "def receive_inputs(self, conn, path, transfer)" }, { "docstring": "Send output attachments"...
3
stack_v2_sparse_classes_30k_train_012768
Implement the Python class `EdiConnectionSFTP` described below. Class description: EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents. Method signatures and docstrings: - def connect(self, gateway): Connect to SFTP server - def receive_inputs(self, conn, path, tr...
Implement the Python class `EdiConnectionSFTP` described below. Class description: EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents. Method signatures and docstrings: - def connect(self, gateway): Connect to SFTP server - def receive_inputs(self, conn, path, tr...
d6d55fbf8abecb0b8201384921833868ae849920
<|skeleton|> class EdiConnectionSFTP: """EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents.""" def connect(self, gateway): """Connect to SFTP server""" <|body_0|> def receive_inputs(self, conn, path, transfer): """Receive inpu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdiConnectionSFTP: """EDI SFTP connection An EDI SFTP connection is a remote SFTP server used to send and receive EDI documents.""" def connect(self, gateway): """Connect to SFTP server""" conn = SFTPOnlyClient.from_ssh_client(gateway.ssh_connect()) if gateway.timeout: ...
the_stack_v2_python_sparse
addons/edi/models/edi_connection_sftp.py
unipartdigital/odoo-edi
train
9
c927c73f329f7c4f7f12be770ff908959f3ee8ce
[ "if not self.early_payment_discount:\n self.early_payment_disc_total = self.amount_total\n self.early_payment_disc_tax = self.amount_tax\n self.early_payment_disc_untaxed = self.amount_untaxed\nelse:\n cur = self.pricelist_id.currency_id\n val = val1 = 0\n for line in self.order_line:\n if ...
<|body_start_0|> if not self.early_payment_discount: self.early_payment_disc_total = self.amount_total self.early_payment_disc_tax = self.amount_tax self.early_payment_disc_untaxed = self.amount_untaxed else: cur = self.pricelist_id.currency_id ...
Inherit sale_order to add early payment discount
sale_order
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sale_order: """Inherit sale_order to add early payment discount""" def _amount_all2(self): """calculates functions amount fields""" <|body_0|> def onchange_partner_id2(self, cr, uid, ids, part, early_payment_discount=False, payment_term=False, context=None): """e...
stack_v2_sparse_classes_36k_train_012972
7,334
no_license
[ { "docstring": "calculates functions amount fields", "name": "_amount_all2", "signature": "def _amount_all2(self)" }, { "docstring": "extend this event for delete early payment discount if it isn't valid to new partner or add new early payment discount", "name": "onchange_partner_id2", "...
4
null
Implement the Python class `sale_order` described below. Class description: Inherit sale_order to add early payment discount Method signatures and docstrings: - def _amount_all2(self): calculates functions amount fields - def onchange_partner_id2(self, cr, uid, ids, part, early_payment_discount=False, payment_term=Fa...
Implement the Python class `sale_order` described below. Class description: Inherit sale_order to add early payment discount Method signatures and docstrings: - def _amount_all2(self): calculates functions amount fields - def onchange_partner_id2(self, cr, uid, ids, part, early_payment_discount=False, payment_term=Fa...
9718281e31b4a4f6395d8bed54adf02799df6221
<|skeleton|> class sale_order: """Inherit sale_order to add early payment discount""" def _amount_all2(self): """calculates functions amount fields""" <|body_0|> def onchange_partner_id2(self, cr, uid, ids, part, early_payment_discount=False, payment_term=False, context=None): """e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sale_order: """Inherit sale_order to add early payment discount""" def _amount_all2(self): """calculates functions amount fields""" if not self.early_payment_discount: self.early_payment_disc_total = self.amount_total self.early_payment_disc_tax = self.amount_tax ...
the_stack_v2_python_sparse
sale_early_payment_discount/sale.py
Comunitea/external_modules
train
4
3e97f3df502a08a310f38c2e66a9b2485b07fa82
[ "self.org_number = org_number\nself.prokura = prokura\nself.signature = signature\nself.signatures = signatures\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\norg_number = dictionary.get('OrgNumber')\nprokura = dictionary.get('Prokura')\nsignature = dictionary.get(...
<|body_start_0|> self.org_number = org_number self.prokura = prokura self.signature = signature self.signatures = signatures self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None org_numb...
Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignature): TODO: type description here.
OrganizationRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationRequest: """Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignatur...
stack_v2_sparse_classes_36k_train_012973
2,864
permissive
[ { "docstring": "Constructor for the OrganizationRequest class", "name": "__init__", "signature": "def __init__(self, org_number=None, prokura=None, signature=None, signatures=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary ...
2
stack_v2_sparse_classes_30k_train_013210
Implement the Python class `OrganizationRequest` described below. Class description: Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description ...
Implement the Python class `OrganizationRequest` described below. Class description: Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description ...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class OrganizationRequest: """Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignatur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationRequest: """Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignature): TODO: typ...
the_stack_v2_python_sparse
idfy_rest_client/models/organization_request.py
dealflowteam/Idfy
train
0
4466336ade31863df97c6abec9e3c2a2f0a10fca
[ "pkgs_changed = []\nif not action.keys():\n log.debug('No gems specified')\n return pkgs_changed\nfor pkg in action:\n installed = False\n if not action[pkg]:\n installed = self._install_gem(pkg)\n elif isinstance(action[pkg], basestring):\n installed = self._install_gem(pkg, action[pkg...
<|body_start_0|> pkgs_changed = [] if not action.keys(): log.debug('No gems specified') return pkgs_changed for pkg in action: installed = False if not action[pkg]: installed = self._install_gem(pkg) elif isinstance(acti...
Installs packages via rubygems
GemTool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a...
stack_v2_sparse_classes_36k_train_012974
5,320
no_license
[ { "docstring": "Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a list of strings Exceptions: ToolError -- on expected failures (such as a non-zero exit code)", "nam...
3
null
Implement the Python class `GemTool` described below. Class description: Installs packages via rubygems Method signatures and docstrings: - def apply(self, action, auth_config=None): Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package na...
Implement the Python class `GemTool` described below. Class description: Installs packages via rubygems Method signatures and docstrings: - def apply(self, action, auth_config=None): Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package na...
a473d0d389612e53a2ad6fe8a18d984474c44623
<|skeleton|> class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a list of stri...
the_stack_v2_python_sparse
p/dist-packages/cfnbootstrap/lang_package_tools.py
joshg111/craigslist_kbb
train
7
99a588fd1b3c8e7defae24d01c4ae7e08c5fb5c1
[ "if not callable(trafo):\n raise ValueError('trafo is not callable, but of type {}'.format(type(trafo)))\nsuper(WithThresh, self).__init__()\nself.batch_wise: bool = batch_wise\n'Whether to assume a batch of masks is given (``True``) or a\\n single mask (``False``).'\nself.trafo: Callable[[torch.Tensor], ...
<|body_start_0|> if not callable(trafo): raise ValueError('trafo is not callable, but of type {}'.format(type(trafo))) super(WithThresh, self).__init__() self.batch_wise: bool = batch_wise 'Whether to assume a batch of masks is given (``True``) or a\n single mask (``Fa...
Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThresh.batch_wise` is ``True``) and return a transformed batch. If given, ``pre_...
WithThresh
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WithThresh: """Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThresh.batch_wise` is ``True``) and return...
stack_v2_sparse_classes_36k_train_012975
14,707
permissive
[ { "docstring": "Init. :param trafo: the transformation instance to wrap :param pre_thresh: if not ``None``, the tensors to be modified are binarized to 0 and 1 values with threshold ``pre_thresh`` before modification :param post_thresh: if not ``None``, the tensors to be modified are binarized to 0 and 1 values...
3
stack_v2_sparse_classes_30k_train_015065
Implement the Python class `WithThresh` described below. Class description: Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThr...
Implement the Python class `WithThresh` described below. Class description: Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThr...
37b9fc83d7b14902dfe92e0c45071c150bcf3779
<|skeleton|> class WithThresh: """Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThresh.batch_wise` is ``True``) and return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WithThresh: """Wrap a batch transformation with binarizing (and unsqueezing) before and after. The transformation should accept a tensor holding a masks (respectively a batch of masks if :py:attr:`~hybrid_learning.datasets.transforms.image_transforms.WithThresh.batch_wise` is ``True``) and return a transforme...
the_stack_v2_python_sparse
hybrid_learning/datasets/transforms/image_transforms.py
JohnnyZhang917/hybrid_learning
train
0
48c919946ce879045c6ff2cda93ebb08923bb76c
[ "try:\n release = Release.objects.get(project=project, version=version)\nexcept Release.DoesNotExist:\n raise ResourceDoesNotExist\nfile_list = ReleaseFile.objects.filter(release=release).select_related('file').order_by('name')\nreturn self.paginate(request=request, queryset=file_list, order_by='name', pagina...
<|body_start_0|> try: release = Release.objects.get(project=project, version=version) except Release.DoesNotExist: raise ResourceDoesNotExist file_list = ReleaseFile.objects.filter(release=release).select_related('file').order_by('name') return self.paginate(reque...
ReleaseFilesEndpoint
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReleaseFilesEndpoint: def get(self, request, project, version): """List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of t...
stack_v2_sparse_classes_36k_train_012976
6,460
permissive
[ { "docstring": "List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project to list the release files of. :pparam string version: the versio...
2
null
Implement the Python class `ReleaseFilesEndpoint` described below. Class description: Implement the ReleaseFilesEndpoint class. Method signatures and docstrings: - def get(self, request, project, version): List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organ...
Implement the Python class `ReleaseFilesEndpoint` described below. Class description: Implement the ReleaseFilesEndpoint class. Method signatures and docstrings: - def get(self, request, project, version): List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organ...
cddc3b643a13b52ac6d07ff22e4bd5d69ecbad90
<|skeleton|> class ReleaseFilesEndpoint: def get(self, request, project, version): """List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReleaseFilesEndpoint: def get(self, request, project, version): """List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project to ...
the_stack_v2_python_sparse
src/sentry/api/endpoints/release_files.py
mitsuhiko/sentry
train
4
420fabc4c13777bf3a4a7a4796063b42e8a8e741
[ "self.num_elem = self.kwargs['num_elem']\nnum_pts = self.num_elem + 1\nind_pts = range(num_pts)\nself._declare_variable('rho', size=num_pts, lower=0.001)\nself._declare_argument('Temp', indices=ind_pts)", "pvec = self.vec['p']\nuvec = self.vec['u']\ntemp = pvec('Temp') * 100.0\nrho = uvec('rho')\nrho[:] = 1.225 *...
<|body_start_0|> self.num_elem = self.kwargs['num_elem'] num_pts = self.num_elem + 1 ind_pts = range(num_pts) self._declare_variable('rho', size=num_pts, lower=0.001) self._declare_argument('Temp', indices=ind_pts) <|end_body_0|> <|body_start_1|> pvec = self.vec['p'] ...
density model using the linear temperature std atm model
SysRhoOld
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SysRhoOld: """density model using the linear temperature std atm model""" def _declare(self): """owned variable: rho (density) dependencies: temp (temperature)""" <|body_0|> def apply_G(self): """Density model extracted from the standard atmosphere. Only dependen...
stack_v2_sparse_classes_36k_train_012977
17,488
no_license
[ { "docstring": "owned variable: rho (density) dependencies: temp (temperature)", "name": "_declare", "signature": "def _declare(self)" }, { "docstring": "Density model extracted from the standard atmosphere. Only dependence on temperature, with indirect dependence on altitude. Temperature model ...
3
stack_v2_sparse_classes_30k_train_007122
Implement the Python class `SysRhoOld` described below. Class description: density model using the linear temperature std atm model Method signatures and docstrings: - def _declare(self): owned variable: rho (density) dependencies: temp (temperature) - def apply_G(self): Density model extracted from the standard atmo...
Implement the Python class `SysRhoOld` described below. Class description: density model using the linear temperature std atm model Method signatures and docstrings: - def _declare(self): owned variable: rho (density) dependencies: temp (temperature) - def apply_G(self): Density model extracted from the standard atmo...
f5b1ce287c6692540b738a7e9ec85be645f4947a
<|skeleton|> class SysRhoOld: """density model using the linear temperature std atm model""" def _declare(self): """owned variable: rho (density) dependencies: temp (temperature)""" <|body_0|> def apply_G(self): """Density model extracted from the standard atmosphere. Only dependen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SysRhoOld: """density model using the linear temperature std atm model""" def _declare(self): """owned variable: rho (density) dependencies: temp (temperature)""" self.num_elem = self.kwargs['num_elem'] num_pts = self.num_elem + 1 ind_pts = range(num_pts) self._dec...
the_stack_v2_python_sparse
cmf_original_code/atmospherics.py
naylor-b/pyMission
train
0
cd8554dcfd6144db0c9af331596613c981fac1e4
[ "if not matrix:\n return False\nif not matrix[0]:\n return False\nfor i in range(len(matrix[0]) - 1, -1, -1):\n if matrix[0][i] <= target:\n for j in range(len(matrix)):\n if matrix[j][i] >= target:\n small_matrix = matrix[j:][:i + 1]\n for x in small_matrix:...
<|body_start_0|> if not matrix: return False if not matrix[0]: return False for i in range(len(matrix[0]) - 1, -1, -1): if matrix[0][i] <= target: for j in range(len(matrix)): if matrix[j][i] >= target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix2(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_012978
1,598
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix1", "signature": "def searchMatrix1(self, matrix, target)" }, { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix2", "signature": "def sear...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix1(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix1(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :ty...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def searchMatrix1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix2(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if not matrix: return False if not matrix[0]: return False for i in range(len(matrix[0]) - 1, -1, -1): if matrix[0][i] <= ta...
the_stack_v2_python_sparse
Python/LeetCode/74.py
czx94/Algorithms-Collection
train
2
a8a14cc306ad15a2bec7353415321668c425c07c
[ "self.event_str = event_str\nself.date = calendar_util.convert_str_to_date(date_str)\nself.start_time_str = start_time_str\nself.end_time_str = end_time_str", "date_str = datetime.datetime.strftime(self.date, calendar_util.DATE_STR_FMT)\nret = ' '.join([self.event_str, 'on', date_str])\nif self.start_time_str:\n ...
<|body_start_0|> self.event_str = event_str self.date = calendar_util.convert_str_to_date(date_str) self.start_time_str = start_time_str self.end_time_str = end_time_str <|end_body_0|> <|body_start_1|> date_str = datetime.datetime.strftime(self.date, calendar_util.DATE_STR_FMT) ...
Class for storing calendar event information.
CalendarEvent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" <|body_0|> def __str__(self): """Returns the st...
stack_v2_sparse_classes_36k_train_012979
1,047
permissive
[ { "docstring": "Initialize this CalendarEvent instance.", "name": "__init__", "signature": "def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str='')" }, { "docstring": "Returns the string representation of this CalendarEvent.", "name": "__str__", ...
2
stack_v2_sparse_classes_30k_train_010915
Implement the Python class `CalendarEvent` described below. Class description: Class for storing calendar event information. Method signatures and docstrings: - def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): Initialize this CalendarEvent instance. - def __str__(...
Implement the Python class `CalendarEvent` described below. Class description: Class for storing calendar event information. Method signatures and docstrings: - def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): Initialize this CalendarEvent instance. - def __str__(...
9fdf2f2b4861450fbed64b90b8c7c69b0173e052
<|skeleton|> class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" <|body_0|> def __str__(self): """Returns the st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" self.event_str = event_str self.date = calendar_util.convert_str_...
the_stack_v2_python_sparse
LTUAssistantPlus/services/calendar/calendar_event.py
Xyaneon/LTUAssistantPlus
train
0
3e0fa2e54938d72afe0ee795890c28920402d6dc
[ "wx.Menu.__init__(self)\nself._callbacks = {}\nfor i in menu:\n menuid = wx.NewId()\n item = wx.MenuItem(self, menuid, i[0])\n self._callbacks[menuid] = i[1]\n self.Append(item)\n self.Bind(wx.EVT_MENU, self.on_callback, item)", "menuid = event.GetId()\nself._callbacks[menuid](event)\nevent.Skip()"...
<|body_start_0|> wx.Menu.__init__(self) self._callbacks = {} for i in menu: menuid = wx.NewId() item = wx.MenuItem(self, menuid, i[0]) self._callbacks[menuid] = i[1] self.Append(item) self.Bind(wx.EVT_MENU, self.on_callback, item) <|end...
Context Menu.
ContextMenu
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextMenu: """Context Menu.""" def __init__(self, menu): """Attach the context menu to to the parent with the defined items.""" <|body_0|> def on_callback(self, event): """Execute the menu item callback.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_012980
9,581
permissive
[ { "docstring": "Attach the context menu to to the parent with the defined items.", "name": "__init__", "signature": "def __init__(self, menu)" }, { "docstring": "Execute the menu item callback.", "name": "on_callback", "signature": "def on_callback(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_013390
Implement the Python class `ContextMenu` described below. Class description: Context Menu. Method signatures and docstrings: - def __init__(self, menu): Attach the context menu to to the parent with the defined items. - def on_callback(self, event): Execute the menu item callback.
Implement the Python class `ContextMenu` described below. Class description: Context Menu. Method signatures and docstrings: - def __init__(self, menu): Attach the context menu to to the parent with the defined items. - def on_callback(self, event): Execute the menu item callback. <|skeleton|> class ContextMenu: ...
95129ca054384a4c59a4effdb3fe32a7a66af6ff
<|skeleton|> class ContextMenu: """Context Menu.""" def __init__(self, menu): """Attach the context menu to to the parent with the defined items.""" <|body_0|> def on_callback(self, event): """Execute the menu item callback.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContextMenu: """Context Menu.""" def __init__(self, menu): """Attach the context menu to to the parent with the defined items.""" wx.Menu.__init__(self) self._callbacks = {} for i in menu: menuid = wx.NewId() item = wx.MenuItem(self, menuid, i[0]) ...
the_stack_v2_python_sparse
rummage/lib/gui/controls/custom_statusbar.py
facelessuser/Rummage
train
70
4ac01e9db0266170690e0c450adeb2258ce5ce60
[ "super(GeneratorNet, self).__init__()\nself.n_features = 100\nself.n_out = 784\nself.__model_fn()\nself.optimizer = optim.Adam(self.parameters(), lr=0.0002)", "self.hidden0 = nn.Sequential(nn.Linear(self.n_features, 256), nn.LeakyReLU(0.2))\nself.hidden1 = nn.Sequential(nn.Linear(256, 512), nn.LeakyReLU(0.2))\nse...
<|body_start_0|> super(GeneratorNet, self).__init__() self.n_features = 100 self.n_out = 784 self.__model_fn() self.optimizer = optim.Adam(self.parameters(), lr=0.0002) <|end_body_0|> <|body_start_1|> self.hidden0 = nn.Sequential(nn.Linear(self.n_features, 256), nn.Leaky...
Class GeneratorNet.
GeneratorNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneratorNet: """Class GeneratorNet.""" def __init__(self): """Constructor.""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :param X: network input""" ...
stack_v2_sparse_classes_36k_train_012981
11,950
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Specifies the network.", "name": "__model_fn", "signature": "def __model_fn(self)" }, { "docstring": "Performs a forward-pass on the data. :param X: network input", "name":...
3
stack_v2_sparse_classes_30k_train_013518
Implement the Python class `GeneratorNet` described below. Class description: Class GeneratorNet. Method signatures and docstrings: - def __init__(self): Constructor. - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network input
Implement the Python class `GeneratorNet` described below. Class description: Class GeneratorNet. Method signatures and docstrings: - def __init__(self): Constructor. - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network input <|skeleton|> class...
98b71b76f664d5f6493bd7f90036531d8f6644a7
<|skeleton|> class GeneratorNet: """Class GeneratorNet.""" def __init__(self): """Constructor.""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :param X: network input""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneratorNet: """Class GeneratorNet.""" def __init__(self): """Constructor.""" super(GeneratorNet, self).__init__() self.n_features = 100 self.n_out = 784 self.__model_fn() self.optimizer = optim.Adam(self.parameters(), lr=0.0002) def __model_fn(self):...
the_stack_v2_python_sparse
06_python/misc/gan.py
pfisterer/Applied_ML_Fundamentals
train
0
66f4852fd4f4ffadd33f36f25760bfa23338c89c
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nscenario = Scenario.query.get(scenario_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID')\nif not sketch.has_permission(current_user, 'write'):\n abort(HTTP_STATUS_CODE_FORBIDDEN, 'User does not have write access controls on ...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) scenario = Scenario.query.get(scenario_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID') if not sketch.has_permission(current_user, 'write'): abort(HTTP_STATUS_CODE_F...
Resource for investigative scenarios.
ScenarioResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" <|body_0|> def post(self, sketch_id, scenario_id): """Handles...
stack_v2_sparse_classes_36k_train_012982
15,391
permissive
[ { "docstring": "Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.", "name": "get", "signature": "def get(self, sketch_id, scenario_id)" }, { "docstring": "Handles POST request to the resource. This resource creates a new scenario for a sketch based on...
2
stack_v2_sparse_classes_30k_train_014919
Implement the Python class `ScenarioResource` described below. Class description: Resource for investigative scenarios. Method signatures and docstrings: - def get(self, sketch_id, scenario_id): Handles GET request to the resource. Returns: A list of JSON representations of the scenarios. - def post(self, sketch_id, ...
Implement the Python class `ScenarioResource` described below. Class description: Resource for investigative scenarios. Method signatures and docstrings: - def get(self, sketch_id, scenario_id): Handles GET request to the resource. Returns: A list of JSON representations of the scenarios. - def post(self, sketch_id, ...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" <|body_0|> def post(self, sketch_id, scenario_id): """Handles...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScenarioResource: """Resource for investigative scenarios.""" def get(self, sketch_id, scenario_id): """Handles GET request to the resource. Returns: A list of JSON representations of the scenarios.""" sketch = Sketch.query.get_with_acl(sketch_id) scenario = Scenario.query.get(sce...
the_stack_v2_python_sparse
timesketch/api/v1/resources/scenarios.py
google/timesketch
train
2,263
e9c5f30f1bc8ea3b6321a8daf805d87181566bb1
[ "graph = BELGraph()\nself.update(graph)\nreturn graph", "if self.name:\n graph.name = self.name\nif self.version:\n graph.version = self.version\nif self.authors:\n graph.authors = self.authors\nif self.description:\n graph.description = self.description\nif self.contact:\n graph.contact = self.con...
<|body_start_0|> graph = BELGraph() self.update(graph) return graph <|end_body_0|> <|body_start_1|> if self.name: graph.name = self.name if self.version: graph.version = self.version if self.authors: graph.authors = self.authors ...
A container for BEL document metadata.
BELMetadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BELMetadata: """A container for BEL document metadata.""" def new(self) -> BELGraph: """Generate a new BEL graph with the given metadata.""" <|body_0|> def update(self, graph: BELGraph) -> None: """Update the BEL graph's metadata.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_012983
18,905
permissive
[ { "docstring": "Generate a new BEL graph with the given metadata.", "name": "new", "signature": "def new(self) -> BELGraph" }, { "docstring": "Update the BEL graph's metadata.", "name": "update", "signature": "def update(self, graph: BELGraph) -> None" } ]
2
null
Implement the Python class `BELMetadata` described below. Class description: A container for BEL document metadata. Method signatures and docstrings: - def new(self) -> BELGraph: Generate a new BEL graph with the given metadata. - def update(self, graph: BELGraph) -> None: Update the BEL graph's metadata.
Implement the Python class `BELMetadata` described below. Class description: A container for BEL document metadata. Method signatures and docstrings: - def new(self) -> BELGraph: Generate a new BEL graph with the given metadata. - def update(self, graph: BELGraph) -> None: Update the BEL graph's metadata. <|skeleton...
ed66f013a77f9cbc513892b0dad1025b8f68bb46
<|skeleton|> class BELMetadata: """A container for BEL document metadata.""" def new(self) -> BELGraph: """Generate a new BEL graph with the given metadata.""" <|body_0|> def update(self, graph: BELGraph) -> None: """Update the BEL graph's metadata.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BELMetadata: """A container for BEL document metadata.""" def new(self) -> BELGraph: """Generate a new BEL graph with the given metadata.""" graph = BELGraph() self.update(graph) return graph def update(self, graph: BELGraph) -> None: """Update the BEL graph's...
the_stack_v2_python_sparse
src/pybel/repository.py
pybel/pybel
train
133
66b0d04f9ff8ff6a25a73968d0081278f7593e60
[ "if form_class is None:\n form_class = self.get_form_class()\nreturn form_class(token=self.request.session.get('token', False), aiid=self.kwargs['aiid'], **self.get_form_kwargs())", "initial = super(SkillsView, self).get_initial()\nai = get_ai(self.request.session.get('token', False), self.kwargs['aiid'])\nini...
<|body_start_0|> if form_class is None: form_class = self.get_form_class() return form_class(token=self.request.session.get('token', False), aiid=self.kwargs['aiid'], **self.get_form_kwargs()) <|end_body_0|> <|body_start_1|> initial = super(SkillsView, self).get_initial() ai...
SkillsView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkillsView: def get_form(self, form_class=None): """Return an instance of the form to be used in this view.""" <|body_0|> def get_initial(self): """Returns the initial data to use for forms on this view.""" <|body_1|> def form_valid(self, form): ...
stack_v2_sparse_classes_36k_train_012984
39,842
permissive
[ { "docstring": "Return an instance of the form to be used in this view.", "name": "get_form", "signature": "def get_form(self, form_class=None)" }, { "docstring": "Returns the initial data to use for forms on this view.", "name": "get_initial", "signature": "def get_initial(self)" }, ...
3
stack_v2_sparse_classes_30k_train_014337
Implement the Python class `SkillsView` described below. Class description: Implement the SkillsView class. Method signatures and docstrings: - def get_form(self, form_class=None): Return an instance of the form to be used in this view. - def get_initial(self): Returns the initial data to use for forms on this view. ...
Implement the Python class `SkillsView` described below. Class description: Implement the SkillsView class. Method signatures and docstrings: - def get_form(self, form_class=None): Return an instance of the form to be used in this view. - def get_initial(self): Returns the initial data to use for forms on this view. ...
d632d00f9a22a7a826bba4896a7102b2ac8690ff
<|skeleton|> class SkillsView: def get_form(self, form_class=None): """Return an instance of the form to be used in this view.""" <|body_0|> def get_initial(self): """Returns the initial data to use for forms on this view.""" <|body_1|> def form_valid(self, form): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkillsView: def get_form(self, form_class=None): """Return an instance of the form to be used in this view.""" if form_class is None: form_class = self.get_form_class() return form_class(token=self.request.session.get('token', False), aiid=self.kwargs['aiid'], **self.get_fo...
the_stack_v2_python_sparse
src/studio/views.py
hutomadotAI/web-console
train
6
2f6587ebab7cdefe199aa9036e8992aa4c02047e
[ "if 'not' in data:\n new_data = {'not': True}\n for key, value in data.get('not').items():\n new_data[key] = value\n data = new_data\nif 'enum' in data:\n if not isinstance(data.get('enum'), list):\n raise ValidationError('enum is not specified as a list')\nreturn data", "if data.pop('no...
<|body_start_0|> if 'not' in data: new_data = {'not': True} for key, value in data.get('not').items(): new_data[key] = value data = new_data if 'enum' in data: if not isinstance(data.get('enum'), list): raise ValidationError...
Single Filter Schema.
FilterSchema
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterSchema: """Single Filter Schema.""" def extract_info(self, data, **kwargs): """Enum validation and not filter logic.""" <|body_0|> def serialize_reformat(self, data, **kwargs): """Support serialization of not filter according to DIF spec.""" <|body_...
stack_v2_sparse_classes_36k_train_012985
27,273
permissive
[ { "docstring": "Enum validation and not filter logic.", "name": "extract_info", "signature": "def extract_info(self, data, **kwargs)" }, { "docstring": "Support serialization of not filter according to DIF spec.", "name": "serialize_reformat", "signature": "def serialize_reformat(self, d...
2
null
Implement the Python class `FilterSchema` described below. Class description: Single Filter Schema. Method signatures and docstrings: - def extract_info(self, data, **kwargs): Enum validation and not filter logic. - def serialize_reformat(self, data, **kwargs): Support serialization of not filter according to DIF spe...
Implement the Python class `FilterSchema` described below. Class description: Single Filter Schema. Method signatures and docstrings: - def extract_info(self, data, **kwargs): Enum validation and not filter logic. - def serialize_reformat(self, data, **kwargs): Support serialization of not filter according to DIF spe...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class FilterSchema: """Single Filter Schema.""" def extract_info(self, data, **kwargs): """Enum validation and not filter logic.""" <|body_0|> def serialize_reformat(self, data, **kwargs): """Support serialization of not filter according to DIF spec.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterSchema: """Single Filter Schema.""" def extract_info(self, data, **kwargs): """Enum validation and not filter logic.""" if 'not' in data: new_data = {'not': True} for key, value in data.get('not').items(): new_data[key] = value dat...
the_stack_v2_python_sparse
aries_cloudagent/protocols/present_proof/dif/pres_exch.py
hyperledger/aries-cloudagent-python
train
370
0ccd90e3cc0e4ba33dc54abaec43caa0ab161433
[ "def f(txn: LoggingTransaction) -> None:\n txn.execute('SELECT 1 FROM erased_users WHERE user_id = ?', (user_id,))\n if txn.fetchone():\n return\n txn.execute('INSERT INTO erased_users (user_id) VALUES (?)', (user_id,))\n self._invalidate_cache_and_stream(txn, self.is_user_erased, (user_id,))\naw...
<|body_start_0|> def f(txn: LoggingTransaction) -> None: txn.execute('SELECT 1 FROM erased_users WHERE user_id = ?', (user_id,)) if txn.fetchone(): return txn.execute('INSERT INTO erased_users (user_id) VALUES (?)', (user_id,)) self._invalidate_cac...
UserErasureStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserErasureStore: async def mark_user_erased(self, user_id: str) -> None: """Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased""" <|body_0|> async def mark_user_not_erased(self, user_id: str) -> None: """Indicat...
stack_v2_sparse_classes_36k_train_012986
3,689
permissive
[ { "docstring": "Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased", "name": "mark_user_erased", "signature": "async def mark_user_erased(self, user_id: str) -> None" }, { "docstring": "Indicate that user_id is no longer erased. Args: user_i...
2
stack_v2_sparse_classes_30k_train_011104
Implement the Python class `UserErasureStore` described below. Class description: Implement the UserErasureStore class. Method signatures and docstrings: - async def mark_user_erased(self, user_id: str) -> None: Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased ...
Implement the Python class `UserErasureStore` described below. Class description: Implement the UserErasureStore class. Method signatures and docstrings: - async def mark_user_erased(self, user_id: str) -> None: Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased ...
d35bed8369514fe727b4fe1afb68f48cc8b2655a
<|skeleton|> class UserErasureStore: async def mark_user_erased(self, user_id: str) -> None: """Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased""" <|body_0|> async def mark_user_not_erased(self, user_id: str) -> None: """Indicat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserErasureStore: async def mark_user_erased(self, user_id: str) -> None: """Indicate that user_id wishes their message history to be erased. Args: user_id: full user_id to be erased""" def f(txn: LoggingTransaction) -> None: txn.execute('SELECT 1 FROM erased_users WHERE user_id = ...
the_stack_v2_python_sparse
synapse/storage/databases/main/user_erasure_store.py
matrix-org/synapse
train
12,215
1c74a998242901b44bb6fc055b65dfe6dd56c877
[ "parser.add_argument('review_request_ids', metavar='REVIEW_REQUEST_ID', nargs='*', help='Specific review request IDs to reset.')\nparser.add_argument('-a', '--all', action='store_true', default=False, dest='all', help='Reset issue counts for all review requests.')\nparser.add_argument('--recalculate', action='store...
<|body_start_0|> parser.add_argument('review_request_ids', metavar='REVIEW_REQUEST_ID', nargs='*', help='Specific review request IDs to reset.') parser.add_argument('-a', '--all', action='store_true', default=False, dest='all', help='Reset issue counts for all review requests.') parser.add_argum...
Management command to reset issue counters.
Command
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Management command to reset issue counters.""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" <|body_0|> def handle(self, *args, **options): """Handle t...
stack_v2_sparse_classes_36k_train_012987
3,134
permissive
[ { "docstring": "Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "Handle the command. Args: *args (tuple): Specific review request IDs to reset. *...
2
null
Implement the Python class `Command` described below. Class description: Management command to reset issue counters. Method signatures and docstrings: - def add_arguments(self, parser): Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command. - def handle(self, *args,...
Implement the Python class `Command` described below. Class description: Management command to reset issue counters. Method signatures and docstrings: - def add_arguments(self, parser): Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command. - def handle(self, *args,...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class Command: """Management command to reset issue counters.""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" <|body_0|> def handle(self, *args, **options): """Handle t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """Management command to reset issue counters.""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" parser.add_argument('review_request_ids', metavar='REVIEW_REQUEST_ID', nargs='*', he...
the_stack_v2_python_sparse
reviewboard/reviews/management/commands/reset-issue-counts.py
reviewboard/reviewboard
train
1,141
5aaa1f03a61c1e57da76276798c80ad98353eb91
[ "logger = logger or setup_logger('LocalCommandRunner')\nself.logger = logger\nself.host = host", "if isinstance(command, list):\n popen_args = command\nelse:\n popen_args = _shlex_split(command)\nself.logger.debug('[{0}] run: {1}'.format(self.host, popen_args))\nstdout = subprocess.PIPE if stdout_pipe else ...
<|body_start_0|> logger = logger or setup_logger('LocalCommandRunner') self.logger = logger self.host = host <|end_body_0|> <|body_start_1|> if isinstance(command, list): popen_args = command else: popen_args = _shlex_split(command) self.logger.de...
LocalCommandRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalCommandRunner: def __init__(self, logger=None, host='localhost'): """:param logger: This logger will be used for printing the output and the command.""" <|body_0|> def run(self, command, exit_on_failure=True, stdout_pipe=True, stderr_pipe=True, cwd=None, execution_env=N...
stack_v2_sparse_classes_36k_train_012988
37,803
permissive
[ { "docstring": ":param logger: This logger will be used for printing the output and the command.", "name": "__init__", "signature": "def __init__(self, logger=None, host='localhost')" }, { "docstring": "Runs local commands. :param command: The command to execute. :param exit_on_failure: False to...
2
stack_v2_sparse_classes_30k_train_020655
Implement the Python class `LocalCommandRunner` described below. Class description: Implement the LocalCommandRunner class. Method signatures and docstrings: - def __init__(self, logger=None, host='localhost'): :param logger: This logger will be used for printing the output and the command. - def run(self, command, e...
Implement the Python class `LocalCommandRunner` described below. Class description: Implement the LocalCommandRunner class. Method signatures and docstrings: - def __init__(self, logger=None, host='localhost'): :param logger: This logger will be used for printing the output and the command. - def run(self, command, e...
246550c150e33e3e8cf815e1ecff244d82293832
<|skeleton|> class LocalCommandRunner: def __init__(self, logger=None, host='localhost'): """:param logger: This logger will be used for printing the output and the command.""" <|body_0|> def run(self, command, exit_on_failure=True, stdout_pipe=True, stderr_pipe=True, cwd=None, execution_env=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocalCommandRunner: def __init__(self, logger=None, host='localhost'): """:param logger: This logger will be used for printing the output and the command.""" logger = logger or setup_logger('LocalCommandRunner') self.logger = logger self.host = host def run(self, command, ...
the_stack_v2_python_sparse
cloudify/utils.py
cloudify-cosmo/cloudify-common
train
8
99df6a52d5abc0e40549369e2bff49581d55c2ef
[ "a, b = (0, 1)\nif n == 0:\n return 0\nwhile n > 1:\n n -= 1\n a, b = (b, a + b)\nreturn b % 1000000007", "a, b = (1, 2)\nwhile n > 1:\n n -= 1\n a, b = (b, a + b)\nreturn a % 1000000007" ]
<|body_start_0|> a, b = (0, 1) if n == 0: return 0 while n > 1: n -= 1 a, b = (b, a + b) return b % 1000000007 <|end_body_0|> <|body_start_1|> a, b = (1, 2) while n > 1: n -= 1 a, b = (b, a + b) return a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib(self, n: int) -> int: """offer 10-1斐波那契数列""" <|body_0|> def numWays(self, n: int) -> int: """offer 10-2青蛙跳台阶""" <|body_1|> <|end_skeleton|> <|body_start_0|> a, b = (0, 1) if n == 0: return 0 while n > 1:...
stack_v2_sparse_classes_36k_train_012989
1,573
no_license
[ { "docstring": "offer 10-1斐波那契数列", "name": "fib", "signature": "def fib(self, n: int) -> int" }, { "docstring": "offer 10-2青蛙跳台阶", "name": "numWays", "signature": "def numWays(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: offer 10-1斐波那契数列 - def numWays(self, n: int) -> int: offer 10-2青蛙跳台阶
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n: int) -> int: offer 10-1斐波那契数列 - def numWays(self, n: int) -> int: offer 10-2青蛙跳台阶 <|skeleton|> class Solution: def fib(self, n: int) -> int: """off...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def fib(self, n: int) -> int: """offer 10-1斐波那契数列""" <|body_0|> def numWays(self, n: int) -> int: """offer 10-2青蛙跳台阶""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fib(self, n: int) -> int: """offer 10-1斐波那契数列""" a, b = (0, 1) if n == 0: return 0 while n > 1: n -= 1 a, b = (b, a + b) return b % 1000000007 def numWays(self, n: int) -> int: """offer 10-2青蛙跳台阶""" ...
the_stack_v2_python_sparse
Offer/09_CQueue.py
helloprogram6/leetcode_Cookbook_python
train
0
4ffe9820be16705c6336831481c97cf2bbc8094f
[ "if hasattr(self, '_cy'):\n return\nself._cy = Int(0)", "from apysc.type import value_util\nself._initialize_cy_if_not_initialized()\nreturn value_util.get_copy(value=self._cy)", "from apysc.validation import number_validation\nnumber_validation.validate_integer(integer=value)\nif not isinstance(value, Int):...
<|body_start_0|> if hasattr(self, '_cy'): return self._cy = Int(0) <|end_body_0|> <|body_start_1|> from apysc.type import value_util self._initialize_cy_if_not_initialized() return value_util.get_copy(value=self._cy) <|end_body_1|> <|body_start_2|> from apys...
CyInterface
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CyInterface: def _initialize_cy_if_not_initialized(self) -> None: """Initialize _cy attribute if it is not initialized yet.""" <|body_0|> def y(self) -> Int: """Get a center y-coordinate. Returns ------- y : Int Center y-coordinate.""" <|body_1|> def y(s...
stack_v2_sparse_classes_36k_train_012990
2,926
permissive
[ { "docstring": "Initialize _cy attribute if it is not initialized yet.", "name": "_initialize_cy_if_not_initialized", "signature": "def _initialize_cy_if_not_initialized(self) -> None" }, { "docstring": "Get a center y-coordinate. Returns ------- y : Int Center y-coordinate.", "name": "y", ...
6
null
Implement the Python class `CyInterface` described below. Class description: Implement the CyInterface class. Method signatures and docstrings: - def _initialize_cy_if_not_initialized(self) -> None: Initialize _cy attribute if it is not initialized yet. - def y(self) -> Int: Get a center y-coordinate. Returns -------...
Implement the Python class `CyInterface` described below. Class description: Implement the CyInterface class. Method signatures and docstrings: - def _initialize_cy_if_not_initialized(self) -> None: Initialize _cy attribute if it is not initialized yet. - def y(self) -> Int: Get a center y-coordinate. Returns -------...
5c6a4674e2e9684cb2cb1325dc9b070879d4d355
<|skeleton|> class CyInterface: def _initialize_cy_if_not_initialized(self) -> None: """Initialize _cy attribute if it is not initialized yet.""" <|body_0|> def y(self) -> Int: """Get a center y-coordinate. Returns ------- y : Int Center y-coordinate.""" <|body_1|> def y(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CyInterface: def _initialize_cy_if_not_initialized(self) -> None: """Initialize _cy attribute if it is not initialized yet.""" if hasattr(self, '_cy'): return self._cy = Int(0) def y(self) -> Int: """Get a center y-coordinate. Returns ------- y : Int Center y-c...
the_stack_v2_python_sparse
apysc/display/cy_interface.py
TrendingTechnology/apysc
train
0
0d8beca4a6422279aac2463ce9e04c32cc8c6435
[ "result = urlparse(base_url)\nresult = ParseResult(result.scheme, result.netloc, result.path, result.params, urlencode(query_parameters), result.fragment)\nreturn result.geturl()", "try:\n url_parsed = urlparse(url)\nexcept AttributeError:\n return False\nurl_match_in_list = False\nfor allowed_domain in dom...
<|body_start_0|> result = urlparse(base_url) result = ParseResult(result.scheme, result.netloc, result.path, result.params, urlencode(query_parameters), result.fragment) return result.geturl() <|end_body_0|> <|body_start_1|> try: url_parsed = urlparse(url) except Att...
Contains different helper methods simplifying URL construction.
URLUtility
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLUtility: """Contains different helper methods simplifying URL construction.""" def build_url(base_url, query_parameters): """Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :param query_parameters: Dictionary containing query paramete...
stack_v2_sparse_classes_36k_train_012991
3,107
permissive
[ { "docstring": "Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :param query_parameters: Dictionary containing query parameters :type query_parameters: Dict :return: Constructed URL :rtype: str", "name": "build_url", "signature": "def build_url(base_url, qu...
2
null
Implement the Python class `URLUtility` described below. Class description: Contains different helper methods simplifying URL construction. Method signatures and docstrings: - def build_url(base_url, query_parameters): Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :par...
Implement the Python class `URLUtility` described below. Class description: Contains different helper methods simplifying URL construction. Method signatures and docstrings: - def build_url(base_url, query_parameters): Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :par...
662cc7e0721d0153857c8c17a37e2a6df86f8ce6
<|skeleton|> class URLUtility: """Contains different helper methods simplifying URL construction.""" def build_url(base_url, query_parameters): """Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :param query_parameters: Dictionary containing query paramete...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class URLUtility: """Contains different helper methods simplifying URL construction.""" def build_url(base_url, query_parameters): """Construct a URL with specified query parameters. :param base_url: Base URL :type base_url: str :param query_parameters: Dictionary containing query parameters :type quer...
the_stack_v2_python_sparse
api/util/url.py
NYPL-Simplified/circulation
train
20
1b516fd1f764b25e83edf869f06c39e327824270
[ "self.model = MultinomialNB\nself.active_model = None\nself.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior': [True, False]}", "classifier = GridSearchCV(self.model(), self.param_grid)\nclassifier.fit(training_data, training_labels)\nself.active_model = self.model(**classifier.best_params_)\nself.activ...
<|body_start_0|> self.model = MultinomialNB self.active_model = None self.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior': [True, False]} <|end_body_0|> <|body_start_1|> classifier = GridSearchCV(self.model(), self.param_grid) classifier.fit(training_data, training_l...
Basic implementation of a grid-search optimized Logistic Regression.
NaiveMultinomialBayes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" <|body_0|> def train(self, training_data, training_labels): """Run grid search to optimize hyper-parameters...
stack_v2_sparse_classes_36k_train_012992
3,287
no_license
[ { "docstring": "Initialize internal classifier.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run grid search to optimize hyper-parameters, then trains the final model.", "name": "train", "signature": "def train(self, training_data, training_labels)" }, {...
3
stack_v2_sparse_classes_30k_test_000860
Implement the Python class `NaiveMultinomialBayes` described below. Class description: Basic implementation of a grid-search optimized Logistic Regression. Method signatures and docstrings: - def __init__(self): Initialize internal classifier. - def train(self, training_data, training_labels): Run grid search to opti...
Implement the Python class `NaiveMultinomialBayes` described below. Class description: Basic implementation of a grid-search optimized Logistic Regression. Method signatures and docstrings: - def __init__(self): Initialize internal classifier. - def train(self, training_data, training_labels): Run grid search to opti...
edffa89740e5cef810344a7bbf8a157241f46d02
<|skeleton|> class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" <|body_0|> def train(self, training_data, training_labels): """Run grid search to optimize hyper-parameters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NaiveMultinomialBayes: """Basic implementation of a grid-search optimized Logistic Regression.""" def __init__(self): """Initialize internal classifier.""" self.model = MultinomialNB self.active_model = None self.param_grid = {'alpha': [0, 0.25, 0.5, 0.75, 1], 'fit_prior':...
the_stack_v2_python_sparse
enso/experiment/NB.py
RichGit101/Enso
train
0
a836d8d69051acefa80329429809e02e940a1ba7
[ "if not source:\n raise ValueError('badge 需要使用键值对的的形式传入, 否则会引发递归调用')\ntarget = get_subclasses_graph(source, relative, badge_name)\nif return_class:\n return target\ncls_name = target.__name__\ncaller = traceback.extract_stack()[-2]\nlogging.debug('{} in {} -> {} install subclass <{}> from <{}>.'.format(caller...
<|body_start_0|> if not source: raise ValueError('badge 需要使用键值对的的形式传入, 否则会引发递归调用') target = get_subclasses_graph(source, relative, badge_name) if return_class: return target cls_name = target.__name__ caller = traceback.extract_stack()[-2] logging....
徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact.
Badge
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Badge: """徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact.""" def __new__(cls, *args, source=None, singleton=False, relative=True, return_class=False, badge_name='', **kwargs): """通过获取组内最远亲的子类,获取其子类的单例返回, 需要通过此类获取实例化的对象,否则会创建一个新的实例。 只会获取最远亲的子类。当然这也会牺牲init方法...
stack_v2_sparse_classes_36k_train_012993
6,733
permissive
[ { "docstring": "通过获取组内最远亲的子类,获取其子类的单例返回, 需要通过此类获取实例化的对象,否则会创建一个新的实例。 只会获取最远亲的子类。当然这也会牺牲init方法初始化参数的问题,只能依托于重构方法时 手动创建。 To get the singleton return of its subclass, you need to get the instantiated object through this class, otherwise a new instance will be created. Only get the most distant relatives. :param so...
2
stack_v2_sparse_classes_30k_train_006495
Implement the Python class `Badge` described below. Class description: 徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact. Method signatures and docstrings: - def __new__(cls, *args, source=None, singleton=False, relative=True, return_class=False, badge_name='', **kwargs): 通过获取组内最远亲的子类,获取其子类的单...
Implement the Python class `Badge` described below. Class description: 徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact. Method signatures and docstrings: - def __new__(cls, *args, source=None, singleton=False, relative=True, return_class=False, badge_name='', **kwargs): 通过获取组内最远亲的子类,获取其子类的单...
edaa6398260d5f8c7a90cdf2a9669f0a02ca5102
<|skeleton|> class Badge: """徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact.""" def __new__(cls, *args, source=None, singleton=False, relative=True, return_class=False, badge_name='', **kwargs): """通过获取组内最远亲的子类,获取其子类的单例返回, 需要通过此类获取实例化的对象,否则会创建一个新的实例。 只会获取最远亲的子类。当然这也会牺牲init方法...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Badge: """徽章是所有成员联络的基础 <img src=''/> Badges are the basis for all members to contact.""" def __new__(cls, *args, source=None, singleton=False, relative=True, return_class=False, badge_name='', **kwargs): """通过获取组内最远亲的子类,获取其子类的单例返回, 需要通过此类获取实例化的对象,否则会创建一个新的实例。 只会获取最远亲的子类。当然这也会牺牲init方法初始化参数的问题,只能依托...
the_stack_v2_python_sparse
sherry/core/badge.py
wumaoland/sherry
train
0
1be7690b54b5cdd754c9e1a6455449796c7e406c
[ "super(ProbPacConv2d, self).__init__(in_channels, out_channels, kernel_size, stride=1, padding=padding, dilation=1, bias=bias, kernel_type=kernel_type, smooth_kernel_type='none', normalize_kernel=False, shared_filters=shared_filters, filler='uniform', native_impl=False)\nself.weight_normalization = torch.nn.paramet...
<|body_start_0|> super(ProbPacConv2d, self).__init__(in_channels, out_channels, kernel_size, stride=1, padding=padding, dilation=1, bias=bias, kernel_type=kernel_type, smooth_kernel_type='none', normalize_kernel=False, shared_filters=shared_filters, filler='uniform', native_impl=False) self.weight_norma...
Implements a probabilistic pixel-adaptive convolution.
ProbPacConv2d
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProbPacConv2d: """Implements a probabilistic pixel-adaptive convolution.""" def __init__(self, in_channels, out_channels, kernel_size, padding=0, bias=True, kernel_type='gaussian', shared_filters=False): """Initializes PPAC. Args: in_channels: Number of input channels. out_channels: ...
stack_v2_sparse_classes_36k_train_012994
7,401
permissive
[ { "docstring": "Initializes PPAC. Args: in_channels: Number of input channels. out_channels: Number of output channels. kernel_size: Filter size of used kernel. padding: Number of zero padding elements applied at all borders. bias: Usage of bias term. kernel_type: Type of kernel function K. See original PAC for...
2
stack_v2_sparse_classes_30k_train_021419
Implement the Python class `ProbPacConv2d` described below. Class description: Implements a probabilistic pixel-adaptive convolution. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, padding=0, bias=True, kernel_type='gaussian', shared_filters=False): Initializes PPAC. Ar...
Implement the Python class `ProbPacConv2d` described below. Class description: Implements a probabilistic pixel-adaptive convolution. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, padding=0, bias=True, kernel_type='gaussian', shared_filters=False): Initializes PPAC. Ar...
04a8676f5eb96c41ec6b1125c6bcad430218ef30
<|skeleton|> class ProbPacConv2d: """Implements a probabilistic pixel-adaptive convolution.""" def __init__(self, in_channels, out_channels, kernel_size, padding=0, bias=True, kernel_type='gaussian', shared_filters=False): """Initializes PPAC. Args: in_channels: Number of input channels. out_channels: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProbPacConv2d: """Implements a probabilistic pixel-adaptive convolution.""" def __init__(self, in_channels, out_channels, kernel_size, padding=0, bias=True, kernel_type='gaussian', shared_filters=False): """Initializes PPAC. Args: in_channels: Number of input channels. out_channels: Number of out...
the_stack_v2_python_sparse
src/probabilistic_pac.py
visinf/ppac_refinement
train
81
6cfee43b0338e9d172c4ca80bc8a6451963240fd
[ "super().__init__()\nself.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)\nself.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)\nself.relu = nn.ReLU(inplace=True)", "out = self.relu(x)\nout = self.conv1(out)\nout = self.relu(out)\nout = sel...
<|body_start_0|> super().__init__() self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.relu = nn.ReLU(inplace=True) <|end_body_0|> <|body_start_1|> ...
Residual convolution module.
ResidualConvUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, x): """Forward pass. Args: x (tensor): input Returns: tensor: output""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_012995
17,410
permissive
[ { "docstring": "Init. Args: features (int): number of features", "name": "__init__", "signature": "def __init__(self, features)" }, { "docstring": "Forward pass. Args: x (tensor): input Returns: tensor: output", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `ResidualConvUnit` described below. Class description: Residual convolution module. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output
Implement the Python class `ResidualConvUnit` described below. Class description: Residual convolution module. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output <|skele...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, x): """Forward pass. Args: x (tensor): input Returns: tensor: output""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" super().__init__() self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.conv2 = nn.Conv2d(featu...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/blocks.py
kcyu2014/nas-landmarkreg
train
10
9d4cc8d14c0e4cf37d81584303445a28d2496bd4
[ "Request.__init__(self, id_, environment)\nself.compression = 'true' if compression is True else 'false'\nself.software = 'bankws 1.01'\nself.key = key\nself.certificate = certificate", "if start_date is None:\n startdate = str(date.today())\nelse:\n startdate = str(start_date)\nget_file = DOC(CUSTOMERID(se...
<|body_start_0|> Request.__init__(self, id_, environment) self.compression = 'true' if compression is True else 'false' self.software = 'bankws 1.01' self.key = key self.certificate = certificate <|end_body_0|> <|body_start_1|> if start_date is None: startdat...
GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of software @type key: string @ivar key: RSA-private key filename. @type certifica...
GetFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetFile: """GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of software @type key: string @ivar key: RSA-pr...
stack_v2_sparse_classes_36k_train_012996
3,693
permissive
[ { "docstring": "Initializes GetFile class. @type id_: number @param id_: User customerid to web services @type environment: string @param environment: TEST or PRODUCTION @type key: string @param key: RSA-key filename. @type certificate: string @param certificate: X509 certificate filename. @type compression: bo...
2
stack_v2_sparse_classes_30k_train_008050
Implement the Python class `GetFile` described below. Class description: GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of softw...
Implement the Python class `GetFile` described below. Class description: GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of softw...
70a500a1a3c85d86bf76a8b9010264ce941c2799
<|skeleton|> class GetFile: """GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of software @type key: string @ivar key: RSA-pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetFile: """GetFile - class can be used to generate getfile messages for finnish banks web-services interfaces. @type compression: string @ivar compression: Is compression used in messages. (Default false) @type software: string @ivar software: Name of software @type key: string @ivar key: RSA-private key fil...
the_stack_v2_python_sparse
bankws/getfile.py
luojus/bankws
train
3
57d6d5e4d9eb53340f3ab34c8790f97805938378
[ "query = query.replace('(', ' ( ')\nnormalized = query.replace(')', ' ) ')\nreturn normalized", "if query.count('(') != query.count(')'):\n raise QueryException('Parentheses dont match')\nif query[0] in ['AND', 'OR', ')']:\n raise QueryException('Invalid First Term')\ni = 1\nwhile i < len(query):\n if ty...
<|body_start_0|> query = query.replace('(', ' ( ') normalized = query.replace(')', ' ) ') return normalized <|end_body_0|> <|body_start_1|> if query.count('(') != query.count(')'): raise QueryException('Parentheses dont match') if query[0] in ['AND', 'OR', ')']: ...
Manages parsing boolean query strings, and converting them to a postfix list.
QueryParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryParser: """Manages parsing boolean query strings, and converting them to a postfix list.""" def _normalize_query(self, query): """Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the query.""" <|body_0|> def _validate_query(self,...
stack_v2_sparse_classes_36k_train_012997
5,387
no_license
[ { "docstring": "Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the query.", "name": "_normalize_query", "signature": "def _normalize_query(self, query)" }, { "docstring": "Validates the order and overall construction of the query :exception: QueryException ...
5
stack_v2_sparse_classes_30k_train_000231
Implement the Python class `QueryParser` described below. Class description: Manages parsing boolean query strings, and converting them to a postfix list. Method signatures and docstrings: - def _normalize_query(self, query): Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the qu...
Implement the Python class `QueryParser` described below. Class description: Manages parsing boolean query strings, and converting them to a postfix list. Method signatures and docstrings: - def _normalize_query(self, query): Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the qu...
54481dfd88637572b92b8e17ba6ef6458fade9a4
<|skeleton|> class QueryParser: """Manages parsing boolean query strings, and converting them to a postfix list.""" def _normalize_query(self, query): """Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the query.""" <|body_0|> def _validate_query(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryParser: """Manages parsing boolean query strings, and converting them to a postfix list.""" def _normalize_query(self, query): """Normalizes the braces in the query to be padded with spaces. Allows easy splitting of the query.""" query = query.replace('(', ' ( ') normalized =...
the_stack_v2_python_sparse
web/bfex/components/search_engine/parser.py
MandyMeindersma/BFEX
train
0
02cb826392f772204ad1c4f3d43cd1a0472e2054
[ "activity = self.get_object()\nif kwargs.get('order'):\n try:\n getattr(activity, 'to')(int(kwargs['order']))\n except AttributeError:\n log.exception('Unknown ordering method!')\n return HttpResponse(status=201)\nreturn super().get(request, *args, **kwargs)", "activity = self.get_object()\...
<|body_start_0|> activity = self.get_object() if kwargs.get('order'): try: getattr(activity, 'to')(int(kwargs['order'])) except AttributeError: log.exception('Unknown ordering method!') return HttpResponse(status=201) return sup...
ActivityUpdate
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityUpdate: def get(self, request, *args, **kwargs): """To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop feature uses this view.""" <|body_0|> def post(self, request, *args, **kwargs): "...
stack_v2_sparse_classes_36k_train_012998
36,805
permissive
[ { "docstring": "To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop feature uses this view.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "To Update activity by a POST request. U...
2
stack_v2_sparse_classes_30k_train_001616
Implement the Python class `ActivityUpdate` described below. Class description: Implement the ActivityUpdate class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop...
Implement the Python class `ActivityUpdate` described below. Class description: Implement the ActivityUpdate class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop...
07c04dadaaaeefc840593e5582dacdb188fcf8f8
<|skeleton|> class ActivityUpdate: def get(self, request, *args, **kwargs): """To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop feature uses this view.""" <|body_0|> def post(self, request, *args, **kwargs): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActivityUpdate: def get(self, request, *args, **kwargs): """To Update activity by a GET request. Updating activities order and running update method in the superclass. The drag and drop feature uses this view.""" activity = self.get_object() if kwargs.get('order'): try: ...
the_stack_v2_python_sparse
bridge_adaptivity/module/views.py
ahsaniqbal94/bridge-adaptivity
train
0
2ce0900a1f9d3913db3dbd2041d6ae3060a6fc69
[ "assert len(self.buff_dict) == 10\nassert self.buff_dict.popitem() == (9, 9)\nassert len(self.buff_dict) == 9\nassert (9, 9) not in self.buff_dict.items()", "try:\n assert self.buff_dict.get(i) == i\nexcept AssertionError:\n assert self.buff_dict.get(i) is None" ]
<|body_start_0|> assert len(self.buff_dict) == 10 assert self.buff_dict.popitem() == (9, 9) assert len(self.buff_dict) == 9 assert (9, 9) not in self.buff_dict.items() <|end_body_0|> <|body_start_1|> try: assert self.buff_dict.get(i) == i except AssertionErro...
тесты для dict
TestDict2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" <|body_0|> def test_dict_2_2(self, i): """тест метода get""" <|body_1|> <|end_skeleton|> <|body_start_0|> assert len(self.buff_dict) == 10 assert self.buf...
stack_v2_sparse_classes_36k_train_012999
1,316
no_license
[ { "docstring": "тест метода popitem", "name": "test_dict_2_1", "signature": "def test_dict_2_1(self)" }, { "docstring": "тест метода get", "name": "test_dict_2_2", "signature": "def test_dict_2_2(self, i)" } ]
2
stack_v2_sparse_classes_30k_train_000632
Implement the Python class `TestDict2` described below. Class description: тесты для dict Method signatures and docstrings: - def test_dict_2_1(self): тест метода popitem - def test_dict_2_2(self, i): тест метода get
Implement the Python class `TestDict2` described below. Class description: тесты для dict Method signatures and docstrings: - def test_dict_2_1(self): тест метода popitem - def test_dict_2_2(self, i): тест метода get <|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест...
9c468bc73dc4e326f423cb7932090f59b50a4371
<|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" <|body_0|> def test_dict_2_2(self, i): """тест метода get""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" assert len(self.buff_dict) == 10 assert self.buff_dict.popitem() == (9, 9) assert len(self.buff_dict) == 9 assert (9, 9) not in self.buff_dict.items() def test_dict_2_2(self, i)...
the_stack_v2_python_sparse
hw1/test_dict.py
ikramanop/2020-1-Atom-QA-Python-L-Marder
train
1