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
eff8fe34670ee19cc6c3c3d3003fed17729860bd
[ "print('Constructing trajectory network for time: {}'.format(stream.time), end='\\r')\nG = Graph()\nparticles = list(stream)\nif save_position:\n G.add_nodes_from(((p.id, {'pos': p.position}) for p in particles))\nelse:\n G.add_nodes_from((p.id for p in particles))\npos = np.array([p.position for p in particl...
<|body_start_0|> print('Constructing trajectory network for time: {}'.format(stream.time), end='\r') G = Graph() particles = list(stream) if save_position: G.add_nodes_from(((p.id, {'pos': p.position}) for p in particles)) else: G.add_nodes_from((p.id for ...
Trajectory network constructor singleton class.
TrajectoryNetConstructor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep d...
stack_v2_sparse_classes_36k_train_012200
2,890
no_license
[ { "docstring": "Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep distance : int or float The distance threshold within which objects are considered connected. save_position : boolean (optional, default: False) Whether to save pa...
2
stack_v2_sparse_classes_30k_train_009394
Implement the Python class `TrajectoryNetConstructor` described below. Class description: Trajectory network constructor singleton class. Method signatures and docstrings: - def get_proximitynet(self, stream, distance, save_position=False): Get the proximity network for a single timestamp. Params ------ stream : Part...
Implement the Python class `TrajectoryNetConstructor` described below. Class description: Trajectory network constructor singleton class. Method signatures and docstrings: - def get_proximitynet(self, stream, distance, save_position=False): Get the proximity network for a single timestamp. Params ------ stream : Part...
0394980efc628bfedd4fd504079a534418cbb89a
<|skeleton|> class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep distance : int...
the_stack_v2_python_sparse
generators/trajectories/trajectory_net_constructor.py
tipech/spatialnet
train
1
c3d4b0139cba0453fde7f8e5a03a998c1b172de7
[ "super().__init__()\n\ndef block(in_features, out_features, normalization=True):\n \"\"\"Classifier block\"\"\"\n layers = [torch.nn.Conv2d(in_features, out_features, 3, stride=2, padding=1), torch.nn.LeakyReLU(0.2, inplace=True)]\n if normalization:\n layers.append(torch.nn.InstanceNorm2d(out_featu...
<|body_start_0|> super().__init__() def block(in_features, out_features, normalization=True): """Classifier block""" layers = [torch.nn.Conv2d(in_features, out_features, 3, stride=2, padding=1), torch.nn.LeakyReLU(0.2, inplace=True)] if normalization: ...
Classifier Network
Classifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Classifier: """Classifier Network""" def __init__(self, num_channels, img_size, n_classes): """Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of classes""" <|body_0|> def forward(self, img...
stack_v2_sparse_classes_36k_train_012201
5,861
permissive
[ { "docstring": "Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of classes", "name": "__init__", "signature": "def __init__(self, num_channels, img_size, n_classes)" }, { "docstring": "Feeds a single batch through ...
2
null
Implement the Python class `Classifier` described below. Class description: Classifier Network Method signatures and docstrings: - def __init__(self, num_channels, img_size, n_classes): Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of...
Implement the Python class `Classifier` described below. Class description: Classifier Network Method signatures and docstrings: - def __init__(self, num_channels, img_size, n_classes): Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class Classifier: """Classifier Network""" def __init__(self, num_channels, img_size, n_classes): """Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of classes""" <|body_0|> def forward(self, img...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Classifier: """Classifier Network""" def __init__(self, num_channels, img_size, n_classes): """Parameters ---------- num_channels : int number of image channels img_size : int number of pixels per side n_classes : int number of classes""" super().__init__() def block(in_features,...
the_stack_v2_python_sparse
dlutils/models/gans/pixel_da/models.py
justusschock/dl-utils
train
15
c48edcf9b08b38440b6a736417eb24360eab22d9
[ "a = self.B2D(a)\nb = self.B2D(b)\nreturn self.D2B(a + b)", "decimal = 0\nlenth = len(binary)\nfor i in range(lenth):\n number = int(binary[lenth - i - 1])\n decimal += 2 ** i * number\nreturn decimal", "binary = ''\nif decimal == 1:\n return '1'\nif decimal == 0:\n return '0'\nwhile decimal > 1:\n ...
<|body_start_0|> a = self.B2D(a) b = self.B2D(b) return self.D2B(a + b) <|end_body_0|> <|body_start_1|> decimal = 0 lenth = len(binary) for i in range(lenth): number = int(binary[lenth - i - 1]) decimal += 2 ** i * number return decimal <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def B2D(self, binary): """:type binary: str""" <|body_1|> def D2B(self, decimal): """:type decimal: int""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_012202
930
no_license
[ { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary", "signature": "def addBinary(self, a, b)" }, { "docstring": ":type binary: str", "name": "B2D", "signature": "def B2D(self, binary)" }, { "docstring": ":type decimal: int", "name": "D2B", "signatu...
3
stack_v2_sparse_classes_30k_train_003074
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def B2D(self, binary): :type binary: str - def D2B(self, decimal): :type decimal: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def B2D(self, binary): :type binary: str - def D2B(self, decimal): :type decimal: int <|skeleton|> class Solut...
b60e2b7a8f2ad604c7d28b21498991da60066dc3
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def B2D(self, binary): """:type binary: str""" <|body_1|> def D2B(self, decimal): """:type decimal: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" a = self.B2D(a) b = self.B2D(b) return self.D2B(a + b) def B2D(self, binary): """:type binary: str""" decimal = 0 lenth = len(binary) for i in range(lenth): ...
the_stack_v2_python_sparse
OJ/LeetCode/67. Add Binary.py
Nobody0321/MyCodes
train
0
fb24979088c8898572071938c343aa0db6c7df86
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn LocationConstraintItem()", "from .location import Location\nfrom .location import Location\nfields: Dict[str, Callable[[Any], None]] = {'resolveAvailability': lambda n: setattr(self, 'resolve_availability', n.get_bool_value())}\nsuper_...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return LocationConstraintItem() <|end_body_0|> <|body_start_1|> from .location import Location from .location import Location fields: Dict[str, Callable[[Any], None]] = {'resolveAvailab...
LocationConstraintItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationConstraintItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
stack_v2_sparse_classes_36k_train_012203
2,348
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: LocationConstraintItem", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
stack_v2_sparse_classes_30k_train_010276
Implement the Python class `LocationConstraintItem` described below. Class description: Implement the LocationConstraintItem class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: Creates a new instance of the appropriate class b...
Implement the Python class `LocationConstraintItem` described below. Class description: Implement the LocationConstraintItem class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: Creates a new instance of the appropriate class b...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class LocationConstraintItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationConstraintItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LocationConstraintItem: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret...
the_stack_v2_python_sparse
msgraph/generated/models/location_constraint_item.py
microsoftgraph/msgraph-sdk-python
train
135
7cbd65d86ce2b9239d3a37c471f56785b075e5be
[ "if id:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if len(list_dictionaries) is False or list_dictionaries is None:\n return '[]'\nelse:\n json_str = json.dumps(list_dictionaries)\n return json_str", "if len(json_string) == 0 or json_string is None:\n re...
<|body_start_0|> if id: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if len(list_dictionaries) is False or list_dictionaries is None: return '[]' else: json_str = json.du...
base class for project all other shapes are built on this class return: 0
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """base class for project all other shapes are built on this class return: 0""" def __init__(self, id=None): """count object""" <|body_0|> def to_json_string(list_dictionaries): """convert to json obj Return: dict""" <|body_1|> def from_json_st...
stack_v2_sparse_classes_36k_train_012204
2,646
no_license
[ { "docstring": "count object", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "convert to json obj Return: dict", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "creates dictionaries", "name":...
6
stack_v2_sparse_classes_30k_train_012306
Implement the Python class `Base` described below. Class description: base class for project all other shapes are built on this class return: 0 Method signatures and docstrings: - def __init__(self, id=None): count object - def to_json_string(list_dictionaries): convert to json obj Return: dict - def from_json_string...
Implement the Python class `Base` described below. Class description: base class for project all other shapes are built on this class return: 0 Method signatures and docstrings: - def __init__(self, id=None): count object - def to_json_string(list_dictionaries): convert to json obj Return: dict - def from_json_string...
f47fc1817245fa41e597c9b03707687c78bc80e6
<|skeleton|> class Base: """base class for project all other shapes are built on this class return: 0""" def __init__(self, id=None): """count object""" <|body_0|> def to_json_string(list_dictionaries): """convert to json obj Return: dict""" <|body_1|> def from_json_st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """base class for project all other shapes are built on this class return: 0""" def __init__(self, id=None): """count object""" if id: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dicti...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
stefansilverio/holbertonschool-higher_level_programming
train
1
12dcd5f7096e4684a91a188a73df5dbe52febc66
[ "self.name = name\nself.desired_species = desired_species\nself.feared_species = feared_species", "adopter_score = float(adoption_center.get_number_of_species(self.desired_species))\nnum_feared = float(adoption_center.get_number_of_species(self.feared_species))\nresult = adopter_score - 0.3 * num_feared\nif resul...
<|body_start_0|> self.name = name self.desired_species = desired_species self.feared_species = feared_species <|end_body_0|> <|body_start_1|> adopter_score = float(adoption_center.get_number_of_species(self.desired_species)) num_feared = float(adoption_center.get_number_of_speci...
A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the number of feared species
FearfulAdopter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the num...
stack_v2_sparse_classes_36k_train_012205
4,359
no_license
[ { "docstring": "Initializes FearfulAdopter, a subclass of Adopter object class feared_species - a string that is the name of the feared species. All of the inputs are the same as the Adopter", "name": "__init__", "signature": "def __init__(self, name, desired_species, feared_species)" }, { "docs...
2
stack_v2_sparse_classes_30k_test_000867
Implement the Python class `FearfulAdopter` described below. Class description: A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x ...
Implement the Python class `FearfulAdopter` described below. Class description: A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x ...
d8750a5d78f042477f6577af67cc46d584f4aede
<|skeleton|> class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the number of feared...
the_stack_v2_python_sparse
ProblemSets/ProblemSet07c.py
Greatdane/MITx-6.00.1x
train
0
03344bc18239ed6913aa5adff13d82bdb836f8ac
[ "if page_url is None or html_cont is None:\n return\nsoup = BeautifulSoup(html_cont, 'html.parser')\nnew_url = self._get_new_urls(page_url, soup)\nnew_data = self._get_new_data(page_url, soup)\nreturn (new_url, new_data)", "new_urls = set()\nlinks = soup.find_all('a', href=re.compile('/zanghaihua/\\\\d+\\\\.ht...
<|body_start_0|> if page_url is None or html_cont is None: return soup = BeautifulSoup(html_cont, 'html.parser') new_url = self._get_new_urls(page_url, soup) new_data = self._get_new_data(page_url, soup) return (new_url, new_data) <|end_body_0|> <|body_start_1|> ...
HtmlParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtmlParser: def parser(self, page_url, html_cont): """用于网页解析,返回url和数据 :param page_url: :param html_cont: :return:""" <|body_0|> def _get_new_urls(self, page_url, soup): """获取新的url集合 :param page_url: :param soup: :return:""" <|body_1|> def _get_new_data(s...
stack_v2_sparse_classes_36k_train_012206
1,673
no_license
[ { "docstring": "用于网页解析,返回url和数据 :param page_url: :param html_cont: :return:", "name": "parser", "signature": "def parser(self, page_url, html_cont)" }, { "docstring": "获取新的url集合 :param page_url: :param soup: :return:", "name": "_get_new_urls", "signature": "def _get_new_urls(self, page_u...
3
stack_v2_sparse_classes_30k_train_004053
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def parser(self, page_url, html_cont): 用于网页解析,返回url和数据 :param page_url: :param html_cont: :return: - def _get_new_urls(self, page_url, soup): 获取新的url集合 :param page_url: :para...
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def parser(self, page_url, html_cont): 用于网页解析,返回url和数据 :param page_url: :param html_cont: :return: - def _get_new_urls(self, page_url, soup): 获取新的url集合 :param page_url: :para...
5c61bbd07e1b66a1abc1c25e9cc41896a3e45dcd
<|skeleton|> class HtmlParser: def parser(self, page_url, html_cont): """用于网页解析,返回url和数据 :param page_url: :param html_cont: :return:""" <|body_0|> def _get_new_urls(self, page_url, soup): """获取新的url集合 :param page_url: :param soup: :return:""" <|body_1|> def _get_new_data(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HtmlParser: def parser(self, page_url, html_cont): """用于网页解析,返回url和数据 :param page_url: :param html_cont: :return:""" if page_url is None or html_cont is None: return soup = BeautifulSoup(html_cont, 'html.parser') new_url = self._get_new_urls(page_url, soup) ...
the_stack_v2_python_sparse
crawler/crawler_test/htmlparser.py
vipqian/inter
train
0
34c202f078fefacd38f73b7acdf67c9e98897565
[ "super().__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\nif use_fid_inception:\n ...
<|body_start_0|> super().__init__() self.resize_input = resize_input self.normalize_input = normalize_input self.output_blocks = sorted(output_blocks) self.last_needed_block = max(output_blocks) assert self.last_needed_block <= 3, 'Last possible output block index is 3' ...
Pretrained InceptionV3 network returning feature maps.
InceptionV3
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: out...
stack_v2_sparse_classes_36k_train_012207
12,348
permissive
[ { "docstring": "Build pretrained InceptionV3. Args: output_blocks (list[int]): Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier - 3: corresponds...
2
stack_v2_sparse_classes_30k_train_002415
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps. Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid...
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps. Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: output_blocks (l...
the_stack_v2_python_sparse
mmagic/evaluation/functional/fid_inception.py
open-mmlab/mmagic
train
1,370
eb3b49320098161cbe857aafd09c1acb3fa5cba0
[ "if df is None:\n raise TypeError\nself._df = df\nself._jMelt = self._df._sc._jvm.com.ons.sml.api.java.methods.JavaMeltFactory.melt(self._df._jdf)", "if df is None:\n df = self._df\nreturn DataFrame(self._jMelt.melt1(df._jdf, id_vars, value_vars, var_name, val_name), df.sql_ctx)" ]
<|body_start_0|> if df is None: raise TypeError self._df = df self._jMelt = self._df._sc._jvm.com.ons.sml.api.java.methods.JavaMeltFactory.melt(self._df._jdf) <|end_body_0|> <|body_start_1|> if df is None: df = self._df return DataFrame(self._jMelt.melt1(...
This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame.
Melt
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Melt: """This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame.""" def __init__(self, df=None): """Initialise function to instantiate the Melt class. :param df: a DataFrame""" <|body_0|> def melt1(self, df=None, id_vars=None, value_vars...
stack_v2_sparse_classes_36k_train_012208
1,318
permissive
[ { "docstring": "Initialise function to instantiate the Melt class. :param df: a DataFrame", "name": "__init__", "signature": "def __init__(self, df=None)" }, { "docstring": "Version 1 of the melt function. :param df: a DataFrame :param id_vars: Column(s) which are used as unique identifiers :par...
2
stack_v2_sparse_classes_30k_train_012115
Implement the Python class `Melt` described below. Class description: This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame. Method signatures and docstrings: - def __init__(self, df=None): Initialise function to instantiate the Melt class. :param df: a DataFrame - def melt1(self, d...
Implement the Python class `Melt` described below. Class description: This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame. Method signatures and docstrings: - def __init__(self, df=None): Initialise function to instantiate the Melt class. :param df: a DataFrame - def melt1(self, d...
ceab962a3e14c57fa08de6141ef3f4df7cc7ad79
<|skeleton|> class Melt: """This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame.""" def __init__(self, df=None): """Initialise function to instantiate the Melt class. :param df: a DataFrame""" <|body_0|> def melt1(self, df=None, id_vars=None, value_vars...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Melt: """This class contains methods which perform a melt (the reverse of a pivot) on a DataFrame.""" def __init__(self, df=None): """Initialise function to instantiate the Melt class. :param df: a DataFrame""" if df is None: raise TypeError self._df = df self....
the_stack_v2_python_sparse
python/sparkts/onsMethods/Melt.py
SteveBall/SML
train
3
d3dd9d59e249f10aa73d983e7d7afb5637e204fd
[ "record_type_string = self._RECORD_TYPE.GetName(file_header.record_type) or 'UNKNOWN'\nself._DebugPrintValue('Record type', f'0x{file_header.record_type:04x} ({record_type_string:s})')\nself._DebugPrintValue('Record size', f'{file_header.record_size:d}')\nself._DebugPrintValue('Signature', f'0x{file_header.signatur...
<|body_start_0|> record_type_string = self._RECORD_TYPE.GetName(file_header.record_type) or 'UNKNOWN' self._DebugPrintValue('Record type', f'0x{file_header.record_type:04x} ({record_type_string:s})') self._DebugPrintValue('Record size', f'{file_header.record_size:d}') self._DebugPrintVal...
Enhanced Metafile Format (EMF) file.
EMFFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EMFFile: """Enhanced Metafile Format (EMF) file.""" def _DebugPrintFileHeader(self, file_header): """Prints file header debug information. Args: file_header (emf_file_header): file header.""" <|body_0|> def _DebugPrintRecordHeader(self, record_header): """Prints ...
stack_v2_sparse_classes_36k_train_012209
24,865
permissive
[ { "docstring": "Prints file header debug information. Args: file_header (emf_file_header): file header.", "name": "_DebugPrintFileHeader", "signature": "def _DebugPrintFileHeader(self, file_header)" }, { "docstring": "Prints record header debug information. Args: record_header (emf_record_header...
6
stack_v2_sparse_classes_30k_train_011873
Implement the Python class `EMFFile` described below. Class description: Enhanced Metafile Format (EMF) file. Method signatures and docstrings: - def _DebugPrintFileHeader(self, file_header): Prints file header debug information. Args: file_header (emf_file_header): file header. - def _DebugPrintRecordHeader(self, re...
Implement the Python class `EMFFile` described below. Class description: Enhanced Metafile Format (EMF) file. Method signatures and docstrings: - def _DebugPrintFileHeader(self, file_header): Prints file header debug information. Args: file_header (emf_file_header): file header. - def _DebugPrintRecordHeader(self, re...
55007dcac48efff42c497e739208ebfb88e4048d
<|skeleton|> class EMFFile: """Enhanced Metafile Format (EMF) file.""" def _DebugPrintFileHeader(self, file_header): """Prints file header debug information. Args: file_header (emf_file_header): file header.""" <|body_0|> def _DebugPrintRecordHeader(self, record_header): """Prints ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EMFFile: """Enhanced Metafile Format (EMF) file.""" def _DebugPrintFileHeader(self, file_header): """Prints file header debug information. Args: file_header (emf_file_header): file header.""" record_type_string = self._RECORD_TYPE.GetName(file_header.record_type) or 'UNKNOWN' self...
the_stack_v2_python_sparse
dtformats/wemf.py
libyal/dtformats
train
109
b11e588dca325eca9295a6c2502c26034556c028
[ "cls = type(self)\nfor cls_name in dir(cls):\n cls_item = getattr(cls, cls_name, None)\n if isinstance(cls_item, NamedResourceFactoryDecorator):\n if cls_item.name == name:\n return getattr(self, cls_name)()\nreturn default", "cls = type(self)\nfor cls_name in dir(cls):\n cls_item = get...
<|body_start_0|> cls = type(self) for cls_name in dir(cls): cls_item = getattr(cls, cls_name, None) if isinstance(cls_item, NamedResourceFactoryDecorator): if cls_item.name == name: return getattr(self, cls_name)() return default <|end_...
THe behaviour class which add the ability to traverse named resources
NamedResourceBehaviour
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NamedResourceBehaviour: """THe behaviour class which add the ability to traverse named resources""" def get_named_resource(self, name, default=None): """Return a named resource named resources are traversable by self[name], this function is called by __getitem__ to obtain the object ...
stack_v2_sparse_classes_36k_train_012210
5,320
permissive
[ { "docstring": "Return a named resource named resources are traversable by self[name], this function is called by __getitem__ to obtain the object for a given name. By default this function looks object factories which are marked on the class with the attribute tinterface_factory_for. get_tinterfaces doesn't it...
3
stack_v2_sparse_classes_30k_train_008308
Implement the Python class `NamedResourceBehaviour` described below. Class description: THe behaviour class which add the ability to traverse named resources Method signatures and docstrings: - def get_named_resource(self, name, default=None): Return a named resource named resources are traversable by self[name], thi...
Implement the Python class `NamedResourceBehaviour` described below. Class description: THe behaviour class which add the ability to traverse named resources Method signatures and docstrings: - def get_named_resource(self, name, default=None): Return a named resource named resources are traversable by self[name], thi...
52f24d7f1f22c0ba14884fa84766b1c7084ef7bb
<|skeleton|> class NamedResourceBehaviour: """THe behaviour class which add the ability to traverse named resources""" def get_named_resource(self, name, default=None): """Return a named resource named resources are traversable by self[name], this function is called by __getitem__ to obtain the object ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NamedResourceBehaviour: """THe behaviour class which add the ability to traverse named resources""" def get_named_resource(self, name, default=None): """Return a named resource named resources are traversable by self[name], this function is called by __getitem__ to obtain the object for a given n...
the_stack_v2_python_sparse
contextplus/behaviour/named_resource.py
olivelink/contextplus
train
0
7c1ca75a4f218e02e1c9b99c1c60a43e56d3f8f6
[ "super().__init__(game, mode_label=mode_selector_ui)\nself.mode_selector_ui = mode_selector_ui\nself.mission_selector_ui = mission_selector_ui\nself.mission_selector_label_ui = mission_selector_label_ui\nself.stage_selector_ui = stage_selector_ui\nself.mode_name = stage_name if stage_name else self.stage_selector_u...
<|body_start_0|> super().__init__(game, mode_label=mode_selector_ui) self.mode_selector_ui = mode_selector_ui self.mission_selector_ui = mission_selector_ui self.mission_selector_label_ui = mission_selector_label_ui self.stage_selector_ui = stage_selector_ui self.mode_nam...
Class for working with Epic Quests with 10 stages (usual missions without difficulty).
TenStageEpicQuest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.gam...
stack_v2_sparse_classes_36k_train_012211
26,035
permissive
[ { "docstring": "Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_selector_ui: UI element of Epic Quest selector. :param ui.UIElement mission_selector_ui: UI element of Epic Quest's mission selector. :param ui.UIElement mission_selector_label_ui: UI element of ...
6
stack_v2_sparse_classes_30k_train_020309
Implement the Python class `TenStageEpicQuest` described below. Class description: Class for working with Epic Quests with 10 stages (usual missions without difficulty). Method signatures and docstrings: - def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, st...
Implement the Python class `TenStageEpicQuest` described below. Class description: Class for working with Epic Quests with 10 stages (usual missions without difficulty). Method signatures and docstrings: - def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, st...
fd3f0bd45aea45e2e8ad8e8fc73a8953c96d350a
<|skeleton|> class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.gam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.game.Game game: ...
the_stack_v2_python_sparse
lib/game/missions/epic_quest.py
th3f1v3/mff_auto
train
0
9631c2ad16ad1a494a450d8325f52066318861f5
[ "self.items = []\nself.ordered = ordered\nif objects is not None:\n self.items.extend(objects)", "ret_str = ''\nfor count, item in enumerate(self.items):\n if self.ordered is False:\n ret_str += '* {}\\n'.format(str(item))\n else:\n ret_str += '{}. {}\\n'.format(count + 1, str(item))\nretur...
<|body_start_0|> self.items = [] self.ordered = ordered if objects is not None: self.items.extend(objects) <|end_body_0|> <|body_start_1|> ret_str = '' for count, item in enumerate(self.items): if self.ordered is False: ret_str += '* {}\n'...
Lists.
MarkDownList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarkDownList: """Lists.""" def __init__(self, objects=None, ordered=False): """Initialize.""" <|body_0|> def dumps(self): """Dump list string.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.items = [] self.ordered = ordered ...
stack_v2_sparse_classes_36k_train_012212
3,689
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, objects=None, ordered=False)" }, { "docstring": "Dump list string.", "name": "dumps", "signature": "def dumps(self)" } ]
2
null
Implement the Python class `MarkDownList` described below. Class description: Lists. Method signatures and docstrings: - def __init__(self, objects=None, ordered=False): Initialize. - def dumps(self): Dump list string.
Implement the Python class `MarkDownList` described below. Class description: Lists. Method signatures and docstrings: - def __init__(self, objects=None, ordered=False): Initialize. - def dumps(self): Dump list string. <|skeleton|> class MarkDownList: """Lists.""" def __init__(self, objects=None, ordered=Fa...
463412cf6a72456acc8cb99569e7dc9c9d472f6d
<|skeleton|> class MarkDownList: """Lists.""" def __init__(self, objects=None, ordered=False): """Initialize.""" <|body_0|> def dumps(self): """Dump list string.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MarkDownList: """Lists.""" def __init__(self, objects=None, ordered=False): """Initialize.""" self.items = [] self.ordered = ordered if objects is not None: self.items.extend(objects) def dumps(self): """Dump list string.""" ret_str = '' ...
the_stack_v2_python_sparse
hdltools/docgen/markdown.py
brunosmmm/hdltools
train
2
0ab76fa30a1b7b8ce7892e7c932e823dc5e94d85
[ "WindowsBalloonTip._lock.acquire()\nval = WindowsBalloonTip._count\nWindowsBalloonTip._count += 1\nWindowsBalloonTip._lock.release()\nreturn val", "atexit.register(self.__del__)\nwnd_class_ex = win_api_defs.get_WNDCLASSEXW()\nclass_name = 'PlyerTaskbar' + str(WindowsBalloonTip._get_unique_id())\nwnd_class_ex.lpsz...
<|body_start_0|> WindowsBalloonTip._lock.acquire() val = WindowsBalloonTip._count WindowsBalloonTip._count += 1 WindowsBalloonTip._lock.release() return val <|end_body_0|> <|body_start_1|> atexit.register(self.__del__) wnd_class_ex = win_api_defs.get_WNDCLASSEXW(...
Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidden everywhere in GUI unless ShowWindow(handle, SW_SHOW) function is called. * Show/re...
WindowsBalloonTip
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsBalloonTip: """Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidden everywhere in GUI unless ShowWindow(h...
stack_v2_sparse_classes_36k_train_012213
6,418
permissive
[ { "docstring": "Keep track of each created balloon tip notification names, so that they can be easily identified even from outside. Make sure the count is shared between all the instances i.e. use a lock, so that _count class variable is incremented safely when using balloon tip notifications with Threads.", ...
5
null
Implement the Python class `WindowsBalloonTip` described below. Class description: Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidde...
Implement the Python class `WindowsBalloonTip` described below. Class description: Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidde...
d8a2b3d16b12fc54667744a092a453ad007c9448
<|skeleton|> class WindowsBalloonTip: """Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidden everywhere in GUI unless ShowWindow(h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsBalloonTip: """Implementation of balloon tip notifications through Windows API. * Register Window class name: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632596.aspx * Create an overlapped window using the registered class. - It's hidden everywhere in GUI unless ShowWindow(handle, SW_SHO...
the_stack_v2_python_sparse
plyer/platforms/win/libs/balloontip.py
kivy/plyer
train
1,516
d954c4a82d03bb04604e78b48e43504363c6d5d6
[ "slow = 0\nwhile slow < len(nums) and nums[slow] != 0:\n slow += 1\nfast = slow + 1\nwhile fast < len(nums):\n if nums[fast]:\n nums[slow], nums[fast] = (nums[fast], 0)\n slow += 1\n fast += 1\nreturn nums", "tail = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[tail], nu...
<|body_start_0|> slow = 0 while slow < len(nums) and nums[slow] != 0: slow += 1 fast = slow + 1 while fast < len(nums): if nums[fast]: nums[slow], nums[fast] = (nums[fast], 0) slow += 1 fast += 1 return nums <|en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes_precisetomine(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None D...
stack_v2_sparse_classes_36k_train_012214
1,563
no_license
[ { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def moveZeroes(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modif...
3
stack_v2_sparse_classes_30k_train_013392
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def moveZeroes_precisetomine(self, num...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def moveZeroes_precisetomine(self, num...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes_precisetomine(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" slow = 0 while slow < len(nums) and nums[slow] != 0: slow += 1 fast = slow + 1 while fast < len(nums): ...
the_stack_v2_python_sparse
LeetCode/Array/283_move_zeros.py
XyK0907/for_work
train
0
2e764bb05e37ef38e6a6be032a292111d2edaef8
[ "if n == 1:\n return '1'\ni = 1\nret = '1'\nwhile i < n:\n i += 1\n pre_ret = ret\n pre_c = pre_ret[0]\n cnt = 1\n ret = ''\n for c in pre_ret[1:]:\n if c == pre_c:\n cnt += 1\n else:\n ret += f'{cnt}{pre_c}'\n pre_c = c\n cnt = 1\n r...
<|body_start_0|> if n == 1: return '1' i = 1 ret = '1' while i < n: i += 1 pre_ret = ret pre_c = pre_ret[0] cnt = 1 ret = '' for c in pre_ret[1:]: if c == pre_c: cnt +=...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" <|body_0|> def countAndSay(self, n): """:type n: int :rtype:...
stack_v2_sparse_classes_36k_train_012215
1,775
permissive
[ { "docstring": "CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30", "name": "countAndSay2", "signature": "def countAndSay2(self, n: int) -> str" }, { "docstring": ":type n: int :rtype: str", ...
2
stack_v2_sparse_classes_30k_train_006458
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay2(self, n: int) -> str: CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay2(self, n: int) -> str: CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" <|body_0|> def countAndSay(self, n): """:type n: int :rtype:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" if n == 1: return '1' i = 1 ret = '1' while i < n: ...
the_stack_v2_python_sparse
src/38-CountAndSay.py
Jiezhi/myleetcode
train
1
1975f136643f26728a6846cbca65cdafcf5c2a1b
[ "if N == 1:\n return 1\nif N == 2:\n return 2\ndp = [1 for _ in range(N + 1)]\ndp[2] = 2\nfor i in range(3, N + 1):\n dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(1000000000.0 + 7)\nreturn dp[-1]", "import numpy as np\nif N == 1:\n return 1\nif N == 2:\n return 2\nif N % 2 == 1:\n k = (N - 2) // 2\...
<|body_start_0|> if N == 1: return 1 if N == 2: return 2 dp = [1 for _ in range(N + 1)] dp[2] = 2 for i in range(3, N + 1): dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(1000000000.0 + 7) return dp[-1] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" <|body_0|> def numTilings_1(self, N): """:type N: int :rtype: int 95MS""" <|body_1|> <|end_skeleton|> <|body_start_0|> if N == 1: return 1 if N == 2: ...
stack_v2_sparse_classes_36k_train_012216
1,973
no_license
[ { "docstring": ":type N: int :rtype: int 35MS", "name": "numTilings", "signature": "def numTilings(self, N)" }, { "docstring": ":type N: int :rtype: int 95MS", "name": "numTilings_1", "signature": "def numTilings_1(self, N)" } ]
2
stack_v2_sparse_classes_30k_val_000200
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTilings(self, N): :type N: int :rtype: int 35MS - def numTilings_1(self, N): :type N: int :rtype: int 95MS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTilings(self, N): :type N: int :rtype: int 35MS - def numTilings_1(self, N): :type N: int :rtype: int 95MS <|skeleton|> class Solution: def numTilings(self, N): ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" <|body_0|> def numTilings_1(self, N): """:type N: int :rtype: int 95MS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" if N == 1: return 1 if N == 2: return 2 dp = [1 for _ in range(N + 1)] dp[2] = 2 for i in range(3, N + 1): dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(100000...
the_stack_v2_python_sparse
DominoAndTrominoTiling_MID_790.py
953250587/leetcode-python
train
2
ff68f55d5148b9a6a43a031b644d36baa8447da3
[ "user_uuid = get_jwt_identity()\ntry:\n page = int(request.args.get('page'))\nexcept (ValueError, TypeError):\n page = 1\nreturn TrackService.get_popular_tracks(page, user_uuid)", "user_uuid = get_jwt_identity()\ndata = request.get_json()\nreturn TrackService.add_additional_track(user_uuid, data)" ]
<|body_start_0|> user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return TrackService.get_popular_tracks(page, user_uuid) <|end_body_0|> <|body_start_1|> user_uuid = get_jwt_identity() ...
TrackResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackResource: def get(self): """Get list of the most popular Tracks""" <|body_0|> def post(self): """Add additional Track for validation""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_uuid = get_jwt_identity() try: page = ...
stack_v2_sparse_classes_36k_train_012217
8,885
no_license
[ { "docstring": "Get list of the most popular Tracks", "name": "get", "signature": "def get(self)" }, { "docstring": "Add additional Track for validation", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_014181
Implement the Python class `TrackResource` described below. Class description: Implement the TrackResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Tracks - def post(self): Add additional Track for validation
Implement the Python class `TrackResource` described below. Class description: Implement the TrackResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Tracks - def post(self): Add additional Track for validation <|skeleton|> class TrackResource: def get(self): ...
2e7b4e07f149ede884cfe37130d9842ff9bb7be2
<|skeleton|> class TrackResource: def get(self): """Get list of the most popular Tracks""" <|body_0|> def post(self): """Add additional Track for validation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrackResource: def get(self): """Get list of the most popular Tracks""" user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return TrackService.get_popular_tracks(page, user_uuid) ...
the_stack_v2_python_sparse
src/resources/track_resource.py
RomainCtl/RecoFinement-api
train
0
a6acebb61291716f567fc716a84334a0552fcf38
[ "if not request.user.is_superuser:\n return HttpResponseForbidden()\nextension = ReviewBotExtension.instance\nuser = get_object_or_404(User, pk=extension.settings.get('user'))\nreturn HttpResponse(json.dumps(_serialize_user(request, user)), content_type='application/json')", "if not request.user.is_superuser:\...
<|body_start_0|> if not request.user.is_superuser: return HttpResponseForbidden() extension = ReviewBotExtension.instance user = get_object_or_404(User, pk=extension.settings.get('user')) return HttpResponse(json.dumps(_serialize_user(request, user)), content_type='applicatio...
An endpoint for setting the user for Review Bot.
ConfigureUserView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" ...
stack_v2_sparse_classes_36k_train_012218
11,244
permissive
[ { "docstring": "Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create a new user for Review Bo...
2
null
Implement the Python class `ConfigureUserView` described below. Class description: An endpoint for setting the user for Review Bot. Method signatures and docstrings: - def get(self, request): Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A re...
Implement the Python class `ConfigureUserView` described below. Class description: An endpoint for setting the user for Review Bot. Method signatures and docstrings: - def get(self, request): Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A re...
b59b566e127b5ef1b08f3189f1aa0194b7437d94
<|skeleton|> class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigureUserView: """An endpoint for setting the user for Review Bot.""" def get(self, request): """Return the configured user. Args: request (django.http.HttpRequest): The HTTP request. Returns: django.http.HttpResponse: A response containing the currently-configured user.""" if not req...
the_stack_v2_python_sparse
extension/reviewbotext/views.py
reviewboard/ReviewBot
train
110
594f253eadf5775d70fc88558aaf3ed584f45560
[ "random.seed(102938482634)\npoint_cloud = load(os.path.join('testdata', 'AHN3.las'))\nnum_all_pc_points = len(point_cloud[keys.point]['x']['data'])\nrand_indices = [random.randint(0, num_all_pc_points) for _ in range(20)]\ntarget_point_cloud = utils.copy_point_cloud(point_cloud, rand_indices)\nradius = 2.5\nneighbo...
<|body_start_0|> random.seed(102938482634) point_cloud = load(os.path.join('testdata', 'AHN3.las')) num_all_pc_points = len(point_cloud[keys.point]['x']['data']) rand_indices = [random.randint(0, num_all_pc_points) for _ in range(20)] target_point_cloud = utils.copy_point_cloud(p...
TestExtractEigenValues
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestExtractEigenValues: def test_eigenvalues_in_cylinders(self): """Test provenance added (This should actually be part the general feature extractor test suite).""" <|body_0|> def test_eigenvalues_of_too_few_points_results_in_0(): """If there are too few points to c...
stack_v2_sparse_classes_36k_train_012219
11,643
permissive
[ { "docstring": "Test provenance added (This should actually be part the general feature extractor test suite).", "name": "test_eigenvalues_in_cylinders", "signature": "def test_eigenvalues_in_cylinders(self)" }, { "docstring": "If there are too few points to calculate the eigen values don't outp...
2
stack_v2_sparse_classes_30k_train_009583
Implement the Python class `TestExtractEigenValues` described below. Class description: Implement the TestExtractEigenValues class. Method signatures and docstrings: - def test_eigenvalues_in_cylinders(self): Test provenance added (This should actually be part the general feature extractor test suite). - def test_eig...
Implement the Python class `TestExtractEigenValues` described below. Class description: Implement the TestExtractEigenValues class. Method signatures and docstrings: - def test_eigenvalues_in_cylinders(self): Test provenance added (This should actually be part the general feature extractor test suite). - def test_eig...
f6c22841dcbd375639c7f7aecec70f2602b91ee4
<|skeleton|> class TestExtractEigenValues: def test_eigenvalues_in_cylinders(self): """Test provenance added (This should actually be part the general feature extractor test suite).""" <|body_0|> def test_eigenvalues_of_too_few_points_results_in_0(): """If there are too few points to c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestExtractEigenValues: def test_eigenvalues_in_cylinders(self): """Test provenance added (This should actually be part the general feature extractor test suite).""" random.seed(102938482634) point_cloud = load(os.path.join('testdata', 'AHN3.las')) num_all_pc_points = len(point...
the_stack_v2_python_sparse
laserchicken/feature_extractor/test_eigenvals_feature_extractor.py
eEcoLiDAR/laserchicken
train
28
ca09b011e46cc3e2540532ef0366740189e496e3
[ "linear.drop_data()\nself.assertEqual(linear.show_available_products(), {})\nwith self.assertRaises(FileNotFoundError):\n result = linear.import_data('data2', 'p.csv', 'c.csv', 'r.csv')\nresult = linear.import_data('data', 'products.csv', 'customers.csv', 'rentals.csv')\nself.assertEqual(result[0][0], 1000)\nsel...
<|body_start_0|> linear.drop_data() self.assertEqual(linear.show_available_products(), {}) with self.assertRaises(FileNotFoundError): result = linear.import_data('data2', 'p.csv', 'c.csv', 'r.csv') result = linear.import_data('data', 'products.csv', 'customers.csv', 'rentals....
Tests for population and data integrity of database.
RentalDbTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RentalDbTest: """Tests for population and data integrity of database.""" def test_1_import(self): """Test that the records are successfully imported.""" <|body_0|> def test_2_show_rentals(self): """Test the integrity of the returned dictionary of active rentals."...
stack_v2_sparse_classes_36k_train_012220
3,511
no_license
[ { "docstring": "Test that the records are successfully imported.", "name": "test_1_import", "signature": "def test_1_import(self)" }, { "docstring": "Test the integrity of the returned dictionary of active rentals.", "name": "test_2_show_rentals", "signature": "def test_2_show_rentals(se...
2
stack_v2_sparse_classes_30k_train_000657
Implement the Python class `RentalDbTest` described below. Class description: Tests for population and data integrity of database. Method signatures and docstrings: - def test_1_import(self): Test that the records are successfully imported. - def test_2_show_rentals(self): Test the integrity of the returned dictionar...
Implement the Python class `RentalDbTest` described below. Class description: Tests for population and data integrity of database. Method signatures and docstrings: - def test_1_import(self): Test that the records are successfully imported. - def test_2_show_rentals(self): Test the integrity of the returned dictionar...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class RentalDbTest: """Tests for population and data integrity of database.""" def test_1_import(self): """Test that the records are successfully imported.""" <|body_0|> def test_2_show_rentals(self): """Test the integrity of the returned dictionary of active rentals."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RentalDbTest: """Tests for population and data integrity of database.""" def test_1_import(self): """Test that the records are successfully imported.""" linear.drop_data() self.assertEqual(linear.show_available_products(), {}) with self.assertRaises(FileNotFoundError): ...
the_stack_v2_python_sparse
students/shodges/lesson07/test_database.py
JavaRod/SP_Python220B_2019
train
1
ecb74adb3c71d99676310d8ec96083c46b4f92f0
[ "super(QldbEvent, self).__init__(start_time)\nself.event_id = 'qldb-{}'.format(str(uuid4()))\nself.resource['name'] = getattr(instance.__getattribute__('_transaction')._session, '_ledger_name')\nself.resource['operation'] = wrapped.__func__.__name__\nself.resource['metadata']['query'] = args[0]\nadd_data_if_needed(...
<|body_start_0|> super(QldbEvent, self).__init__(start_time) self.event_id = 'qldb-{}'.format(str(uuid4())) self.resource['name'] = getattr(instance.__getattribute__('_transaction')._session, '_ledger_name') self.resource['operation'] = wrapped.__func__.__name__ self.resource['me...
Represents base pyqldb event.
QldbEvent
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QldbEvent: """Represents base pyqldb event.""" def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): """Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_t...
stack_v2_sparse_classes_36k_train_012221
2,852
permissive
[ { "docstring": "Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_time: Start timestamp (epoch) :param response: response data :param exception: Exception (if happened)", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_009810
Implement the Python class `QldbEvent` described below. Class description: Represents base pyqldb event. Method signatures and docstrings: - def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: ...
Implement the Python class `QldbEvent` described below. Class description: Represents base pyqldb event. Method signatures and docstrings: - def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: ...
91e28fe43bc4f42152fb156145088cb8c9f69b85
<|skeleton|> class QldbEvent: """Represents base pyqldb event.""" def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): """Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QldbEvent: """Represents base pyqldb event.""" def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): """Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_time: Start ti...
the_stack_v2_python_sparse
epsagon/events/pyqldb.py
epsagon/epsagon-python
train
57
27b8b8878b2be882e27fa6878b75b5b550604c68
[ "super(IdentifierForm, self).__init__(*args, **kwargs)\nself.fields['name'].widget.attrs['readonly'] = True\nself.fields['name'].widget.attrs['style'] = 'background-color:white;'\nself.fields['url'].widget.attrs['readonly'] = True\nself.fields['url'].widget.attrs['style'] = 'background-color:white;'\nself.helper = ...
<|body_start_0|> super(IdentifierForm, self).__init__(*args, **kwargs) self.fields['name'].widget.attrs['readonly'] = True self.fields['name'].widget.attrs['style'] = 'background-color:white;' self.fields['url'].widget.attrs['readonly'] = True self.fields['url'].widget.attrs['sty...
Render Identifier model form with appropriate attributes.
IdentifierForm
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentifierForm: """Render Identifier model form with appropriate attributes.""" def __init__(self, res_short_id=None, *args, **kwargs): """Render Identifier model form with appropriate attributes.""" <|body_0|> def clean(self): """Ensure that identifier name attr...
stack_v2_sparse_classes_36k_train_012222
43,447
permissive
[ { "docstring": "Render Identifier model form with appropriate attributes.", "name": "__init__", "signature": "def __init__(self, res_short_id=None, *args, **kwargs)" }, { "docstring": "Ensure that identifier name attribute is not blank.", "name": "clean", "signature": "def clean(self)" ...
2
null
Implement the Python class `IdentifierForm` described below. Class description: Render Identifier model form with appropriate attributes. Method signatures and docstrings: - def __init__(self, res_short_id=None, *args, **kwargs): Render Identifier model form with appropriate attributes. - def clean(self): Ensure that...
Implement the Python class `IdentifierForm` described below. Class description: Render Identifier model form with appropriate attributes. Method signatures and docstrings: - def __init__(self, res_short_id=None, *args, **kwargs): Render Identifier model form with appropriate attributes. - def clean(self): Ensure that...
69855813052243c702c9b0108d2eac3f4f1a768f
<|skeleton|> class IdentifierForm: """Render Identifier model form with appropriate attributes.""" def __init__(self, res_short_id=None, *args, **kwargs): """Render Identifier model form with appropriate attributes.""" <|body_0|> def clean(self): """Ensure that identifier name attr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentifierForm: """Render Identifier model form with appropriate attributes.""" def __init__(self, res_short_id=None, *args, **kwargs): """Render Identifier model form with appropriate attributes.""" super(IdentifierForm, self).__init__(*args, **kwargs) self.fields['name'].widget....
the_stack_v2_python_sparse
hs_core/forms.py
hydroshare/hydroshare
train
207
e09eca9387b3fae4b74f7f48c362b8b3d40da401
[ "inputs = [x.strip('[]\"\\n') for x in sys_stdin]\na1 = self.cast_int_arr(inputs[0])\na2 = self.cast_int_arr(inputs[1])\nreturn (a1, a2)", "if s == '':\n a = list()\nelse:\n a = [int(x) for x in s.split(',')]\nreturn a" ]
<|body_start_0|> inputs = [x.strip('[]"\n') for x in sys_stdin] a1 = self.cast_int_arr(inputs[0]) a2 = self.cast_int_arr(inputs[1]) return (a1, a2) <|end_body_0|> <|body_start_1|> if s == '': a = list() else: a = [int(x) for x in s.split(',')] ...
Input
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]]""" <|body_0|> def cast_int_arr(self, s): """Converts string to array of integers. :par...
stack_v2_sparse_classes_36k_train_012223
3,821
permissive
[ { "docstring": "Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]]", "name": "stdin", "signature": "def stdin(self, sys_stdin)" }, { "docstring": "Converts string to array of integers. :param str s: input...
2
null
Implement the Python class `Input` described below. Class description: Implement the Input class. Method signatures and docstrings: - def stdin(self, sys_stdin): Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]] - def cast_in...
Implement the Python class `Input` described below. Class description: Implement the Input class. Method signatures and docstrings: - def stdin(self, sys_stdin): Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]] - def cast_in...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]]""" <|body_0|> def cast_int_arr(self, s): """Converts string to array of integers. :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Input: def stdin(self, sys_stdin): """Imports standard input. :param _io.TextIOWrapper sys_stdin: standard input :return: input arrays of integers :rtype: tup[list[int], list[int]]""" inputs = [x.strip('[]"\n') for x in sys_stdin] a1 = self.cast_int_arr(inputs[0]) a2 = self.cas...
the_stack_v2_python_sparse
0349_intersection_two_arrays/python_source.py
arthurdysart/LeetCode
train
0
47920f83698f8f269a45844e31540e852c4ddde0
[ "if not intervals:\n return 0\nintervals.sort(key=lambda d: d.start)\nendheap = [intervals[0].end]\nn = len(intervals)\nrooms = 1\nfor i in range(1, n):\n if endheap:\n if intervals[i].start < endheap[0]:\n rooms += 1\n else:\n heapq.heappop(endheap)\n heapq.heappush(end...
<|body_start_0|> if not intervals: return 0 intervals.sort(key=lambda d: d.start) endheap = [intervals[0].end] n = len(intervals) rooms = 1 for i in range(1, n): if endheap: if intervals[i].start < endheap[0]: ro...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_0|> def minMeetingRooms3(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_1|> def minMeetingRooms2(self, intervals): ...
stack_v2_sparse_classes_36k_train_012224
2,515
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: int", "name": "minMeetingRooms", "signature": "def minMeetingRooms(self, intervals)" }, { "docstring": ":type intervals: List[Interval] :rtype: int", "name": "minMeetingRooms3", "signature": "def minMeetingRooms3(self, intervals)" ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): :type intervals: List[Interval] :rtype: int - def minMeetingRooms3(self, intervals): :type intervals: List[Interval] :rtype: int - def minMe...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): :type intervals: List[Interval] :rtype: int - def minMeetingRooms3(self, intervals): :type intervals: List[Interval] :rtype: int - def minMe...
692bf0e5aab402d55463274e99ab4d0ed56ce64c
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_0|> def minMeetingRooms3(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_1|> def minMeetingRooms2(self, intervals): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minMeetingRooms(self, intervals): """:type intervals: List[Interval] :rtype: int""" if not intervals: return 0 intervals.sort(key=lambda d: d.start) endheap = [intervals[0].end] n = len(intervals) rooms = 1 for i in range(1, n):...
the_stack_v2_python_sparse
253-meeting_rooms_II.py
WweiL/LeetCode
train
0
f83b01297b3ec2befbbd4c2808adeefd689f4e89
[ "current_app.logger.info(f'StalePaymentTask Ran at {datetime.datetime.now()}')\ncls._update_stale_payments()\ncls._delete_marked_payments()", "stale_transactions = PaymentTransactionModel.find_stale_records(minutes=30)\nservice_unavailable_transactions = db.session.query(PaymentTransactionModel).join(PaymentModel...
<|body_start_0|> current_app.logger.info(f'StalePaymentTask Ran at {datetime.datetime.now()}') cls._update_stale_payments() cls._delete_marked_payments() <|end_body_0|> <|body_start_1|> stale_transactions = PaymentTransactionModel.find_stale_records(minutes=30) service_unavailab...
Task to sync stale payments.
StalePaymentTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StalePaymentTask: """Task to sync stale payments.""" def update_stale_payments(cls): """Update stale payments.""" <|body_0|> def _update_stale_payments(cls): """Update stale payment records. This is to handle edge cases where the user has completed payment and so...
stack_v2_sparse_classes_36k_train_012225
4,776
permissive
[ { "docstring": "Update stale payments.", "name": "update_stale_payments", "signature": "def update_stale_payments(cls)" }, { "docstring": "Update stale payment records. This is to handle edge cases where the user has completed payment and some error occured and payment status is not up-to-date."...
3
null
Implement the Python class `StalePaymentTask` described below. Class description: Task to sync stale payments. Method signatures and docstrings: - def update_stale_payments(cls): Update stale payments. - def _update_stale_payments(cls): Update stale payment records. This is to handle edge cases where the user has com...
Implement the Python class `StalePaymentTask` described below. Class description: Task to sync stale payments. Method signatures and docstrings: - def update_stale_payments(cls): Update stale payments. - def _update_stale_payments(cls): Update stale payment records. This is to handle edge cases where the user has com...
0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1
<|skeleton|> class StalePaymentTask: """Task to sync stale payments.""" def update_stale_payments(cls): """Update stale payments.""" <|body_0|> def _update_stale_payments(cls): """Update stale payment records. This is to handle edge cases where the user has completed payment and so...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StalePaymentTask: """Task to sync stale payments.""" def update_stale_payments(cls): """Update stale payments.""" current_app.logger.info(f'StalePaymentTask Ran at {datetime.datetime.now()}') cls._update_stale_payments() cls._delete_marked_payments() def _update_stale...
the_stack_v2_python_sparse
jobs/payment-jobs/tasks/stale_payment_task.py
bcgov/sbc-pay
train
6
29bbd165bf5fd1dfe6ac93da30dcd7f018c5e688
[ "serializedData = ''\nnodeQueue = [root] if root else []\nwhile nodeQueue:\n for node in nodeQueue:\n if node:\n serializedData += str(node.val) + ' '\n else:\n serializedData += 'null' + ' '\n nodeQueue = [childNode for node in nodeQueue if node for childNode in [node.left...
<|body_start_0|> serializedData = '' nodeQueue = [root] if root else [] while nodeQueue: for node in nodeQueue: if node: serializedData += str(node.val) + ' ' else: serializedData += 'null' + ' ' node...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_012226
1,735
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
e05f29071d0badd081535e773f43ebc303aa12c4
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" serializedData = '' nodeQueue = [root] if root else [] while nodeQueue: for node in nodeQueue: if node: serializedData += ...
the_stack_v2_python_sparse
LeetCode/BFS/449_SerializeAndDeserializeBST.py
HzCeee/Algorithms
train
0
2b9bbfa7bc0bbb909787bd219536e64943852ddc
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Campaign Draft service. Service to manage campaign drafts.
CampaignDraftServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignDraftServiceServicer: """Proto file describing the Campaign Draft service. Service to manage campaign drafts.""" def GetCampaignDraft(self, request, context): """Returns the requested campaign draft in full detail.""" <|body_0|> def MutateCampaignDrafts(self, req...
stack_v2_sparse_classes_36k_train_012227
10,568
permissive
[ { "docstring": "Returns the requested campaign draft in full detail.", "name": "GetCampaignDraft", "signature": "def GetCampaignDraft(self, request, context)" }, { "docstring": "Creates, updates, or removes campaign drafts. Operation statuses are returned.", "name": "MutateCampaignDrafts", ...
4
stack_v2_sparse_classes_30k_train_020770
Implement the Python class `CampaignDraftServiceServicer` described below. Class description: Proto file describing the Campaign Draft service. Service to manage campaign drafts. Method signatures and docstrings: - def GetCampaignDraft(self, request, context): Returns the requested campaign draft in full detail. - de...
Implement the Python class `CampaignDraftServiceServicer` described below. Class description: Proto file describing the Campaign Draft service. Service to manage campaign drafts. Method signatures and docstrings: - def GetCampaignDraft(self, request, context): Returns the requested campaign draft in full detail. - de...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class CampaignDraftServiceServicer: """Proto file describing the Campaign Draft service. Service to manage campaign drafts.""" def GetCampaignDraft(self, request, context): """Returns the requested campaign draft in full detail.""" <|body_0|> def MutateCampaignDrafts(self, req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampaignDraftServiceServicer: """Proto file describing the Campaign Draft service. Service to manage campaign drafts.""" def GetCampaignDraft(self, request, context): """Returns the requested campaign draft in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/campaign_draft_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
49dcb3083f5d15e4ca1b3e5173d2484cb674f8a9
[ "checked_dict = dict()\nfor char in string:\n if checked_dict.get(char):\n return True\n checked_dict[char] = 1\nreturn False", "max_len = len(s)\nif max_len < 2:\n return max_len\nfor idx in range(max_len, 1, -1):\n for start in range(0, max_len - idx + 1):\n if not self.has_repeat_char...
<|body_start_0|> checked_dict = dict() for char in string: if checked_dict.get(char): return True checked_dict[char] = 1 return False <|end_body_0|> <|body_start_1|> max_len = len(s) if max_len < 2: return max_len for i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def has_repeat_char(string): """检查字符串是否包含重复字符 :param string: 原始字符串""" <|body_0|> def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> checked_dict = dict() for char in s...
stack_v2_sparse_classes_36k_train_012228
32,941
no_license
[ { "docstring": "检查字符串是否包含重复字符 :param string: 原始字符串", "name": "has_repeat_char", "signature": "def has_repeat_char(string)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_016765
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def has_repeat_char(string): 检查字符串是否包含重复字符 :param string: 原始字符串 - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def has_repeat_char(string): 检查字符串是否包含重复字符 :param string: 原始字符串 - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def has_repea...
255f49e3a7f437d6f2f8155dcca646d34dd5bbfa
<|skeleton|> class Solution: def has_repeat_char(string): """检查字符串是否包含重复字符 :param string: 原始字符串""" <|body_0|> def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def has_repeat_char(string): """检查字符串是否包含重复字符 :param string: 原始字符串""" checked_dict = dict() for char in string: if checked_dict.get(char): return True checked_dict[char] = 1 return False def lengthOfLongestSubstring(self, s...
the_stack_v2_python_sparse
3.py
Eastwu5788/LeetCode
train
0
451d606904da780e8a2734d472907bf84574007e
[ "if self._listeners is None:\n self._listeners = weakref.WeakValueDictionary()\nself._listeners[id(listener)] = listener", "if self._listeners is None:\n return\nwith suppress(KeyError):\n del self._listeners[id(listener)]", "if self._listeners is None:\n return\nmethod_name = f'_update_{notificatio...
<|body_start_0|> if self._listeners is None: self._listeners = weakref.WeakValueDictionary() self._listeners[id(listener)] = listener <|end_body_0|> <|body_start_1|> if self._listeners is None: return with suppress(KeyError): del self._listeners[id(li...
Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic way, and is not machinery that should be exposed to users of the classes involved....
NotifierMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifierMixin: """Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic way, and is not machinery that should be ...
stack_v2_sparse_classes_36k_train_012229
29,904
permissive
[ { "docstring": "Add an object to the list of listeners to notify of changes to this object. This adds a weakref to the list of listeners that is removed from the listeners list when the listener has no other references to it.", "name": "_add_listener", "signature": "def _add_listener(self, listener)" ...
4
null
Implement the Python class `NotifierMixin` described below. Class description: Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic wa...
Implement the Python class `NotifierMixin` described below. Class description: Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic wa...
53188c39a23c33b72df5850ec59e31886f84e29d
<|skeleton|> class NotifierMixin: """Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic way, and is not machinery that should be ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifierMixin: """Mixin class that provides services by which objects can register listeners to changes on that object. All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic way, and is not machinery that should be exposed to us...
the_stack_v2_python_sparse
astropy/io/fits/util.py
astropy/astropy
train
3,922
cdcef1ae782e52f73075323746554944e8b32cb2
[ "self.__size = size\nself.__cache = OrderedDict()\nself.__label = label", "try:\n value = self.__cache.pop(key)\n self.__cache[key] = value\n return value\nexcept KeyError:\n return None", "try:\n try:\n self.__cache.pop(key)\n except KeyError:\n if len(self.__cache) >= self.__si...
<|body_start_0|> self.__size = size self.__cache = OrderedDict() self.__label = label <|end_body_0|> <|body_start_1|> try: value = self.__cache.pop(key) self.__cache[key] = value return value except KeyError: return None <|end_body...
LRU style cache.
CacheUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheUtils: """LRU style cache.""" def __init__(self, size=10, label='cache'): """LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance of the cache. Defaults to "cache".""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012230
1,828
permissive
[ { "docstring": "LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance of the cache. Defaults to \"cache\".", "name": "__init__", "signature": "def __init__(self, size=10, label='cache')" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_007686
Implement the Python class `CacheUtils` described below. Class description: LRU style cache. Method signatures and docstrings: - def __init__(self, size=10, label='cache'): LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance o...
Implement the Python class `CacheUtils` described below. Class description: LRU style cache. Method signatures and docstrings: - def __init__(self, size=10, label='cache'): LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance o...
02178b2e04eb80e21caaa1c596d904af91b8e502
<|skeleton|> class CacheUtils: """LRU style cache.""" def __init__(self, size=10, label='cache'): """LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance of the cache. Defaults to "cache".""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CacheUtils: """LRU style cache.""" def __init__(self, size=10, label='cache'): """LRU style cache Args: size (int, optional): maximum number of elements in the cache. Defaults to 10. label (str, optional): A label an instance of the cache. Defaults to "cache".""" self.__size = size ...
the_stack_v2_python_sparse
rcsb/utils/io/CacheUtils.py
rcsb/py-rcsb_utils_io
train
0
edb73ac1fb6f4b75d99e624b56a68a0560c4425a
[ "try:\n logger.info('Starting model version %s for project %s', model_version, project_name)\n lookoutvision_client.start_model(ProjectName=project_name, ModelVersion=model_version, MinInferenceUnits=min_inference_units)\n print('Starting hosting...')\n status = ''\n finished = False\n while finis...
<|body_start_0|> try: logger.info('Starting model version %s for project %s', model_version, project_name) lookoutvision_client.start_model(ProjectName=project_name, ModelVersion=model_version, MinInferenceUnits=min_inference_units) print('Starting hosting...') st...
Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running.
Hosting
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hosting: """Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running.""" def start_model(lookoutvision_client, project_name, model_version, min_inference_units): """Starts the hosting of a Lookout for Vision model. :param lo...
stack_v2_sparse_classes_36k_train_012231
6,335
permissive
[ { "docstring": "Starts the hosting of a Lookout for Vision model. :param lookoutvision_client: A Boto3 Lookout for Vision client. :param project_name: The name of the project that contains the version of the model that you want to start hosting. :param model_version: The version of the model that you want to st...
3
stack_v2_sparse_classes_30k_train_011102
Implement the Python class `Hosting` described below. Class description: Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running. Method signatures and docstrings: - def start_model(lookoutvision_client, project_name, model_version, min_inference_units): St...
Implement the Python class `Hosting` described below. Class description: Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running. Method signatures and docstrings: - def start_model(lookoutvision_client, project_name, model_version, min_inference_units): St...
dec41fb589043ac9d8667aac36fb88a53c3abe50
<|skeleton|> class Hosting: """Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running.""" def start_model(lookoutvision_client, project_name, model_version, min_inference_units): """Starts the hosting of a Lookout for Vision model. :param lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hosting: """Shows how to start and stop a Lookout for Vision Model. Also shows how to list the models that are currently running.""" def start_model(lookoutvision_client, project_name, model_version, min_inference_units): """Starts the hosting of a Lookout for Vision model. :param lookoutvision_c...
the_stack_v2_python_sparse
python/example_code/lookoutvision/hosting.py
awsdocs/aws-doc-sdk-examples
train
8,240
4e9b8c123a2225ecf7660fbd919f985063439c33
[ "recommendation = Recommendation.query.filter_by(id=id).first()\nif recommendation is None:\n return ({'message': 'Recommendation does not exist'}, 404)\nreturn recommendation_schema.dump(recommendation)", "with db.session.no_autoflush:\n req = api.payload\n recommendation = Recommendation.query.filter_b...
<|body_start_0|> recommendation = Recommendation.query.filter_by(id=id).first() if recommendation is None: return ({'message': 'Recommendation does not exist'}, 404) return recommendation_schema.dump(recommendation) <|end_body_0|> <|body_start_1|> with db.session.no_autoflus...
SingleRecommendation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleRecommendation: def get(self, id): """Get Recommendation by id""" <|body_0|> def patch(self, id): """Update a Recommendation""" <|body_1|> def delete(self, id): """Delete a Recommendation by id""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_012232
7,370
no_license
[ { "docstring": "Get Recommendation by id", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update a Recommendation", "name": "patch", "signature": "def patch(self, id)" }, { "docstring": "Delete a Recommendation by id", "name": "delete", "signature": "d...
3
stack_v2_sparse_classes_30k_train_018514
Implement the Python class `SingleRecommendation` described below. Class description: Implement the SingleRecommendation class. Method signatures and docstrings: - def get(self, id): Get Recommendation by id - def patch(self, id): Update a Recommendation - def delete(self, id): Delete a Recommendation by id
Implement the Python class `SingleRecommendation` described below. Class description: Implement the SingleRecommendation class. Method signatures and docstrings: - def get(self, id): Get Recommendation by id - def patch(self, id): Update a Recommendation - def delete(self, id): Delete a Recommendation by id <|skelet...
ae78fff9888b0f68d9403d7f65cba086dabb3802
<|skeleton|> class SingleRecommendation: def get(self, id): """Get Recommendation by id""" <|body_0|> def patch(self, id): """Update a Recommendation""" <|body_1|> def delete(self, id): """Delete a Recommendation by id""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleRecommendation: def get(self, id): """Get Recommendation by id""" recommendation = Recommendation.query.filter_by(id=id).first() if recommendation is None: return ({'message': 'Recommendation does not exist'}, 404) return recommendation_schema.dump(recommendat...
the_stack_v2_python_sparse
api/v1/recommendations.py
mythril-io/flask-api
train
0
535f5da35483c84166da689e686287a0887e4e36
[ "if isinstance(value, str):\n path = epath.Path(value)\n return cls(root_path=path.parent, filenames=[path.name])\nelif isinstance(value, dict):\n return cls(root_path=epath.Path(value['root_path']), filenames=value['filenames'])\nelse:\n raise ValueError(f'Invalid input: {value}')", "if len(self.file...
<|body_start_0|> if isinstance(value, str): path = epath.Path(value) return cls(root_path=path.parent, filenames=[path.name]) elif isinstance(value, dict): return cls(root_path=epath.Path(value['root_path']), filenames=value['filenames']) else: rai...
Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package
DatasetSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'D...
stack_v2_sparse_classes_36k_train_012233
2,642
permissive
[ { "docstring": "Imports from JSON.", "name": "from_json", "signature": "def from_json(cls, value: utils.JsonValue) -> 'DatasetSource'" }, { "docstring": "Exports to JSON.", "name": "to_json", "signature": "def to_json(self) -> utils.JsonValue" } ]
2
null
Implement the Python class `DatasetSource` described below. Class description: Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package Method signature...
Implement the Python class `DatasetSource` described below. Class description: Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package Method signature...
41ae3cf1439711ed2f50f99caa0e6702082e6d37
<|skeleton|> class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'DatasetSource'...
the_stack_v2_python_sparse
tensorflow_datasets/core/community/dataset_sources.py
tensorflow/datasets
train
4,224
3014d6cf414efeb2a4c9e797927face61ba22b6a
[ "datas = []\nif file_path != '':\n with open(file_path, encoding='utf-8') as f:\n datas = yaml.safe_load(f)\n if data_key == '':\n return datas\n else:\n return datas[data_key]\nreturn datas", "logger = logging.getLogger(log_id)\nlogger.setLevel(logging.DEBUG)\nif not logger.handlers...
<|body_start_0|> datas = [] if file_path != '': with open(file_path, encoding='utf-8') as f: datas = yaml.safe_load(f) if data_key == '': return datas else: return datas[data_key] return datas <|end_body_0|> <|b...
Utils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" <|body_0|> def log_init(self, log_id, log_name): """规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_012234
2,525
no_license
[ { "docstring": "yaml文件流转成json数据对象 :param file_path: :param data_key: :return:", "name": "yaml_load", "signature": "def yaml_load(self, file_path, data_key='')" }, { "docstring": "规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:", "name": "log_init", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_015025
Implement the Python class `Utils` described below. Class description: Implement the Utils class. Method signatures and docstrings: - def yaml_load(self, file_path, data_key=''): yaml文件流转成json数据对象 :param file_path: :param data_key: :return: - def log_init(self, log_id, log_name): 规范输出日志的格式 :param log_id: log内容中的标识 :p...
Implement the Python class `Utils` described below. Class description: Implement the Utils class. Method signatures and docstrings: - def yaml_load(self, file_path, data_key=''): yaml文件流转成json数据对象 :param file_path: :param data_key: :return: - def log_init(self, log_id, log_name): 规范输出日志的格式 :param log_id: log内容中的标识 :p...
955a6453d0e041a5af19f1eadaac00c15e9d5850
<|skeleton|> class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" <|body_0|> def log_init(self, log_id, log_name): """规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" datas = [] if file_path != '': with open(file_path, encoding='utf-8') as f: datas = yaml.safe_load(f) if data_key == '': ...
the_stack_v2_python_sparse
classWorks/feishu1/web/utils.py
jumper0419/HogwartsStudy
train
2
8d6d0e55c271ac7df25c5791d771120863bccd2d
[ "super().__init__()\nself._config_entry = config_entry\nself._entry_id = config_entry.entry_id", "errors = {}\nif user_input is not None:\n return self.async_create_entry(title='', data=user_input)\nreturn self.async_show_form(step_id='init', data_schema=create_schema(self._config_entry, step='init'), errors=e...
<|body_start_0|> super().__init__() self._config_entry = config_entry self._entry_id = config_entry.entry_id <|end_body_0|> <|body_start_1|> errors = {} if user_input is not None: return self.async_create_entry(title='', data=user_input) return self.async_sho...
Changing options flow.
SleepAsAndroidOptionsFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012235
3,504
no_license
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry)" }, { "docstring": "Manage the options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=None)" } ]
2
stack_v2_sparse_classes_30k_train_014254
Implement the Python class `SleepAsAndroidOptionsFlow` described below. Class description: Changing options flow. Method signatures and docstrings: - def __init__(self, config_entry): Initialize options flow. - async def async_step_init(self, user_input=None): Manage the options.
Implement the Python class `SleepAsAndroidOptionsFlow` described below. Class description: Changing options flow. Method signatures and docstrings: - def __init__(self, config_entry): Initialize options flow. - async def async_step_init(self, user_input=None): Manage the options. <|skeleton|> class SleepAsAndroidOpt...
3c985391265c94c733cf333201c72010c6296900
<|skeleton|> class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" super().__init__() self._config_entry = config_entry self._entry_id = config_entry.entry_id async def async_step_init(self, user_input=None): ...
the_stack_v2_python_sparse
custom_components/sleep_as_android/config_flow.py
SeLLeRoNe/HA-Config
train
80
22b892923124f6f7b7432370b83ad91b0c545419
[ "super(MaskNet, self).__init__()\nself.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2d(32), nn.Dropout(dropout_rate))\nself.prep_block_2 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1)...
<|body_start_0|> super(MaskNet, self).__init__() self.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2d(32), nn.Dropout(dropout_rate)) self.prep_block_2 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_chan...
MaskNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" <|body_0|> def forward(self, x): """This function defines the forward pass of the model. Args: x: Input. Returns: Model output.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_012236
1,855
permissive
[ { "docstring": "This function instantiates all the model layers.", "name": "__init__", "signature": "def __init__(self, dropout_rate=0.0, in_channels=3)" }, { "docstring": "This function defines the forward pass of the model. Args: x: Input. Returns: Model output.", "name": "forward", "s...
2
stack_v2_sparse_classes_30k_train_008873
Implement the Python class `MaskNet` described below. Class description: Implement the MaskNet class. Method signatures and docstrings: - def __init__(self, dropout_rate=0.0, in_channels=3): This function instantiates all the model layers. - def forward(self, x): This function defines the forward pass of the model. A...
Implement the Python class `MaskNet` described below. Class description: Implement the MaskNet class. Method signatures and docstrings: - def __init__(self, dropout_rate=0.0, in_channels=3): This function instantiates all the model layers. - def forward(self, x): This function defines the forward pass of the model. A...
2eea883c96bf106774ea94464fc16c6baea86a95
<|skeleton|> class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" <|body_0|> def forward(self, x): """This function defines the forward pass of the model. Args: x: Input. Returns: Model output.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" super(MaskNet, self).__init__() self.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2...
the_stack_v2_python_sparse
tensornet/model/masknet.py
shan18/Depth-Estimation-Segmentation
train
7
5c32b53d4576e8adb5f50df8d896445e1abb8177
[ "lu = defaultdict(list)\nfor path in lib.files.walk(NOTESPATH, '.*\\\\.th\\\\.txt$'):\n for th in lib.dataparse.read_themes_from_txt(path, verbose=True):\n lu[th.name].append(path)\nfor name in lu:\n if len(lu[name]) > 1:\n log.debug(\"multiple theme definitions for '%s' in: %s\" % (name, lu[nam...
<|body_start_0|> lu = defaultdict(list) for path in lib.files.walk(NOTESPATH, '.*\\.th\\.txt$'): for th in lib.dataparse.read_themes_from_txt(path, verbose=True): lu[th.name].append(path) for name in lu: if len(lu[name]) > 1: log.debug("mul...
Tests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tests: def test_read_themes(self): """Check that all theme definitions can be read.""" <|body_0|> def test_read_stories(self): """Check that all story definitions can be read.""" <|body_1|> def test_read_storythemes(self): """Test that all themes...
stack_v2_sparse_classes_36k_train_012237
3,327
no_license
[ { "docstring": "Check that all theme definitions can be read.", "name": "test_read_themes", "signature": "def test_read_themes(self)" }, { "docstring": "Check that all story definitions can be read.", "name": "test_read_stories", "signature": "def test_read_stories(self)" }, { "d...
4
stack_v2_sparse_classes_30k_train_010482
Implement the Python class `Tests` described below. Class description: Implement the Tests class. Method signatures and docstrings: - def test_read_themes(self): Check that all theme definitions can be read. - def test_read_stories(self): Check that all story definitions can be read. - def test_read_storythemes(self)...
Implement the Python class `Tests` described below. Class description: Implement the Tests class. Method signatures and docstrings: - def test_read_themes(self): Check that all theme definitions can be read. - def test_read_stories(self): Check that all story definitions can be read. - def test_read_storythemes(self)...
a19e323d2db2714c5c391b5e082459a3b5111a53
<|skeleton|> class Tests: def test_read_themes(self): """Check that all theme definitions can be read.""" <|body_0|> def test_read_stories(self): """Check that all story definitions can be read.""" <|body_1|> def test_read_storythemes(self): """Test that all themes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tests: def test_read_themes(self): """Check that all theme definitions can be read.""" lu = defaultdict(list) for path in lib.files.walk(NOTESPATH, '.*\\.th\\.txt$'): for th in lib.dataparse.read_themes_from_txt(path, verbose=True): lu[th.name].append(path) ...
the_stack_v2_python_sparse
pylib/webtask/test_formatting.py
odinlake/tstp
train
0
3a391091e6dc7f4b366b9f62d3c03c5da0bb8bb5
[ "path = urls.WIDS['GET_CLIENT_ATTACKS']\nparams = {'limit': limit, 'offset': offset, 'sort': sort, 'calculate_total': calculate_total}\nif group:\n params['group'] = group\nif label:\n params['label'] = label\nif site:\n params['site'] = site\nif swarm_id:\n params['swarm_id'] = swarm_id\nif start:\n ...
<|body_start_0|> path = urls.WIDS['GET_CLIENT_ATTACKS'] params = {'limit': limit, 'offset': offset, 'sort': sort, 'calculate_total': calculate_total} if group: params['group'] = group if label: params['label'] = label if site: params['site'] = ...
A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs.
WIDS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WIDS: """A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs.""" def list_client_attacks(self, conn, group=None, label=None, site=None, swarm_id=None, start=None, end=None, from_timestamp=None, to_timestamp=None, limit=100, calculate_total=True, s...
stack_v2_sparse_classes_36k_train_012238
22,300
permissive
[ { "docstring": "Get client attacks over a time period :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call. :type conn: class:`pycentral.ArubaCentralBase` :param group: List of group names, defaults to None :type group: list, optional :param label: List of label names, defaults to Non...
3
stack_v2_sparse_classes_30k_val_000056
Implement the Python class `WIDS` described below. Class description: A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs. Method signatures and docstrings: - def list_client_attacks(self, conn, group=None, label=None, site=None, swarm_id=None, start=None, end=None, from_t...
Implement the Python class `WIDS` described below. Class description: A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs. Method signatures and docstrings: - def list_client_attacks(self, conn, group=None, label=None, site=None, swarm_id=None, start=None, end=None, from_t...
d938396a18193473afbe54e6cc6697d2bd4954a7
<|skeleton|> class WIDS: """A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs.""" def list_client_attacks(self, conn, group=None, label=None, site=None, swarm_id=None, start=None, end=None, from_timestamp=None, to_timestamp=None, limit=100, calculate_total=True, s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WIDS: """A Python Class to obtain Aruba Central's Wireless Intrusion Detection details based on REST APIs.""" def list_client_attacks(self, conn, group=None, label=None, site=None, swarm_id=None, start=None, end=None, from_timestamp=None, to_timestamp=None, limit=100, calculate_total=True, sort='-ts', of...
the_stack_v2_python_sparse
pycentral/rapids.py
jayp193/pycentral
train
0
6ba5302d68666e08bc30863c4de3b4fa031b3267
[ "bus = dbus.SessionBus()\ntry:\n self.__bus = bus.get_object('org.mpris.MediaPlayer2.spotify', '/org/mpris/MediaPlayer2')\n self.player = dbus.Interface(self.__bus, 'org.freedesktop.DBus.Properties')\n try:\n metadata = self.player.Get('org.mpris.MediaPlayer2.Player', 'Metadata')\n album = me...
<|body_start_0|> bus = dbus.SessionBus() try: self.__bus = bus.get_object('org.mpris.MediaPlayer2.spotify', '/org/mpris/MediaPlayer2') self.player = dbus.Interface(self.__bus, 'org.freedesktop.DBus.Properties') try: metadata = self.player.Get('org.mpri...
Py3status
[ "WTFPL", "EPL-2.0", "BSD-3-Clause", "GPL-3.0-only", "BSD-2-Clause", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Py3status: def _get_text(self, i3s_config): """Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-Desktop-Linux-Windows-Web/DBus-MPRIS-interface-bug/td-p/1262889 retested on : 2016-02-22""" ...
stack_v2_sparse_classes_36k_train_012239
3,607
permissive
[ { "docstring": "Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-Desktop-Linux-Windows-Web/DBus-MPRIS-interface-bug/td-p/1262889 retested on : 2016-02-22", "name": "_get_text", "signature": "def _get_text(self, i...
2
stack_v2_sparse_classes_30k_train_020165
Implement the Python class `Py3status` described below. Class description: Implement the Py3status class. Method signatures and docstrings: - def _get_text(self, i3s_config): Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-De...
Implement the Python class `Py3status` described below. Class description: Implement the Py3status class. Method signatures and docstrings: - def _get_text(self, i3s_config): Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-De...
a762517505ed8e3ecb6bc35edc5cc70d49f44ffd
<|skeleton|> class Py3status: def _get_text(self, i3s_config): """Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-Desktop-Linux-Windows-Web/DBus-MPRIS-interface-bug/td-p/1262889 retested on : 2016-02-22""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Py3status: def _get_text(self, i3s_config): """Get the current song metadatas (artist - title) there is a known bug for dbus property PlaybackStatus: https://community.spotify.com/t5/Help-Desktop-Linux-Windows-Web/DBus-MPRIS-interface-bug/td-p/1262889 retested on : 2016-02-22""" bus = dbus.Ses...
the_stack_v2_python_sparse
py3status/modules/spotify.py
nan0tube/py3status
train
0
2d7cfcb4b22e3b76139aa2e15e6782f478d2556f
[ "if port is None:\n port = 8080\nself._redirect_uri = REDIRECT_URI.format(port if port else 8080)\nself._auth_url = fn_opts.get('auth_url')\nself._token_url = fn_opts.get('token_url')\nself._client_id = fn_opts.get('client_id')\nself._client_secret = fn_opts.get('client_secret')\nself._refresh_token = fn_opts.ge...
<|body_start_0|> if port is None: port = 8080 self._redirect_uri = REDIRECT_URI.format(port if port else 8080) self._auth_url = fn_opts.get('auth_url') self._token_url = fn_opts.get('token_url') self._client_id = fn_opts.get('client_id') self._client_secret = ...
Class Responsible for handling OAuth2 authorization/authentication.
OAuth2Flow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" ...
stack_v2_sparse_classes_36k_train_012240
5,128
permissive
[ { "docstring": ":param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)", "name": "__init__", "signature": "def __init__(self, fn_opts, crsf_token=None, port=None)" }, { "docstring": "Get the OAuth2 authorization url fo...
5
null
Implement the Python class `OAuth2Flow` described below. Class description: Class Responsible for handling OAuth2 authorization/authentication. Method signatures and docstrings: - def __init__(self, fn_opts, crsf_token=None, port=None): :param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret...
Implement the Python class `OAuth2Flow` described below. Class description: Class Responsible for handling OAuth2 authorization/authentication. Method signatures and docstrings: - def __init__(self, fn_opts, crsf_token=None, port=None): :param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAuth2Flow: """Class Responsible for handling OAuth2 authorization/authentication.""" def __init__(self, fn_opts, crsf_token=None, port=None): """:param fn_opts: The app.config values for the app.(str) :param crsf_token: Secret used in requests to make request more secure.(str)""" if port...
the_stack_v2_python_sparse
oauth-utils/oauth_utils/lib/oauth2flow.py
ibmresilient/resilient-community-apps
train
81
cf36466f7f6cdece9d2803946ecece5758e71016
[ "address = self.get_object(request.user, address_id)\nserializedAddress = AddressSerializer(address, data=request.data, partial=True)\nif serializedAddress.is_valid():\n serializedAddress.save(owner=request.user)\n return Response({'address': serializedAddress.data})\nreturn Response({'error': serializedAddre...
<|body_start_0|> address = self.get_object(request.user, address_id) serializedAddress = AddressSerializer(address, data=request.data, partial=True) if serializedAddress.is_valid(): serializedAddress.save(owner=request.user) return Response({'address': serializedAddress.d...
MemberAddressDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemberAddressDetail: def put(self, request, address_id, format=None): """Modify an address created by this user, fields that are left empty will not be modified --- serializer : location.serializers.AddressSerializer""" <|body_0|> def delete(self, request, address_id, format...
stack_v2_sparse_classes_36k_train_012241
2,504
no_license
[ { "docstring": "Modify an address created by this user, fields that are left empty will not be modified --- serializer : location.serializers.AddressSerializer", "name": "put", "signature": "def put(self, request, address_id, format=None)" }, { "docstring": "Delets this address --- omit_serializ...
2
stack_v2_sparse_classes_30k_train_004320
Implement the Python class `MemberAddressDetail` described below. Class description: Implement the MemberAddressDetail class. Method signatures and docstrings: - def put(self, request, address_id, format=None): Modify an address created by this user, fields that are left empty will not be modified --- serializer : lo...
Implement the Python class `MemberAddressDetail` described below. Class description: Implement the MemberAddressDetail class. Method signatures and docstrings: - def put(self, request, address_id, format=None): Modify an address created by this user, fields that are left empty will not be modified --- serializer : lo...
6aef9c2db875ff77022f55d70bc785d612f092c0
<|skeleton|> class MemberAddressDetail: def put(self, request, address_id, format=None): """Modify an address created by this user, fields that are left empty will not be modified --- serializer : location.serializers.AddressSerializer""" <|body_0|> def delete(self, request, address_id, format...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemberAddressDetail: def put(self, request, address_id, format=None): """Modify an address created by this user, fields that are left empty will not be modified --- serializer : location.serializers.AddressSerializer""" address = self.get_object(request.user, address_id) serializedAddr...
the_stack_v2_python_sparse
location/views.py
dynoto/ordergogo
train
1
c1dc2f0df073027de820071920a43badb81bb84d
[ "super().__init__(dynamic=True, **kwargs)\nself.max_edge = maximum_edge_length\nself.dimensions = homology_dimensions\nself.min_persistence = min_persistence if min_persistence is not None else [0.0 for _ in range(len(self.dimensions))]\nself.hcf = homology_coeff_field\nassert len(self.min_persistence) == len(self....
<|body_start_0|> super().__init__(dynamic=True, **kwargs) self.max_edge = maximum_edge_length self.dimensions = homology_dimensions self.min_persistence = min_persistence if min_persistence is not None else [0.0 for _ in range(len(self.dimensions))] self.hcf = homology_coeff_fiel...
TensorFlow layer for computing Rips persistence out of a point cloud
RipsLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (...
stack_v2_sparse_classes_36k_train_012242
4,886
permissive
[ { "docstring": "Constructor for the RipsLayer class Parameters: maximum_edge_length (float): maximum edge length for the Rips complex homology_dimensions (List[int]): list of homology dimensions min_persistence (List[float]): minimum distance-to-diagonal of the points in the output persistence diagrams (default...
2
stack_v2_sparse_classes_30k_train_021106
Implement the Python class `RipsLayer` described below. Class description: TensorFlow layer for computing Rips persistence out of a point cloud Method signatures and docstrings: - def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): Constructor ...
Implement the Python class `RipsLayer` described below. Class description: TensorFlow layer for computing Rips persistence out of a point cloud Method signatures and docstrings: - def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): Constructor ...
2f76d9416e145282adcd8264438480008bd59f77
<|skeleton|> class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (float): maxim...
the_stack_v2_python_sparse
src/python/gudhi/tensorflow/rips_layer.py
GUDHI/gudhi-devel
train
212
ceab7d611160663aa0f71bcd078e3f56c910b26f
[ "attributes = node.attributes\nself.individual_address = IndividualAddress(self.get_attribute_value(attributes.get('IndividualAddress')))\nself.tool_key = self.get_attribute_value(attributes.get('ToolKey'))\nself.management_password = self.get_attribute_value(attributes.get('ManagementPassword'))\nself.authenticati...
<|body_start_0|> attributes = node.attributes self.individual_address = IndividualAddress(self.get_attribute_value(attributes.get('IndividualAddress'))) self.tool_key = self.get_attribute_value(attributes.get('ToolKey')) self.management_password = self.get_attribute_value(attributes.get(...
Device in a knxkeys file.
XMLDevice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDevice: """Device in a knxkeys file.""" def parse_xml(self, node: Element) -> None: """Parse all needed attributes from the given node map.""" <|body_0|> def decrypt_attributes(self, password_hash: bytes, initialization_vector: bytes) -> None: """Decrypt attri...
stack_v2_sparse_classes_36k_train_012243
19,593
permissive
[ { "docstring": "Parse all needed attributes from the given node map.", "name": "parse_xml", "signature": "def parse_xml(self, node: Element) -> None" }, { "docstring": "Decrypt attributes.", "name": "decrypt_attributes", "signature": "def decrypt_attributes(self, password_hash: bytes, in...
2
stack_v2_sparse_classes_30k_train_009842
Implement the Python class `XMLDevice` described below. Class description: Device in a knxkeys file. Method signatures and docstrings: - def parse_xml(self, node: Element) -> None: Parse all needed attributes from the given node map. - def decrypt_attributes(self, password_hash: bytes, initialization_vector: bytes) -...
Implement the Python class `XMLDevice` described below. Class description: Device in a knxkeys file. Method signatures and docstrings: - def parse_xml(self, node: Element) -> None: Parse all needed attributes from the given node map. - def decrypt_attributes(self, password_hash: bytes, initialization_vector: bytes) -...
48d4e31365c15e632b275f0d129cd9f2b2b5717d
<|skeleton|> class XMLDevice: """Device in a knxkeys file.""" def parse_xml(self, node: Element) -> None: """Parse all needed attributes from the given node map.""" <|body_0|> def decrypt_attributes(self, password_hash: bytes, initialization_vector: bytes) -> None: """Decrypt attri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLDevice: """Device in a knxkeys file.""" def parse_xml(self, node: Element) -> None: """Parse all needed attributes from the given node map.""" attributes = node.attributes self.individual_address = IndividualAddress(self.get_attribute_value(attributes.get('IndividualAddress')))...
the_stack_v2_python_sparse
xknx/secure/keyring.py
XKNX/xknx
train
248
013c9018ed5c308ede628fd084f5bb063abb065f
[ "LOG.info('Initializing - Version:{}'.format(__version__))\nself.m_pyhouse_obj = p_pyhouse_obj\nself.m_config = Config(p_pyhouse_obj)\nself.m_utility = Utility(p_pyhouse_obj)\np_pyhouse_obj.House = HouseInformation()\nself.m_location_api = location.Api(p_pyhouse_obj)\nself.m_floor_api = floors.Api(p_pyhouse_obj)\ns...
<|body_start_0|> LOG.info('Initializing - Version:{}'.format(__version__)) self.m_pyhouse_obj = p_pyhouse_obj self.m_config = Config(p_pyhouse_obj) self.m_utility = Utility(p_pyhouse_obj) p_pyhouse_obj.House = HouseInformation() self.m_location_api = location.Api(p_pyhous...
API
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class API: def __init__(self, p_pyhouse_obj): """**NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running.""" <|body_0|> def LoadConfig(self): """The house is always present but the components of the house ar...
stack_v2_sparse_classes_36k_train_012244
14,568
no_license
[ { "docstring": "**NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running.", "name": "__init__", "signature": "def __init__(self, p_pyhouse_obj)" }, { "docstring": "The house is always present but the components of the house are plu...
5
stack_v2_sparse_classes_30k_train_010195
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def __init__(self, p_pyhouse_obj): **NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running. - def LoadConfig(self): The ho...
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def __init__(self, p_pyhouse_obj): **NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running. - def LoadConfig(self): The ho...
8ccbbd1494b7b33ff5099d321cda634fbb254ceb
<|skeleton|> class API: def __init__(self, p_pyhouse_obj): """**NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running.""" <|body_0|> def LoadConfig(self): """The house is always present but the components of the house ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class API: def __init__(self, p_pyhouse_obj): """**NoReactor** This is part of Core PyHouse - House is the reason we are running! Note that the reactor is not yet running.""" LOG.info('Initializing - Version:{}'.format(__version__)) self.m_pyhouse_obj = p_pyhouse_obj self.m_config = ...
the_stack_v2_python_sparse
Project/src/Modules/House/house.py
bopopescu/PyHouse
train
0
81d6f6a0eab74a3d8f14b7d5bc025ad73f876274
[ "super(SubstructureEncoder, self).__init__()\nself.atom_fdim = atom_fdim\nself.args = args\nself.hidden_size = args.substructures_hidden_size\nself.bias = args.bias\nself.dropout = args.dropout\nself.use_input_features = args.use_input_features\nself.device = args.device\nself.dropout_layer = nn.Dropout(p=self.drop...
<|body_start_0|> super(SubstructureEncoder, self).__init__() self.atom_fdim = atom_fdim self.args = args self.hidden_size = args.substructures_hidden_size self.bias = args.bias self.dropout = args.dropout self.use_input_features = args.use_input_features s...
An :class:`MPNEncoder` is a message passing neural network for encoding a molecule.
SubstructureEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstructureEncoder: """An :class:`MPNEncoder` is a message passing neural network for encoding a molecule.""" def __init__(self, args: TrainArgs, atom_fdim: int): """:param args: A :class:`~chemprop.args.TrainArgs` object containing model arguments. :param atom_fdim: Atom feature ve...
stack_v2_sparse_classes_36k_train_012245
4,786
permissive
[ { "docstring": ":param args: A :class:`~chemprop.args.TrainArgs` object containing model arguments. :param atom_fdim: Atom feature vector dimension. :param bond_fdim: Bond feature vector dimension.", "name": "__init__", "signature": "def __init__(self, args: TrainArgs, atom_fdim: int)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_001734
Implement the Python class `SubstructureEncoder` described below. Class description: An :class:`MPNEncoder` is a message passing neural network for encoding a molecule. Method signatures and docstrings: - def __init__(self, args: TrainArgs, atom_fdim: int): :param args: A :class:`~chemprop.args.TrainArgs` object cont...
Implement the Python class `SubstructureEncoder` described below. Class description: An :class:`MPNEncoder` is a message passing neural network for encoding a molecule. Method signatures and docstrings: - def __init__(self, args: TrainArgs, atom_fdim: int): :param args: A :class:`~chemprop.args.TrainArgs` object cont...
f766cbb8c1fa4d1aca419983e70ef59892176807
<|skeleton|> class SubstructureEncoder: """An :class:`MPNEncoder` is a message passing neural network for encoding a molecule.""" def __init__(self, args: TrainArgs, atom_fdim: int): """:param args: A :class:`~chemprop.args.TrainArgs` object containing model arguments. :param atom_fdim: Atom feature ve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubstructureEncoder: """An :class:`MPNEncoder` is a message passing neural network for encoding a molecule.""" def __init__(self, args: TrainArgs, atom_fdim: int): """:param args: A :class:`~chemprop.args.TrainArgs` object containing model arguments. :param atom_fdim: Atom feature vector dimensio...
the_stack_v2_python_sparse
scripts/SOTA/dmpnn/chemprop/models/substructures_feature_model.py
simonlevine/lipophilicity-prediction
train
0
a15284234f817837ad826c17e9fd52793d3040b4
[ "if len(strs) == 0:\n return '#'\nencoded_str = ''\nhead = ''\nfor this_str in strs:\n size = len(this_str)\n head = head + str(size) + ','\n encoded_str = encoded_str + this_str\nencoded_str = head + '#' + encoded_str\nreturn encoded_str", "if encoded_str == '#':\n return []\ndecoded_str_list = []...
<|body_start_0|> if len(strs) == 0: return '#' encoded_str = '' head = '' for this_str in strs: size = len(this_str) head = head + str(size) + ',' encoded_str = encoded_str + this_str encoded_str = head + '#' + encoded_str r...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, encoded_str: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012246
1,203
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, encoded_str: str) -> [str]" } ]
2
stack_v2_sparse_classes_30k_train_006781
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, encoded_str: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, encoded_str: str) -> [str]: Decodes a single string to a list of strings. <|skel...
2e2b002d2eb1c9bc70e5c1233537eba2235341a4
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, encoded_str: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" if len(strs) == 0: return '#' encoded_str = '' head = '' for this_str in strs: size = len(this_str) head = head + str(size) + ',' ...
the_stack_v2_python_sparse
String/Encode and Decode Strings/solution.py
Superhzf/python_exercise
train
1
b9f095356cdbbd7a61aa5239322db13463ed208a
[ "self.assertRaises(TypeError, add_errors, 'one', 2)\nself.assertRaises(TypeError, add_errors, 2)\nself.assertRaises(TypeError, add_errors, 2, 5.5)\nself.assertRaises(TypeError, add_errors, 'one', 'two')", "self.assertEqual(9, add_errors(3, 6), \"Can't add it up\")\nself.assertEqual(5, add_errors(-1, 6), \"Can't a...
<|body_start_0|> self.assertRaises(TypeError, add_errors, 'one', 2) self.assertRaises(TypeError, add_errors, 2) self.assertRaises(TypeError, add_errors, 2, 5.5) self.assertRaises(TypeError, add_errors, 'one', 'two') <|end_body_0|> <|body_start_1|> self.assertEqual(9, add_errors(...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" <|body_0|> def testAddSuccesses(self): """Test ensuring that valid data passes.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertRaises(TypeError...
stack_v2_sparse_classes_36k_train_012247
914
no_license
[ { "docstring": "Tests ensuring errors in data cause validation failures.", "name": "testAddErrors", "signature": "def testAddErrors(self)" }, { "docstring": "Test ensuring that valid data passes.", "name": "testAddSuccesses", "signature": "def testAddSuccesses(self)" } ]
2
stack_v2_sparse_classes_30k_train_004267
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def testAddErrors(self): Tests ensuring errors in data cause validation failures. - def testAddSuccesses(self): Test ensuring that valid data passes.
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def testAddErrors(self): Tests ensuring errors in data cause validation failures. - def testAddSuccesses(self): Test ensuring that valid data passes. <|skeleton|> class Test: def t...
049c654ed626e97d7fe2f8dc61d84c60f10d7558
<|skeleton|> class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" <|body_0|> def testAddSuccesses(self): """Test ensuring that valid data passes.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def testAddErrors(self): """Tests ensuring errors in data cause validation failures.""" self.assertRaises(TypeError, add_errors, 'one', 2) self.assertRaises(TypeError, add_errors, 2) self.assertRaises(TypeError, add_errors, 2, 5.5) self.assertRaises(TypeError, add...
the_stack_v2_python_sparse
workspace/Python3_Homework01/src/test_adder.py
paulrefalo/Python-2---4
train
0
50a08e7fccbcba14b09c674fc4f11b1769eef8ea
[ "key = '%s.dict' % self.prefix\nfor class_impl in (RedisDict, PickleRedisDict, JSONRedisDict):\n rd = class_impl()\n del rd[key]\n init_size = len(rd)\n self.assertFalse(key in rd)\n rd[key] = 10\n self.assertTrue(key in rd)\n self.assertEqual(len(rd), init_size + 1)\n self.assertTrue(rd[key...
<|body_start_0|> key = '%s.dict' % self.prefix for class_impl in (RedisDict, PickleRedisDict, JSONRedisDict): rd = class_impl() del rd[key] init_size = len(rd) self.assertFalse(key in rd) rd[key] = 10 self.assertTrue(key in rd) ...
Test the various data structures.
TestRedisDatastructures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRedisDatastructures: """Test the various data structures.""" def test_redis_dict(self): """Test the redis dict implementation.""" <|body_0|> def test_redis_hash_dict(self): """Test the redis hash dict implementation.""" <|body_1|> def test_redis_...
stack_v2_sparse_classes_36k_train_012248
13,402
no_license
[ { "docstring": "Test the redis dict implementation.", "name": "test_redis_dict", "signature": "def test_redis_dict(self)" }, { "docstring": "Test the redis hash dict implementation.", "name": "test_redis_hash_dict", "signature": "def test_redis_hash_dict(self)" }, { "docstring": ...
4
null
Implement the Python class `TestRedisDatastructures` described below. Class description: Test the various data structures. Method signatures and docstrings: - def test_redis_dict(self): Test the redis dict implementation. - def test_redis_hash_dict(self): Test the redis hash dict implementation. - def test_redis_list...
Implement the Python class `TestRedisDatastructures` described below. Class description: Test the various data structures. Method signatures and docstrings: - def test_redis_dict(self): Test the redis dict implementation. - def test_redis_hash_dict(self): Test the redis hash dict implementation. - def test_redis_list...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class TestRedisDatastructures: """Test the various data structures.""" def test_redis_dict(self): """Test the redis dict implementation.""" <|body_0|> def test_redis_hash_dict(self): """Test the redis hash dict implementation.""" <|body_1|> def test_redis_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRedisDatastructures: """Test the various data structures.""" def test_redis_dict(self): """Test the redis dict implementation.""" key = '%s.dict' % self.prefix for class_impl in (RedisDict, PickleRedisDict, JSONRedisDict): rd = class_impl() del rd[key] ...
the_stack_v2_python_sparse
repoData/lethain-Redis-Python-Datastructures/allPythonContent.py
aCoffeeYin/pyreco
train
0
e049b6f78f5ce65cb884b5fb1437243f559f512a
[ "super().__init__(coordinator)\nself.entity_description = description\nself._remote = remote\nself._attr_unique_id = f'{coordinator.mac_address}-{description.key}'\nself._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, coordinator.mac_address)})", "response: SwitcherBaseResponse = None\nerr...
<|body_start_0|> super().__init__(coordinator) self.entity_description = description self._remote = remote self._attr_unique_id = f'{coordinator.mac_address}-{description.key}' self._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, coordinator.mac_address)})...
Representation of a Switcher climate entity.
SwitcherThermostatButtonEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" <|body...
stack_v2_sparse_classes_36k_train_012249
5,671
permissive
[ { "docstring": "Initialize the entity.", "name": "__init__", "signature": "def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None" }, { "docstring": "Press the button.", "name": "async_press...
2
null
Implement the Python class `SwitcherThermostatButtonEntity` described below. Class description: Representation of a Switcher climate entity. Method signatures and docstrings: - def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreeze...
Implement the Python class `SwitcherThermostatButtonEntity` described below. Class description: Representation of a Switcher climate entity. Method signatures and docstrings: - def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreeze...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" super().__init__(co...
the_stack_v2_python_sparse
homeassistant/components/switcher_kis/button.py
home-assistant/core
train
35,501
ea22d79ee64901bf2d21eddd8dc8681b74016a02
[ "if uuidutils.is_uuid_like(segment_uuid):\n LOG.debug('Fetching failover segment by uuid %s', segment_uuid)\n segment = objects.FailoverSegment.get_by_uuid(context, segment_uuid)\nelse:\n LOG.debug('Failed to fetch failover segment by uuid %s', segment_uuid)\n raise exception.FailoverSegmentNotFound(id=...
<|body_start_0|> if uuidutils.is_uuid_like(segment_uuid): LOG.debug('Fetching failover segment by uuid %s', segment_uuid) segment = objects.FailoverSegment.get_by_uuid(context, segment_uuid) else: LOG.debug('Failed to fetch failover segment by uuid %s', segment_uuid) ...
FailoverSegmentAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" <|body_0|> def get_all(self, context, filters=None, sort_keys=None, sort_dirs=None, limit=None, marker=None): """Get all failover segmen...
stack_v2_sparse_classes_36k_train_012250
17,673
permissive
[ { "docstring": "Get a single failover segment with the given segment_uuid.", "name": "get_segment", "signature": "def get_segment(self, context, segment_uuid)" }, { "docstring": "Get all failover segments filtered by one of the given parameters. If there is no filter it will retrieve all segment...
5
stack_v2_sparse_classes_30k_train_011321
Implement the Python class `FailoverSegmentAPI` described below. Class description: Implement the FailoverSegmentAPI class. Method signatures and docstrings: - def get_segment(self, context, segment_uuid): Get a single failover segment with the given segment_uuid. - def get_all(self, context, filters=None, sort_keys=...
Implement the Python class `FailoverSegmentAPI` described below. Class description: Implement the FailoverSegmentAPI class. Method signatures and docstrings: - def get_segment(self, context, segment_uuid): Get a single failover segment with the given segment_uuid. - def get_all(self, context, filters=None, sort_keys=...
bad1f2fe6e5b4cc1f04c8723d9aba8c4cfffb164
<|skeleton|> class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" <|body_0|> def get_all(self, context, filters=None, sort_keys=None, sort_dirs=None, limit=None, marker=None): """Get all failover segmen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" if uuidutils.is_uuid_like(segment_uuid): LOG.debug('Fetching failover segment by uuid %s', segment_uuid) segment = objects.FailoverSegment....
the_stack_v2_python_sparse
masakari/ha/api.py
openstack/masakari
train
74
26a0ae093e50ba557105e90de436f1302d44fac3
[ "self.conn = connection\nself.method_proto = MethodProtocol(self.conn)\nself.process_map = {'divide': self._process_divide}\nself.handlers = handlers", "name = self.method_proto.get_method_name()\n_process = self.process_map[name]\n_process()", "proto = DivideProtocol()\nargs = proto.args_decode(self.conn)\ntry...
<|body_start_0|> self.conn = connection self.method_proto = MethodProtocol(self.conn) self.process_map = {'divide': self._process_divide} self.handlers = handlers <|end_body_0|> <|body_start_1|> name = self.method_proto.get_method_name() _process = self.process_map[name]...
帮助服务器完成远端过程调用
ServerStub
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" <|body_0|> def process(self): """当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:""" <|body_1|> def _process_divide(self): """处理除法的过程调...
stack_v2_sparse_classes_36k_train_012251
9,202
permissive
[ { "docstring": ":param connection: :param handlers:", "name": "__init__", "signature": "def __init__(self, connection, handlers)" }, { "docstring": "当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:", "name": "process", "signature": "def process(self)" }, { "docstring": "处理除法的过程调用 :return...
3
stack_v2_sparse_classes_30k_train_010421
Implement the Python class `ServerStub` described below. Class description: 帮助服务器完成远端过程调用 Method signatures and docstrings: - def __init__(self, connection, handlers): :param connection: :param handlers: - def process(self): 当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return: - def _process_divide(self): 处理除法的过程调用 :return:
Implement the Python class `ServerStub` described below. Class description: 帮助服务器完成远端过程调用 Method signatures and docstrings: - def __init__(self, connection, handlers): :param connection: :param handlers: - def process(self): 当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return: - def _process_divide(self): 处理除法的过程调用 :return: <|s...
be120ce2bb94a8e8395630218985f5e51ae087d9
<|skeleton|> class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" <|body_0|> def process(self): """当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:""" <|body_1|> def _process_divide(self): """处理除法的过程调...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" self.conn = connection self.method_proto = MethodProtocol(self.conn) self.process_map = {'divide': self._process_divide} self.handlers = handlers ...
the_stack_v2_python_sparse
KnowledgeMapping/grpc/services.py
nickliqian/keep_learning
train
8
cc7468515370e4a4845ed45bba1746e7a3b83941
[ "super().__init__()\nsys.stdout.flush()\ntry:\n self.my_device = params['my_device']\nexcept:\n self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')\nself.config = params\nif not self.config['include_metadata']:\n self.config['other_features_size'] = 0\nif params['activation'] ==...
<|body_start_0|> super().__init__() sys.stdout.flush() try: self.my_device = params['my_device'] except: self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') self.config = params if not self.config['include_metadata']: ...
myLSTMOutputHidden
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu"...
stack_v2_sparse_classes_36k_train_012252
34,560
no_license
[ { "docstring": "IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: \"relu\", \"elu\", or \"selu\" to be applied to all dense activations vo...
2
stack_v2_sparse_classes_30k_train_010521
Implement the Python class `myLSTMOutputHidden` described below. Class description: Implement the myLSTMOutputHidden class. Method signatures and docstrings: - def __init__(self, params): IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Shoul...
Implement the Python class `myLSTMOutputHidden` described below. Class description: Implement the myLSTMOutputHidden class. Method signatures and docstrings: - def __init__(self, params): IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Shoul...
b850f7c91e16e3dacca4d3b6377c77502960dd19
<|skeleton|> class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu", or "selu" to...
the_stack_v2_python_sparse
common/mytorch.py
altLabs/attrib
train
1
20b95b78af0aef7699c4365042db1c054ebb09c9
[ "background = Background(color, image, elements, mode=mode, finish=False)\nbackground.finish()\nreturn background", "super(Background, self).__init__('', elements, normal_params, finish=False)\nW, H = functions.get_screen_size()\nif image:\n painter = ImageFrame(image, mode=mode)\nelif color:\n painter = Ba...
<|body_start_0|> background = Background(color, image, elements, mode=mode, finish=False) background.finish() return background <|end_body_0|> <|body_start_1|> super(Background, self).__init__('', elements, normal_params, finish=False) W, H = functions.get_screen_size() ...
Background element for another element or menu.
Background
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Background: """Background element for another element or menu.""" def make(color=None, image=None, elements=None, mode='scale to screen'): """Background element for another element or menu. <color>: if not None, define the color for the background. <image>: if not None, define the im...
stack_v2_sparse_classes_36k_train_012253
2,483
permissive
[ { "docstring": "Background element for another element or menu. <color>: if not None, define the color for the background. <image>: if not None, define the image of the background. <Mode>: None : if an image is passed, its original size is kept. Otherwise, a <color> (white by default) rect of the size of the sc...
2
stack_v2_sparse_classes_30k_train_017110
Implement the Python class `Background` described below. Class description: Background element for another element or menu. Method signatures and docstrings: - def make(color=None, image=None, elements=None, mode='scale to screen'): Background element for another element or menu. <color>: if not None, define the colo...
Implement the Python class `Background` described below. Class description: Background element for another element or menu. Method signatures and docstrings: - def make(color=None, image=None, elements=None, mode='scale to screen'): Background element for another element or menu. <color>: if not None, define the colo...
e9dc52ff209f684be578f57a324f5bcf29d536ad
<|skeleton|> class Background: """Background element for another element or menu.""" def make(color=None, image=None, elements=None, mode='scale to screen'): """Background element for another element or menu. <color>: if not None, define the color for the background. <image>: if not None, define the im...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Background: """Background element for another element or menu.""" def make(color=None, image=None, elements=None, mode='scale to screen'): """Background element for another element or menu. <color>: if not None, define the color for the background. <image>: if not None, define the image of the ba...
the_stack_v2_python_sparse
elements/background.py
YannThorimbert/Thorpy
train
32
90601a5194897661efbb0583b8a32d239c787db7
[ "super(ConditionalEventFormatter, self).__init__()\nregexp = re.compile('{[a-z][a-zA-Z0-9_]*[!]?[^:}]*[:]?[^}]*}')\nregexp_name = re.compile('[a-z][a-zA-Z0-9_]*')\nself._format_string_pieces_map = []\nfor format_string_piece in self.FORMAT_STRING_PIECES:\n result = regexp.findall(format_string_piece)\n if not...
<|body_start_0|> super(ConditionalEventFormatter, self).__init__() regexp = re.compile('{[a-z][a-zA-Z0-9_]*[!]?[^:}]*[:]?[^}]*}') regexp_name = re.compile('[a-z][a-zA-Z0-9_]*') self._format_string_pieces_map = [] for format_string_piece in self.FORMAT_STRING_PIECES: r...
Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format strings pieces is similar to of the event formatter (EventFormatter). Every format string piece ...
ConditionalEventFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalEventFormatter: """Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format strings pieces is similar to of the event f...
stack_v2_sparse_classes_36k_train_012254
15,049
permissive
[ { "docstring": "Initializes the conditional formatter. A map is build of the string pieces and their corresponding attribute name to optimize conditional string formatting. Raises: RuntimeError: when an invalid format string piece is encountered.", "name": "__init__", "signature": "def __init__(self)" ...
2
stack_v2_sparse_classes_30k_train_001664
Implement the Python class `ConditionalEventFormatter` described below. Class description: Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format stri...
Implement the Python class `ConditionalEventFormatter` described below. Class description: Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format stri...
b4dc64b3a2d2906e8947824c493a2bc311d765c1
<|skeleton|> class ConditionalEventFormatter: """Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format strings pieces is similar to of the event f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConditionalEventFormatter: """Base class to conditionally format event data using format string pieces. Define the (long) format string and the short format string by defining FORMAT_STRING_PIECES and FORMAT_STRING_SHORT_PIECES. The syntax of the format strings pieces is similar to of the event formatter (Eve...
the_stack_v2_python_sparse
plaso/lib/eventdata.py
iwm911/plaso
train
0
c022c0a0964612b399db096e3b1df9291ac074ce
[ "path = '/billing_request_flows'\nif params is not None:\n params = {self._envelope_key(): params}\nresponse = self._perform_request('POST', path, params, headers, retry_failures=True)\nreturn self._resource_for(response)", "path = self._sub_url_params('/billing_request_flows/:identity/actions/initialise', {'i...
<|body_start_0|> path = '/billing_request_flows' if params is not None: params = {self._envelope_key(): params} response = self._perform_request('POST', path, params, headers, retry_failures=True) return self._resource_for(response) <|end_body_0|> <|body_start_1|> pa...
Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API.
BillingRequestFlowsService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillingRequestFlowsService: """Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API.""" def create(self, params=None, headers=None): """Create a Billing Request Flow. Creates a new billing request flow. Args: params (dict, optional): Req...
stack_v2_sparse_classes_36k_train_012255
1,948
permissive
[ { "docstring": "Create a Billing Request Flow. Creates a new billing request flow. Args: params (dict, optional): Request body. Returns: BillingRequestFlow", "name": "create", "signature": "def create(self, params=None, headers=None)" }, { "docstring": "Initialise a Billing Request Flow. Returns...
2
stack_v2_sparse_classes_30k_train_011954
Implement the Python class `BillingRequestFlowsService` described below. Class description: Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API. Method signatures and docstrings: - def create(self, params=None, headers=None): Create a Billing Request Flow. Creates a new...
Implement the Python class `BillingRequestFlowsService` described below. Class description: Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API. Method signatures and docstrings: - def create(self, params=None, headers=None): Create a Billing Request Flow. Creates a new...
ce6ef9064a2837ae4cebd7ca731fdef6c4ceca2d
<|skeleton|> class BillingRequestFlowsService: """Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API.""" def create(self, params=None, headers=None): """Create a Billing Request Flow. Creates a new billing request flow. Args: params (dict, optional): Req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BillingRequestFlowsService: """Service class that provides access to the billing_request_flows endpoints of the GoCardless Pro API.""" def create(self, params=None, headers=None): """Create a Billing Request Flow. Creates a new billing request flow. Args: params (dict, optional): Request body. Re...
the_stack_v2_python_sparse
gocardless_pro/services/billing_request_flows_service.py
gocardless/gocardless-pro-python
train
34
ab5f6281f8d018442ef3fae9b75f2687d981fd0a
[ "obj = cls()\nobj.channel_id = payload[device_key]\nfor key in payload:\n if key in ('created', 'last_registration'):\n payload[key] = datetime.datetime.strptime(payload[key], '%Y-%m-%dT%H:%M:%S')\n setattr(obj, key, payload[key])\nreturn obj", "start_url = common.CHANNEL_URL\ndata_attribute = 'chann...
<|body_start_0|> obj = cls() obj.channel_id = payload[device_key] for key in payload: if key in ('created', 'last_registration'): payload[key] = datetime.datetime.strptime(payload[key], '%Y-%m-%dT%H:%M:%S') setattr(obj, key, payload[key]) return ob...
Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in: bool; whether the device is opted in to push. :ivar background: bool; whether...
ChannelInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelInfo: """Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in: bool; whether the device is opted in t...
stack_v2_sparse_classes_36k_train_012256
7,797
no_license
[ { "docstring": "Create based on results from a ChannelList iterator.", "name": "from_payload", "signature": "def from_payload(cls, payload, device_key)" }, { "docstring": "Fetch metadata from a channel ID", "name": "lookup", "signature": "def lookup(cls, airship, channel_id)" } ]
2
null
Implement the Python class `ChannelInfo` described below. Class description: Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in:...
Implement the Python class `ChannelInfo` described below. Class description: Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in:...
ed0185f36e274d46f978a8f670a4189571280e8b
<|skeleton|> class ChannelInfo: """Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in: bool; whether the device is opted in t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChannelInfo: """Information object for iOS, Android and Amazon device channels. :ivar channel_id: Channel ID for the device. :ivar device_type: Type of the device, e.g. ``ios``. :ivar installed: bool; whether the app is installed on the device. :ivar opt_in: bool; whether the device is opted in to push. :ivar...
the_stack_v2_python_sparse
venv/lib/python2.7/site-packages/urbanairship/devices/devicelist.py
poojapauskar/vzcards-api
train
0
2afd2f4bf803f1c7b94b4dfeaea99c6b90f336a1
[ "p = super().Params()\np.Define('input_dims', 0, 'Depth of the input to the network.')\np.Define('epsilon', 1e-06, 'Tiny value to guard rsqrt.')\np.Define('scale', True, 'Whether to use a learned scaling.')\np.Define('bias', True, 'Whether to use bias.')\nreturn p", "super().create_layer_variables()\np = self.par...
<|body_start_0|> p = super().Params() p.Define('input_dims', 0, 'Depth of the input to the network.') p.Define('epsilon', 1e-06, 'Tiny value to guard rsqrt.') p.Define('scale', True, 'Whether to use a learned scaling.') p.Define('bias', True, 'Whether to use bias.') retur...
Layer normalization.
LayerNorm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerNorm: """Layer normalization.""" def Params(cls) -> InstantiableParams: """Returns the layer params with LayerNorm specific params.""" <|body_0|> def create_layer_variables(self) -> None: """Creates layer normalization variables.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_012257
17,959
permissive
[ { "docstring": "Returns the layer params with LayerNorm specific params.", "name": "Params", "signature": "def Params(cls) -> InstantiableParams" }, { "docstring": "Creates layer normalization variables.", "name": "create_layer_variables", "signature": "def create_layer_variables(self) -...
3
null
Implement the Python class `LayerNorm` described below. Class description: Layer normalization. Method signatures and docstrings: - def Params(cls) -> InstantiableParams: Returns the layer params with LayerNorm specific params. - def create_layer_variables(self) -> None: Creates layer normalization variables. - def f...
Implement the Python class `LayerNorm` described below. Class description: Layer normalization. Method signatures and docstrings: - def Params(cls) -> InstantiableParams: Returns the layer params with LayerNorm specific params. - def create_layer_variables(self) -> None: Creates layer normalization variables. - def f...
c00a74b260fcf6ba11199cc4a340c127d6616479
<|skeleton|> class LayerNorm: """Layer normalization.""" def Params(cls) -> InstantiableParams: """Returns the layer params with LayerNorm specific params.""" <|body_0|> def create_layer_variables(self) -> None: """Creates layer normalization variables.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerNorm: """Layer normalization.""" def Params(cls) -> InstantiableParams: """Returns the layer params with LayerNorm specific params.""" p = super().Params() p.Define('input_dims', 0, 'Depth of the input to the network.') p.Define('epsilon', 1e-06, 'Tiny value to guard ...
the_stack_v2_python_sparse
lingvo/jax/layers/normalizations.py
tensorflow/lingvo
train
2,963
1dd737be40a70a9f528a0ddd185f472412aaba3e
[ "name = self.normalize(name)\nfor portion in self.split(name):\n super().add(portion)", "string = cls.normalize(string)\nquery = cls._get_search_query()\nquery = query.filter(lambda tag: tag.name.startswith(string))\nobjects = cls._get_opbjects_from_query(query)\nreturn objects", "words = []\ni = 0\nwhile i ...
<|body_start_0|> name = self.normalize(name) for portion in self.split(name): super().add(portion) <|end_body_0|> <|body_start_1|> string = cls.normalize(string) query = cls._get_search_query() query = query.filter(lambda tag: tag.name.startswith(string)) obj...
Name handler, using a tag handler behind the scenes.
NameHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NameHandler: """Name handler, using a tag handler behind the scenes.""" def register(self, name: str): """Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-appropriate portions) and each portion is stored in a tag with ...
stack_v2_sparse_classes_36k_train_012258
6,240
permissive
[ { "docstring": "Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-appropriate portions) and each portion is stored in a tag with a specific subset. Searching through the database (using the `search` class method) will search through these names.",...
5
stack_v2_sparse_classes_30k_train_010822
Implement the Python class `NameHandler` described below. Class description: Name handler, using a tag handler behind the scenes. Method signatures and docstrings: - def register(self, name: str): Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-approp...
Implement the Python class `NameHandler` described below. Class description: Name handler, using a tag handler behind the scenes. Method signatures and docstrings: - def register(self, name: str): Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-approp...
fb7f98d331e47e2032ee1e51bf3e4b2592807fdf
<|skeleton|> class NameHandler: """Name handler, using a tag handler behind the scenes.""" def register(self, name: str): """Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-appropriate portions) and each portion is stored in a tag with ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NameHandler: """Name handler, using a tag handler behind the scenes.""" def register(self, name: str): """Register a name Args: name (str): the name to register. Behind the scenes, the name is split in words (or language-appropriate portions) and each portion is stored in a tag with a specific su...
the_stack_v2_python_sparse
src/data/handlers/name.py
vincent-lg/avenew.one
train
0
70fac634dcc35c70b2bc5b2309de35d51944e20d
[ "type_list = response.xpath(\"//div[@class='nav cate']/a\")\nstr = 'aaa'\ntype_list = ['http://www.netbian.com' + i.xpath('./@href').extract_first() for i in type_list if 'http' not in i.xpath('./@href').extract_first()]\nprint('【所有类型图片列表】type_list========>>>>>%s' % type_list)\nfor type in type_list:\n yield scr...
<|body_start_0|> type_list = response.xpath("//div[@class='nav cate']/a") str = 'aaa' type_list = ['http://www.netbian.com' + i.xpath('./@href').extract_first() for i in type_list if 'http' not in i.xpath('./@href').extract_first()] print('【所有类型图片列表】type_list========>>>>>%s' % type_list)...
www.netbian.com全站图片爬虫
NetbianSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetbianSpider: """www.netbian.com全站图片爬虫""" def parse(self, response): """按图片类型分组""" <|body_0|> def type_parse(self, response): """图片分组""" <|body_1|> def parse_detail_page(self, response): """图片详情页解析""" <|body_2|> def parse_downlo...
stack_v2_sparse_classes_36k_train_012259
3,509
no_license
[ { "docstring": "按图片类型分组", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "图片分组", "name": "type_parse", "signature": "def type_parse(self, response)" }, { "docstring": "图片详情页解析", "name": "parse_detail_page", "signature": "def parse_detail_page(...
4
stack_v2_sparse_classes_30k_test_000231
Implement the Python class `NetbianSpider` described below. Class description: www.netbian.com全站图片爬虫 Method signatures and docstrings: - def parse(self, response): 按图片类型分组 - def type_parse(self, response): 图片分组 - def parse_detail_page(self, response): 图片详情页解析 - def parse_download_page(self, response): 图片下载页解析,并传递下载UR...
Implement the Python class `NetbianSpider` described below. Class description: www.netbian.com全站图片爬虫 Method signatures and docstrings: - def parse(self, response): 按图片类型分组 - def type_parse(self, response): 图片分组 - def parse_detail_page(self, response): 图片详情页解析 - def parse_download_page(self, response): 图片下载页解析,并传递下载UR...
3ccbaa9c8512bd16a9784d716143f9f50f352819
<|skeleton|> class NetbianSpider: """www.netbian.com全站图片爬虫""" def parse(self, response): """按图片类型分组""" <|body_0|> def type_parse(self, response): """图片分组""" <|body_1|> def parse_detail_page(self, response): """图片详情页解析""" <|body_2|> def parse_downlo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetbianSpider: """www.netbian.com全站图片爬虫""" def parse(self, response): """按图片类型分组""" type_list = response.xpath("//div[@class='nav cate']/a") str = 'aaa' type_list = ['http://www.netbian.com' + i.xpath('./@href').extract_first() for i in type_list if 'http' not in i.xpath('...
the_stack_v2_python_sparse
2-爬虫/壁纸爬虫/WallPaperSpider/WallPaperSpider/spiders/netbian.py
JulySunny/PythonNotes
train
0
35fd07a9361d92d1f4b709341d35296e2a8433b6
[ "self.keysymstring = keysymstring\nself.modifier_mask = modifier_mask\nself.modifiers = modifiers\nself.handler = handler\nself.click_count = click_count\nself.keycode = None", "if not self.keycode:\n self.keycode = getKeycode(self.keysymstring)\nif self.keycode == keycode:\n result = modifiers & self.modif...
<|body_start_0|> self.keysymstring = keysymstring self.modifier_mask = modifier_mask self.modifiers = modifiers self.handler = handler self.click_count = click_count self.keycode = None <|end_body_0|> <|body_start_1|> if not self.keycode: self.keycode...
A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler.
KeyBinding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyBinding: """A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler.""" def __init__(self, keysymstring, modifier_mask, modifiers, handler, click_count=1): """Creates a new key binding. Arguments: - keysymstring: the keysymstring - this is typical...
stack_v2_sparse_classes_36k_train_012260
14,338
no_license
[ { "docstring": "Creates a new key binding. Arguments: - keysymstring: the keysymstring - this is typically a string from /usr/include/X11/keysymdef.h with the preceding 'XK_' removed (e.g., XK_KP_Enter becomes the string 'KP_Enter'). - modifier_mask: bit mask where a set bit tells us what modifiers we care abou...
2
stack_v2_sparse_classes_30k_train_006776
Implement the Python class `KeyBinding` described below. Class description: A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler. Method signatures and docstrings: - def __init__(self, keysymstring, modifier_mask, modifiers, handler, click_count=1): Creates a new key binding. Argu...
Implement the Python class `KeyBinding` described below. Class description: A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler. Method signatures and docstrings: - def __init__(self, keysymstring, modifier_mask, modifiers, handler, click_count=1): Creates a new key binding. Argu...
d08f7bf370a82b6970387bb9f165d374a9d9092b
<|skeleton|> class KeyBinding: """A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler.""" def __init__(self, keysymstring, modifier_mask, modifiers, handler, click_count=1): """Creates a new key binding. Arguments: - keysymstring: the keysymstring - this is typical...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyBinding: """A single key binding, consisting of a keycode, a modifier mask, and the InputEventHandler.""" def __init__(self, keysymstring, modifier_mask, modifiers, handler, click_count=1): """Creates a new key binding. Arguments: - keysymstring: the keysymstring - this is typically a string f...
the_stack_v2_python_sparse
usr/share/python-support/gnome-orca/orca/keybindings.py
haniokasai/netwalker-rootfs
train
2
f04a6fdb0af6980bfed437a6accc1012cb16080c
[ "path, __ = os.path.splitext(filePath)\ncharacterPath = f'{path}_Characters.xml'\nsuper()._postprocess_xml_file(characterPath)\nlocationPath = f'{path}_Locations.xml'\nsuper()._postprocess_xml_file(locationPath)\nitemPath = f'{path}_Items.xml'\nsuper()._postprocess_xml_file(itemPath)", "path, __ = os.path.splitex...
<|body_start_0|> path, __ = os.path.splitext(filePath) characterPath = f'{path}_Characters.xml' super()._postprocess_xml_file(characterPath) locationPath = f'{path}_Locations.xml' super()._postprocess_xml_file(locationPath) itemPath = f'{path}_Items.xml' super()._...
yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project.
DataFiles
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFiles: """yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project.""" def _postprocess_xml_file(self, filePath): """Postprocess thr...
stack_v2_sparse_classes_36k_train_012261
3,167
permissive
[ { "docstring": "Postprocess three xml files created by ElementTree. Positional argument: filePath: str -- path to .yw7 xml file. Generate the xml file paths from the .yw7 path. Read, postprocess and write the characters, locations, and items xml files. Extends the superclass method.", "name": "_postprocess_...
2
stack_v2_sparse_classes_30k_train_011832
Implement the Python class `DataFiles` described below. Class description: yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project. Method signatures and docstrings: - d...
Implement the Python class `DataFiles` described below. Class description: yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project. Method signatures and docstrings: - d...
33a868daed653c3371f5991d243a034668a80884
<|skeleton|> class DataFiles: """yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project.""" def _postprocess_xml_file(self, filePath): """Postprocess thr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFiles: """yWriter XML data files representation. yWriter can import or export characters, locations and items as separate xml files. This class represents a set of three xml files generated from a yWriter 7 project.""" def _postprocess_xml_file(self, filePath): """Postprocess three xml files ...
the_stack_v2_python_sparse
src/pywriter/yw/data_files.py
peter88213/PyWriter
train
3
511c16c70b9a87c43de2a28773d220f8c0e157ba
[ "if request.method in self.safe_methods:\n return True\nif request.user.is_authenticated and hasattr(request.user, 'profile'):\n return True\nreturn False", "if obj.account == request.user:\n return True\nreturn False" ]
<|body_start_0|> if request.method in self.safe_methods: return True if request.user.is_authenticated and hasattr(request.user, 'profile'): return True return False <|end_body_0|> <|body_start_1|> if obj.account == request.user: return True re...
The Permission class used by UserProfileView.
UserProfilePermissions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfilePermissions: """The Permission class used by UserProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because that account may be other type like a driver, shop or an a...
stack_v2_sparse_classes_36k_train_012262
1,859
permissive
[ { "docstring": "Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because that account may be other type like a driver, shop or an admin.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Checks i...
2
stack_v2_sparse_classes_30k_train_007198
Implement the Python class `UserProfilePermissions` described below. Class description: The Permission class used by UserProfileView. Method signatures and docstrings: - def has_permission(self, request, view): Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because t...
Implement the Python class `UserProfilePermissions` described below. Class description: The Permission class used by UserProfileView. Method signatures and docstrings: - def has_permission(self, request, view): Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because t...
7c361a31c5225c6ad649fcf92e323bdb10cc4c16
<|skeleton|> class UserProfilePermissions: """The Permission class used by UserProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because that account may be other type like a driver, shop or an a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfilePermissions: """The Permission class used by UserProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid profile, because that account may be other type like a driver, shop or an admin.""" ...
the_stack_v2_python_sparse
users/permissions.py
ahmed-alllam/Koshkie-Server
train
0
13421ce80f463c1fc3d39bb808181c83962672af
[ "self.spec = spec\nself.neurons = {}\nself.connections = []\nself.params = {}", "yaml_network = {}\nneurons = network.neuron\nconnections = network.connection\nself._parse_neurons(neurons)\nself._parse_connections(connections)\nyaml_network['neurons'] = self.neurons\nyaml_network['connections'] = self.connections...
<|body_start_0|> self.spec = spec self.neurons = {} self.connections = [] self.params = {} <|end_body_0|> <|body_start_1|> yaml_network = {} neurons = network.neuron connections = network.connection self._parse_neurons(neurons) self._parse_connect...
Encoder class for the standard neural network spec.
NeuralNetworkEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuralNetworkEncoder: """Encoder class for the standard neural network spec.""" def __init__(self, spec): """:param spec: :type spec: NeuralNetImplementation :return:""" <|body_0|> def parse_neural_network(self, network): """:param network: :type protobuf brain s...
stack_v2_sparse_classes_36k_train_012263
5,411
permissive
[ { "docstring": ":param spec: :type spec: NeuralNetImplementation :return:", "name": "__init__", "signature": "def __init__(self, spec)" }, { "docstring": ":param network: :type protobuf brain specification :return:", "name": "parse_neural_network", "signature": "def parse_neural_network(...
4
null
Implement the Python class `NeuralNetworkEncoder` described below. Class description: Encoder class for the standard neural network spec. Method signatures and docstrings: - def __init__(self, spec): :param spec: :type spec: NeuralNetImplementation :return: - def parse_neural_network(self, network): :param network: :...
Implement the Python class `NeuralNetworkEncoder` described below. Class description: Encoder class for the standard neural network spec. Method signatures and docstrings: - def __init__(self, spec): :param spec: :type spec: NeuralNetImplementation :return: - def parse_neural_network(self, network): :param network: :...
70e65320a28fe04e121145b2cdde289d3052728a
<|skeleton|> class NeuralNetworkEncoder: """Encoder class for the standard neural network spec.""" def __init__(self, spec): """:param spec: :type spec: NeuralNetImplementation :return:""" <|body_0|> def parse_neural_network(self, network): """:param network: :type protobuf brain s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeuralNetworkEncoder: """Encoder class for the standard neural network spec.""" def __init__(self, spec): """:param spec: :type spec: NeuralNetImplementation :return:""" self.spec = spec self.neurons = {} self.connections = [] self.params = {} def parse_neural...
the_stack_v2_python_sparse
revolve/convert/proto_to_yaml.py
ElteHupkes/revolve
train
0
95b76fb520afd561c38e599f43095acbffdf8812
[ "self._reactor = reactor\nself._getThreadPool = reactor.getThreadPool if getThreadPool is None else getThreadPool\nself._getaddrinfo = getaddrinfo", "pool = self._getThreadPool()\naddressFamily = _typesToAF[_any if addressTypes is None else frozenset(addressTypes)]\nsocketType = _transportToSocket[transportSemant...
<|body_start_0|> self._reactor = reactor self._getThreadPool = reactor.getThreadPool if getThreadPool is None else getThreadPool self._getaddrinfo = getaddrinfo <|end_body_0|> <|body_start_1|> pool = self._getThreadPool() addressFamily = _typesToAF[_any if addressTypes is None e...
L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread.
GAIResolver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GAIResolver: """L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread.""" def __init__(self, reactor: IReactorThreads, getThreadPool: Optional[Callable[[], 'ThreadPool']]=None, getaddrinfo: Callable[[str, int, int, int], _GETADDRINFO_RESULT]=getadd...
stack_v2_sparse_classes_36k_train_012264
5,240
permissive
[ { "docstring": "Create a L{GAIResolver}. @param reactor: the reactor to schedule result-delivery on @type reactor: L{IReactorThreads} @param getThreadPool: a function to retrieve the thread pool to use for scheduling name resolutions. If not supplied, the use the given C{reactor}'s thread pool. @type getThreadP...
2
stack_v2_sparse_classes_30k_train_020736
Implement the Python class `GAIResolver` described below. Class description: L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread. Method signatures and docstrings: - def __init__(self, reactor: IReactorThreads, getThreadPool: Optional[Callable[[], 'ThreadPool']]=None, get...
Implement the Python class `GAIResolver` described below. Class description: L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread. Method signatures and docstrings: - def __init__(self, reactor: IReactorThreads, getThreadPool: Optional[Callable[[], 'ThreadPool']]=None, get...
d35bed8369514fe727b4fe1afb68f48cc8b2655a
<|skeleton|> class GAIResolver: """L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread.""" def __init__(self, reactor: IReactorThreads, getThreadPool: Optional[Callable[[], 'ThreadPool']]=None, getaddrinfo: Callable[[str, int, int, int], _GETADDRINFO_RESULT]=getadd...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GAIResolver: """L{IHostnameResolver} implementation that resolves hostnames by calling L{getaddrinfo} in a thread.""" def __init__(self, reactor: IReactorThreads, getThreadPool: Optional[Callable[[], 'ThreadPool']]=None, getaddrinfo: Callable[[str, int, int, int], _GETADDRINFO_RESULT]=getaddrinfo): ...
the_stack_v2_python_sparse
synapse/util/gai_resolver.py
matrix-org/synapse
train
12,215
d7f35d17e468006a7867e470e4bb93f166f44b6c
[ "if len(s) == 1:\n return 1\nelif s == '':\n return 0\nlength = 0\nsub = []\nfor c in s:\n if c in sub:\n sub = sub[sub.index(c) + 1:]\n sub.append(c)\n length = max(length, len(sub))\nreturn length", "dicts = {}\nlength = start = 0\nfor i, c in enumerate(s):\n if c in dicts:\n sum...
<|body_start_0|> if len(s) == 1: return 1 elif s == '': return 0 length = 0 sub = [] for c in s: if c in sub: sub = sub[sub.index(c) + 1:] sub.append(c) length = max(length, len(sub)) return lengt...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) == 1: return 1 ...
stack_v2_sparse_classes_36k_train_012265
989
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring1", "signature": "def lengthOfLongestSubstring1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_000853
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOf...
3ac66a1bf85a344234c746ebf3de30e643838e5f
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" if len(s) == 1: return 1 elif s == '': return 0 length = 0 sub = [] for c in s: if c in sub: sub = sub[sub.index(c) + 1:] ...
the_stack_v2_python_sparse
3. Longest Substring Without Repeating Characters/3.py
JohnHuiWB/leetcode
train
0
0a473d13775608aceced1d2c210a92bb82f1a36d
[ "self.url_addresses = []\nif url_addresses and isinstance(url_addresses, list):\n for given_url in url_addresses:\n if given_url and isinstance(given_url, str) and url(given_url):\n self.url_addresses.append(given_url)\nif not self.url_addresses:\n self.url_addresses = TEST_URLS\nself.driver...
<|body_start_0|> self.url_addresses = [] if url_addresses and isinstance(url_addresses, list): for given_url in url_addresses: if given_url and isinstance(given_url, str) and url(given_url): self.url_addresses.append(given_url) if not self.url_addr...
WebPagesScreenshots
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebPagesScreenshots: def __init__(self, url_addresses=None): """creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (list)""" <|body_0|> def scroll_down_and_grab_screen(self): """scrolling page down with sel...
stack_v2_sparse_classes_36k_train_012266
7,939
permissive
[ { "docstring": "creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (list)", "name": "__init__", "signature": "def __init__(self, url_addresses=None)" }, { "docstring": "scrolling page down with selenium WebDriver to get more data from ...
2
stack_v2_sparse_classes_30k_train_020098
Implement the Python class `WebPagesScreenshots` described below. Class description: Implement the WebPagesScreenshots class. Method signatures and docstrings: - def __init__(self, url_addresses=None): creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (lis...
Implement the Python class `WebPagesScreenshots` described below. Class description: Implement the WebPagesScreenshots class. Method signatures and docstrings: - def __init__(self, url_addresses=None): creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (lis...
d08525bca4f7719b7bdf2f824ec8c6fd5b1c929d
<|skeleton|> class WebPagesScreenshots: def __init__(self, url_addresses=None): """creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (list)""" <|body_0|> def scroll_down_and_grab_screen(self): """scrolling page down with sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebPagesScreenshots: def __init__(self, url_addresses=None): """creates new instance of WebPagesScreenshots Object :param url_addresses: URL addresses to take screenshots from (list)""" self.url_addresses = [] if url_addresses and isinstance(url_addresses, list): for given_...
the_stack_v2_python_sparse
web_pages_screenshots.py
KnifeF/py-automate-stuff
train
0
62a06265a899f1d422031d38480e05ed3b650020
[ "category_id = self.data.skill_category_id or -1\nquery = Query(SkillCategory.collection, service_id=self._client.service_id)\nquery.add_term(field=SkillCategory.id_field, value=category_id)\nreturn InstanceProxy(SkillCategory, query, client=self._client)", "query = Query(Skill.collection, service_id=self._client...
<|body_start_0|> category_id = self.data.skill_category_id or -1 query = Query(SkillCategory.collection, service_id=self._client.service_id) query.add_term(field=SkillCategory.id_field, value=category_id) return InstanceProxy(SkillCategory, query, client=self._client) <|end_body_0|> <|b...
A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill line. .. attribute:: skill_points :type: int Unused. Any skill lines that can...
SkillLine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkillLine: """A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill line. .. attribute:: skill_points :type:...
stack_v2_sparse_classes_36k_train_012267
11,338
permissive
[ { "docstring": "Return the category this skill line belongs to. This returns an :class:`auraxium.InstanceProxy`.", "name": "category", "signature": "def category(self) -> InstanceProxy[SkillCategory]" }, { "docstring": "Return the skills contained in this skill line in order. This returns a :cla...
2
null
Implement the Python class `SkillLine` described below. Class description: A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill l...
Implement the Python class `SkillLine` described below. Class description: A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill l...
23dcf927a199c8d7c917d89fe96b470a34cf4bba
<|skeleton|> class SkillLine: """A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill line. .. attribute:: skill_points :type:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkillLine: """A series of skills or certifications. .. attribute:: id :type: int The unique ID for this skill line. In the API payload, this field is called ``skill_line_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill line. .. attribute:: skill_points :type: int Unused. ...
the_stack_v2_python_sparse
auraxium/ps2/_skill.py
leonhard-s/auraxium
train
29
c2744166669b99c6e32a885d92505d613db28787
[ "point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]]\npoint_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]]\ntf_point_cloud_1 = tf.constant(point_cloud_1)\ntf_point_cloud_2 = tf.constant(point_cloud_2)\ndist1, idx1, dist2, idx2 = tf_nndistance.nn_distance(tf_point_cloud_1, tf_point...
<|body_start_0|> point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] point_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] tf_point_cloud_1 = tf.constant(point_cloud_1) tf_point_cloud_2 = tf.constant(point_cloud_2) dist1, idx1, dist2, idx2 = tf_n...
NearestNeighborTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" <|body_0|> def test_nn_distance_2(self): """Test for nearest neighbor algorithm where distance is non-zero.""" <|body_1|> def test_nn_d...
stack_v2_sparse_classes_36k_train_012268
4,084
permissive
[ { "docstring": "Test for nearest neighbor algorithm where distance should be 0.", "name": "test_nn_distance", "signature": "def test_nn_distance(self)" }, { "docstring": "Test for nearest neighbor algorithm where distance is non-zero.", "name": "test_nn_distance_2", "signature": "def tes...
5
stack_v2_sparse_classes_30k_train_010844
Implement the Python class `NearestNeighborTest` described below. Class description: Implement the NearestNeighborTest class. Method signatures and docstrings: - def test_nn_distance(self): Test for nearest neighbor algorithm where distance should be 0. - def test_nn_distance_2(self): Test for nearest neighbor algori...
Implement the Python class `NearestNeighborTest` described below. Class description: Implement the NearestNeighborTest class. Method signatures and docstrings: - def test_nn_distance(self): Test for nearest neighbor algorithm where distance should be 0. - def test_nn_distance_2(self): Test for nearest neighbor algori...
f3cb31909666012dfcf38e5fe0b0f6feb3801560
<|skeleton|> class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" <|body_0|> def test_nn_distance_2(self): """Test for nearest neighbor algorithm where distance is non-zero.""" <|body_1|> def test_nn_d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] point_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] tf_point_cloud_1 = ...
the_stack_v2_python_sparse
src/tf_ops/nn_distance/tf_nndistance_test.py
minghanz/monopsr
train
0
452f5aed3db230a3c032145bea468190b38090f5
[ "resources.AddMembershipResourceArg(parser, membership_required=True, membership_help='The name of the Membership to update.')\napp_group = parser.add_mutually_exclusive_group(required=False)\napp_group.add_argument('--enable-stackdriver-on-applications', action='store_true', help='Enable the collection of logs and...
<|body_start_0|> resources.AddMembershipResourceArg(parser, membership_required=True, membership_help='The name of the Membership to update.') app_group = parser.add_mutually_exclusive_group(required=False) app_group.add_argument('--enable-stackdriver-on-applications', action='store_true', help=...
Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true
Update
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Update: """Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true""" def Args(cls, parser): ""...
stack_v2_sparse_classes_36k_train_012269
4,987
permissive
[ { "docstring": "Set up arguments for this command. Args: parser: An argparse.ArgumentParser.", "name": "Args", "signature": "def Args(cls, parser)" }, { "docstring": "Runs the command. Args: args: argparse.Namespace, An object that contains the values for the arguments specified in the .Args() m...
2
null
Implement the Python class `Update` described below. Class description: Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true M...
Implement the Python class `Update` described below. Class description: Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true M...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Update: """Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true""" def Args(cls, parser): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Update: """Update Anthos Observability spec on the specified membership. ## EXAMPLES To update the observability configuration on a membership named `MEMBERSHIP_NAME`, run: $ {command} --membership=MEMBERSHIP_NAME --enable-stackdriver-on-applications=true""" def Args(cls, parser): """Set up argum...
the_stack_v2_python_sparse
lib/surface/container/fleet/anthosobservability/update.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
228823ebe3953dc99bfbd9e354247bfcc483f7fe
[ "self.center = center\nself.scale = scale\nself.trimming = trimming", "X = _check_input(X)\n_check_trimming(self.trimming)\nif type(self.center) is str:\n center = eval(self.center)\nelse:\n center = self.center\nif type(self.scale) is str:\n scale = eval(self.scale)\nelse:\n scale = self.scale\nn = X...
<|body_start_0|> self.center = center self.scale = scale self.trimming = trimming <|end_body_0|> <|body_start_1|> X = _check_input(X) _check_trimming(self.trimming) if type(self.center) is str: center = eval(self.center) else: center = sel...
VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or callable, scale estimator `trimming`: trimming percentage to be used in location ...
VersatileScaler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersatileScaler: """VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or callable, scale estimator `trimming`: ...
stack_v2_sparse_classes_36k_train_012270
9,199
permissive
[ { "docstring": "Initialize values. Check if correct options provided.", "name": "__init__", "signature": "def __init__(self, center='mean', scale='std', trimming=0)" }, { "docstring": "Estimate location and scale, store these in the class object. Trimming fraction can be provided as keyword argu...
6
stack_v2_sparse_classes_30k_train_002671
Implement the Python class `VersatileScaler` described below. Class description: VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or...
Implement the Python class `VersatileScaler` described below. Class description: VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or...
8b11800f11b9ccd852b24a449d4a82762e7dc811
<|skeleton|> class VersatileScaler: """VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or callable, scale estimator `trimming`: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersatileScaler: """VersatileScaler Center and Scale data about classical or robust location and scale estimates Parameters ---------- `center`: str or callable, location estimator. String has to be name of the function to be used, or 'None'. `scale`: str or callable, scale estimator `trimming`: trimming perc...
the_stack_v2_python_sparse
src/direpack/preprocessing/robcent.py
SvenSerneels/direpack
train
37
5ade448680a5844bf13a1889693214afefa8fdf9
[ "self.name = name\nself.wx_name = name + '_wx'\nself.wh_name = name + '_wh'\nself.b_name = name + '_b'\nself.input_dim = input_dim\nself.h_dim = h_dim\nself.params = {}\nself.grads = {}\nself.params[self.wx_name] = init_scale * np.random.randn(input_dim, h_dim)\nself.params[self.wh_name] = init_scale * np.random.ra...
<|body_start_0|> self.name = name self.wx_name = name + '_wx' self.wh_name = name + '_wh' self.b_name = name + '_b' self.input_dim = input_dim self.h_dim = h_dim self.params = {} self.grads = {} self.params[self.wx_name] = init_scale * np.random.ra...
VanillaRNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VanillaRNN: def __init__(self, input_dim, h_dim, init_scale=0.02, name='vanilla_rnn'): """In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer input_dim: input dimens...
stack_v2_sparse_classes_36k_train_012271
28,090
permissive
[ { "docstring": "In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer input_dim: input dimension h_dim: hidden state dimension meta: variables needed for the backward pass", "name": "__in...
5
stack_v2_sparse_classes_30k_train_011758
Implement the Python class `VanillaRNN` described below. Class description: Implement the VanillaRNN class. Method signatures and docstrings: - def __init__(self, input_dim, h_dim, init_scale=0.02, name='vanilla_rnn'): In forward pass, please use self.params for the weights and biases for this layer In backward pass,...
Implement the Python class `VanillaRNN` described below. Class description: Implement the VanillaRNN class. Method signatures and docstrings: - def __init__(self, input_dim, h_dim, init_scale=0.02, name='vanilla_rnn'): In forward pass, please use self.params for the weights and biases for this layer In backward pass,...
c5cfa2410d47c7e43a476a8c8a9795182fe8f836
<|skeleton|> class VanillaRNN: def __init__(self, input_dim, h_dim, init_scale=0.02, name='vanilla_rnn'): """In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer input_dim: input dimens...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VanillaRNN: def __init__(self, input_dim, h_dim, init_scale=0.02, name='vanilla_rnn'): """In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer input_dim: input dimension h_dim: hid...
the_stack_v2_python_sparse
2017_Fall/CSCI-599/Assignment02/lib/layer_utils.py
saketkc/hatex
train
21
61e05ddce9bc09f0f81f3442a1ca80b544608ad8
[ "self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]]\nself.weights = [2.5, 3.0, 3.5]\nfor i in range(0, 3):\n self.assertEqual(self.nuts[i].weight, self.weights[i], 'The weight is wrong')", "varieties = [variety() for variety in [Middle_Eastern, South_Asian, South_Asian, American, Am...
<|body_start_0|> self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqual(self.nuts[i].weight, self.weights[i], 'The weight is wrong') <|end_body_0|> <|body_start_1|> varieties = [var...
TestCoconuts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_36k_train_012272
2,195
no_license
[ { "docstring": "Tests that different coconut types each have a different weight", "name": "test_weight", "signature": "def test_weight(self)" }, { "docstring": "Tests that the sum of a specified number of coconuts of each type returned matches the expected total", "name": "test_total_weight"...
3
stack_v2_sparse_classes_30k_train_007441
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
4ca74dd054be17e7a57da891c5d239e3f915d3f1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqual(self.nuts[...
the_stack_v2_python_sparse
Lesson 2 - Converting Data Into Structured Objects/project/attempt_2/test_coconuts.py
jmwoloso/Python_3
train
0
c7482a4492bc592cc99600fee56a50122fb06b53
[ "self.kw = kwargs\nStep.__init__(self, *args, routine=routine, **kwargs)\nt1_settings = self.parse_settings(self.get_requested_settings())\nqbcal.T1.__init__(self, dev=self.dev, **t1_settings)", "kwargs = {}\ntask_list = []\nfor qb in self.qubits:\n task = {}\n task_list_fields = requested_kwargs['task_list...
<|body_start_0|> self.kw = kwargs Step.__init__(self, *args, routine=routine, **kwargs) t1_settings = self.parse_settings(self.get_requested_settings()) qbcal.T1.__init__(self, dev=self.dev, **t1_settings) <|end_body_0|> <|body_start_1|> kwargs = {} task_list = [] ...
A wrapper class for the T1 experiment.
T1Step
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class T1Step: """A wrapper class for the T1 experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits to b...
stack_v2_sparse_classes_36k_train_012273
48,290
permissive
[ { "docstring": "Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits to be used in the routine. Configuration parameters (coming from the configuration parameter dictionary): transition_n...
4
stack_v2_sparse_classes_30k_train_013726
Implement the Python class `T1Step` described below. Class description: A wrapper class for the T1 experiment. Method signatures and docstrings: - def __init__(self, routine, *args, **kwargs): Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent ...
Implement the Python class `T1Step` described below. Class description: A wrapper class for the T1 experiment. Method signatures and docstrings: - def __init__(self, routine, *args, **kwargs): Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent ...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class T1Step: """A wrapper class for the T1 experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits to b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class T1Step: """A wrapper class for the T1 experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the T1Step class, which also includes initialization of the T1 experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits to be used in the...
the_stack_v2_python_sparse
pycqed/measurement/calibration/automatic_calibration_routines/single_qubit_routines.py
QudevETH/PycQED_py3
train
8
738dd6d9f81a2e9cfcf1a517e923618fa3ba4a2a
[ "command = 'create'\nif mac is not None:\n args = 'tapname {} mac {}'.format(tap_name, mac)\nelse:\n args = 'tapname {}'.format(tap_name)\nwith VatTerminal(node) as vat:\n resp = vat.vat_terminal_exec_cmd_from_template('tap.vat', tap_command=command, tap_arguments=args)\nsw_if_idx = resp[0]['sw_if_index']\...
<|body_start_0|> command = 'create' if mac is not None: args = 'tapname {} mac {}'.format(tap_name, mac) else: args = 'tapname {}'.format(tap_name) with VatTerminal(node) as vat: resp = vat.vat_terminal_exec_cmd_from_template('tap.vat', tap_command=com...
Tap utilities.
Tap
[ "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tap: """Tap utilities.""" def add_tap_interface(node, tap_name, mac=None): """Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: Optional MAC address for VPP tap. :type node: dict :type ...
stack_v2_sparse_classes_36k_train_012274
6,728
permissive
[ { "docstring": "Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: Optional MAC address for VPP tap. :type node: dict :type tap_name: str :type mac: str :returns: Returns a interface index. :rtype: int", "name"...
6
null
Implement the Python class `Tap` described below. Class description: Tap utilities. Method signatures and docstrings: - def add_tap_interface(node, tap_name, mac=None): Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: ...
Implement the Python class `Tap` described below. Class description: Tap utilities. Method signatures and docstrings: - def add_tap_interface(node, tap_name, mac=None): Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: ...
3151c98618c78e3782e48bbe4d9c8f906c126f69
<|skeleton|> class Tap: """Tap utilities.""" def add_tap_interface(node, tap_name, mac=None): """Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: Optional MAC address for VPP tap. :type node: dict :type ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tap: """Tap utilities.""" def add_tap_interface(node, tap_name, mac=None): """Add tap interface with name and optionally with MAC. :param node: Node to add tap on. :param tap_name: Tap interface name for linux tap. :param mac: Optional MAC address for VPP tap. :type node: dict :type tap_name: str...
the_stack_v2_python_sparse
resources/libraries/python/Tap.py
preym17/csit
train
0
55985167491ac63bb4049ec33e7dbf677eb205fb
[ "if not isinstance(value, list):\n raise XRPLBinaryCodecException(f'Invalid type to construct a PathSet: expected list, received {value.__class__.__name__}.')\nif _is_path_set(value):\n buffer: List[bytes] = []\n for path_dict in value:\n path = Path.from_value(path_dict)\n buffer.append(byte...
<|body_start_0|> if not isinstance(value, list): raise XRPLBinaryCodecException(f'Invalid type to construct a PathSet: expected list, received {value.__class__.__name__}.') if _is_path_set(value): buffer: List[bytes] = [] for path_dict in value: path =...
Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_
PathSet
[ "ISC", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PathSet: """Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_""" def from_value(cls: Type[PathSet], value: List[List[Dict[str, str]]]) -> PathSet: """Construct a PathSet from a List of Lists representing...
stack_v2_sparse_classes_36k_train_012275
9,067
permissive
[ { "docstring": "Construct a PathSet from a List of Lists representing paths. Args: value: The List to construct a PathSet object from. Returns: The PathSet constructed from value. Raises: XRPLBinaryCodecException: If the PathSet representation is invalid.", "name": "from_value", "signature": "def from_v...
3
null
Implement the Python class `PathSet` described below. Class description: Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_ Method signatures and docstrings: - def from_value(cls: Type[PathSet], value: List[List[Dict[str, str]]]) -> PathS...
Implement the Python class `PathSet` described below. Class description: Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_ Method signatures and docstrings: - def from_value(cls: Type[PathSet], value: List[List[Dict[str, str]]]) -> PathS...
e5bbdf458ad83e6670a4ebf3df63e17fed8b099f
<|skeleton|> class PathSet: """Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_""" def from_value(cls: Type[PathSet], value: List[List[Dict[str, str]]]) -> PathSet: """Construct a PathSet from a List of Lists representing...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PathSet: """Codec for serializing and deserializing PathSet fields. See `PathSet Fields <https://xrpl.org/serialization.html#pathset-fields>`_""" def from_value(cls: Type[PathSet], value: List[List[Dict[str, str]]]) -> PathSet: """Construct a PathSet from a List of Lists representing paths. Args:...
the_stack_v2_python_sparse
xrpl/core/binarycodec/types/path_set.py
yyolk/xrpl-py
train
1
ad73eac64076004763219edc238d4f2ddc727d01
[ "def is_matched(left, right):\n if not left and (not right):\n return True\n if not left or not right:\n return False\n if left.val != right.val:\n return False\n return is_matched(left.left, right.right) and is_matched(left.right, right.left)\nif not root:\n return True\nreturn ...
<|body_start_0|> def is_matched(left, right): if not left and (not right): return True if not left or not right: return False if left.val != right.val: return False return is_matched(left.left, right.right) and is_ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSymmetric_iterative(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> def is_matched(left, right): ...
stack_v2_sparse_classes_36k_train_012276
2,214
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isSymmetric_iterative", "signature": "def isSymmetric_iterative(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_009527
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSymmetric_iterative(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSymmetric_iterative(self, root): :type root: TreeNode :rtype: bool <|skeleton|> class Solution: def i...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSymmetric_iterative(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" def is_matched(left, right): if not left and (not right): return True if not left or not right: return False if left.val != right.val: ...
the_stack_v2_python_sparse
src/lt_101.py
oxhead/CodingYourWay
train
0
9e2d322cb9719fde8286510f62034d0149e75876
[ "ret = []\nstk = collections.deque()\nwhile root is not None or len(stk) > 0:\n if root is not None:\n ret.append(str(root.val))\n stk.append(root)\n root = root.left\n else:\n root = stk.pop()\n root = root.right\nreturn ' '.join(ret)", "def insert(root, val):\n pre = ...
<|body_start_0|> ret = [] stk = collections.deque() while root is not None or len(stk) > 0: if root is not None: ret.append(str(root.val)) stk.append(root) root = root.left else: root = stk.pop() ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_012277
2,336
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ret = [] stk = collections.deque() while root is not None or len(stk) > 0: if root is not None: ret.append(str(root.val)) stk....
the_stack_v2_python_sparse
SerializeAndDeserializeBST.py
ellinx/LC-python
train
1
1053ed374a79e18aa796f9961319a43862d6949f
[ "super(CompetitiveDenseBlock, self).__init__()\npadding_h = int((params['kernel_h'] - 1) / 2)\npadding_w = int((params['kernel_w'] - 1) / 2)\nconv0_in_size = int(params['num_filters'])\nconv1_in_size = int(params['num_filters'])\nconv2_in_size = int(params['num_filters'])\nself.conv0 = nn.Conv2d(in_channels=conv0_i...
<|body_start_0|> super(CompetitiveDenseBlock, self).__init__() padding_h = int((params['kernel_h'] - 1) / 2) padding_w = int((params['kernel_w'] - 1) / 2) conv0_in_size = int(params['num_filters']) conv1_in_size = int(params['num_filters']) conv2_in_size = int(params['num...
Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1 'input':True }
CompetitiveDenseBlock
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompetitiveDenseBlock: """Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1 '...
stack_v2_sparse_classes_36k_train_012278
12,544
permissive
[ { "docstring": "Constructor to initialize the Competitive Dense Block :param dict params: dictionary with parameters specifiying block architecture :param bool outblock: Flag indicating if last block (before classifier block) is set up. Default: False :return None:", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_020046
Implement the Python class `CompetitiveDenseBlock` described below. Class description: Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_poo...
Implement the Python class `CompetitiveDenseBlock` described below. Class description: Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_poo...
1f20d60d4e81332715f7e50d82ad6779963fe30a
<|skeleton|> class CompetitiveDenseBlock: """Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1 '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompetitiveDenseBlock: """Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1 'input':True }...
the_stack_v2_python_sparse
FastSurferCNN/models/sub_module.py
abdullahbas/FastSurfer
train
0
909421d6d4e5e31627cf7b83c1f263ad0516f704
[ "envelopes.sort(key=lambda x: (x[0], -x[1]))\n\ndef LIS(nums):\n dp = []\n for i in range(len(nums)):\n idx = bisect_left(dp, nums[i])\n if idx == len(dp):\n dp.append(nums[i])\n else:\n dp[idx] = nums[i]\n return len(dp)\nreturn LIS([i[1] for i in envelopes])", ...
<|body_start_0|> envelopes.sort(key=lambda x: (x[0], -x[1])) def LIS(nums): dp = [] for i in range(len(nums)): idx = bisect_left(dp, nums[i]) if idx == len(dp): dp.append(nums[i]) else: dp[id...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> envelopes.s...
stack_v2_sparse_classes_36k_train_012279
1,388
no_license
[ { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" }, { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" } ]
2
stack_v2_sparse_classes_30k_test_000986
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int <|skeleton|> cl...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" envelopes.sort(key=lambda x: (x[0], -x[1])) def LIS(nums): dp = [] for i in range(len(nums)): idx = bisect_left(dp, nums[i]) if idx =...
the_stack_v2_python_sparse
0354_Russian_Doll_Envelopes.py
bingli8802/leetcode
train
0
7a908dbb6ede1d104a249485a63f73b3eed68c52
[ "try:\n username = request.data.get('username', '')\n User.reset_password(username=username)\n return Response({}, status=status.HTTP_201_CREATED)\nexcept User.DoesNotExist:\n raise Http404", "if not request.user.is_authenticated:\n raise PermissionDenied()\ndata = request.data\npassword, new_passw...
<|body_start_0|> try: username = request.data.get('username', '') User.reset_password(username=username) return Response({}, status=status.HTTP_201_CREATED) except User.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> if not request.use...
UserPassword
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPassword: def post(self, request, *args, **kwargs): """Reset a user's password and email it to them.""" <|body_0|> def put(self, request, *args, **kwargs): """Change the authenticated user's password.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012280
4,355
permissive
[ { "docstring": "Reset a user's password and email it to them.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Change the authenticated user's password.", "name": "put", "signature": "def put(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_014108
Implement the Python class `UserPassword` described below. Class description: Implement the UserPassword class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Reset a user's password and email it to them. - def put(self, request, *args, **kwargs): Change the authenticated user's passwor...
Implement the Python class `UserPassword` described below. Class description: Implement the UserPassword class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Reset a user's password and email it to them. - def put(self, request, *args, **kwargs): Change the authenticated user's passwor...
0f737e92d7946a83150b402784d911ab7438547b
<|skeleton|> class UserPassword: def post(self, request, *args, **kwargs): """Reset a user's password and email it to them.""" <|body_0|> def put(self, request, *args, **kwargs): """Change the authenticated user's password.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserPassword: def post(self, request, *args, **kwargs): """Reset a user's password and email it to them.""" try: username = request.data.get('username', '') User.reset_password(username=username) return Response({}, status=status.HTTP_201_CREATED) ex...
the_stack_v2_python_sparse
huxley/api/views/user.py
bmun/huxley
train
23
007e8bd5206148faec3cad23ce5fd4464904b92a
[ "k %= len(nums)\nself.reverse(nums, 0, len(nums) - 1)\nself.reverse(nums, 0, k - 1)\nself.reverse(nums, k, len(nums) - 1)", "while start < end:\n temp = nums[start]\n nums[start] = nums[end]\n nums[end] = temp\n start += 1\n end -= 1" ]
<|body_start_0|> k %= len(nums) self.reverse(nums, 0, len(nums) - 1) self.reverse(nums, 0, k - 1) self.reverse(nums, k, len(nums) - 1) <|end_body_0|> <|body_start_1|> while start < end: temp = nums[start] nums[start] = nums[end] nums[end] = te...
Solution4
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution4: def rotate(self, nums, k) -> None: """这个方法基于这个事实:当我们旋转数组 k 次, k\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始数组 : 1 2 3 4 5 6 7 反转所有数字后 : 7 6 5 4 3 2 1 反转前 k 个数字后 : 5 6 7 4 3 2 1 反转后 n-k 个数字后 : 5 6 7 1 2 3 4...
stack_v2_sparse_classes_36k_train_012281
3,149
no_license
[ { "docstring": "这个方法基于这个事实:当我们旋转数组 k 次, k\\\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始数组 : 1 2 3 4 5 6 7 反转所有数字后 : 7 6 5 4 3 2 1 反转前 k 个数字后 : 5 6 7 4 3 2 1 反转后 n-k 个数字后 : 5 6 7 1 2 3 4 --> 结果", "name": "rotate", "signature": "def r...
2
null
Implement the Python class `Solution4` described below. Class description: Implement the Solution4 class. Method signatures and docstrings: - def rotate(self, nums, k) -> None: 这个方法基于这个事实:当我们旋转数组 k 次, k\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始...
Implement the Python class `Solution4` described below. Class description: Implement the Solution4 class. Method signatures and docstrings: - def rotate(self, nums, k) -> None: 这个方法基于这个事实:当我们旋转数组 k 次, k\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始...
08c958e7ba28e92c3115b88f3f94a350fc2ba276
<|skeleton|> class Solution4: def rotate(self, nums, k) -> None: """这个方法基于这个事实:当我们旋转数组 k 次, k\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始数组 : 1 2 3 4 5 6 7 反转所有数字后 : 7 6 5 4 3 2 1 反转前 k 个数字后 : 5 6 7 4 3 2 1 反转后 n-k 个数字后 : 5 6 7 1 2 3 4...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution4: def rotate(self, nums, k) -> None: """这个方法基于这个事实:当我们旋转数组 k 次, k\\%nk%n 个尾部元素会被移动到头部,剩下的元素会被向后移动。 在这个方法中,我们首先将所有元素反转。然后反转前 k 个元素,再反转后面 n-kn−k 个元素,就能得到想要的结果。 假设 n=7n=7 且 k=3k=3 。 原始数组 : 1 2 3 4 5 6 7 反转所有数字后 : 7 6 5 4 3 2 1 反转前 k 个数字后 : 5 6 7 4 3 2 1 反转后 n-k 个数字后 : 5 6 7 1 2 3 4 --> 结果""" ...
the_stack_v2_python_sparse
数组/189. 旋转数组.py
1530426574/practices-of-Data-Structures-and-Algorithms
train
2
5e8a2e6bd65e8d78ae00f475c693e4d22231964c
[ "super().__init__(order=CallbackOrder.external)\nif mode not in ['best', 'last']:\n raise ValueError(f\"Unknown `mode` '{mode}'. Must be 'best' or 'last'\")\nself.metric = metric\nself.mode = mode\nself.do_once = do_once\nself.best_score = None\nself.is_better = None\nself.first_time = True\nif minimize:\n se...
<|body_start_0|> super().__init__(order=CallbackOrder.external) if mode not in ['best', 'last']: raise ValueError(f"Unknown `mode` '{mode}'. Must be 'best' or 'last'") self.metric = metric self.mode = mode self.do_once = do_once self.best_score = None ...
Dynamic Quantization Callback This callback applying dynamic quantization to the model.
DynamicQuantizationCallback
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicQuantizationCallback: """Dynamic Quantization Callback This callback applying dynamic quantization to the model.""" def __init__(self, metric: str='loss', minimize: bool=True, min_delta: float=1e-06, mode: str='best', do_once: bool=True, qconfig_spec: Optional[Union[Set, Dict]]=None, ...
stack_v2_sparse_classes_36k_train_012282
5,000
permissive
[ { "docstring": "Init method for callback Args: metric: Metric key we should trace model based on minimize: Whether do we minimize metric or not min_delta: Minimum value of change for metric to be considered as improved mode: One of `best` or `last` do_once: Whether do we trace once per stage or every epoch qcon...
3
stack_v2_sparse_classes_30k_train_015001
Implement the Python class `DynamicQuantizationCallback` described below. Class description: Dynamic Quantization Callback This callback applying dynamic quantization to the model. Method signatures and docstrings: - def __init__(self, metric: str='loss', minimize: bool=True, min_delta: float=1e-06, mode: str='best',...
Implement the Python class `DynamicQuantizationCallback` described below. Class description: Dynamic Quantization Callback This callback applying dynamic quantization to the model. Method signatures and docstrings: - def __init__(self, metric: str='loss', minimize: bool=True, min_delta: float=1e-06, mode: str='best',...
8ce39fc31635eabc348b055a2df8ec8bc5700dce
<|skeleton|> class DynamicQuantizationCallback: """Dynamic Quantization Callback This callback applying dynamic quantization to the model.""" def __init__(self, metric: str='loss', minimize: bool=True, min_delta: float=1e-06, mode: str='best', do_once: bool=True, qconfig_spec: Optional[Union[Set, Dict]]=None, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicQuantizationCallback: """Dynamic Quantization Callback This callback applying dynamic quantization to the model.""" def __init__(self, metric: str='loss', minimize: bool=True, min_delta: float=1e-06, mode: str='best', do_once: bool=True, qconfig_spec: Optional[Union[Set, Dict]]=None, dtype: Option...
the_stack_v2_python_sparse
catalyst/callbacks/quantization.py
418sec/catalyst
train
0
27de8bfe64a91ccf13abf24aa4004908ae3be567
[ "self.matrix = matrix\nif not matrix:\n return\nm = len(matrix)\nn = len(matrix[0])\nself.dp = [[0] * (n + 1) for _ in range(m)]\nfor i in range(m):\n for j in range(1, n + 1):\n self.dp[i][j] = self.dp[i][j - 1] + matrix[i][j - 1]", "res = 0\nfor k in range(row1, row2 + 1):\n res += self.dp[k][co...
<|body_start_0|> self.matrix = matrix if not matrix: return m = len(matrix) n = len(matrix[0]) self.dp = [[0] * (n + 1) for _ in range(m)] for i in range(m): for j in range(1, n + 1): self.dp[i][j] = self.dp[i][j - 1] + matrix[i][j ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_012283
1,170
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_train_002159
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.matrix = matrix if not matrix: return m = len(matrix) n = len(matrix[0]) self.dp = [[0] * (n + 1) for _ in range(m)] for i in range(m): for j in range...
the_stack_v2_python_sparse
0304_Range_Sum_Query_2D-Immutable.py
bingli8802/leetcode
train
0
95ec0c5f71a39b0a01f3e920960d02e1543c0812
[ "self.fl_model = fl_model\nself.data_handler = data_handler\nself.hyperparams = hyperparams", "try:\n if model_update is not None:\n self.fl_model.update_model(model_update)\n logger.info('Local model updated.')\n else:\n logger.info('No model update was provided.')\nexcept Exception as...
<|body_start_0|> self.fl_model = fl_model self.data_handler = data_handler self.hyperparams = hyperparams <|end_body_0|> <|body_start_1|> try: if model_update is not None: self.fl_model.update_model(model_update) logger.info('Local model updat...
LocalTrainingHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalTrainingHandler: def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain ...
stack_v2_sparse_classes_36k_train_012284
4,704
no_license
[ { "docstring": "Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain data :type data_handler: `DataHandler` :param hyperparams: Hyperparameters used for training. :type hyper...
6
stack_v2_sparse_classes_30k_train_021445
Implement the Python class `LocalTrainingHandler` described below. Class description: Implement the LocalTrainingHandler class. Method signatures and docstrings: - def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model...
Implement the Python class `LocalTrainingHandler` described below. Class description: Implement the LocalTrainingHandler class. Method signatures and docstrings: - def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model...
a4cd429484e857b849df08d93688d35e632b3e29
<|skeleton|> class LocalTrainingHandler: def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocalTrainingHandler: def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain data :type dat...
the_stack_v2_python_sparse
venv/Lib/site-packages/ibmfl/party/training/local_training_handler.py
yusufcet/healty-hearts
train
0
162f5ee60161cd0028357fbb3134a4243be62758
[ "game_loop = True\nstore = Store.get_instance()\nwhile game_loop:\n state = store.get_state()\n if state.reboot or state.next_state:\n if state.reboot:\n store.set_initial()\n elif state.next_state:\n store.set_next_state()\n elif state.quit:\n game_loop = False\n...
<|body_start_0|> game_loop = True store = Store.get_instance() while game_loop: state = store.get_state() if state.reboot or state.next_state: if state.reboot: store.set_initial() elif state.next_state: ...
this class deals with the smooth running of the states
GameManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameManager: """this class deals with the smooth running of the states""" def start(): """this method start the game with the main loop""" <|body_0|> def collect_item(object_name): """recover the item that the character wants to pick up""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_012285
5,555
no_license
[ { "docstring": "this method start the game with the main loop", "name": "start", "signature": "def start()" }, { "docstring": "recover the item that the character wants to pick up", "name": "collect_item", "signature": "def collect_item(object_name)" }, { "docstring": "determines...
3
stack_v2_sparse_classes_30k_train_013302
Implement the Python class `GameManager` described below. Class description: this class deals with the smooth running of the states Method signatures and docstrings: - def start(): this method start the game with the main loop - def collect_item(object_name): recover the item that the character wants to pick up - def...
Implement the Python class `GameManager` described below. Class description: this class deals with the smooth running of the states Method signatures and docstrings: - def start(): this method start the game with the main loop - def collect_item(object_name): recover the item that the character wants to pick up - def...
475ed7dd9ecf972909c84b58d926745bc8687ba1
<|skeleton|> class GameManager: """this class deals with the smooth running of the states""" def start(): """this method start the game with the main loop""" <|body_0|> def collect_item(object_name): """recover the item that the character wants to pick up""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameManager: """this class deals with the smooth running of the states""" def start(): """this method start the game with the main loop""" game_loop = True store = Store.get_instance() while game_loop: state = store.get_state() if state.reboot or st...
the_stack_v2_python_sparse
managers.py
ivan-fr/oc_projet_3
train
0
e08e6e0472bdeb7defc458524d39b8b991af7e50
[ "target = self.named.data.site_xpos['target', ['x', 'z']]\nball = self.named.data.xpos['ball', ['x', 'z']]\nreturn target - ball", "ball_to_target = abs(self.ball_to_target())\ntarget_size = self.named.model.site_size['target', [0, 2]]\nball_size = self.named.model.geom_size['ball', 0]\nreturn float(all(ball_to_t...
<|body_start_0|> target = self.named.data.site_xpos['target', ['x', 'z']] ball = self.named.data.xpos['ball', ['x', 'z']] return target - ball <|end_body_0|> <|body_start_1|> ball_to_target = abs(self.ball_to_target()) target_size = self.named.model.site_size['target', [0, 2]] ...
Physics with additional features for the Ball-in-Cup domain.
Physics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Physics: """Physics with additional features for the Ball-in-Cup domain.""" def ball_to_target(self): """Returns the vector from the ball to the target.""" <|body_0|> def in_target(self): """Returns 1 if the ball is in the target, 0 otherwise.""" <|body_1...
stack_v2_sparse_classes_36k_train_012286
3,510
permissive
[ { "docstring": "Returns the vector from the ball to the target.", "name": "ball_to_target", "signature": "def ball_to_target(self)" }, { "docstring": "Returns 1 if the ball is in the target, 0 otherwise.", "name": "in_target", "signature": "def in_target(self)" } ]
2
stack_v2_sparse_classes_30k_train_003551
Implement the Python class `Physics` described below. Class description: Physics with additional features for the Ball-in-Cup domain. Method signatures and docstrings: - def ball_to_target(self): Returns the vector from the ball to the target. - def in_target(self): Returns 1 if the ball is in the target, 0 otherwise...
Implement the Python class `Physics` described below. Class description: Physics with additional features for the Ball-in-Cup domain. Method signatures and docstrings: - def ball_to_target(self): Returns the vector from the ball to the target. - def in_target(self): Returns 1 if the ball is in the target, 0 otherwise...
cec06842df66f1eef11eb40e97e02fd428795df7
<|skeleton|> class Physics: """Physics with additional features for the Ball-in-Cup domain.""" def ball_to_target(self): """Returns the vector from the ball to the target.""" <|body_0|> def in_target(self): """Returns 1 if the ball is in the target, 0 otherwise.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Physics: """Physics with additional features for the Ball-in-Cup domain.""" def ball_to_target(self): """Returns the vector from the ball to the target.""" target = self.named.data.site_xpos['target', ['x', 'z']] ball = self.named.data.xpos['ball', ['x', 'z']] return targe...
the_stack_v2_python_sparse
dmc_remastered/ball_in_cup.py
QData/dmc_remastered
train
11
3d60b1e2bb7a94bdc268eb7268657a3716a05f9f
[ "Parametre.__init__(self, 'supprimer', 'del')\nself.schema = '<texte_libre>'\nself.aide_courte = 'supprime une ou plusieurs routes'\nself.aide_longue = \"Cette commande permet de supprimer une ou plusieurs routes. La syntaxe pour supprimer une route est de préciser sa salle d'origine et de destination, comme %route...
<|body_start_0|> Parametre.__init__(self, 'supprimer', 'del') self.schema = '<texte_libre>' self.aide_courte = 'supprime une ou plusieurs routes' self.aide_longue = "Cette commande permet de supprimer une ou plusieurs routes. La syntaxe pour supprimer une route est de préciser sa salle d...
Commande 'route supprimer'
PrmSupprimer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmSupprimer: """Commande 'route supprimer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012287
3,607
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmSupprimer` described below. Class description: Commande 'route supprimer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmSupprimer` described below. Class description: Commande 'route supprimer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmSupprimer: """Co...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmSupprimer: """Commande 'route supprimer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmSupprimer: """Commande 'route supprimer'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'supprimer', 'del') self.schema = '<texte_libre>' self.aide_courte = 'supprime une ou plusieurs routes' self.aide_longue = "Cette commande p...
the_stack_v2_python_sparse
src/secondaires/route/commandes/route/supprimer.py
vincent-lg/tsunami
train
5
b71fe722d7c66fb18faf18f86b97d049d02c3be1
[ "if pid == 0:\n logger.warning(\"PID 0 refers to 'every process in calling processes', and should be untouched\")\n return True\ntry:\n os.kill(pid, 0)\nexcept OSError as pid_checkout_error:\n if pid_checkout_error.errno == errno.ESRCH:\n return False\n if pid_checkout_error.errno == errno.EPE...
<|body_start_0|> if pid == 0: logger.warning("PID 0 refers to 'every process in calling processes', and should be untouched") return True try: os.kill(pid, 0) except OSError as pid_checkout_error: if pid_checkout_error.errno == errno.ESRCH: ...
.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.
CommandLine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (i...
stack_v2_sparse_classes_36k_train_012288
5,903
permissive
[ { "docstring": ".. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (int): the Process ID you want to check. Returns: A boolean stating the result. Example: .. code-block:: python CommandLine.check_pid_exists(os.getpid()) True", "name": "check_pid_exists", ...
3
null
Implement the Python class `CommandLine` described below. Class description: .. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline. Method signatures and docstrings: - def check_pid_exists(pid: int) -> bool: .. versionadded:: 0.2.0 Check whether the give...
Implement the Python class `CommandLine` described below. Class description: .. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline. Method signatures and docstrings: - def check_pid_exists(pid: int) -> bool: .. versionadded:: 0.2.0 Check whether the give...
5e63e4e78a9db4929a34f76b8db5099f0cc49115
<|skeleton|> class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (int): the Proc...
the_stack_v2_python_sparse
pyhdtoolkit/utils/cmdline.py
fsoubelet/PyhDToolkit
train
7
8a685681bfe46a305a053b9d858f3667a50f2d14
[ "super().__init__()\nself.fc = nn.Linear(768, num_labels)\nself.loss_fn = FocalLoss()", "x = data['x']\ny = data['y']\nlogits = self.fc(x)\nif y is not None:\n loss = self.loss_fn.forward(torch.reshape(logits, [-1, logits.shape[-1]]), y.view(-1))\nelse:\n loss = None\nreturn {'loss': loss, 'logits': logits,...
<|body_start_0|> super().__init__() self.fc = nn.Linear(768, num_labels) self.loss_fn = FocalLoss() <|end_body_0|> <|body_start_1|> x = data['x'] y = data['y'] logits = self.fc(x) if y is not None: loss = self.loss_fn.forward(torch.reshape(logits, [-1...
TaskModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskModel: def __init__(self, num_labels, dropout_prob, bret_pretrainded_path): """:param num_labels: :param dropout_prob: :param bret_pretrainded_path:""" <|body_0|> def forward(self, data): """:param data: :return:""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_012289
5,862
permissive
[ { "docstring": ":param num_labels: :param dropout_prob: :param bret_pretrainded_path:", "name": "__init__", "signature": "def __init__(self, num_labels, dropout_prob, bret_pretrainded_path)" }, { "docstring": ":param data: :return:", "name": "forward", "signature": "def forward(self, dat...
2
null
Implement the Python class `TaskModel` described below. Class description: Implement the TaskModel class. Method signatures and docstrings: - def __init__(self, num_labels, dropout_prob, bret_pretrainded_path): :param num_labels: :param dropout_prob: :param bret_pretrainded_path: - def forward(self, data): :param dat...
Implement the Python class `TaskModel` described below. Class description: Implement the TaskModel class. Method signatures and docstrings: - def __init__(self, num_labels, dropout_prob, bret_pretrainded_path): :param num_labels: :param dropout_prob: :param bret_pretrainded_path: - def forward(self, data): :param dat...
9aa9d7a50ada1deb653d295dd8a7fe46321b9094
<|skeleton|> class TaskModel: def __init__(self, num_labels, dropout_prob, bret_pretrainded_path): """:param num_labels: :param dropout_prob: :param bret_pretrainded_path:""" <|body_0|> def forward(self, data): """:param data: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskModel: def __init__(self, num_labels, dropout_prob, bret_pretrainded_path): """:param num_labels: :param dropout_prob: :param bret_pretrainded_path:""" super().__init__() self.fc = nn.Linear(768, num_labels) self.loss_fn = FocalLoss() def forward(self, data): "...
the_stack_v2_python_sparse
src/nlp/classification/tf1/traditional_cls/_run_bert.py
wu-uw/OpenCompetition
train
0
78221a7ec98e7165723377cc52039e01b80ae10e
[ "self._compute_adapter = compute_adapter\nself._resource_service = resource_service\nself._client = compute_adapter.apitools_client\nself._messages = compute_adapter.messages\nself._status_enum = self._messages.Operation.StatusValueValuesEnum\nself._target_refs = target_refs", "is_done = True\nfor operation_ref i...
<|body_start_0|> self._compute_adapter = compute_adapter self._resource_service = resource_service self._client = compute_adapter.apitools_client self._messages = compute_adapter.messages self._status_enum = self._messages.Operation.StatusValueValuesEnum self._target_refs...
Compute operations batch poller.
BatchPoller
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchPoller: """Compute operations batch poller.""" def __init__(self, compute_adapter, resource_service, target_refs=None): """Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.client_adapter .ClientAdapter. resource_service: apitools.b...
stack_v2_sparse_classes_36k_train_012290
6,267
permissive
[ { "docstring": "Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.client_adapter .ClientAdapter. resource_service: apitools.base.py.base_api.BaseApiService, service representing the target of operation. target_refs: Resources, optional references to the expected ta...
4
null
Implement the Python class `BatchPoller` described below. Class description: Compute operations batch poller. Method signatures and docstrings: - def __init__(self, compute_adapter, resource_service, target_refs=None): Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.cl...
Implement the Python class `BatchPoller` described below. Class description: Compute operations batch poller. Method signatures and docstrings: - def __init__(self, compute_adapter, resource_service, target_refs=None): Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.cl...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class BatchPoller: """Compute operations batch poller.""" def __init__(self, compute_adapter, resource_service, target_refs=None): """Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.client_adapter .ClientAdapter. resource_service: apitools.b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchPoller: """Compute operations batch poller.""" def __init__(self, compute_adapter, resource_service, target_refs=None): """Initializes poller for compute operations. Args: compute_adapter: googlecloudsdk.api_lib.compute.client_adapter .ClientAdapter. resource_service: apitools.base.py.base_a...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/compute/operations/poller.py
KaranToor/MA450
train
1
b0f4e434b66372ab9d0ecb3be7db5fcadd1240ca
[ "self._num_neg = num_neg\nself._num_dup = num_dup\nself._left = inputs.left\nself._right = inputs.right\nself._task = tasks.Ranking()\nself._relation = self.transform_relation(inputs.relation)\nnum_pairs = len(self._relation) // (self._num_neg + 1)\nsuper().__init__(batch_size, num_pairs, stage, shuffle)", "if 'l...
<|body_start_0|> self._num_neg = num_neg self._num_dup = num_dup self._left = inputs.left self._right = inputs.right self._task = tasks.Ranking() self._relation = self.transform_relation(inputs.relation) num_pairs = len(self._relation) // (self._num_neg + 1) ...
PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right = [['did0', [2, 3]], ... ['did1', [3, 4]], ... ['did2', [4, 5]], ... ] >>> relati...
PairGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairGenerator: """PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right = [['did0', [2, 3]], ... ['did1', [3, 4]...
stack_v2_sparse_classes_36k_train_012291
5,818
permissive
[ { "docstring": "Construct the pair generator. :param inputs: the output generated by :class:`DataPack`. :param num_neg: the number of negative samples associated with each positive sample. :param num_dup: the number of duplicates for each positive sample. This variable is used to balance samples since there are...
3
stack_v2_sparse_classes_30k_train_004232
Implement the Python class `PairGenerator` described below. Class description: PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right =...
Implement the Python class `PairGenerator` described below. Class description: PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right =...
e49d619a52b2e96b6f0e8e76164d76f623210198
<|skeleton|> class PairGenerator: """PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right = [['did0', [2, 3]], ... ['did1', [3, 4]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PairGenerator: """PairGenerator for Matchzoo. Pair generator can be used only for ranking. Examples: >>> np.random.seed(111) >>> relation = [['qid0', 'did0', 0], ... ['qid0', 'did1', 1], ... ['qid0', 'did2', 2] ... ] >>> left = [['qid0', [1, 2]]] >>> right = [['did0', [2, 3]], ... ['did1', [3, 4]], ... ['did2...
the_stack_v2_python_sparse
matchzoo/generators/pair_generator.py
JacobPolloreno/MatchZoo
train
0
9f114b834ef9b9bc326e68b4d85caa4296b60cdb
[ "dims = (wrapper.num_people, wrapper.num_people, wrapper.num_samples)\nsuper().__init__(wrapper, dims)\nself.embedder = embedder\nself.transformer = transformer", "style_pid, source_pid, source_sid = coords_from_index(index, self.dims)\nsource_audio = self.wrapper.mel_from_ids(source_pid, source_sid)[None, :]\nst...
<|body_start_0|> dims = (wrapper.num_people, wrapper.num_people, wrapper.num_samples) super().__init__(wrapper, dims) self.embedder = embedder self.transformer = transformer <|end_body_0|> <|body_start_1|> style_pid, source_pid, source_sid = coords_from_index(index, self.dims) ...
A class for training the isvoice discriminator with negative (generated) examples
Isvoice_Dataset_Fake
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" ...
stack_v2_sparse_classes_36k_train_012292
12,382
no_license
[ { "docstring": "There are (people * samples) original \"real\" files, and (people) possible transformations of each of files.", "name": "__init__", "signature": "def __init__(self, wrapper, embedder, transformer)" }, { "docstring": "# TODO Work on some sort of caching if there are speed/memory i...
2
stack_v2_sparse_classes_30k_test_001099
Implement the Python class `Isvoice_Dataset_Fake` described below. Class description: A class for training the isvoice discriminator with negative (generated) examples Method signatures and docstrings: - def __init__(self, wrapper, embedder, transformer): There are (people * samples) original "real" files, and (peopl...
Implement the Python class `Isvoice_Dataset_Fake` described below. Class description: A class for training the isvoice discriminator with negative (generated) examples Method signatures and docstrings: - def __init__(self, wrapper, embedder, transformer): There are (people * samples) original "real" files, and (peopl...
ceb1b9580f515df744f7c7bfb94e6a2ae6a18c87
<|skeleton|> class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Isvoice_Dataset_Fake: """A class for training the isvoice discriminator with negative (generated) examples""" def __init__(self, wrapper, embedder, transformer): """There are (people * samples) original "real" files, and (people) possible transformations of each of files.""" dims = (wrapp...
the_stack_v2_python_sparse
vocal-mimicry/dataset.py
anlsh/cs4803
train
0
48fffe56c77b5f42da862a87091034a8806fc2d9
[ "decorator_name = ''.join(('@', Constraint.__name__.lower()))\nself.decorator_name = decorator_name\nself.args = args\nself.kwargs = kwargs\nself.scope = CONTEXT.in_pycompss()\nself.core_element = None\nself.core_element_configured = False", "@wraps(user_function)\ndef constrained_f(*args: typing.Any, **kwargs: t...
<|body_start_0|> decorator_name = ''.join(('@', Constraint.__name__.lower())) self.decorator_name = decorator_name self.args = args self.kwargs = kwargs self.scope = CONTEXT.in_pycompss() self.core_element = None self.core_element_configured = False <|end_body_0|>...
Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation.
Constraint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Constraint: """Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator...
stack_v2_sparse_classes_36k_train_012293
5,411
permissive
[ { "docstring": "Store arguments passed to the decorator. self = itself. args = not used. kwargs = dictionary with the given constraints. :param args: Arguments. :param kwargs: Keyword arguments.", "name": "__init__", "signature": "def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None" },...
3
null
Implement the Python class `Constraint` described below. Class description: Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: typ...
Implement the Python class `Constraint` described below. Class description: Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: typ...
5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092
<|skeleton|> class Constraint: """Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Constraint: """Constraint decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on task constraint creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator. self = itse...
the_stack_v2_python_sparse
compss/programming_model/bindings/python/src/pycompss/api/constraint.py
bsc-wdc/compss
train
39
a96c94f516245759d9c9106bd0acd430dd4e9ab4
[ "from sunpy.coordinates.sun import _angular_radius\nif not isinstance(self.observer, HeliographicStonyhurst):\n if self.observer is None:\n raise ValueError('The observer must be defined, not `None`.')\n raise ValueError('The observer must be fully defined by specifying `obstime`.')\nreturn _angular_ra...
<|body_start_0|> from sunpy.coordinates.sun import _angular_radius if not isinstance(self.observer, HeliographicStonyhurst): if self.observer is None: raise ValueError('The observer must be defined, not `None`.') raise ValueError('The observer must be fully define...
A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive values in the direction of the Sun's west li...
Helioprojective
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive v...
stack_v2_sparse_classes_36k_train_012294
35,206
permissive
[ { "docstring": "Angular radius of the Sun as seen by the observer. The ``rsun`` frame attribute is the radius of the Sun in length units. The tangent vector from the observer to the edge of the Sun forms a right-angle triangle with the radius of the Sun as the far side and the Sun-observer distance as the hypot...
3
stack_v2_sparse_classes_30k_train_012037
Implement the Python class `Helioprojective` described below. Class description: A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and t...
Implement the Python class `Helioprojective` described below. Class description: A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and t...
edd3ea805f4540d41ce2932a0e865cab2d6a4cf5
<|skeleton|> class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive values in the ...
the_stack_v2_python_sparse
sunpy/coordinates/frames.py
sunpy/sunpy
train
792
eae5b89aaecdd3407dcb2c17608d368ed60f9c95
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('xcao19', 'xcao19')\nstations = list(repo['xcao19.policeStation'].find())\nairbnb_neighborhoods = list(repo['xcao19.neighborhoods'].find())\nprint(airbnb_neighborhoods[0])\nprint(stations[0])\njoined = []...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('xcao19', 'xcao19') stations = list(repo['xcao19.policeStation'].find()) airbnb_neighborhoods = list(repo['xcao19.neighborhoods'].find()) p...
policeStations_in_neighborhoods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class policeStations_in_neighborhoods: 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 des...
stack_v2_sparse_classes_36k_train_012295
5,725
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 `policeStations_in_neighborhoods` described below. Class description: Implement the policeStations_in_neighborhoods 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.mod...
Implement the Python class `policeStations_in_neighborhoods` described below. Class description: Implement the policeStations_in_neighborhoods 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.mod...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class policeStations_in_neighborhoods: 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 des...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class policeStations_in_neighborhoods: 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('xcao19', 'xcao19') ...
the_stack_v2_python_sparse
xcao19/policeStations_in_neighborhoods.py
maximega/course-2019-spr-proj
train
2
6a560d6619ffae2f01f3e92e7e7e3327dc98695c
[ "assert isinstance(filename, str), 'expecting file name string'\nassert filename, 'empty file name'\nwith open(filename) as config_file:\n for line in config_file:\n line_nocomments = re.sub(re.compile('#.*?$'), '', line.strip())\n if line_nocomments:\n name, var = line_nocomments.partit...
<|body_start_0|> assert isinstance(filename, str), 'expecting file name string' assert filename, 'empty file name' with open(filename) as config_file: for line in config_file: line_nocomments = re.sub(re.compile('#.*?$'), '', line.strip()) if line_noco...
Class reads, writes and keeps the application parameters.
Configuration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configuration: """Class reads, writes and keeps the application parameters.""" def __init__(self, filename): """Constructor reads and parses configuration file of application parameters.""" <|body_0|> def WriteParameterFile(self, filename) -> str: """Function wri...
stack_v2_sparse_classes_36k_train_012296
2,004
no_license
[ { "docstring": "Constructor reads and parses configuration file of application parameters.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Function writes modified configuration parameters into a new file.", "name": "WriteParameterFile", "signature": ...
3
stack_v2_sparse_classes_30k_train_002835
Implement the Python class `Configuration` described below. Class description: Class reads, writes and keeps the application parameters. Method signatures and docstrings: - def __init__(self, filename): Constructor reads and parses configuration file of application parameters. - def WriteParameterFile(self, filename)...
Implement the Python class `Configuration` described below. Class description: Class reads, writes and keeps the application parameters. Method signatures and docstrings: - def __init__(self, filename): Constructor reads and parses configuration file of application parameters. - def WriteParameterFile(self, filename)...
a080b6afc95d6f15f67a318854417fc45f187054
<|skeleton|> class Configuration: """Class reads, writes and keeps the application parameters.""" def __init__(self, filename): """Constructor reads and parses configuration file of application parameters.""" <|body_0|> def WriteParameterFile(self, filename) -> str: """Function wri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configuration: """Class reads, writes and keeps the application parameters.""" def __init__(self, filename): """Constructor reads and parses configuration file of application parameters.""" assert isinstance(filename, str), 'expecting file name string' assert filename, 'empty file...
the_stack_v2_python_sparse
python/Configuration.py
allscale/allscale_amdados
train
0
969cd429a2f1ed38233465f3efcfcd2348eb8cdb
[ "logging.debug('%s', request)\npools = bot_management.get_pools_from_dimensions_flat(request.dimensions)\nrealms.check_bots_list_acl(pools)\nnow = utils.utcnow()\nq = bot_management.BotInfo.query(default_options=ndb.QueryOptions(use_cache=False))\ntry:\n q = bot_management.filter_dimensions(q, request.dimensions...
<|body_start_0|> logging.debug('%s', request) pools = bot_management.get_pools_from_dimensions_flat(request.dimensions) realms.check_bots_list_acl(pools) now = utils.utcnow() q = bot_management.BotInfo.query(default_options=ndb.QueryOptions(use_cache=False)) try: ...
Bots-related API.
SwarmingBotsService
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwarmingBotsService: """Bots-related API.""" def list(self, request): """Provides list of known bots. Deleted bots will not be listed.""" <|body_0|> def count(self, request): """Counts number of bots with given dimensions.""" <|body_1|> def dimension...
stack_v2_sparse_classes_36k_train_012297
42,982
permissive
[ { "docstring": "Provides list of known bots. Deleted bots will not be listed.", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Counts number of bots with given dimensions.", "name": "count", "signature": "def count(self, request)" }, { "docstring": "Ret...
3
null
Implement the Python class `SwarmingBotsService` described below. Class description: Bots-related API. Method signatures and docstrings: - def list(self, request): Provides list of known bots. Deleted bots will not be listed. - def count(self, request): Counts number of bots with given dimensions. - def dimensions(se...
Implement the Python class `SwarmingBotsService` described below. Class description: Bots-related API. Method signatures and docstrings: - def list(self, request): Provides list of known bots. Deleted bots will not be listed. - def count(self, request): Counts number of bots with given dimensions. - def dimensions(se...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class SwarmingBotsService: """Bots-related API.""" def list(self, request): """Provides list of known bots. Deleted bots will not be listed.""" <|body_0|> def count(self, request): """Counts number of bots with given dimensions.""" <|body_1|> def dimension...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwarmingBotsService: """Bots-related API.""" def list(self, request): """Provides list of known bots. Deleted bots will not be listed.""" logging.debug('%s', request) pools = bot_management.get_pools_from_dimensions_flat(request.dimensions) realms.check_bots_list_acl(pools...
the_stack_v2_python_sparse
appengine/swarming/handlers_endpoints.py
luci/luci-py
train
84
b22618703aba4b31e3d62597b3628b4c49479e23
[ "pg.ModellingBase.__init__(self, verbose)\nself.f_ = fvec\nself.nf_ = len(fvec)\nself.t_ = tvec\nself.mesh = pg.createMesh1D(len(tvec))\nself.setMesh(self.mesh)", "y = np.ones(self.nf_, dtype=np.complex)\nfor tau, mk in zip(self.t_, par):\n y -= (1.0 - relaxationTerm(self.f_, tau)) * mk\nreturn -np.angle(y)" ]
<|body_start_0|> pg.ModellingBase.__init__(self, verbose) self.f_ = fvec self.nf_ = len(fvec) self.t_ = tvec self.mesh = pg.createMesh1D(len(tvec)) self.setMesh(self.mesh) <|end_body_0|> <|body_start_1|> y = np.ones(self.nf_, dtype=np.complex) for tau, mk...
Debye decomposition (smooth Debye relaxations) phase only
DebyePhi
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebyePhi: """Debye decomposition (smooth Debye relaxations) phase only""" def __init__(self, fvec, tvec, verbose=False): """constructor with frequecy and tau vector""" <|body_0|> def response(self, par): """amplitude/phase spectra as function of spectral chargeab...
stack_v2_sparse_classes_36k_train_012298
11,407
permissive
[ { "docstring": "constructor with frequecy and tau vector", "name": "__init__", "signature": "def __init__(self, fvec, tvec, verbose=False)" }, { "docstring": "amplitude/phase spectra as function of spectral chargeabilities", "name": "response", "signature": "def response(self, par)" } ...
2
stack_v2_sparse_classes_30k_train_000918
Implement the Python class `DebyePhi` described below. Class description: Debye decomposition (smooth Debye relaxations) phase only Method signatures and docstrings: - def __init__(self, fvec, tvec, verbose=False): constructor with frequecy and tau vector - def response(self, par): amplitude/phase spectra as function...
Implement the Python class `DebyePhi` described below. Class description: Debye decomposition (smooth Debye relaxations) phase only Method signatures and docstrings: - def __init__(self, fvec, tvec, verbose=False): constructor with frequecy and tau vector - def response(self, par): amplitude/phase spectra as function...
9962fe882fad284e52858ba3aa5e87b2395d791d
<|skeleton|> class DebyePhi: """Debye decomposition (smooth Debye relaxations) phase only""" def __init__(self, fvec, tvec, verbose=False): """constructor with frequecy and tau vector""" <|body_0|> def response(self, par): """amplitude/phase spectra as function of spectral chargeab...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DebyePhi: """Debye decomposition (smooth Debye relaxations) phase only""" def __init__(self, fvec, tvec, verbose=False): """constructor with frequecy and tau vector""" pg.ModellingBase.__init__(self, verbose) self.f_ = fvec self.nf_ = len(fvec) self.t_ = tvec ...
the_stack_v2_python_sparse
python/pygimli/physics/SIP/models.py
Geophysics-OpenSource/gimli
train
0
66f4852fd4f4ffadd33f36f25760bfa23338c89c
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID')\nquestion = InvestigativeQuestion.query.get(question_id)\nif not question:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No question found with this ID')\nconclusion = InvestigativeQuestio...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID') question = InvestigativeQuestion.query.get(question_id) if not question: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No question ...
Resource for investigative question conclusion.
QuestionConclusionResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" <|body_0|> def delete(s...
stack_v2_sparse_classes_36k_train_012299
15,391
permissive
[ { "docstring": "Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.", "name": "put", "signature": "def put(self, sketch_id, question_id, conclusion_id)" }, { "docstring": "Handles DELETE request to the resource. Deletes a conclusion.", "n...
2
stack_v2_sparse_classes_30k_train_016361
Implement the Python class `QuestionConclusionResource` described below. Class description: Resource for investigative question conclusion. Method signatures and docstrings: - def put(self, sketch_id, question_id, conclusion_id): Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation o...
Implement the Python class `QuestionConclusionResource` described below. Class description: Resource for investigative question conclusion. Method signatures and docstrings: - def put(self, sketch_id, question_id, conclusion_id): Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation o...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" <|body_0|> def delete(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionConclusionResource: """Resource for investigative question conclusion.""" def put(self, sketch_id, question_id, conclusion_id): """Handles PUT request to the resource. Edit a conclusion. Returns: A JSON representation of the conclusion.""" sketch = Sketch.query.get_with_acl(sketch...
the_stack_v2_python_sparse
timesketch/api/v1/resources/scenarios.py
google/timesketch
train
2,263