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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
92c6a288f68ed99948e5a12a9ce9cb5786b92d8c | [
"self.num_objects_failed = num_objects_failed\nself.num_runs_failed = num_runs_failed\nself.num_runs_failed_sla = num_runs_failed_sla\nself.num_runs_met_sla = num_runs_met_sla\nself.stats_by_env = stats_by_env",
"if dictionary is None:\n return None\nnum_objects_failed = dictionary.get('numObjectsFailed')\nnum... | <|body_start_0|>
self.num_objects_failed = num_objects_failed
self.num_runs_failed = num_runs_failed
self.num_runs_failed_sla = num_runs_failed_sla
self.num_runs_met_sla = num_runs_met_sla
self.stats_by_env = stats_by_env
<|end_body_0|>
<|body_start_1|>
if dictionary is ... | Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Jobs. num_runs_failed (long|int): Specifies the number of Protection Jobs for which specifie... | LastProtectionRunStats | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LastProtectionRunStats:
"""Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Jobs. num_runs_failed (long|int): Specifie... | stack_v2_sparse_classes_36k_train_005100 | 3,250 | permissive | [
{
"docstring": "Constructor for the LastProtectionRunStats class",
"name": "__init__",
"signature": "def __init__(self, num_objects_failed=None, num_runs_failed=None, num_runs_failed_sla=None, num_runs_met_sla=None, stats_by_env=None)"
},
{
"docstring": "Creates an instance of this model from a ... | 2 | stack_v2_sparse_classes_30k_train_006075 | Implement the Python class `LastProtectionRunStats` described below.
Class description:
Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Job... | Implement the Python class `LastProtectionRunStats` described below.
Class description:
Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Job... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class LastProtectionRunStats:
"""Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Jobs. num_runs_failed (long|int): Specifie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LastProtectionRunStats:
"""Implementation of the 'LastProtectionRunStats' model. Specifies the stats of last Protection Run. Attributes: num_objects_failed (long|int): Specifies the number of objects that were failed in the last Run across all Protection Jobs. num_runs_failed (long|int): Specifies the number ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/last_protection_run_stats.py | cohesity/management-sdk-python | train | 24 |
538c0e52ddba115234f80f951a8bc2548f169540 | [
"super(NewlineSentenceSplitter, self).__init__(**kwargs)\nif 'create_empty' in kwargs:\n self.create_empty = True\nelse:\n self.create_empty = False\nif kwargs.get('use_universal_newline', 'true').lower() == 'true':\n self.use_universal_newline = True\nelse:\n self.use_universal_newline = False",
"add... | <|body_start_0|>
super(NewlineSentenceSplitter, self).__init__(**kwargs)
if 'create_empty' in kwargs:
self.create_empty = True
else:
self.create_empty = False
if kwargs.get('use_universal_newline', 'true').lower() == 'true':
self.use_universal_newline ... | This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline | NewlineSentenceSplitter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewlineSentenceSplitter:
"""This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline"""
def __init__(self, **kwargs):
""":param kwargs: create_empty: This is very useful if you want to strictly as... | stack_v2_sparse_classes_36k_train_005101 | 2,412 | permissive | [
{
"docstring": ":param kwargs: create_empty: This is very useful if you want to strictly assume number of sentences matches with your input for alignment purpose. When specified, it will create empty sentence as place holders for empty lines. Usage: ``` SENTENCE_SPLITTING_MODEL NewlineSentenceSplitter create_em... | 2 | stack_v2_sparse_classes_30k_train_020470 | Implement the Python class `NewlineSentenceSplitter` described below.
Class description:
This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline
Method signatures and docstrings:
- def __init__(self, **kwargs): :param kwargs: cre... | Implement the Python class `NewlineSentenceSplitter` described below.
Class description:
This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline
Method signatures and docstrings:
- def __init__(self, **kwargs): :param kwargs: cre... | b486a66339a330e94d81850e6acb3a7e34df746e | <|skeleton|>
class NewlineSentenceSplitter:
"""This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline"""
def __init__(self, **kwargs):
""":param kwargs: create_empty: This is very useful if you want to strictly as... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewlineSentenceSplitter:
"""This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline"""
def __init__(self, **kwargs):
""":param kwargs: create_empty: This is very useful if you want to strictly assume number o... | the_stack_v2_python_sparse | src/python/serif/model/impl/sentence_splitter/newline_sentence_splitter.py | BBN-E/text-open | train | 2 |
bcbb47290650ff4a14e135ac96a9a27a89c3f3a4 | [
"cats = ['annuals', 'edibles', 'flower_bulbs', 'flowering_fast_growing_trees', 'perennial_plants', 'rose_plants', 'shrubs_hedges', 'vines_climbers']\nhas_cat = hasattr(self, 'category')\nif has_cat and self.category not in cats:\n raise ValueError('Invalid category')\nto_fetch = cats if not has_cat else [self.ca... | <|body_start_0|>
cats = ['annuals', 'edibles', 'flower_bulbs', 'flowering_fast_growing_trees', 'perennial_plants', 'rose_plants', 'shrubs_hedges', 'vines_climbers']
has_cat = hasattr(self, 'category')
if has_cat and self.category not in cats:
raise ValueError('Invalid category')
... | SpringHillNursery | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpringHillNursery:
def start_requests(self):
"""Determine which category starting url to run."""
<|body_0|>
def parse_plant_details(self, response):
"""Parse plant details."""
<|body_1|>
def parse(self, response):
"""Parse the response."""
... | stack_v2_sparse_classes_36k_train_005102 | 2,159 | permissive | [
{
"docstring": "Determine which category starting url to run.",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "Parse plant details.",
"name": "parse_plant_details",
"signature": "def parse_plant_details(self, response)"
},
{
"docstring": "Par... | 3 | stack_v2_sparse_classes_30k_test_000102 | Implement the Python class `SpringHillNursery` described below.
Class description:
Implement the SpringHillNursery class.
Method signatures and docstrings:
- def start_requests(self): Determine which category starting url to run.
- def parse_plant_details(self, response): Parse plant details.
- def parse(self, respon... | Implement the Python class `SpringHillNursery` described below.
Class description:
Implement the SpringHillNursery class.
Method signatures and docstrings:
- def start_requests(self): Determine which category starting url to run.
- def parse_plant_details(self, response): Parse plant details.
- def parse(self, respon... | 8515fcc4c86ef0a96f34278d90419e5fad2b48d3 | <|skeleton|>
class SpringHillNursery:
def start_requests(self):
"""Determine which category starting url to run."""
<|body_0|>
def parse_plant_details(self, response):
"""Parse plant details."""
<|body_1|>
def parse(self, response):
"""Parse the response."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpringHillNursery:
def start_requests(self):
"""Determine which category starting url to run."""
cats = ['annuals', 'edibles', 'flower_bulbs', 'flowering_fast_growing_trees', 'perennial_plants', 'rose_plants', 'shrubs_hedges', 'vines_climbers']
has_cat = hasattr(self, 'category')
... | the_stack_v2_python_sparse | plantstuff/scraping/scrapers/spiders/springhill.py | christabor/plantstuff | train | 8 | |
271f1b18ec797c25f684df51ed466dbfd051ab2e | [
"self.connector_group_id = connector_group_id\nself.entity_id = entity_id\nself.network_realm_id = network_realm_id",
"if dictionary is None:\n return None\nconnector_group_id = dictionary.get('connectorGroupId')\nentity_id = dictionary.get('entityId')\nnetwork_realm_id = dictionary.get('networkRealmId')\nretu... | <|body_start_0|>
self.connector_group_id = connector_group_id
self.entity_id = entity_id
self.network_realm_id = network_realm_id
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
connector_group_id = dictionary.get('connectorGroupId')
entity... | Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_group_id (long|int): 'network_realm_id' main... | NetworkRealmInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworkRealmInfo:
"""Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_... | stack_v2_sparse_classes_36k_train_005103 | 2,452 | permissive | [
{
"docstring": "Constructor for the NetworkRealmInfo class",
"name": "__init__",
"signature": "def __init__(self, connector_group_id=None, entity_id=None, network_realm_id=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary re... | 2 | stack_v2_sparse_classes_30k_train_019549 | Implement the Python class `NetworkRealmInfo` described below.
Class description:
Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding e... | Implement the Python class `NetworkRealmInfo` described below.
Class description:
Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding e... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NetworkRealmInfo:
"""Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetworkRealmInfo:
"""Implementation of the 'NetworkRealmInfo' model. Contains mapping of network realms with adapter specific entities. This will be populated by IRIS for create/update source requests so that we can persist the mapping in the corresponding entity hierarchy. Attributes: connector_group_id (lon... | the_stack_v2_python_sparse | cohesity_management_sdk/models/network_realm_info.py | cohesity/management-sdk-python | train | 24 |
21d1e5a6c4c7bacbf2cf4bbc825f01b7ae49149a | [
"if 'params' not in self.context['request'].keys():\n self.fail('invalid_data')\nparams = self.context['request']['params']\nif obj['method'] in ['gaussian', 'sp'] and 'intensity' not in params:\n self.fail('invalid_data')\nif obj['method'] == 'rain' and any((param not in params for param in ['intensity', 'ke... | <|body_start_0|>
if 'params' not in self.context['request'].keys():
self.fail('invalid_data')
params = self.context['request']['params']
if obj['method'] in ['gaussian', 'sp'] and 'intensity' not in params:
self.fail('invalid_data')
if obj['method'] == 'rain' and ... | Serializer validates image processing method and required parameters | ImageProcessingSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageProcessingSerializer:
"""Serializer validates image processing method and required parameters"""
def get_params(self, obj):
"""validation of method parameters"""
<|body_0|>
def validate_method(self, value):
"""validation of image processing method"""
... | stack_v2_sparse_classes_36k_train_005104 | 3,334 | no_license | [
{
"docstring": "validation of method parameters",
"name": "get_params",
"signature": "def get_params(self, obj)"
},
{
"docstring": "validation of image processing method",
"name": "validate_method",
"signature": "def validate_method(self, value)"
},
{
"docstring": "changes image ... | 3 | stack_v2_sparse_classes_30k_train_012774 | Implement the Python class `ImageProcessingSerializer` described below.
Class description:
Serializer validates image processing method and required parameters
Method signatures and docstrings:
- def get_params(self, obj): validation of method parameters
- def validate_method(self, value): validation of image process... | Implement the Python class `ImageProcessingSerializer` described below.
Class description:
Serializer validates image processing method and required parameters
Method signatures and docstrings:
- def get_params(self, obj): validation of method parameters
- def validate_method(self, value): validation of image process... | 525f4ced839fe0176304c3feacd436962bcd8a0e | <|skeleton|>
class ImageProcessingSerializer:
"""Serializer validates image processing method and required parameters"""
def get_params(self, obj):
"""validation of method parameters"""
<|body_0|>
def validate_method(self, value):
"""validation of image processing method"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageProcessingSerializer:
"""Serializer validates image processing method and required parameters"""
def get_params(self, obj):
"""validation of method parameters"""
if 'params' not in self.context['request'].keys():
self.fail('invalid_data')
params = self.context['re... | the_stack_v2_python_sparse | backend/images/serializers.py | jsz5/denoising_app | train | 0 |
035c188bbade296d41628437dcc99fb0f841248b | [
"super(TakeDicomTest, self).setUp()\nself.dataset = self.get_file('dicom_uncompressed')\nself.dicom = self.context.dicom.import_dcm(self.dataset)\nself.xml_directory = self.get_local_dataset('dicom_xml/')\nself.image_directory = self.get_local_dataset('dicom_uncompressed/')\nself.count = self.dicom.metadata.count()... | <|body_start_0|>
super(TakeDicomTest, self).setUp()
self.dataset = self.get_file('dicom_uncompressed')
self.dicom = self.context.dicom.import_dcm(self.dataset)
self.xml_directory = self.get_local_dataset('dicom_xml/')
self.image_directory = self.get_local_dataset('dicom_uncompres... | TakeDicomTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TakeDicomTest:
def setUp(self):
"""import dicom data for testing"""
<|body_0|>
def test_metadata_imagedata_row_count_same(self):
"""test metadata pixeldata row count"""
<|body_1|>
def test_metadata_content_take_dcm_basic(self):
"""content test of... | stack_v2_sparse_classes_36k_train_005105 | 3,808 | permissive | [
{
"docstring": "import dicom data for testing",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "test metadata pixeldata row count",
"name": "test_metadata_imagedata_row_count_same",
"signature": "def test_metadata_imagedata_row_count_same(self)"
},
{
"docstring... | 4 | null | Implement the Python class `TakeDicomTest` described below.
Class description:
Implement the TakeDicomTest class.
Method signatures and docstrings:
- def setUp(self): import dicom data for testing
- def test_metadata_imagedata_row_count_same(self): test metadata pixeldata row count
- def test_metadata_content_take_dc... | Implement the Python class `TakeDicomTest` described below.
Class description:
Implement the TakeDicomTest class.
Method signatures and docstrings:
- def setUp(self): import dicom data for testing
- def test_metadata_imagedata_row_count_same(self): test metadata pixeldata row count
- def test_metadata_content_take_dc... | 5548fc925b5c278263cbdebbd9e8c7593320c2f4 | <|skeleton|>
class TakeDicomTest:
def setUp(self):
"""import dicom data for testing"""
<|body_0|>
def test_metadata_imagedata_row_count_same(self):
"""test metadata pixeldata row count"""
<|body_1|>
def test_metadata_content_take_dcm_basic(self):
"""content test of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TakeDicomTest:
def setUp(self):
"""import dicom data for testing"""
super(TakeDicomTest, self).setUp()
self.dataset = self.get_file('dicom_uncompressed')
self.dicom = self.context.dicom.import_dcm(self.dataset)
self.xml_directory = self.get_local_dataset('dicom_xml/')
... | the_stack_v2_python_sparse | regression-tests/sparktkregtests/testcases/dicom/take_dicom_test.py | trustedanalytics/spark-tk | train | 35 | |
4c5950ddf6f2c8b2bd1b805712ea1fb4d0c9fb83 | [
"if not 'L_NU_X_BAR' in simtab.colnames:\n for val in ['L', 'E', 'ALPHA']:\n simtab[f'{val}_NU_X_BAR'] = simtab[f'{val}_NU_X']\ntime = simtab['TIME'] << u.s\nself.luminosity = {}\nself.meanE = {}\nself.pinch = {}\nfor f in Flavor:\n self.luminosity[f] = simtab[f'L_{f.name}'] << u.erg / u.s\n self.me... | <|body_start_0|>
if not 'L_NU_X_BAR' in simtab.colnames:
for val in ['L', 'E', 'ALPHA']:
simtab[f'{val}_NU_X_BAR'] = simtab[f'{val}_NU_X']
time = simtab['TIME'] << u.s
self.luminosity = {}
self.meanE = {}
self.pinch = {}
for f in Flavor:
... | Subclass that contains spectra/luminosity pinches | PinchedModel | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PinchedModel:
"""Subclass that contains spectra/luminosity pinches"""
def __init__(self, simtab, metadata):
"""Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should contain columns TIME, {L,E,ALPHA}_NU_{E,E_BAR,X,X_BAR} Th... | stack_v2_sparse_classes_36k_train_005106 | 18,095 | permissive | [
{
"docstring": "Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should contain columns TIME, {L,E,ALPHA}_NU_{E,E_BAR,X,X_BAR} The values for X_BAR may be missing, then NU_X data will be used metadata: dict Model parameters dict",
"name": "__init__... | 2 | stack_v2_sparse_classes_30k_train_011378 | Implement the Python class `PinchedModel` described below.
Class description:
Subclass that contains spectra/luminosity pinches
Method signatures and docstrings:
- def __init__(self, simtab, metadata): Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should ... | Implement the Python class `PinchedModel` described below.
Class description:
Subclass that contains spectra/luminosity pinches
Method signatures and docstrings:
- def __init__(self, simtab, metadata): Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should ... | feb3a6c46d7dc4e999446994025001de77768e1d | <|skeleton|>
class PinchedModel:
"""Subclass that contains spectra/luminosity pinches"""
def __init__(self, simtab, metadata):
"""Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should contain columns TIME, {L,E,ALPHA}_NU_{E,E_BAR,X,X_BAR} Th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PinchedModel:
"""Subclass that contains spectra/luminosity pinches"""
def __init__(self, simtab, metadata):
"""Initialize the PinchedModel using the data from the given table. Parameters ---------- simtab: astropy.Table Should contain columns TIME, {L,E,ALPHA}_NU_{E,E_BAR,X,X_BAR} The values for ... | the_stack_v2_python_sparse | python/snewpy/models/base.py | SNEWS2/snewpy | train | 22 |
1f9475dbb9aaeb60cb36be07860e5ed441e79773 | [
"self.trie = Trie()\nfor w, f in zip(sentences, times):\n self.trie.insert(w, f)\nself.prefix = ''",
"if c == '#':\n self.trie.insert(self.prefix, 1)\n self.prefix = ''\n return []\nelse:\n start_pointer = self.trie.search(self.prefix)\n if not start_pointer:\n return []\n freq_words =... | <|body_start_0|>
self.trie = Trie()
for w, f in zip(sentences, times):
self.trie.insert(w, f)
self.prefix = ''
<|end_body_0|>
<|body_start_1|>
if c == '#':
self.trie.insert(self.prefix, 1)
self.prefix = ''
return []
else:
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.trie = Trie()
... | stack_v2_sparse_classes_36k_train_005107 | 5,655 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004042 | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | 04716049fab1e8e35157c4baa2d496826d3e0884 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.trie = Trie()
for w, f in zip(sentences, times):
self.trie.insert(w, f)
self.prefix = ''
def input(self, c):
""":type c: str :rtype: L... | the_stack_v2_python_sparse | amazon/design_search_autocomplete.py | cyberbono3/leetcode | train | 0 | |
f1e090e8885f8292128621a3caf280f80891efae | [
"self.instance_generator = instance_generator\nself.labelset_ = {l: i for i, l in enumerate(labels, start=1)}\nself.labelset_[UNK] = 0",
"for doc in raw_documents:\n for edu in self.instance_generator(doc):\n label = clean_dialogue_act(edu.dialogue_act() or UNK)\n yield self.labelset_[label]"
] | <|body_start_0|>
self.instance_generator = instance_generator
self.labelset_ = {l: i for i, l in enumerate(labels, start=1)}
self.labelset_[UNK] = 0
<|end_body_0|>
<|body_start_1|>
for doc in raw_documents:
for edu in self.instance_generator(doc):
label = cle... | Dialogue act extractor for the STAC corpus. | DialogueActVectorizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogueActVectorizer:
"""Dialogue act extractor for the STAC corpus."""
def __init__(self, instance_generator, labels):
"""instance_generator to enumerate the instances from a doc :type labels: set(string)"""
<|body_0|>
def transform(self, raw_documents):
"""Lea... | stack_v2_sparse_classes_36k_train_005108 | 2,050 | no_license | [
{
"docstring": "instance_generator to enumerate the instances from a doc :type labels: set(string)",
"name": "__init__",
"signature": "def __init__(self, instance_generator, labels)"
},
{
"docstring": "Learn the label encoder and return a vector of labels There is one label per instance extracte... | 2 | stack_v2_sparse_classes_30k_train_016980 | Implement the Python class `DialogueActVectorizer` described below.
Class description:
Dialogue act extractor for the STAC corpus.
Method signatures and docstrings:
- def __init__(self, instance_generator, labels): instance_generator to enumerate the instances from a doc :type labels: set(string)
- def transform(self... | Implement the Python class `DialogueActVectorizer` described below.
Class description:
Dialogue act extractor for the STAC corpus.
Method signatures and docstrings:
- def __init__(self, instance_generator, labels): instance_generator to enumerate the instances from a doc :type labels: set(string)
- def transform(self... | c550f4383016e05fe20ad7180a027979e3540d1f | <|skeleton|>
class DialogueActVectorizer:
"""Dialogue act extractor for the STAC corpus."""
def __init__(self, instance_generator, labels):
"""instance_generator to enumerate the instances from a doc :type labels: set(string)"""
<|body_0|>
def transform(self, raw_documents):
"""Lea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DialogueActVectorizer:
"""Dialogue act extractor for the STAC corpus."""
def __init__(self, instance_generator, labels):
"""instance_generator to enumerate the instances from a doc :type labels: set(string)"""
self.instance_generator = instance_generator
self.labelset_ = {l: i for... | the_stack_v2_python_sparse | educe/stac/learning/doc_vectorizer.py | kowey/educe | train | 1 |
6f86bba5412470b31625ba5471af348f49e03f34 | [
"super().__init__(name=name)\nconv2d_layer = get_conv_op(head_conv_type)\nself.min_level = min_level\nself.max_level = max_level\nself.fullres_output = fullres_output\nself.fullres_skip_connections = fullres_skip_connections\nself.fnode = FNode(0, list(range(max_level - min_level + 1)), output_filters, apply_bn_for... | <|body_start_0|>
super().__init__(name=name)
conv2d_layer = get_conv_op(head_conv_type)
self.min_level = min_level
self.max_level = max_level
self.fullres_output = fullres_output
self.fullres_skip_connections = fullres_skip_connections
self.fnode = FNode(0, list(r... | Segmentation class prediction network. | SegClassNet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegClassNet:
"""Segmentation class prediction network."""
def __init__(self, min_level=3, max_level=7, output_filters=256, apply_bn_for_resampling=True, is_training_bn=True, conv_after_downsample=True, conv_bn_act_pattern=True, head_conv_type='sep_3', act_type='swish', strategy='tpu', output... | stack_v2_sparse_classes_36k_train_005109 | 26,355 | permissive | [
{
"docstring": "Initialize the SegClassNet. Args: min_level: minimum feature level to use in the head. max_level: maximum feature level to use in the head. output_filters: output filter size. apply_bn_for_resampling: whether to apply batch normalization for resampling. is_training_bn: is training mode. conv_aft... | 2 | null | Implement the Python class `SegClassNet` described below.
Class description:
Segmentation class prediction network.
Method signatures and docstrings:
- def __init__(self, min_level=3, max_level=7, output_filters=256, apply_bn_for_resampling=True, is_training_bn=True, conv_after_downsample=True, conv_bn_act_pattern=Tr... | Implement the Python class `SegClassNet` described below.
Class description:
Segmentation class prediction network.
Method signatures and docstrings:
- def __init__(self, min_level=3, max_level=7, output_filters=256, apply_bn_for_resampling=True, is_training_bn=True, conv_after_downsample=True, conv_bn_act_pattern=Tr... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class SegClassNet:
"""Segmentation class prediction network."""
def __init__(self, min_level=3, max_level=7, output_filters=256, apply_bn_for_resampling=True, is_training_bn=True, conv_after_downsample=True, conv_bn_act_pattern=True, head_conv_type='sep_3', act_type='swish', strategy='tpu', output... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SegClassNet:
"""Segmentation class prediction network."""
def __init__(self, min_level=3, max_level=7, output_filters=256, apply_bn_for_resampling=True, is_training_bn=True, conv_after_downsample=True, conv_bn_act_pattern=True, head_conv_type='sep_3', act_type='swish', strategy='tpu', output_weight_metho... | the_stack_v2_python_sparse | official/projects/edgetpu/vision/modeling/heads/bifpn_head.py | jianzhnie/models | train | 2 |
7bd54e12039d188594d2ca0ff008b7c30e17a487 | [
"self.inlinehilite = []\nself.config = {'style_plain_text': [False, \"Process inline code even when a language is not specified or langauge is specified as 'text'. When 'False', no classes will be added to 'text' code blocksand no scoping will performed. The content will just be escaped.- Default: False\"], 'css_cl... | <|body_start_0|>
self.inlinehilite = []
self.config = {'style_plain_text': [False, "Process inline code even when a language is not specified or langauge is specified as 'text'. When 'False', no classes will be added to 'text' code blocksand no scoping will performed. The content will just be escaped.- ... | Add inline highlighting extension to Markdown class. | InlineHiliteExtension | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InlineHiliteExtension:
"""Add inline highlighting extension to Markdown class."""
def __init__(self, *args, **kwargs):
"""Initialize."""
<|body_0|>
def extendMarkdown(self, md):
"""Add support for `:::language code` and `#!language code` highlighting."""
... | stack_v2_sparse_classes_36k_train_005110 | 7,110 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Add support for `:::language code` and `#!language code` highlighting.",
"name": "extendMarkdown",
"signature": "def extendMarkdown(self, md)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008313 | Implement the Python class `InlineHiliteExtension` described below.
Class description:
Add inline highlighting extension to Markdown class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize.
- def extendMarkdown(self, md): Add support for `:::language code` and `#!language code` high... | Implement the Python class `InlineHiliteExtension` described below.
Class description:
Add inline highlighting extension to Markdown class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize.
- def extendMarkdown(self, md): Add support for `:::language code` and `#!language code` high... | 0eed7cfcb43fe39b20a6be693adaa3ef03b0231e | <|skeleton|>
class InlineHiliteExtension:
"""Add inline highlighting extension to Markdown class."""
def __init__(self, *args, **kwargs):
"""Initialize."""
<|body_0|>
def extendMarkdown(self, md):
"""Add support for `:::language code` and `#!language code` highlighting."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InlineHiliteExtension:
"""Add inline highlighting extension to Markdown class."""
def __init__(self, *args, **kwargs):
"""Initialize."""
self.inlinehilite = []
self.config = {'style_plain_text': [False, "Process inline code even when a language is not specified or langauge is spec... | the_stack_v2_python_sparse | st3/pymdownx/inlinehilite.py | facelessuser/sublime-pymdownx | train | 2 |
0fcb315ec093fd1f1b800035efa86b514ef34936 | [
"condition, body = args\nself.initialize()\nself.setNumChildren(2)\nif not isinstance(condition, Expression):\n raise InvalidConditionException(type(condition))\nself.setChild(0, condition)\nif not isinstance(body, CompoundStatement):\n raise InvalidBodyException(type(body))\nself.setChild(1, body)",
"retva... | <|body_start_0|>
condition, body = args
self.initialize()
self.setNumChildren(2)
if not isinstance(condition, Expression):
raise InvalidConditionException(type(condition))
self.setChild(0, condition)
if not isinstance(body, CompoundStatement):
rais... | Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body | DoLoop | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoLoop:
"""Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body"""
def __init__(self, *args):
"""DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the traversable class. Tests if the specified 'condition' argumen... | stack_v2_sparse_classes_36k_train_005111 | 2,705 | permissive | [
{
"docstring": "DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the traversable class. Tests if the specified 'condition' argument is of type Expression. Secondly, tests if the specified 'body' is of type CompoundStatement",
"name": "__init__",
"signature": "def __init... | 2 | stack_v2_sparse_classes_30k_train_009653 | Implement the Python class `DoLoop` described below.
Class description:
Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body
Method signatures and docstrings:
- def __init__(self, *args): DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the trav... | Implement the Python class `DoLoop` described below.
Class description:
Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body
Method signatures and docstrings:
- def __init__(self, *args): DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the trav... | fe7b4b86f6f652ef791c4d1520e46aa7066defda | <|skeleton|>
class DoLoop:
"""Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body"""
def __init__(self, *args):
"""DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the traversable class. Tests if the specified 'condition' argumen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DoLoop:
"""Ansi C do/while loop. Requires a ConditionalExpression, and a compound statement for a body"""
def __init__(self, *args):
"""DoLoop works on any sequence type containing 2 elements. Initializes 2 children in the traversable class. Tests if the specified 'condition' argument is of type ... | the_stack_v2_python_sparse | c_ast/hir/DoLoop.py | qram9/c_ast | train | 0 |
3a15870cf1813a7c75531139d3a0fb2f056a279f | [
"obj = SteamPacket()\nSteamPacket._packet_count += 1\nobj.packet_id = SteamPacket._packet_count\nobj.outgoing_command = body\nobj._encode(body, packet_type)\nreturn obj",
"obj = SteamPacket()\ndebug_out('Unpacking: ', binary_string, level=5)\nobj._decode(binary_string)\nif obj.decoded['body'].lower().strip() == '... | <|body_start_0|>
obj = SteamPacket()
SteamPacket._packet_count += 1
obj.packet_id = SteamPacket._packet_count
obj.outgoing_command = body
obj._encode(body, packet_type)
return obj
<|end_body_0|>
<|body_start_1|>
obj = SteamPacket()
debug_out('Unpacking: '... | SteamPacket | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SteamPacket:
def pack(body, packet_type=2):
"""Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance"""
<|body_0|>
def unpack(binary_string):
"""Create new Packet instance and dec... | stack_v2_sparse_classes_36k_train_005112 | 1,511 | permissive | [
{
"docstring": "Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance",
"name": "pack",
"signature": "def pack(body, packet_type=2)"
},
{
"docstring": "Create new Packet instance and decode binary string Args... | 2 | stack_v2_sparse_classes_30k_test_000888 | Implement the Python class `SteamPacket` described below.
Class description:
Implement the SteamPacket class.
Method signatures and docstrings:
- def pack(body, packet_type=2): Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance... | Implement the Python class `SteamPacket` described below.
Class description:
Implement the SteamPacket class.
Method signatures and docstrings:
- def pack(body, packet_type=2): Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance... | b352c25968aed1b00e6d7fd58ac697c4ae6633ac | <|skeleton|>
class SteamPacket:
def pack(body, packet_type=2):
"""Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance"""
<|body_0|>
def unpack(binary_string):
"""Create new Packet instance and dec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SteamPacket:
def pack(body, packet_type=2):
"""Create new Packet instance and encode packet Args: body: ASCII string packet_type: Packet Type ID Returns: Object: New packet object instance"""
obj = SteamPacket()
SteamPacket._packet_count += 1
obj.packet_id = SteamPacket._packet... | the_stack_v2_python_sparse | ark/steam/steam_packet.py | f4ble/pyarc | train | 8 | |
9512ac65ee120de771f37f2dc6182ea6f5e88231 | [
"similarity_calc = region_similarity_calculator.IouSimilarity()\nmatcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)\nbox_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()\nself._target_assigner = target_as... | <|body_start_0|>
similarity_calc = region_similarity_calculator.IouSimilarity()
matcher = argmax_matcher.ArgMaxMatcher(match_threshold, unmatched_threshold=match_threshold, negatives_lower_than_unmatched=True, force_match_for_each_row=True)
box_coder = faster_rcnn_box_coder.FasterRcnnBoxCoder()
... | Labeler for multiscale anchor boxes. | AnchorLabeler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnchorLabeler:
"""Labeler for multiscale anchor boxes."""
def __init__(self, anchors, num_classes, match_threshold=0.5):
"""Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i... | stack_v2_sparse_classes_36k_train_005113 | 10,735 | permissive | [
{
"docstring": "Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset. match_threshold: float number between 0 and 1 representing the threshold to assign positive labels for anchors.",
"na... | 3 | stack_v2_sparse_classes_30k_train_005559 | Implement the Python class `AnchorLabeler` described below.
Class description:
Labeler for multiscale anchor boxes.
Method signatures and docstrings:
- def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num... | Implement the Python class `AnchorLabeler` described below.
Class description:
Labeler for multiscale anchor boxes.
Method signatures and docstrings:
- def __init__(self, anchors, num_classes, match_threshold=0.5): Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num... | a5388a45f71a949639b35cc5b990bd130d2d8164 | <|skeleton|>
class AnchorLabeler:
"""Labeler for multiscale anchor boxes."""
def __init__(self, anchors, num_classes, match_threshold=0.5):
"""Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnchorLabeler:
"""Labeler for multiscale anchor boxes."""
def __init__(self, anchors, num_classes, match_threshold=0.5):
"""Constructs anchor labeler to assign labels to anchors. Args: anchors: an instance of class Anchors. num_classes: integer number representing number of classes in the dataset... | the_stack_v2_python_sparse | TensorFlow2/Detection/Efficientdet/model/anchors.py | NVIDIA/DeepLearningExamples | train | 11,838 |
3b79480f0f4856185b237652795ba4463b26c5e0 | [
"ret = self.addr\nself.addr = self.addr + size + self.align - 1\nself.addr &= self.mask ^ self.align - 1\nreturn ret",
"addr = self.next_addr(size)\njitter.vm.add_memory_page(addr, PAGE_READ | PAGE_WRITE, '\\x00' * size)\nreturn addr"
] | <|body_start_0|>
ret = self.addr
self.addr = self.addr + size + self.align - 1
self.addr &= self.mask ^ self.align - 1
return ret
<|end_body_0|>
<|body_start_1|>
addr = self.next_addr(size)
jitter.vm.add_memory_page(addr, PAGE_READ | PAGE_WRITE, '\x00' * size)
re... | Light heap simulation | heap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class heap:
"""Light heap simulation"""
def next_addr(self, size):
"""@size: the size to allocate return the future checnk address"""
<|body_0|>
def alloc(self, jitter, size):
"""@jitter: a jitter instance @size: the size to allocate"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_005114 | 1,418 | no_license | [
{
"docstring": "@size: the size to allocate return the future checnk address",
"name": "next_addr",
"signature": "def next_addr(self, size)"
},
{
"docstring": "@jitter: a jitter instance @size: the size to allocate",
"name": "alloc",
"signature": "def alloc(self, jitter, size)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001072 | Implement the Python class `heap` described below.
Class description:
Light heap simulation
Method signatures and docstrings:
- def next_addr(self, size): @size: the size to allocate return the future checnk address
- def alloc(self, jitter, size): @jitter: a jitter instance @size: the size to allocate | Implement the Python class `heap` described below.
Class description:
Light heap simulation
Method signatures and docstrings:
- def next_addr(self, size): @size: the size to allocate return the future checnk address
- def alloc(self, jitter, size): @jitter: a jitter instance @size: the size to allocate
<|skeleton|>
... | 3af62274b68f13fc6eba680ef1524e5f215e5c8b | <|skeleton|>
class heap:
"""Light heap simulation"""
def next_addr(self, size):
"""@size: the size to allocate return the future checnk address"""
<|body_0|>
def alloc(self, jitter, size):
"""@jitter: a jitter instance @size: the size to allocate"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class heap:
"""Light heap simulation"""
def next_addr(self, size):
"""@size: the size to allocate return the future checnk address"""
ret = self.addr
self.addr = self.addr + size + self.align - 1
self.addr &= self.mask ^ self.align - 1
return ret
def alloc(self, jit... | the_stack_v2_python_sparse | miasm2/os_dep/common.py | laanwj/miasm | train | 1 |
7a28eef5fdbdb5a76a6b1b4400868f052c1faee0 | [
"self.origin_stream: TScenarioStream = origin_stream\nself.scenario: TScenario = origin_stream.scenario\nself.current_experience: int = current_experience\nself.classes_in_this_experience: Sequence[int] = classes_in_this_exp\n' The list of classes in this experience '\nself.previous_classes: Sequence[int] = previou... | <|body_start_0|>
self.origin_stream: TScenarioStream = origin_stream
self.scenario: TScenario = origin_stream.scenario
self.current_experience: int = current_experience
self.classes_in_this_experience: Sequence[int] = classes_in_this_exp
' The list of classes in this experience '... | Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the experience. For instance, an experience of a New Classes scenario will contain all pa... | AbstractExperience | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbstractExperience:
"""Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the experience. For instance, an experience... | stack_v2_sparse_classes_36k_train_005115 | 24,996 | permissive | [
{
"docstring": "Creates an instance of the abstract experience given the scenario stream, the current experience ID and data about the classes timeline. :param origin_stream: The stream from which this experience was obtained. :param current_experience: The current experience ID, as an integer. :param classes_i... | 2 | null | Implement the Python class `AbstractExperience` described below.
Class description:
Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the ... | Implement the Python class `AbstractExperience` described below.
Class description:
Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the ... | f9cd2548f6c6d3ff119b40fecdb0df6fcd1525f6 | <|skeleton|>
class AbstractExperience:
"""Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the experience. For instance, an experience... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AbstractExperience:
"""Definition of a learning experience. A learning experience contains a set of patterns which has become available at a particular time instant. The content and size of an Experience is defined by the specific benchmark that creates the experience. For instance, an experience of a New Cla... | the_stack_v2_python_sparse | framework/avalanche/benchmarks/scenarios/generic_cl_scenario.py | Yuki-Hong/RehearsalRevealed | train | 0 |
9791e5658365f86124c8501423c9844651c25687 | [
"noval_lis = response.xpath('//ul[@class=\"all-img-list cf\"]/li')\nfor noval_li in noval_lis:\n novalItem = QidianNovalItem()\n novalItem['coverImage'] = 'https:' + noval_li.xpath('.//div[@class=\"book-img-box\"]//img/@src').extract_first('')\n novalItem['coverImage'] = 'https:' + noval_li.css('div.book-i... | <|body_start_0|>
noval_lis = response.xpath('//ul[@class="all-img-list cf"]/li')
for noval_li in noval_lis:
novalItem = QidianNovalItem()
novalItem['coverImage'] = 'https:' + noval_li.xpath('.//div[@class="book-img-box"]//img/@src').extract_first('')
novalItem['coverI... | QdSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QdSpider:
def parse(self, response):
"""获取当前页书籍的列表,遍历 :param response: :return:"""
<|body_0|>
def parse_noval_detail(self, response):
"""获取书籍详情信息,提取章节信息 :param response: :return:"""
<|body_1|>
def parse_dynamic_chpater(self, response):
"""解析动态加载的... | stack_v2_sparse_classes_36k_train_005116 | 6,824 | no_license | [
{
"docstring": "获取当前页书籍的列表,遍历 :param response: :return:",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "获取书籍详情信息,提取章节信息 :param response: :return:",
"name": "parse_noval_detail",
"signature": "def parse_noval_detail(self, response)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_train_020289 | Implement the Python class `QdSpider` described below.
Class description:
Implement the QdSpider class.
Method signatures and docstrings:
- def parse(self, response): 获取当前页书籍的列表,遍历 :param response: :return:
- def parse_noval_detail(self, response): 获取书籍详情信息,提取章节信息 :param response: :return:
- def parse_dynamic_chpater... | Implement the Python class `QdSpider` described below.
Class description:
Implement the QdSpider class.
Method signatures and docstrings:
- def parse(self, response): 获取当前页书籍的列表,遍历 :param response: :return:
- def parse_noval_detail(self, response): 获取书籍详情信息,提取章节信息 :param response: :return:
- def parse_dynamic_chpater... | 15e1322dcc36de4f1d1e467525761746cadb58fa | <|skeleton|>
class QdSpider:
def parse(self, response):
"""获取当前页书籍的列表,遍历 :param response: :return:"""
<|body_0|>
def parse_noval_detail(self, response):
"""获取书籍详情信息,提取章节信息 :param response: :return:"""
<|body_1|>
def parse_dynamic_chpater(self, response):
"""解析动态加载的... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QdSpider:
def parse(self, response):
"""获取当前页书籍的列表,遍历 :param response: :return:"""
noval_lis = response.xpath('//ul[@class="all-img-list cf"]/li')
for noval_li in noval_lis:
novalItem = QidianNovalItem()
novalItem['coverImage'] = 'https:' + noval_li.xpath('.//di... | the_stack_v2_python_sparse | Code/爬虫/scrapy框架/qidian3/qidian/qidian/spiders/qd.py | wangxuyongkang/chengxuyuanhh | train | 1 | |
dd164961fb119d4d5b4b64a4abf351c86c212b8a | [
"self.oldid = None\nif form.oldid is None or form.oldid == form.newid:\n obj.save()\n return\nwith transaction.atomic():\n migrated = []\n for t in Dive.objects.filter(difficulty=form.oldid):\n t.difficulty = None\n t.save()\n migrated.append(t)\n self.oldid = form.oldid\n obj... | <|body_start_0|>
self.oldid = None
if form.oldid is None or form.oldid == form.newid:
obj.save()
return
with transaction.atomic():
migrated = []
for t in Dive.objects.filter(difficulty=form.oldid):
t.difficulty = None
... | DifficultyAdmin | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DifficultyAdmin:
def save_model(self, request, obj, form, change):
"""Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id."""
<|body_0|>
def response_change(self, request, obj):
"""If id was changed, always re... | stack_v2_sparse_classes_36k_train_005117 | 5,126 | permissive | [
{
"docstring": "Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id.",
"name": "save_model",
"signature": "def save_model(self, request, obj, form, change)"
},
{
"docstring": "If id was changed, always returns to the list (prevent 404). O... | 2 | null | Implement the Python class `DifficultyAdmin` described below.
Class description:
Implement the DifficultyAdmin class.
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id.
- d... | Implement the Python class `DifficultyAdmin` described below.
Class description:
Implement the DifficultyAdmin class.
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id.
- d... | a91b75261a876be51ad2a693618629900bea6003 | <|skeleton|>
class DifficultyAdmin:
def save_model(self, request, obj, form, change):
"""Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id."""
<|body_0|>
def response_change(self, request, obj):
"""If id was changed, always re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DifficultyAdmin:
def save_model(self, request, obj, form, change):
"""Allows to change Difficulty id from Admin form. It will migrate all dives using this difficulty to the new id."""
self.oldid = None
if form.oldid is None or form.oldid == form.newid:
obj.save()
... | the_stack_v2_python_sparse | geotrek/diving/admin.py | GeotrekCE/Geotrek-admin | train | 71 | |
cc753d2b72b9b4adb9c1001f12ad8ed63febc3f0 | [
"mock_request.return_value.json.return_value = {'predictions': [{'fields': ['prediction', 'probability'], 'values': [[1, [0.0, 1.0]]]}]}\nbody = Prediction(parameters=[Parameter(name='name', value=5)], target=[Link(rel='endpoint', href='toto')])\nexpected = \"{'result': {'prediction': 1, 'probability': [0.0, 1.0]}}... | <|body_start_0|>
mock_request.return_value.json.return_value = {'predictions': [{'fields': ['prediction', 'probability'], 'values': [[1, [0.0, 1.0]]]}]}
body = Prediction(parameters=[Parameter(name='name', value=5)], target=[Link(rel='endpoint', href='toto')])
expected = "{'result': {'prediction... | RunController integration test stubs | TestRunController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestRunController:
"""RunController integration test stubs"""
def test_prediction(self, mock_request, mock_cred):
"""Test case for prediction Call Prediction of specified deployment"""
<|body_0|>
def test_prediction_no_endpoint_in_target(self, mock_request, mock_cred):
... | stack_v2_sparse_classes_36k_train_005118 | 6,330 | permissive | [
{
"docstring": "Test case for prediction Call Prediction of specified deployment",
"name": "test_prediction",
"signature": "def test_prediction(self, mock_request, mock_cred)"
},
{
"docstring": "Test case for prediction Call Prediction of specified deployment",
"name": "test_prediction_no_en... | 5 | stack_v2_sparse_classes_30k_train_020834 | Implement the Python class `TestRunController` described below.
Class description:
RunController integration test stubs
Method signatures and docstrings:
- def test_prediction(self, mock_request, mock_cred): Test case for prediction Call Prediction of specified deployment
- def test_prediction_no_endpoint_in_target(s... | Implement the Python class `TestRunController` described below.
Class description:
RunController integration test stubs
Method signatures and docstrings:
- def test_prediction(self, mock_request, mock_cred): Test case for prediction Call Prediction of specified deployment
- def test_prediction_no_endpoint_in_target(s... | 8b7db98f46a81b731d0dddfde8e3fb6f91ebc71a | <|skeleton|>
class TestRunController:
"""RunController integration test stubs"""
def test_prediction(self, mock_request, mock_cred):
"""Test case for prediction Call Prediction of specified deployment"""
<|body_0|>
def test_prediction_no_endpoint_in_target(self, mock_request, mock_cred):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestRunController:
"""RunController integration test stubs"""
def test_prediction(self, mock_request, mock_cred):
"""Test case for prediction Call Prediction of specified deployment"""
mock_request.return_value.json.return_value = {'predictions': [{'fields': ['prediction', 'probability'],... | the_stack_v2_python_sparse | ops-implementations/wml-service/swagger_server/test_mocked/test_run_controller.py | Rdecoster/open-prediction-service-hub | train | 0 |
d0a556cfab12531ac1e6c1c0a1d7849d51f7cd5f | [
"results = gisSession.query(func.count('1')).filter(OrgRelease.short_name == short_name).all()\ngisSession.close()\nreturn results[0][0]",
"results = gisSession.query(Area.detail_add).filter_by(area_code=area_code).first()\ngisSession.close()\nif results == None:\n log('机构%s在Area表中不存在' % area_code)\nelse:\n ... | <|body_start_0|>
results = gisSession.query(func.count('1')).filter(OrgRelease.short_name == short_name).all()
gisSession.close()
return results[0][0]
<|end_body_0|>
<|body_start_1|>
results = gisSession.query(Area.detail_add).filter_by(area_code=area_code).first()
gisSession.cl... | 利用数据库,将AreaRelease数据转换为OrgRelease数据 | Transfer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transfer:
"""利用数据库,将AreaRelease数据转换为OrgRelease数据"""
def queryAreaRelease(self, short_name):
"""查询是否有简称相同的记录"""
<|body_0|>
def queryArea(self, area_code):
"""area_code查询t_area表,或者详细地址信息"""
<|body_1|>
def addOrgRelease(self):
"""向OrgRelease数据库插... | stack_v2_sparse_classes_36k_train_005119 | 2,601 | no_license | [
{
"docstring": "查询是否有简称相同的记录",
"name": "queryAreaRelease",
"signature": "def queryAreaRelease(self, short_name)"
},
{
"docstring": "area_code查询t_area表,或者详细地址信息",
"name": "queryArea",
"signature": "def queryArea(self, area_code)"
},
{
"docstring": "向OrgRelease数据库插入机构数据",
"name... | 3 | stack_v2_sparse_classes_30k_train_017975 | Implement the Python class `Transfer` described below.
Class description:
利用数据库,将AreaRelease数据转换为OrgRelease数据
Method signatures and docstrings:
- def queryAreaRelease(self, short_name): 查询是否有简称相同的记录
- def queryArea(self, area_code): area_code查询t_area表,或者详细地址信息
- def addOrgRelease(self): 向OrgRelease数据库插入机构数据 | Implement the Python class `Transfer` described below.
Class description:
利用数据库,将AreaRelease数据转换为OrgRelease数据
Method signatures and docstrings:
- def queryAreaRelease(self, short_name): 查询是否有简称相同的记录
- def queryArea(self, area_code): area_code查询t_area表,或者详细地址信息
- def addOrgRelease(self): 向OrgRelease数据库插入机构数据
<|skelet... | b3a449e4be91515d8a915107d06f6d3a102ee047 | <|skeleton|>
class Transfer:
"""利用数据库,将AreaRelease数据转换为OrgRelease数据"""
def queryAreaRelease(self, short_name):
"""查询是否有简称相同的记录"""
<|body_0|>
def queryArea(self, area_code):
"""area_code查询t_area表,或者详细地址信息"""
<|body_1|>
def addOrgRelease(self):
"""向OrgRelease数据库插... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transfer:
"""利用数据库,将AreaRelease数据转换为OrgRelease数据"""
def queryAreaRelease(self, short_name):
"""查询是否有简称相同的记录"""
results = gisSession.query(func.count('1')).filter(OrgRelease.short_name == short_name).all()
gisSession.close()
return results[0][0]
def queryArea(self, are... | the_stack_v2_python_sparse | gis/transferG7Data/transferAreaData.py | 879106261/test | train | 0 |
6af4fc4a84a3068c9e5130affe5e852a31ad774a | [
"orderAble = IOrderedContainer.providedBy(self.old)\norderMap = {}\nsubobjs = {}\nfor id in self.old.objectIds():\n obj = getattr(self.old.aq_inner.aq_explicit, id)\n if isinstance(obj, BrokenClass):\n LOG.warning('BrokenObject in %s' % self.old.absolute_url(1))\n if orderAble:\n try:\n ... | <|body_start_0|>
orderAble = IOrderedContainer.providedBy(self.old)
orderMap = {}
subobjs = {}
for id in self.old.objectIds():
obj = getattr(self.old.aq_inner.aq_explicit, id)
if isinstance(obj, BrokenClass):
LOG.warning('BrokenObject in %s' % self... | Migrates a folderish object | FolderMigrationMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FolderMigrationMixin:
"""Migrates a folderish object"""
def beforeChange_storeSubojects(self):
"""store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also preservers the folder order in a dict. For performance reasons... | stack_v2_sparse_classes_36k_train_005120 | 21,547 | no_license | [
{
"docstring": "store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also preservers the folder order in a dict. For performance reasons the objects are removed from the old folder before it is renamed. Elsewise the objects would be reindex more ... | 2 | null | Implement the Python class `FolderMigrationMixin` described below.
Class description:
Migrates a folderish object
Method signatures and docstrings:
- def beforeChange_storeSubojects(self): store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also prese... | Implement the Python class `FolderMigrationMixin` described below.
Class description:
Migrates a folderish object
Method signatures and docstrings:
- def beforeChange_storeSubojects(self): store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also prese... | e137eb6225cc5e724bee74a892567796166134ac | <|skeleton|>
class FolderMigrationMixin:
"""Migrates a folderish object"""
def beforeChange_storeSubojects(self):
"""store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also preservers the folder order in a dict. For performance reasons... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FolderMigrationMixin:
"""Migrates a folderish object"""
def beforeChange_storeSubojects(self):
"""store subobjects from old folder This methods gets all subojects from the old folder and removes them from the old. It also preservers the folder order in a dict. For performance reasons the objects ... | the_stack_v2_python_sparse | eggs/Products.contentmigration-2.0.1-py2.7.egg/Products/contentmigration/basemigrator/migrator.py | nacho22martin/tesis | train | 0 |
f427e5f233acc3fcffc6a443685c0fa49495051c | [
"self._generator = generator\nself._node = node\nself._input_port = input_port\nself._output_port = output_port",
"chunk_size = chunk_size or len(self._generator._data)\nend_of_data = False\noutput_data = []\noutput_meta = []\nwhile not end_of_data:\n self._node.clear()\n chunk = self._generator.next(chunk_... | <|body_start_0|>
self._generator = generator
self._node = node
self._input_port = input_port
self._output_port = output_port
<|end_body_0|>
<|body_start_1|>
chunk_size = chunk_size or len(self._generator._data)
end_of_data = False
output_data = []
output_... | Mimics the scheduler behavior to allow testing the output of a node offline. | Looper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a ... | stack_v2_sparse_classes_36k_train_005121 | 5,655 | permissive | [
{
"docstring": "Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a method `next` and `reset`",
"name": "__init__",
"signature": "def __init__(self, generator, node, input_port='i', output_port='o')"
},
{
"docstring": "Loop acro... | 2 | stack_v2_sparse_classes_30k_val_000897 | Implement the Python class `Looper` described below.
Class description:
Mimics the scheduler behavior to allow testing the output of a node offline.
Method signatures and docstrings:
- def __init__(self, generator, node, input_port='i', output_port='o'): Initialize the helper :param generator (Node): timeflux node to... | Implement the Python class `Looper` described below.
Class description:
Mimics the scheduler behavior to allow testing the output of a node offline.
Method signatures and docstrings:
- def __init__(self, generator, node, input_port='i', output_port='o'): Initialize the helper :param generator (Node): timeflux node to... | 55ccae74b5eb99504b3aa715ffa394b7716884b2 | <|skeleton|>
class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a method `next`... | the_stack_v2_python_sparse | timeflux/helpers/testing.py | timeflux/timeflux | train | 163 |
fe6c897bac95d21d3386153b11ae415b9737c291 | [
"print('Testing D_recognize')\nstates = ['1', '2', '3', '4']\ndomain = ['b', 'a', '!']\nstart_state = '1'\naccept_state = ['4']\nstate_table = [('1', 'b', '2'), ('2', 'a', '3'), ('3', 'a', '3'), ('3', '!', '4')]\nFSA = state_machine.Finite_State_Automata(states, domain, start_state, accept_state, state_table)\nself... | <|body_start_0|>
print('Testing D_recognize')
states = ['1', '2', '3', '4']
domain = ['b', 'a', '!']
start_state = '1'
accept_state = ['4']
state_table = [('1', 'b', '2'), ('2', 'a', '3'), ('3', 'a', '3'), ('3', '!', '4')]
FSA = state_machine.Finite_State_Automata... | TestFSA | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFSA:
def test_d_recognize(self):
"""Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/"""
<|body_0|>
def test_d_recognize_b(self):
"""Tests the second d_recognize function by defining a machine that... | stack_v2_sparse_classes_36k_train_005122 | 4,133 | no_license | [
{
"docstring": "Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/",
"name": "test_d_recognize",
"signature": "def test_d_recognize(self)"
},
{
"docstring": "Tests the second d_recognize function by defining a machine that searches... | 3 | stack_v2_sparse_classes_30k_train_008490 | Implement the Python class `TestFSA` described below.
Class description:
Implement the TestFSA class.
Method signatures and docstrings:
- def test_d_recognize(self): Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/
- def test_d_recognize_b(self): Test... | Implement the Python class `TestFSA` described below.
Class description:
Implement the TestFSA class.
Method signatures and docstrings:
- def test_d_recognize(self): Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/
- def test_d_recognize_b(self): Test... | 1f7dd50123b5b69d8268bc071a4adc5b3b8a76e6 | <|skeleton|>
class TestFSA:
def test_d_recognize(self):
"""Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/"""
<|body_0|>
def test_d_recognize_b(self):
"""Tests the second d_recognize function by defining a machine that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestFSA:
def test_d_recognize(self):
"""Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/"""
print('Testing D_recognize')
states = ['1', '2', '3', '4']
domain = ['b', 'a', '!']
start_state = '1'
a... | the_stack_v2_python_sparse | test.py | lzambella/csc470-proj1 | train | 0 | |
3b44be97536a340af916e5ed7d901d010b282321 | [
"inputSpecification = super().getInputSpecification()\norderInputType = InputTypes.makeEnumType('order', 'orderType', ['0', '1'])\ninputSpecification.addSub(InputData.parameterInputFactory('order', contentType=orderInputType), quantity=InputData.Quantity.one)\ninputSpecification.addSub(InputData.parameterInputFacto... | <|body_start_0|>
inputSpecification = super().getInputSpecification()
orderInputType = InputTypes.makeEnumType('order', 'orderType', ['0', '1'])
inputSpecification.addSub(InputData.parameterInputFactory('order', contentType=orderInputType), quantity=InputData.Quantity.one)
inputSpecifica... | Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences | DTW | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DTW:
"""Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are ... | stack_v2_sparse_classes_36k_train_005123 | 7,028 | permissive | [
{
"docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.",
"name": "getInputSpecification",
"signatur... | 6 | null | Implement the Python class `DTW` described below.
Class description:
Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input d... | Implement the Python class `DTW` described below.
Class description:
Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input d... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class DTW:
"""Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DTW:
"""Dynamic Time Warping Metric Class for measuring similarity between two variables X and Y, i.e. two temporal sequences"""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving th... | the_stack_v2_python_sparse | ravenframework/Metrics/metrics/DTW.py | idaholab/raven | train | 201 |
d8dc617078d25c17c68f6a432a57ad746fac5e87 | [
"n = len(matrix)\nm = len(matrix[0])\nans = 0\nleft, right = (matrix[0][0], matrix[n - 1][m - 1])\nwhile left <= right:\n mid = (left + right) / 2\n cnt = 0\n j = m\n for i in xrange(n):\n while j > 0 and matrix[i][j - 1] > mid:\n j -= 1\n cnt += j\n if cnt < k:\n left... | <|body_start_0|>
n = len(matrix)
m = len(matrix[0])
ans = 0
left, right = (matrix[0][0], matrix[n - 1][m - 1])
while left <= right:
mid = (left + right) / 2
cnt = 0
j = m
for i in xrange(n):
while j > 0 and matrix[i]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthSmallest(self, matrix, k):
""":type matrix: List[List[int]] :type k: int :rtype: int"""
<|body_0|>
def kthSmallest_builtin_heapq(self, matrix, k):
""":type matrix: List[List[int]] :type k: int :rtype: int"""
<|body_1|>
def kthSmallest_He... | stack_v2_sparse_classes_36k_train_005124 | 3,940 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type k: int :rtype: int",
"name": "kthSmallest",
"signature": "def kthSmallest(self, matrix, k)"
},
{
"docstring": ":type matrix: List[List[int]] :type k: int :rtype: int",
"name": "kthSmallest_builtin_heapq",
"signature": "def kthSmallest_b... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int
- def kthSmallest_builtin_heapq(self, matrix, k): :type matrix: List[List[int]] :type k: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int
- def kthSmallest_builtin_heapq(self, matrix, k): :type matrix: List[List[int]] :type k: ... | 0a7aa09a2b95e4caca5b5123fb735ceb5c01e992 | <|skeleton|>
class Solution:
def kthSmallest(self, matrix, k):
""":type matrix: List[List[int]] :type k: int :rtype: int"""
<|body_0|>
def kthSmallest_builtin_heapq(self, matrix, k):
""":type matrix: List[List[int]] :type k: int :rtype: int"""
<|body_1|>
def kthSmallest_He... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kthSmallest(self, matrix, k):
""":type matrix: List[List[int]] :type k: int :rtype: int"""
n = len(matrix)
m = len(matrix[0])
ans = 0
left, right = (matrix[0][0], matrix[n - 1][m - 1])
while left <= right:
mid = (left + right) / 2
... | the_stack_v2_python_sparse | kth-smallest-element-in-a-sorted-matrix.py | onestarshang/leetcode | train | 0 | |
4d13badb9b807ef64ab8e423f7786e3dcc5187d3 | [
"if cfg is None:\n return None\nreturn build_from_cfg(cfg, PIPELINES)",
"if cfg is None:\n return None\nreturn build_from_cfg(cfg, PIPELINES)"
] | <|body_start_0|>
if cfg is None:
return None
return build_from_cfg(cfg, PIPELINES)
<|end_body_0|>
<|body_start_1|>
if cfg is None:
return None
return build_from_cfg(cfg, PIPELINES)
<|end_body_1|>
| Load and resize image & annotation with cache support. | LoadResizeDataFromOTXDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadResizeDataFromOTXDataset:
"""Load and resize image & annotation with cache support."""
def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]:
"""Creates resize operation."""
<|body_0|>
def _create_resize_op(self, cfg: Optional[Dict]) -> Optional[Any]:
... | stack_v2_sparse_classes_36k_train_005125 | 4,748 | permissive | [
{
"docstring": "Creates resize operation.",
"name": "_create_load_ann_op",
"signature": "def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]"
},
{
"docstring": "Creates resize operation.",
"name": "_create_resize_op",
"signature": "def _create_resize_op(self, cfg: Optiona... | 2 | null | Implement the Python class `LoadResizeDataFromOTXDataset` described below.
Class description:
Load and resize image & annotation with cache support.
Method signatures and docstrings:
- def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]: Creates resize operation.
- def _create_resize_op(self, cfg: Opt... | Implement the Python class `LoadResizeDataFromOTXDataset` described below.
Class description:
Load and resize image & annotation with cache support.
Method signatures and docstrings:
- def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]: Creates resize operation.
- def _create_resize_op(self, cfg: Opt... | 80454808b38727e358e8b880043eeac0f18152fb | <|skeleton|>
class LoadResizeDataFromOTXDataset:
"""Load and resize image & annotation with cache support."""
def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]:
"""Creates resize operation."""
<|body_0|>
def _create_resize_op(self, cfg: Optional[Dict]) -> Optional[Any]:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadResizeDataFromOTXDataset:
"""Load and resize image & annotation with cache support."""
def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]:
"""Creates resize operation."""
if cfg is None:
return None
return build_from_cfg(cfg, PIPELINES)
def _c... | the_stack_v2_python_sparse | src/otx/algorithms/detection/adapters/mmdet/datasets/pipelines/load_pipelines.py | openvinotoolkit/training_extensions | train | 397 |
c0378ebd4b34c9de25c61a7b5fe7083c3ba1fbea | [
"azimuthT = self.app.mount.obsSite.AzTarget\naltitudeT = self.app.mount.obsSite.AltTarget\nif azimuthT is None or altitudeT is None:\n return False\nazimuthT = azimuthT.degrees\naltitudeT = altitudeT.degrees\nif self.app.deviceStat['dome']:\n delta = self.app.dome.slewDome(altitude=altitudeT, azimuth=azimuthT... | <|body_start_0|>
azimuthT = self.app.mount.obsSite.AzTarget
altitudeT = self.app.mount.obsSite.AltTarget
if azimuthT is None or altitudeT is None:
return False
azimuthT = azimuthT.degrees
altitudeT = altitudeT.degrees
if self.app.deviceStat['dome']:
... | SlewInterface | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlewInterface:
def slewSelectedTargetWithDome(self, slewType='normal'):
""":param slewType: :return: success"""
<|body_0|>
def slewTargetAltAz(self, alt, az, slewType='normal'):
""":param alt: :param az: :param slewType: :return:"""
<|body_1|>
def slewTa... | stack_v2_sparse_classes_36k_train_005126 | 3,313 | permissive | [
{
"docstring": ":param slewType: :return: success",
"name": "slewSelectedTargetWithDome",
"signature": "def slewSelectedTargetWithDome(self, slewType='normal')"
},
{
"docstring": ":param alt: :param az: :param slewType: :return:",
"name": "slewTargetAltAz",
"signature": "def slewTargetAl... | 3 | null | Implement the Python class `SlewInterface` described below.
Class description:
Implement the SlewInterface class.
Method signatures and docstrings:
- def slewSelectedTargetWithDome(self, slewType='normal'): :param slewType: :return: success
- def slewTargetAltAz(self, alt, az, slewType='normal'): :param alt: :param a... | Implement the Python class `SlewInterface` described below.
Class description:
Implement the SlewInterface class.
Method signatures and docstrings:
- def slewSelectedTargetWithDome(self, slewType='normal'): :param slewType: :return: success
- def slewTargetAltAz(self, alt, az, slewType='normal'): :param alt: :param a... | bcdd2d0031998661db716247ed2b0051ec9fe11f | <|skeleton|>
class SlewInterface:
def slewSelectedTargetWithDome(self, slewType='normal'):
""":param slewType: :return: success"""
<|body_0|>
def slewTargetAltAz(self, alt, az, slewType='normal'):
""":param alt: :param az: :param slewType: :return:"""
<|body_1|>
def slewTa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SlewInterface:
def slewSelectedTargetWithDome(self, slewType='normal'):
""":param slewType: :return: success"""
azimuthT = self.app.mount.obsSite.AzTarget
altitudeT = self.app.mount.obsSite.AltTarget
if azimuthT is None or altitudeT is None:
return False
azi... | the_stack_v2_python_sparse | mw4/gui/utilities/slewInterface.py | mworion/MountWizzard4 | train | 28 | |
96642396542ac5c831ca466d4a8c4e187d4156b0 | [
"self.MIN_DIM = PRIOR_BOX_CONFIG['MIN_DIM']\nself.ASPECT_RATIOS = PRIOR_BOX_CONFIG['ASPECT_RATIOS']\nself.NUM_PRIOR = len(PRIOR_BOX_CONFIG['ASPECT_RATIOS'])\nself.VARIANCE = PRIOR_BOX_CONFIG['VARIANCE'] or [0.1]\nfor v in self.VARIANCE:\n if v <= 0:\n raise ValueError('Variances must be greater than 0 !')... | <|body_start_0|>
self.MIN_DIM = PRIOR_BOX_CONFIG['MIN_DIM']
self.ASPECT_RATIOS = PRIOR_BOX_CONFIG['ASPECT_RATIOS']
self.NUM_PRIOR = len(PRIOR_BOX_CONFIG['ASPECT_RATIOS'])
self.VARIANCE = PRIOR_BOX_CONFIG['VARIANCE'] or [0.1]
for v in self.VARIANCE:
if v <= 0:
... | 通过config得到一组候选框 | PriorBox | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PriorBox:
"""通过config得到一组候选框"""
def __init__(self, PRIOR_BOX_CONFIG):
"""PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置"""
<|body_0|>
def __call__(self):
"""调用并获取所有prior_boxes"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.MIN_DIM = PRIOR_BOX_CONFIG['... | stack_v2_sparse_classes_36k_train_005127 | 15,697 | permissive | [
{
"docstring": "PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置",
"name": "__init__",
"signature": "def __init__(self, PRIOR_BOX_CONFIG)"
},
{
"docstring": "调用并获取所有prior_boxes",
"name": "__call__",
"signature": "def __call__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000178 | Implement the Python class `PriorBox` described below.
Class description:
通过config得到一组候选框
Method signatures and docstrings:
- def __init__(self, PRIOR_BOX_CONFIG): PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置
- def __call__(self): 调用并获取所有prior_boxes | Implement the Python class `PriorBox` described below.
Class description:
通过config得到一组候选框
Method signatures and docstrings:
- def __init__(self, PRIOR_BOX_CONFIG): PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置
- def __call__(self): 调用并获取所有prior_boxes
<|skeleton|>
class PriorBox:
"""通过config得到一组候选框"""
def __init__(self... | d8a4f815d756476f99d5297f057853b03743e9c7 | <|skeleton|>
class PriorBox:
"""通过config得到一组候选框"""
def __init__(self, PRIOR_BOX_CONFIG):
"""PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置"""
<|body_0|>
def __call__(self):
"""调用并获取所有prior_boxes"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PriorBox:
"""通过config得到一组候选框"""
def __init__(self, PRIOR_BOX_CONFIG):
"""PROIR_BOX_CONFIG从yaml读取全局配置中的候选框设置"""
self.MIN_DIM = PRIOR_BOX_CONFIG['MIN_DIM']
self.ASPECT_RATIOS = PRIOR_BOX_CONFIG['ASPECT_RATIOS']
self.NUM_PRIOR = len(PRIOR_BOX_CONFIG['ASPECT_RATIOS'])
... | the_stack_v2_python_sparse | models/SSD/ssd_utils.py | albert-jin/CvT-SSD | train | 0 |
22731bac2ac0d2eca0cd8477f9780b252418d60f | [
"data = Data()\ndata.setup()\nsam_file = open(data.sam_filename, 'w')\ndata.write_sam_header(sam_file)\ndata.write_sam_read(sam_file)\nsam_file.close()\nsam_file = pysam.Samfile(data.sam_filename)\nread = sam_file.next()\nsnp_tab = snptable.SNPTable()\nsnp_tab.read_file(data.snp_filename)\nsnp_idx, snp_read_pos, in... | <|body_start_0|>
data = Data()
data.setup()
sam_file = open(data.sam_filename, 'w')
data.write_sam_header(sam_file)
data.write_sam_read(sam_file)
sam_file.close()
sam_file = pysam.Samfile(data.sam_filename)
read = sam_file.next()
snp_tab = snptable... | TestGetOverlappingSNPs | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGetOverlappingSNPs:
def test_get_overlapping_snps_simple(self):
"""Do a simple test of getting 2 overlapping SNPs with a read with 30 matches"""
<|body_0|>
def test_get_overlapping_snps_intron(self):
"""Test a read spanning an intron (N in CIGAR string)"""
... | stack_v2_sparse_classes_36k_train_005128 | 8,182 | permissive | [
{
"docstring": "Do a simple test of getting 2 overlapping SNPs with a read with 30 matches",
"name": "test_get_overlapping_snps_simple",
"signature": "def test_get_overlapping_snps_simple(self)"
},
{
"docstring": "Test a read spanning an intron (N in CIGAR string)",
"name": "test_get_overlap... | 4 | stack_v2_sparse_classes_30k_train_007041 | Implement the Python class `TestGetOverlappingSNPs` described below.
Class description:
Implement the TestGetOverlappingSNPs class.
Method signatures and docstrings:
- def test_get_overlapping_snps_simple(self): Do a simple test of getting 2 overlapping SNPs with a read with 30 matches
- def test_get_overlapping_snps... | Implement the Python class `TestGetOverlappingSNPs` described below.
Class description:
Implement the TestGetOverlappingSNPs class.
Method signatures and docstrings:
- def test_get_overlapping_snps_simple(self): Do a simple test of getting 2 overlapping SNPs with a read with 30 matches
- def test_get_overlapping_snps... | eb963631fb0f832dcf48715962650bdb7d0f9441 | <|skeleton|>
class TestGetOverlappingSNPs:
def test_get_overlapping_snps_simple(self):
"""Do a simple test of getting 2 overlapping SNPs with a read with 30 matches"""
<|body_0|>
def test_get_overlapping_snps_intron(self):
"""Test a read spanning an intron (N in CIGAR string)"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGetOverlappingSNPs:
def test_get_overlapping_snps_simple(self):
"""Do a simple test of getting 2 overlapping SNPs with a read with 30 matches"""
data = Data()
data.setup()
sam_file = open(data.sam_filename, 'w')
data.write_sam_header(sam_file)
data.write_sam... | the_stack_v2_python_sparse | WASP/mapping/test_snptable.py | QiYanPitt/CHIT | train | 3 | |
c36ea0829047d4bebdf8d60fa3a1cf947994a168 | [
"super(DCGANCritic, self).__init__()\nassert img_size == 64, 'Works only for 64x64 images'\nself.img_size = img_size\nself.channels = channels\nkernel_size = (5, 5)\nstride = (2, 2)\npadding_mode = 'replicate'\nself.conv1 = nn.Conv2d(self.channels, 64, kernel_size, stride, padding_mode=padding_mode)\nself.conv2 = n... | <|body_start_0|>
super(DCGANCritic, self).__init__()
assert img_size == 64, 'Works only for 64x64 images'
self.img_size = img_size
self.channels = channels
kernel_size = (5, 5)
stride = (2, 2)
padding_mode = 'replicate'
self.conv1 = nn.Conv2d(self.channels... | DCGANCritic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DCGANCritic:
def __init__(self, img_size, channels):
"""DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :param channels:"""
<|body_0|>
def forward(self, image):
"""Works only for 64x64 :... | stack_v2_sparse_classes_36k_train_005129 | 2,726 | no_license | [
{
"docstring": "DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :param channels:",
"name": "__init__",
"signature": "def __init__(self, img_size, channels)"
},
{
"docstring": "Works only for 64x64 :param image: :par... | 2 | stack_v2_sparse_classes_30k_train_010968 | Implement the Python class `DCGANCritic` described below.
Class description:
Implement the DCGANCritic class.
Method signatures and docstrings:
- def __init__(self, img_size, channels): DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :pa... | Implement the Python class `DCGANCritic` described below.
Class description:
Implement the DCGANCritic class.
Method signatures and docstrings:
- def __init__(self, img_size, channels): DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :pa... | 43a453a03060c2adf6bf16302d5138cfa77a30d1 | <|skeleton|>
class DCGANCritic:
def __init__(self, img_size, channels):
"""DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :param channels:"""
<|body_0|>
def forward(self, image):
"""Works only for 64x64 :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DCGANCritic:
def __init__(self, img_size, channels):
"""DCGAN is only defined for 64x64 images, it takes the img_size and channels here only not to break the interface :param img_size: :param channels:"""
super(DCGANCritic, self).__init__()
assert img_size == 64, 'Works only for 64x64 ... | the_stack_v2_python_sparse | workshops/gan/src/critics.py | Petlja/PSIML | train | 17 | |
5a03b84ccc164267a9c70d7c74959e46856c1373 | [
"if alias is None:\n return 'Error: No alias found'\nreturn '%s/%s' % (DataverseUtil.URL_BASE, alias)",
"if alias is None:\n return None\nurl_path = reverse('view_dataverse_by_alias_api', kwargs=dict(alias=alias))\nreturn '%s://%s%s' % (settings.SWAGGER_SCHEME, settings.SWAGGER_HOST, url_path)"
] | <|body_start_0|>
if alias is None:
return 'Error: No alias found'
return '%s/%s' % (DataverseUtil.URL_BASE, alias)
<|end_body_0|>
<|body_start_1|>
if alias is None:
return None
url_path = reverse('view_dataverse_by_alias_api', kwargs=dict(alias=alias))
re... | DataverseUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataverseUtil:
def get_dataverse_link(alias):
"""Format a link to this Dataverse"""
<|body_0|>
def get_dataverse_serialization_link(alias):
"""Format a link to this Dataverse"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if alias is None:
... | stack_v2_sparse_classes_36k_train_005130 | 875 | no_license | [
{
"docstring": "Format a link to this Dataverse",
"name": "get_dataverse_link",
"signature": "def get_dataverse_link(alias)"
},
{
"docstring": "Format a link to this Dataverse",
"name": "get_dataverse_serialization_link",
"signature": "def get_dataverse_serialization_link(alias)"
}
] | 2 | null | Implement the Python class `DataverseUtil` described below.
Class description:
Implement the DataverseUtil class.
Method signatures and docstrings:
- def get_dataverse_link(alias): Format a link to this Dataverse
- def get_dataverse_serialization_link(alias): Format a link to this Dataverse | Implement the Python class `DataverseUtil` described below.
Class description:
Implement the DataverseUtil class.
Method signatures and docstrings:
- def get_dataverse_link(alias): Format a link to this Dataverse
- def get_dataverse_serialization_link(alias): Format a link to this Dataverse
<|skeleton|>
class Datave... | 2a17e5ba918d6d1c7d38c192e0504e6cd96b32d2 | <|skeleton|>
class DataverseUtil:
def get_dataverse_link(alias):
"""Format a link to this Dataverse"""
<|body_0|>
def get_dataverse_serialization_link(alias):
"""Format a link to this Dataverse"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataverseUtil:
def get_dataverse_link(alias):
"""Format a link to this Dataverse"""
if alias is None:
return 'Error: No alias found'
return '%s/%s' % (DataverseUtil.URL_BASE, alias)
def get_dataverse_serialization_link(alias):
"""Format a link to this Dataverse... | the_stack_v2_python_sparse | dv_apps/dataverses/util.py | IQSS/miniverse | train | 3 | |
abd474c681f56ff16b1b5c1b17ceb539be58b875 | [
"with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=slim.l2_regularizer(weight_decay), biases_initializer=tf.zeros_initializer()):\n with slim.arg_scope([slim.conv2d], padding='SAME') as arg_sc:\n return arg_sc",
"resized = tf.image.resize_images(tenso... | <|body_start_0|>
with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=slim.l2_regularizer(weight_decay), biases_initializer=tf.zeros_initializer()):
with slim.arg_scope([slim.conv2d], padding='SAME') as arg_sc:
return arg_sc
<|end_bod... | DepthVgg | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DepthVgg:
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
<|body_0|>
def preprocess_input(self, tensor_in, output_size):
"""Preprocesses the given input. Args... | stack_v2_sparse_classes_36k_train_005131 | 6,253 | no_license | [
{
"docstring": "Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope.",
"name": "vgg_arg_scope",
"signature": "def vgg_arg_scope(self, weight_decay=0.0005)"
},
{
"docstring": "Preprocesses the given input. Args: tensor_in: A `Tensor` of shape=(b... | 3 | stack_v2_sparse_classes_30k_train_021275 | Implement the Python class `DepthVgg` described below.
Class description:
Implement the DepthVgg class.
Method signatures and docstrings:
- def vgg_arg_scope(self, weight_decay=0.0005): Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope.
- def preprocess_input(self... | Implement the Python class `DepthVgg` described below.
Class description:
Implement the DepthVgg class.
Method signatures and docstrings:
- def vgg_arg_scope(self, weight_decay=0.0005): Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope.
- def preprocess_input(self... | ac8256bd76fe4b81cfc48dc4c0b9d9dc92bc61c6 | <|skeleton|>
class DepthVgg:
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
<|body_0|>
def preprocess_input(self, tensor_in, output_size):
"""Preprocesses the given input. Args... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DepthVgg:
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=slim.l2_regularizer(weig... | the_stack_v2_python_sparse | mlod/core/feature_extractors/depth_vgg.py | songsanling/MLOD | train | 0 | |
90f2ae134d6af0ec71b0def9c901600c34b92e5c | [
"study_id = filter_params.pop('study_id', None)\nbiospecimen_id = filter_params.pop('biospecimen_id', None)\nq = Diagnosis.query.filter_by(**filter_params)\nfrom dataservice.api.participant.models import Participant\nfrom dataservice.api.biospecimen.models import BiospecimenDiagnosis\nif study_id:\n q = q.join(P... | <|body_start_0|>
study_id = filter_params.pop('study_id', None)
biospecimen_id = filter_params.pop('biospecimen_id', None)
q = Diagnosis.query.filter_by(**filter_params)
from dataservice.api.participant.models import Participant
from dataservice.api.biospecimen.models import Bios... | Diagnosis REST API | DiagnosisListAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiagnosisListAPI:
"""Diagnosis REST API"""
def get(self, filter_params, after, limit):
"""Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis"""
<|body_0|>
def post(self):
"""Create a new diagnosis ---... | stack_v2_sparse_classes_36k_train_005132 | 5,021 | permissive | [
{
"docstring": "Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis",
"name": "get",
"signature": "def get(self, filter_params, after, limit)"
},
{
"docstring": "Create a new diagnosis --- template: path: new_resource.yml properties: ... | 2 | stack_v2_sparse_classes_30k_train_005360 | Implement the Python class `DiagnosisListAPI` described below.
Class description:
Diagnosis REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis
- def post(self): Creat... | Implement the Python class `DiagnosisListAPI` described below.
Class description:
Diagnosis REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis
- def post(self): Creat... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class DiagnosisListAPI:
"""Diagnosis REST API"""
def get(self, filter_params, after, limit):
"""Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis"""
<|body_0|>
def post(self):
"""Create a new diagnosis ---... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiagnosisListAPI:
"""Diagnosis REST API"""
def get(self, filter_params, after, limit):
"""Get all diagnoses --- description: Get all diagnoses template: path: get_list.yml properties: resource: Diagnosis"""
study_id = filter_params.pop('study_id', None)
biospecimen_id = filter_par... | the_stack_v2_python_sparse | dataservice/api/diagnosis/resources.py | kids-first/kf-api-dataservice | train | 9 |
c85d731c0b071cb80a1b5e663fb34471d0d9573b | [
"for res in self:\n if res.start_date:\n start_date = str(res.start_date)\n res.date_code = '{}/{}'.format(start_date[:4], start_date[5:7])",
"for res in self:\n count_num = self.search_count([('employee_id', '=', res.employee_id.id), ('date_code', '=', res.date_code)])\n if count_num > 1:\... | <|body_start_0|>
for res in self:
if res.start_date:
start_date = str(res.start_date)
res.date_code = '{}/{}'.format(start_date[:4], start_date[5:7])
<|end_body_0|>
<|body_start_1|>
for res in self:
count_num = self.search_count([('employee_id', '... | WageSpecialAdditionalDeduction | [
"Apache-2.0",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WageSpecialAdditionalDeduction:
def _alter_date_code(self):
"""根据开始日期生成期间代码 :return:"""
<|body_0|>
def _constranint_employee(self):
"""检查员工同一期间是否存在多条记录 :return:"""
<|body_1|>
def _compute_total_tax_deduction(self):
"""计算个税抵扣总额 :return:"""
... | stack_v2_sparse_classes_36k_train_005133 | 3,698 | permissive | [
{
"docstring": "根据开始日期生成期间代码 :return:",
"name": "_alter_date_code",
"signature": "def _alter_date_code(self)"
},
{
"docstring": "检查员工同一期间是否存在多条记录 :return:",
"name": "_constranint_employee",
"signature": "def _constranint_employee(self)"
},
{
"docstring": "计算个税抵扣总额 :return:",
... | 3 | null | Implement the Python class `WageSpecialAdditionalDeduction` described below.
Class description:
Implement the WageSpecialAdditionalDeduction class.
Method signatures and docstrings:
- def _alter_date_code(self): 根据开始日期生成期间代码 :return:
- def _constranint_employee(self): 检查员工同一期间是否存在多条记录 :return:
- def _compute_total_ta... | Implement the Python class `WageSpecialAdditionalDeduction` described below.
Class description:
Implement the WageSpecialAdditionalDeduction class.
Method signatures and docstrings:
- def _alter_date_code(self): 根据开始日期生成期间代码 :return:
- def _constranint_employee(self): 检查员工同一期间是否存在多条记录 :return:
- def _compute_total_ta... | 8608aaeae7a8c86d53b68ce26b7b308f779c3dd8 | <|skeleton|>
class WageSpecialAdditionalDeduction:
def _alter_date_code(self):
"""根据开始日期生成期间代码 :return:"""
<|body_0|>
def _constranint_employee(self):
"""检查员工同一期间是否存在多条记录 :return:"""
<|body_1|>
def _compute_total_tax_deduction(self):
"""计算个税抵扣总额 :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WageSpecialAdditionalDeduction:
def _alter_date_code(self):
"""根据开始日期生成期间代码 :return:"""
for res in self:
if res.start_date:
start_date = str(res.start_date)
res.date_code = '{}/{}'.format(start_date[:4], start_date[5:7])
def _constranint_employe... | the_stack_v2_python_sparse | odoo_wage_manage/models/wage_special_additional_deduction.py | niulinlnc/odooExtModel | train | 4 | |
0e0245ebcdf211999cd46c9f89c3f1e2b87156c1 | [
"if not root1:\n return root2\nif not root2:\n return root1\nmerged = TreeNode(root1.val + root2.val)\nmerged.left = self.mergeTrees(root1.left, root2.left)\nmerged.right = self.mergeTrees(root1.right, root2.right)\nreturn merged",
"if not root1:\n return root2\nif not root2:\n return root1\nmerged = ... | <|body_start_0|>
if not root1:
return root2
if not root2:
return root1
merged = TreeNode(root1.val + root2.val)
merged.left = self.mergeTrees(root1.left, root2.left)
merged.right = self.mergeTrees(root1.right, root2.right)
return merged
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTrees_DFS(self, root1, root2):
"""time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode"""
<|body_0|>
def mergeTrees_BFS(self, root1, root2):
""":param root1: :param root2: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_005134 | 1,982 | no_license | [
{
"docstring": "time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode",
"name": "mergeTrees_DFS",
"signature": "def mergeTrees_DFS(self, root1, root2)"
},
{
"docstring": ":param root1: :param root2: :return:",
"name": "mergeTrees_BFS",
"signatu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTrees_DFS(self, root1, root2): time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode
- def mergeTrees_BFS(self, root1, root2)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTrees_DFS(self, root1, root2): time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode
- def mergeTrees_BFS(self, root1, root2)... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def mergeTrees_DFS(self, root1, root2):
"""time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode"""
<|body_0|>
def mergeTrees_BFS(self, root1, root2):
""":param root1: :param root2: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTrees_DFS(self, root1, root2):
"""time O(min(M, N)) space O(min(m, n)) :type root1: TreeNode :type root2: TreeNode :rtype: TreeNode"""
if not root1:
return root2
if not root2:
return root1
merged = TreeNode(root1.val + root2.val)
... | the_stack_v2_python_sparse | LeetCode/Tree/617_merge_two_binary_trees.py | XyK0907/for_work | train | 0 | |
6746db38c54c1a7d9e7b14895eed7294e7ed2562 | [
"cls.file_interfaces['.yaml'] = YamlInterface()\ncls.file_interfaces['.bin'] = PickleInterface()\nFileManager.initialized = True",
"if not filename:\n raise FileNotFoundError('No filename provided')\nif not FileManager.initialized:\n FileManager.init()\next = os.path.splitext(filename)[1]\nif not os.path.is... | <|body_start_0|>
cls.file_interfaces['.yaml'] = YamlInterface()
cls.file_interfaces['.bin'] = PickleInterface()
FileManager.initialized = True
<|end_body_0|>
<|body_start_1|>
if not filename:
raise FileNotFoundError('No filename provided')
if not FileManager.initiali... | Manages file interfaces. | FileManager | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileManager:
"""Manages file interfaces."""
def init(cls):
"""Initialise file interfaces."""
<|body_0|>
def locate_file(filename) -> str:
"""Find a file location. Args: ---- filename: Filename to locate Returns: Location of file"""
<|body_1|>
def get... | stack_v2_sparse_classes_36k_train_005135 | 3,664 | permissive | [
{
"docstring": "Initialise file interfaces.",
"name": "init",
"signature": "def init(cls)"
},
{
"docstring": "Find a file location. Args: ---- filename: Filename to locate Returns: Location of file",
"name": "locate_file",
"signature": "def locate_file(filename) -> str"
},
{
"doc... | 5 | stack_v2_sparse_classes_30k_train_009066 | Implement the Python class `FileManager` described below.
Class description:
Manages file interfaces.
Method signatures and docstrings:
- def init(cls): Initialise file interfaces.
- def locate_file(filename) -> str: Find a file location. Args: ---- filename: Filename to locate Returns: Location of file
- def get_fil... | Implement the Python class `FileManager` described below.
Class description:
Manages file interfaces.
Method signatures and docstrings:
- def init(cls): Initialise file interfaces.
- def locate_file(filename) -> str: Find a file location. Args: ---- filename: Filename to locate Returns: Location of file
- def get_fil... | 9f90c8b1586363b65340017bfa3af5d56d32c6d9 | <|skeleton|>
class FileManager:
"""Manages file interfaces."""
def init(cls):
"""Initialise file interfaces."""
<|body_0|>
def locate_file(filename) -> str:
"""Find a file location. Args: ---- filename: Filename to locate Returns: Location of file"""
<|body_1|>
def get... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileManager:
"""Manages file interfaces."""
def init(cls):
"""Initialise file interfaces."""
cls.file_interfaces['.yaml'] = YamlInterface()
cls.file_interfaces['.bin'] = PickleInterface()
FileManager.initialized = True
def locate_file(filename) -> str:
"""Find... | the_stack_v2_python_sparse | mpf/core/file_manager.py | missionpinball/mpf | train | 191 |
45f0b1251dcc5b663dccc317fb7265208511a973 | [
"self.postgres_accessor = PostgreSQLAccessor()\nself.influxdb_accessor = InfluxDBAccessor()\nself.mongo_accessor = MongoDBAccessor()",
"imported_data_list = PostgreSQLAccessor.get_imported_data_record(imported_data_id)\nif len(imported_data_list) != 1:\n return\nimported_data = imported_data_list[0]\nreturn im... | <|body_start_0|>
self.postgres_accessor = PostgreSQLAccessor()
self.influxdb_accessor = InfluxDBAccessor()
self.mongo_accessor = MongoDBAccessor()
<|end_body_0|>
<|body_start_1|>
imported_data_list = PostgreSQLAccessor.get_imported_data_record(imported_data_id)
if len(imported_d... | BaseAnalyzer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseAnalyzer:
def __init__(self):
"""initialize"""
<|body_0|>
def get_imported_data(self, imported_data_id=-1):
"""走行データ管理DBから指定されたIDのレコードを取得する :param imported_data_id: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.postgres_accessor ... | stack_v2_sparse_classes_36k_train_005136 | 853 | permissive | [
{
"docstring": "initialize",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "走行データ管理DBから指定されたIDのレコードを取得する :param imported_data_id: :return:",
"name": "get_imported_data",
"signature": "def get_imported_data(self, imported_data_id=-1)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000377 | Implement the Python class `BaseAnalyzer` described below.
Class description:
Implement the BaseAnalyzer class.
Method signatures and docstrings:
- def __init__(self): initialize
- def get_imported_data(self, imported_data_id=-1): 走行データ管理DBから指定されたIDのレコードを取得する :param imported_data_id: :return: | Implement the Python class `BaseAnalyzer` described below.
Class description:
Implement the BaseAnalyzer class.
Method signatures and docstrings:
- def __init__(self): initialize
- def get_imported_data(self, imported_data_id=-1): 走行データ管理DBから指定されたIDのレコードを取得する :param imported_data_id: :return:
<|skeleton|>
class Base... | 588fc9d254b913548159bcd01c5b34bd1c5cbc73 | <|skeleton|>
class BaseAnalyzer:
def __init__(self):
"""initialize"""
<|body_0|>
def get_imported_data(self, imported_data_id=-1):
"""走行データ管理DBから指定されたIDのレコードを取得する :param imported_data_id: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseAnalyzer:
def __init__(self):
"""initialize"""
self.postgres_accessor = PostgreSQLAccessor()
self.influxdb_accessor = InfluxDBAccessor()
self.mongo_accessor = MongoDBAccessor()
def get_imported_data(self, imported_data_id=-1):
"""走行データ管理DBから指定されたIDのレコードを取得する :p... | the_stack_v2_python_sparse | Zipc_airflow/src/analyzer/base_analayzer.py | open-garden/garden | train | 16 | |
1835ccb8ec950e5870c618545c1c313a9ccd9908 | [
"scan_request = cls._index.search().query(MatchAll())\nresponse = scan_request.scan()\nreturn response",
"hits = cls.scan()\ncounter = 0\nfor hit in hits:\n hit.delete()\n counter += 1\nreturn counter"
] | <|body_start_0|>
scan_request = cls._index.search().query(MatchAll())
response = scan_request.scan()
return response
<|end_body_0|>
<|body_start_1|>
hits = cls.scan()
counter = 0
for hit in hits:
hit.delete()
counter += 1
return counter
<|... | Base class for our interactions with ElasticSearch indexes. | BarbadosIndex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BarbadosIndex:
"""Base class for our interactions with ElasticSearch indexes."""
def scan(cls):
"""Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)"""
<|body_0|>
def delete_all(cls):
"""Delet... | stack_v2_sparse_classes_36k_train_005137 | 1,437 | no_license | [
{
"docstring": "Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)",
"name": "scan",
"signature": "def scan(cls)"
},
{
"docstring": "Delete all documents within this index. :return: Count of the documents that were deleted.",
... | 2 | null | Implement the Python class `BarbadosIndex` described below.
Class description:
Base class for our interactions with ElasticSearch indexes.
Method signatures and docstrings:
- def scan(cls): Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)
- def d... | Implement the Python class `BarbadosIndex` described below.
Class description:
Base class for our interactions with ElasticSearch indexes.
Method signatures and docstrings:
- def scan(cls): Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)
- def d... | 343f8fd4ac1f18e5e93d519cbc064693280e4d00 | <|skeleton|>
class BarbadosIndex:
"""Base class for our interactions with ElasticSearch indexes."""
def scan(cls):
"""Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)"""
<|body_0|>
def delete_all(cls):
"""Delet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BarbadosIndex:
"""Base class for our interactions with ElasticSearch indexes."""
def scan(cls):
"""Return a list of all documents within this index. :return: Generator that will yield every document (as a list... kinda)"""
scan_request = cls._index.search().query(MatchAll())
respo... | the_stack_v2_python_sparse | barbados/indexes/base.py | cohoe/barbados | train | 0 |
d7a1abebb9fbbc6bab0f12024a19f9fb0f64a6af | [
"logger.info('Loading keras model {}'.format(path_to_hdf5))\nself.sess = tf.Session()\nself.graph = tf.get_default_graph()\nset_session(self.sess)\nself.model = load_model(path_to_hdf5)\ninput_size = self.model.input.shape.as_list()\nself.img_height = input_size[1]\nself.img_width = input_size[2]",
"img_resized =... | <|body_start_0|>
logger.info('Loading keras model {}'.format(path_to_hdf5))
self.sess = tf.Session()
self.graph = tf.get_default_graph()
set_session(self.sess)
self.model = load_model(path_to_hdf5)
input_size = self.model.input.shape.as_list()
self.img_height = in... | This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session} -- Tensorflow session graph {tf.Graph} -- Tensorflow graph model -- Keras model ... | KerasPredictor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasPredictor:
"""This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session} -- Tensorflow session graph {tf.Graph}... | stack_v2_sparse_classes_36k_train_005138 | 3,529 | no_license | [
{
"docstring": "Constructor of the class. Arguments: path_to_hdf5 {str} -- Path to the model file.",
"name": "__init__",
"signature": "def __init__(self, path_to_hdf5)"
},
{
"docstring": "Make a prediction of a velocity based on an input images. The model takes the image one of the robot's camer... | 2 | stack_v2_sparse_classes_30k_train_021326 | Implement the Python class `KerasPredictor` described below.
Class description:
This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session}... | Implement the Python class `KerasPredictor` described below.
Class description:
This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session}... | a6e40f9778284426a15c05ef362dde243e687888 | <|skeleton|>
class KerasPredictor:
"""This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session} -- Tensorflow session graph {tf.Graph}... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KerasPredictor:
"""This class takes care of the prediction of the models that controls the behaviors of the robots. It's used for keras-based models and it's meant to predict a value (tipically a velocity) based on image inputs. Attributes: sess {tf.Session} -- Tensorflow session graph {tf.Graph} -- Tensorflo... | the_stack_v2_python_sparse | behavior_studio/behaviorlib/keraslib/keras_predict.py | dcharrezt/BehaviorStudio | train | 0 |
fbd39967815ccac87f48331adc11ed4bbc4ac4bc | [
"if root is None:\n return ''\ns = ''\nQ = [root]\nwhile Q:\n current = Q.pop(0)\n if current is not None:\n s += str(current.val) + ','\n if current.left:\n Q.append(current.left)\n else:\n Q.append(None)\n if current.right:\n Q.append(current.r... | <|body_start_0|>
if root is None:
return ''
s = ''
Q = [root]
while Q:
current = Q.pop(0)
if current is not None:
s += str(current.val) + ','
if current.left:
Q.append(current.left)
el... | 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_005139 | 1,896 | 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:... | 0297c25492edb597c2c5210c83a2410df907ec90 | <|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"""
if root is None:
return ''
s = ''
Q = [root]
while Q:
current = Q.pop(0)
if current is not None:
s += str(curr... | the_stack_v2_python_sparse | serialize-and-deserialize-binary-tree.py | dianaevergreen/1337code | train | 0 | |
0674ae203e6262e52e983b31a0ed850db64eef8e | [
"self.path = path\nself.periods = periods\nself.timespan = timespan",
"with open(self.path, 'w') as fh:\n root = etree.Element('nrml', nsmap=xml.NSMAP)\n root.set('%sid' % xml.GML, 'n1')\n uhs_rs = etree.SubElement(root, 'uhsResultSet')\n uhs_periods = etree.SubElement(uhs_rs, 'uhsPeriods')\n uhs_p... | <|body_start_0|>
self.path = path
self.periods = periods
self.timespan = timespan
<|end_body_0|>
<|body_start_1|>
with open(self.path, 'w') as fh:
root = etree.Element('nrml', nsmap=xml.NSMAP)
root.set('%sid' % xml.GML, 'n1')
uhs_rs = etree.SubElement... | Writes UHS results to the defined NRML format. | UHSXMLWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UHSXMLWriter:
"""Writes UHS results to the defined NRML format."""
def __init__(self, path, periods, timespan):
""":param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`float` types) associated with the calculation which produce... | stack_v2_sparse_classes_36k_train_005140 | 2,468 | no_license | [
{
"docstring": ":param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`float` types) associated with the calculation which produced these results. :param timespan: The value of the INVESTIGATION_TIME parameter used in the job. See :data:`openquake.db.models... | 2 | null | Implement the Python class `UHSXMLWriter` described below.
Class description:
Writes UHS results to the defined NRML format.
Method signatures and docstrings:
- def __init__(self, path, periods, timespan): :param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`fl... | Implement the Python class `UHSXMLWriter` described below.
Class description:
Writes UHS results to the defined NRML format.
Method signatures and docstrings:
- def __init__(self, path, periods, timespan): :param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`fl... | d253f09d7848e6cf32e8c7756551436da413176b | <|skeleton|>
class UHSXMLWriter:
"""Writes UHS results to the defined NRML format."""
def __init__(self, path, periods, timespan):
""":param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`float` types) associated with the calculation which produce... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UHSXMLWriter:
"""Writes UHS results to the defined NRML format."""
def __init__(self, path, periods, timespan):
""":param path: Full path to the resulting XML file (including file name). :param periods: List of UHS periods (`float` types) associated with the calculation which produced these resul... | the_stack_v2_python_sparse | python-oq/openquake/output/uhs.py | arbeit/openquake-packages | train | 1 |
7c7a0f6f19cbdbfc2f15745a2c4c407ced3b3d8d | [
"if hasattr(self._estimator, 'fit_transform') and callable(self._estimator.fit_transform):\n self._make_estimator()\n return self._estimator.fit_transform(X, y=y, **fit_params)\nelse:\n return self._fit(X, y=y, **fit_params).transform(X)",
"if self._get_custom_param('_transform'):\n return self._get_c... | <|body_start_0|>
if hasattr(self._estimator, 'fit_transform') and callable(self._estimator.fit_transform):
self._make_estimator()
return self._estimator.fit_transform(X, y=y, **fit_params)
else:
return self._fit(X, y=y, **fit_params).transform(X)
<|end_body_0|>
<|bod... | H2OEstimatorTransformSupport | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class H2OEstimatorTransformSupport:
def fit_transform(self, X, y=None, **fit_params):
"""Fit the model and apply transform on the fitted model. Note that it doesn't convert result back to numpy by default as it is intended to be chained with another H2O transformer or estimator. The transforme... | stack_v2_sparse_classes_36k_train_005141 | 36,832 | permissive | [
{
"docstring": "Fit the model and apply transform on the fitted model. Note that it doesn't convert result back to numpy by default as it is intended to be chained with another H2O transformer or estimator. The transformer should be instantiated with `data_conversion=True` to always obtain numpy objects as resu... | 3 | null | Implement the Python class `H2OEstimatorTransformSupport` described below.
Class description:
Implement the H2OEstimatorTransformSupport class.
Method signatures and docstrings:
- def fit_transform(self, X, y=None, **fit_params): Fit the model and apply transform on the fitted model. Note that it doesn't convert resu... | Implement the Python class `H2OEstimatorTransformSupport` described below.
Class description:
Implement the H2OEstimatorTransformSupport class.
Method signatures and docstrings:
- def fit_transform(self, X, y=None, **fit_params): Fit the model and apply transform on the fitted model. Note that it doesn't convert resu... | d817ab90c8c47f6787604a0b9639b66234158228 | <|skeleton|>
class H2OEstimatorTransformSupport:
def fit_transform(self, X, y=None, **fit_params):
"""Fit the model and apply transform on the fitted model. Note that it doesn't convert result back to numpy by default as it is intended to be chained with another H2O transformer or estimator. The transforme... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class H2OEstimatorTransformSupport:
def fit_transform(self, X, y=None, **fit_params):
"""Fit the model and apply transform on the fitted model. Note that it doesn't convert result back to numpy by default as it is intended to be chained with another H2O transformer or estimator. The transformer should be in... | the_stack_v2_python_sparse | h2o-py/h2o/sklearn/wrapper.py | h2oai/h2o-3 | train | 6,872 | |
e9fa0fe1c40f1288ea1d52dd155dad0eb9897acb | [
"self.login_admin_with_cookie()\nexten_page = extenPage.ExtenPage(self.dr)\ndatas = datainfo.get_xls_to_dict('data_info.xlsx', 'exten_data')[0]\ncnt = exten_page.add_exten(str(datas['extenname']).split('.')[0], str(datas['password']).split('.')[0])\nself.assertEqual(cnt, 1)",
"self.login_admin_with_cookie()\nexte... | <|body_start_0|>
self.login_admin_with_cookie()
exten_page = extenPage.ExtenPage(self.dr)
datas = datainfo.get_xls_to_dict('data_info.xlsx', 'exten_data')[0]
cnt = exten_page.add_exten(str(datas['extenname']).split('.')[0], str(datas['password']).split('.')[0])
self.assertEqual(c... | 分机测试 | TestExten | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestExten:
"""分机测试"""
def test_add_exten(self):
"""添加分机"""
<|body_0|>
def test_modify_exten(self):
"""修改分机-绑定外线"""
<|body_1|>
def test_del_exten(self):
"""删除分机"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.login_admin... | stack_v2_sparse_classes_36k_train_005142 | 1,108 | no_license | [
{
"docstring": "添加分机",
"name": "test_add_exten",
"signature": "def test_add_exten(self)"
},
{
"docstring": "修改分机-绑定外线",
"name": "test_modify_exten",
"signature": "def test_modify_exten(self)"
},
{
"docstring": "删除分机",
"name": "test_del_exten",
"signature": "def test_del_e... | 3 | stack_v2_sparse_classes_30k_train_013821 | Implement the Python class `TestExten` described below.
Class description:
分机测试
Method signatures and docstrings:
- def test_add_exten(self): 添加分机
- def test_modify_exten(self): 修改分机-绑定外线
- def test_del_exten(self): 删除分机 | Implement the Python class `TestExten` described below.
Class description:
分机测试
Method signatures and docstrings:
- def test_add_exten(self): 添加分机
- def test_modify_exten(self): 修改分机-绑定外线
- def test_del_exten(self): 删除分机
<|skeleton|>
class TestExten:
"""分机测试"""
def test_add_exten(self):
"""添加分机"""
... | 91de99c0cba6b339cb95ea2ee4ba7d5b937a4ab6 | <|skeleton|>
class TestExten:
"""分机测试"""
def test_add_exten(self):
"""添加分机"""
<|body_0|>
def test_modify_exten(self):
"""修改分机-绑定外线"""
<|body_1|>
def test_del_exten(self):
"""删除分机"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestExten:
"""分机测试"""
def test_add_exten(self):
"""添加分机"""
self.login_admin_with_cookie()
exten_page = extenPage.ExtenPage(self.dr)
datas = datainfo.get_xls_to_dict('data_info.xlsx', 'exten_data')[0]
cnt = exten_page.add_exten(str(datas['extenname']).split('.')[0],... | the_stack_v2_python_sparse | JustCC/testcase/test_11_admin_exten.py | ganlp/JUST | train | 0 |
e14f5f493f1270683ae216a11c4bef6faf33476c | [
"user_global_prefs = user_domain.UserGlobalPrefs(True, False, True, False)\nself.assertTrue(user_global_prefs.can_receive_email_updates)\nself.assertFalse(user_global_prefs.can_receive_editor_role_email)\nself.assertTrue(user_global_prefs.can_receive_feedback_message_email)\nself.assertFalse(user_global_prefs.can_r... | <|body_start_0|>
user_global_prefs = user_domain.UserGlobalPrefs(True, False, True, False)
self.assertTrue(user_global_prefs.can_receive_email_updates)
self.assertFalse(user_global_prefs.can_receive_editor_role_email)
self.assertTrue(user_global_prefs.can_receive_feedback_message_email)
... | Test domain object for user global email preferences. | UserGlobalPrefsTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserGlobalPrefsTests:
"""Test domain object for user global email preferences."""
def test_initialization(self):
"""Testing init method."""
<|body_0|>
def test_create_default_prefs(self):
"""Testing create_default_prefs."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_005143 | 14,816 | permissive | [
{
"docstring": "Testing init method.",
"name": "test_initialization",
"signature": "def test_initialization(self)"
},
{
"docstring": "Testing create_default_prefs.",
"name": "test_create_default_prefs",
"signature": "def test_create_default_prefs(self)"
}
] | 2 | null | Implement the Python class `UserGlobalPrefsTests` described below.
Class description:
Test domain object for user global email preferences.
Method signatures and docstrings:
- def test_initialization(self): Testing init method.
- def test_create_default_prefs(self): Testing create_default_prefs. | Implement the Python class `UserGlobalPrefsTests` described below.
Class description:
Test domain object for user global email preferences.
Method signatures and docstrings:
- def test_initialization(self): Testing init method.
- def test_create_default_prefs(self): Testing create_default_prefs.
<|skeleton|>
class U... | 899b9755a6b795a8991e596055ac24065a8435e0 | <|skeleton|>
class UserGlobalPrefsTests:
"""Test domain object for user global email preferences."""
def test_initialization(self):
"""Testing init method."""
<|body_0|>
def test_create_default_prefs(self):
"""Testing create_default_prefs."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserGlobalPrefsTests:
"""Test domain object for user global email preferences."""
def test_initialization(self):
"""Testing init method."""
user_global_prefs = user_domain.UserGlobalPrefs(True, False, True, False)
self.assertTrue(user_global_prefs.can_receive_email_updates)
... | the_stack_v2_python_sparse | core/domain/user_domain_test.py | import-keshav/oppia | train | 4 |
8b44ee0dd46827bd8227f660cafffcfc9827afd0 | [
"if not api_key:\n raise EngineAPIKeyException(self.name, 'Bing API Key Required (Searches for the various social media\\n accounts are done via Bing).')\nEngine.__init__(self, **kwargs)\nself.api_key = api_key",
"responses = []\nsites = query.__dict__.get('site_list', SM_LIST)\nif not query.__dict_... | <|body_start_0|>
if not api_key:
raise EngineAPIKeyException(self.name, 'Bing API Key Required (Searches for the various social media\n accounts are done via Bing).')
Engine.__init__(self, **kwargs)
self.api_key = api_key
<|end_body_0|>
<|body_start_1|>
responses ... | Meta Engine to obtain social media specific results from Bing | Socialaccounts | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Socialaccounts:
"""Meta Engine to obtain social media specific results from Bing"""
def __init__(self, api_key='', **kwargs):
"""Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api key needed to access bing search api. A valid Bing API k... | stack_v2_sparse_classes_36k_train_005144 | 3,630 | permissive | [
{
"docstring": "Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api key needed to access bing search api. A valid Bing API key is required as this engine leverages Bing. See Engine. Raises: EngineException Usage: engine = EngineFactory('socialaccounts', api_key='et... | 2 | stack_v2_sparse_classes_30k_train_003430 | Implement the Python class `Socialaccounts` described below.
Class description:
Meta Engine to obtain social media specific results from Bing
Method signatures and docstrings:
- def __init__(self, api_key='', **kwargs): Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api... | Implement the Python class `Socialaccounts` described below.
Class description:
Meta Engine to obtain social media specific results from Bing
Method signatures and docstrings:
- def __init__(self, api_key='', **kwargs): Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api... | d604f1a5d78a9ccd36c57bd03861b1a115df9ab0 | <|skeleton|>
class Socialaccounts:
"""Meta Engine to obtain social media specific results from Bing"""
def __init__(self, api_key='', **kwargs):
"""Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api key needed to access bing search api. A valid Bing API k... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Socialaccounts:
"""Meta Engine to obtain social media specific results from Bing"""
def __init__(self, api_key='', **kwargs):
"""Constructor for the SocialAccounts meta engine Kwargs: api_key (str): string representation of api key needed to access bing search api. A valid Bing API key is require... | the_stack_v2_python_sparse | ifind/search/engines/socialaccounts.py | leifos/ifind | train | 3 |
3064504dc9bc70e64d4a51d972c78837678d0c61 | [
"logits = tf.constant([[0.1, 0.2, 0.7], [0.3, 0.5, 0.2]], dtype='float32')\nlabels = tf.constant([2, 1], dtype='int32')\nadv_target_config = configs.AdvTargetConfig(target_method=configs.AdvTargetType.SECOND)\nself.assertAllEqual(tf.constant([1, 0], dtype='int32'), self.evaluate(utils.get_target_indices(logits, lab... | <|body_start_0|>
logits = tf.constant([[0.1, 0.2, 0.7], [0.3, 0.5, 0.2]], dtype='float32')
labels = tf.constant([2, 1], dtype='int32')
adv_target_config = configs.AdvTargetConfig(target_method=configs.AdvTargetType.SECOND)
self.assertAllEqual(tf.constant([1, 0], dtype='int32'), self.eval... | GetTargetIndicesTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetTargetIndicesTest:
def testGetSecondIndices(self):
"""Test get_target_indices function with AdvTargetType.SECOND."""
<|body_0|>
def testGetLeastIndices(self):
"""Test get_target_indices function with AdvTargetType.LEAST."""
<|body_1|>
def testGetGroun... | stack_v2_sparse_classes_36k_train_005145 | 36,436 | permissive | [
{
"docstring": "Test get_target_indices function with AdvTargetType.SECOND.",
"name": "testGetSecondIndices",
"signature": "def testGetSecondIndices(self)"
},
{
"docstring": "Test get_target_indices function with AdvTargetType.LEAST.",
"name": "testGetLeastIndices",
"signature": "def tes... | 4 | stack_v2_sparse_classes_30k_train_008678 | Implement the Python class `GetTargetIndicesTest` described below.
Class description:
Implement the GetTargetIndicesTest class.
Method signatures and docstrings:
- def testGetSecondIndices(self): Test get_target_indices function with AdvTargetType.SECOND.
- def testGetLeastIndices(self): Test get_target_indices funct... | Implement the Python class `GetTargetIndicesTest` described below.
Class description:
Implement the GetTargetIndicesTest class.
Method signatures and docstrings:
- def testGetSecondIndices(self): Test get_target_indices function with AdvTargetType.SECOND.
- def testGetLeastIndices(self): Test get_target_indices funct... | 995064233479e806a3187ede8a395319520db75e | <|skeleton|>
class GetTargetIndicesTest:
def testGetSecondIndices(self):
"""Test get_target_indices function with AdvTargetType.SECOND."""
<|body_0|>
def testGetLeastIndices(self):
"""Test get_target_indices function with AdvTargetType.LEAST."""
<|body_1|>
def testGetGroun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetTargetIndicesTest:
def testGetSecondIndices(self):
"""Test get_target_indices function with AdvTargetType.SECOND."""
logits = tf.constant([[0.1, 0.2, 0.7], [0.3, 0.5, 0.2]], dtype='float32')
labels = tf.constant([2, 1], dtype='int32')
adv_target_config = configs.AdvTargetCon... | the_stack_v2_python_sparse | neural_structured_learning/lib/utils_test.py | RubensZimbres/neural-structured-learning | train | 1 | |
1e6eff52fa27ea52adb976130447f009bf1dcc24 | [
"super().__init__()\nlogger.debug(' {}'.format(self.name))\nlogger.debug(' year FCStack')\nself.year_fc = FCStack(num_layers=1, default_fc_size=1, default_use_bias=use_bias, default_weights_initializer=weights_initializer, default_bias_initializer=bias_initializer, default_weights_regularizer=weights_regularizer, ... | <|body_start_0|>
super().__init__()
logger.debug(' {}'.format(self.name))
logger.debug(' year FCStack')
self.year_fc = FCStack(num_layers=1, default_fc_size=1, default_use_bias=use_bias, default_weights_initializer=weights_initializer, default_bias_initializer=bias_initializer, default_... | DateEmbed | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateEmbed:
def __init__(self, embedding_size=10, embeddings_on_cpu=False, fc_layers=None, num_fc_layers=0, fc_size=10, use_bias=True, weights_initializer='glorot_uniform', bias_initializer='zeros', weights_regularizer=None, bias_regularizer=None, activity_regularizer=None, norm=None, norm_params... | stack_v2_sparse_classes_36k_train_005146 | 17,612 | permissive | [
{
"docstring": ":param embedding_size: it is the maximum embedding size, the actual size will be `min(vocaularyb_size, embedding_size)` for `dense` representations and exacly `vocaularyb_size` for the `sparse` encoding, where `vocabulary_size` is the number of different strings appearing in the training set in ... | 2 | null | Implement the Python class `DateEmbed` described below.
Class description:
Implement the DateEmbed class.
Method signatures and docstrings:
- def __init__(self, embedding_size=10, embeddings_on_cpu=False, fc_layers=None, num_fc_layers=0, fc_size=10, use_bias=True, weights_initializer='glorot_uniform', bias_initialize... | Implement the Python class `DateEmbed` described below.
Class description:
Implement the DateEmbed class.
Method signatures and docstrings:
- def __init__(self, embedding_size=10, embeddings_on_cpu=False, fc_layers=None, num_fc_layers=0, fc_size=10, use_bias=True, weights_initializer='glorot_uniform', bias_initialize... | e6abdf9d7c58febfccea7fb8e1ce70b9d4bd2d8a | <|skeleton|>
class DateEmbed:
def __init__(self, embedding_size=10, embeddings_on_cpu=False, fc_layers=None, num_fc_layers=0, fc_size=10, use_bias=True, weights_initializer='glorot_uniform', bias_initializer='zeros', weights_regularizer=None, bias_regularizer=None, activity_regularizer=None, norm=None, norm_params... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DateEmbed:
def __init__(self, embedding_size=10, embeddings_on_cpu=False, fc_layers=None, num_fc_layers=0, fc_size=10, use_bias=True, weights_initializer='glorot_uniform', bias_initializer='zeros', weights_regularizer=None, bias_regularizer=None, activity_regularizer=None, norm=None, norm_params=None, activat... | the_stack_v2_python_sparse | ludwig/encoders/date_encoders.py | litanlitudan/ludwig | train | 1 | |
0ee6b97f1af112dc4cb78cd78a37fe62d3de36a9 | [
"email_log = EMAIL_TIMES[self.level]\nemail_backlog = EMAIL_BACKLOG[self.level]\nnow = time.time()\noldest_email_time = min(email_log)\nif oldest_email_time < now - EMAIL_THROTTLE_TIME:\n email_log.append(now)\n if len(email_backlog) > 0:\n backlog = '\\n'.join(email_backlog)\n record.msg = str(... | <|body_start_0|>
email_log = EMAIL_TIMES[self.level]
email_backlog = EMAIL_BACKLOG[self.level]
now = time.time()
oldest_email_time = min(email_log)
if oldest_email_time < now - EMAIL_THROTTLE_TIME:
email_log.append(now)
if len(email_backlog) > 0:
... | PyExpLabSys modified SMTP handler | CustomSMTPHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomSMTPHandler:
"""PyExpLabSys modified SMTP handler"""
def emit(self, record):
"""Custom emit that throttles the number of email sent"""
<|body_0|>
def getSubject(self, record):
"""Returns subject with hostname"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_005147 | 7,447 | no_license | [
{
"docstring": "Custom emit that throttles the number of email sent",
"name": "emit",
"signature": "def emit(self, record)"
},
{
"docstring": "Returns subject with hostname",
"name": "getSubject",
"signature": "def getSubject(self, record)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008335 | Implement the Python class `CustomSMTPHandler` described below.
Class description:
PyExpLabSys modified SMTP handler
Method signatures and docstrings:
- def emit(self, record): Custom emit that throttles the number of email sent
- def getSubject(self, record): Returns subject with hostname | Implement the Python class `CustomSMTPHandler` described below.
Class description:
PyExpLabSys modified SMTP handler
Method signatures and docstrings:
- def emit(self, record): Custom emit that throttles the number of email sent
- def getSubject(self, record): Returns subject with hostname
<|skeleton|>
class CustomS... | 14d2a24c3031a78da0d2d686c42bc01ffe18faca | <|skeleton|>
class CustomSMTPHandler:
"""PyExpLabSys modified SMTP handler"""
def emit(self, record):
"""Custom emit that throttles the number of email sent"""
<|body_0|>
def getSubject(self, record):
"""Returns subject with hostname"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomSMTPHandler:
"""PyExpLabSys modified SMTP handler"""
def emit(self, record):
"""Custom emit that throttles the number of email sent"""
email_log = EMAIL_TIMES[self.level]
email_backlog = EMAIL_BACKLOG[self.level]
now = time.time()
oldest_email_time = min(emai... | the_stack_v2_python_sparse | PyExpLabSys/common/utilities.py | jlopezBolt/PyExpLabSys | train | 0 |
e2117d263eba5625d48512f6009d14a1f41dbaf5 | [
"global pre\nif not root:\n return True\nif not self.is_valid_BST(root.left):\n return False\nif root.val <= pre:\n return False\npre = root.val\nreturn self.is_valid_BST(root.right)",
"pre = -sys.maxsize\nstack = []\nwhile not root or len(stack) < 1:\n while not root.left:\n stack.append(root.... | <|body_start_0|>
global pre
if not root:
return True
if not self.is_valid_BST(root.left):
return False
if root.val <= pre:
return False
pre = root.val
return self.is_valid_BST(root.right)
<|end_body_0|>
<|body_start_1|>
pre = -... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_valid_BST(self, root: TreeNode) -> bool:
"""中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值"""
<|body_0|>
def is_valid_BST_2(self, root: TreeNode) -> bool:
"""中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_005148 | 2,525 | permissive | [
{
"docstring": "中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值",
"name": "is_valid_BST",
"signature": "def is_valid_BST(self, root: TreeNode) -> bool"
},
{
"docstring": "中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值",
"name": "is_valid_BST_2",
"signature": "def is_valid_BST_2(self, root: ... | 2 | stack_v2_sparse_classes_30k_train_008406 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_valid_BST(self, root: TreeNode) -> bool: 中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值
- def is_valid_BST_2(self, root: TreeNode) -> bool: 中序遍历二叉树判断是不是BST树 Args: root: 根节点... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_valid_BST(self, root: TreeNode) -> bool: 中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值
- def is_valid_BST_2(self, root: TreeNode) -> bool: 中序遍历二叉树判断是不是BST树 Args: root: 根节点... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def is_valid_BST(self, root: TreeNode) -> bool:
"""中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值"""
<|body_0|>
def is_valid_BST_2(self, root: TreeNode) -> bool:
"""中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def is_valid_BST(self, root: TreeNode) -> bool:
"""中序遍历二叉树判断是不是BST树 Args: root: 根节点 Returns: 布尔值"""
global pre
if not root:
return True
if not self.is_valid_BST(root.left):
return False
if root.val <= pre:
return False
... | the_stack_v2_python_sparse | src/leetcodepython/tree/validate_binary_search_tree_98.py | zhangyu345293721/leetcode | train | 101 | |
f6bbcf5045d5fa31d858a8a296e25d7313779112 | [
"super().__init__()\nimport sklearn\nimport sklearn.naive_bayes\nself.model = sklearn.naive_bayes.MultinomialNB",
"specs = super(MultinomialNB, cls).getInputSpecification()\nspecs.description = 'The \\\\\\\\textit{MultinomialNB} classifier implements the naive Bayes algorithm for\\n multino... | <|body_start_0|>
super().__init__()
import sklearn
import sklearn.naive_bayes
self.model = sklearn.naive_bayes.MultinomialNB
<|end_body_0|>
<|body_start_1|>
specs = super(MultinomialNB, cls).getInputSpecification()
specs.description = 'The \\\\textit{MultinomialNB} class... | MultinomialNBClassifier Naive Bayes classifier for multinomial models | MultinomialNB | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultinomialNB:
"""MultinomialNBClassifier Naive Bayes classifier for multinomial models"""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
<|body_0|>
def getInputSpecification(cls):
"""M... | stack_v2_sparse_classes_36k_train_005149 | 5,834 | permissive | [
{
"docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for... | 3 | stack_v2_sparse_classes_30k_train_013545 | Implement the Python class `MultinomialNB` described below.
Class description:
MultinomialNBClassifier Naive Bayes classifier for multinomial models
Method signatures and docstrings:
- def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None
- def getInput... | Implement the Python class `MultinomialNB` described below.
Class description:
MultinomialNBClassifier Naive Bayes classifier for multinomial models
Method signatures and docstrings:
- def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None
- def getInput... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class MultinomialNB:
"""MultinomialNBClassifier Naive Bayes classifier for multinomial models"""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
<|body_0|>
def getInputSpecification(cls):
"""M... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultinomialNB:
"""MultinomialNBClassifier Naive Bayes classifier for multinomial models"""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
super().__init__()
import sklearn
import sklearn.naive_ba... | the_stack_v2_python_sparse | ravenframework/SupervisedLearning/ScikitLearn/NaiveBayes/MultinomialNBClassifier.py | idaholab/raven | train | 201 |
0ff048b088303cb2296a9a454cba73c33fa65373 | [
"if isinstance(key, int):\n return Option(key)\nif key not in Option._member_map_:\n extend_enum(Option, key, default)\nreturn Option[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 35 <= value <= 68:\n extend_enum(c... | <|body_start_0|>
if isinstance(key, int):
return Option(key)
if key not in Option._member_map_:
extend_enum(Option, key, default)
return Option[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 255):
raise ValueErro... | [Option] TCP Option Kind Numbers | Option | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_005150 | 3,365 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008412 | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `Option` described below.
Class description:
[Option] TCP Option Kind Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleton|>
class Option:
"""[Opt... | 71363d7948003fec88cedcf5bc80b6befa2ba244 | <|skeleton|>
class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Option:
"""[Option] TCP Option Kind Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return Option(key)
if key not in Option._member_map_:
extend_enum(Option, key, default)
return Option[key]
... | the_stack_v2_python_sparse | pcapkit/const/tcp/option.py | hiok2000/PyPCAPKit | train | 0 |
5f66ff4b37cce1b52d214f6f9caae60676d34cc0 | [
"body_model, response_model = rest_model('molecule', 'get')\nbody = self.parse_bodymodel(body_model)\nmolecules = self.storage.get_molecules(**{**body.data.dict(), **body.meta.dict()})\nret = response_model(**molecules)\nself.logger.info('GET: Molecule - {} pulls.'.format(len(ret.data)))\nself.write(ret)",
"self.... | <|body_start_0|>
body_model, response_model = rest_model('molecule', 'get')
body = self.parse_bodymodel(body_model)
molecules = self.storage.get_molecules(**{**body.data.dict(), **body.meta.dict()})
ret = response_model(**molecules)
self.logger.info('GET: Molecule - {} pulls.'.fo... | A handler to push and get molecules. | MoleculeHandler | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoleculeHandler:
"""A handler to push and get molecules."""
def get(self):
"""Experimental documentation, need to find a decent format. Request: "meta" - Overall options to the Molecule pull request - "index" - What kind of index used to find the data ("id", "molecule_hash", "molecul... | stack_v2_sparse_classes_36k_train_005151 | 16,782 | permissive | [
{
"docstring": "Experimental documentation, need to find a decent format. Request: \"meta\" - Overall options to the Molecule pull request - \"index\" - What kind of index used to find the data (\"id\", \"molecule_hash\", \"molecular_formula\") \"data\" - A dictionary of {key : index} requests Returns: \"meta\"... | 2 | null | Implement the Python class `MoleculeHandler` described below.
Class description:
A handler to push and get molecules.
Method signatures and docstrings:
- def get(self): Experimental documentation, need to find a decent format. Request: "meta" - Overall options to the Molecule pull request - "index" - What kind of ind... | Implement the Python class `MoleculeHandler` described below.
Class description:
A handler to push and get molecules.
Method signatures and docstrings:
- def get(self): Experimental documentation, need to find a decent format. Request: "meta" - Overall options to the Molecule pull request - "index" - What kind of ind... | e48ac2fd5e0bfde56ada9520db64bcc2cb8d8c0d | <|skeleton|>
class MoleculeHandler:
"""A handler to push and get molecules."""
def get(self):
"""Experimental documentation, need to find a decent format. Request: "meta" - Overall options to the Molecule pull request - "index" - What kind of index used to find the data ("id", "molecule_hash", "molecul... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MoleculeHandler:
"""A handler to push and get molecules."""
def get(self):
"""Experimental documentation, need to find a decent format. Request: "meta" - Overall options to the Molecule pull request - "index" - What kind of index used to find the data ("id", "molecule_hash", "molecular_formula") ... | the_stack_v2_python_sparse | qcfractal/web_handlers.py | ahurta92/QCFractal | train | 0 |
ac4ab8f5b25e63e45c83a2d17f875724737d7fae | [
"prev = None\nwhile head:\n cur = head\n head = head.next\n cur.next = prev\n prev = cur\nreturn prev",
"prev = None\nwhile head:\n nh = head.next\n head.next = prev\n prev = head\n head = nh\nreturn prev",
"def reverse(node):\n prev = None\n while node:\n nextNode = node.ne... | <|body_start_0|>
prev = None
while head:
cur = head
head = head.next
cur.next = prev
prev = cur
return prev
<|end_body_0|>
<|body_start_1|>
prev = None
while head:
nh = head.next
head.next = prev
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def rewrite(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
def rewrite2(self, head):
""":type head: ListNode :rtype: ListNode"""
... | stack_v2_sparse_classes_36k_train_005152 | 1,896 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "rewrite",
"signature": "def rewrite(self, head)"
},
{
"docstring": ":type head: ListNode :... | 3 | stack_v2_sparse_classes_30k_train_021359 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def rewrite(self, head): :type head: ListNode :rtype: ListNode
- def rewrite2(self, head): :type head: ListNo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def rewrite(self, head): :type head: ListNode :rtype: ListNode
- def rewrite2(self, head): :type head: ListNo... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def rewrite(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
def rewrite2(self, head):
""":type head: ListNode :rtype: ListNode"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
prev = None
while head:
cur = head
head = head.next
cur.next = prev
prev = cur
return prev
def rewrite(self, head):
""":type head: Lis... | the_stack_v2_python_sparse | co_uber/206_Reverse_Linked_List.py | vsdrun/lc_public | train | 6 | |
42bdf7c2c612f01d328701cac9604be820d4a039 | [
"super(MainApplication, self).__init__()\nself.ui = sff.SimilarFilesUIMainWindow()\nself.ui.setupUi(self)\nself.ui.search_button.clicked.connect(self.search_pressed)\nself.ui.tree.setHeaderLabels([''])",
"self.ui.tree.clear()\npath = self.ui.path_panel.displayText()\ntry:\n file_chains = similar_files_chains(p... | <|body_start_0|>
super(MainApplication, self).__init__()
self.ui = sff.SimilarFilesUIMainWindow()
self.ui.setupUi(self)
self.ui.search_button.clicked.connect(self.search_pressed)
self.ui.tree.setHeaderLabels([''])
<|end_body_0|>
<|body_start_1|>
self.ui.tree.clear()
... | Instances of this class will be similar files finder applications. | MainApplication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainApplication:
"""Instances of this class will be similar files finder applications."""
def __init__(self):
"""Constructor of class MainApplication."""
<|body_0|>
def search_pressed(self):
"""This method is called when the button 'search' is pressed. It searche... | stack_v2_sparse_classes_36k_train_005153 | 2,033 | no_license | [
{
"docstring": "Constructor of class MainApplication.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This method is called when the button 'search' is pressed. It searches for the similar files chains in the directory from the ui.path_panel and displays them in the ui... | 2 | stack_v2_sparse_classes_30k_train_016422 | Implement the Python class `MainApplication` described below.
Class description:
Instances of this class will be similar files finder applications.
Method signatures and docstrings:
- def __init__(self): Constructor of class MainApplication.
- def search_pressed(self): This method is called when the button 'search' i... | Implement the Python class `MainApplication` described below.
Class description:
Instances of this class will be similar files finder applications.
Method signatures and docstrings:
- def __init__(self): Constructor of class MainApplication.
- def search_pressed(self): This method is called when the button 'search' i... | 023307a9b7f7f8dbb1589e222e794e128f1f365b | <|skeleton|>
class MainApplication:
"""Instances of this class will be similar files finder applications."""
def __init__(self):
"""Constructor of class MainApplication."""
<|body_0|>
def search_pressed(self):
"""This method is called when the button 'search' is pressed. It searche... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MainApplication:
"""Instances of this class will be similar files finder applications."""
def __init__(self):
"""Constructor of class MainApplication."""
super(MainApplication, self).__init__()
self.ui = sff.SimilarFilesUIMainWindow()
self.ui.setupUi(self)
self.ui.... | the_stack_v2_python_sparse | supertool/src/supertool/sff_app.py | Goopard/Study-2 | train | 0 |
b573be953d3c3389c210dc0dd5d7a3cf23468767 | [
"self.bazel_exec_root = bazel_exec_root\nself.preserve_tulsi_includes = preserve_tulsi_includes\nif not output_root:\n output_root = bazel_exec_root\nself.tulsi_root = os.path.join(output_root, 'bazel-tulsi-includes')",
"tulsi_root = self.tulsi_root\nif not self.preserve_tulsi_includes and os.path.exists(tulsi... | <|body_start_0|>
self.bazel_exec_root = bazel_exec_root
self.preserve_tulsi_includes = preserve_tulsi_includes
if not output_root:
output_root = bazel_exec_root
self.tulsi_root = os.path.join(output_root, 'bazel-tulsi-includes')
<|end_body_0|>
<|body_start_1|>
tulsi_... | Symlinks generated files into bazel-tulsi-includes. | Installer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Installer:
"""Symlinks generated files into bazel-tulsi-includes."""
def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None):
"""Initializes the installer with the proper Bazel paths."""
<|body_0|>
def PrepareTulsiIncludes(self):
"""Cr... | stack_v2_sparse_classes_36k_train_005154 | 3,617 | permissive | [
{
"docstring": "Initializes the installer with the proper Bazel paths.",
"name": "__init__",
"signature": "def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None)"
},
{
"docstring": "Creates tulsi includes, possibly removing the old folder.",
"name": "PrepareTulsi... | 4 | stack_v2_sparse_classes_30k_train_011878 | Implement the Python class `Installer` described below.
Class description:
Symlinks generated files into bazel-tulsi-includes.
Method signatures and docstrings:
- def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None): Initializes the installer with the proper Bazel paths.
- def PrepareTu... | Implement the Python class `Installer` described below.
Class description:
Symlinks generated files into bazel-tulsi-includes.
Method signatures and docstrings:
- def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None): Initializes the installer with the proper Bazel paths.
- def PrepareTu... | a0bf60e1645869c6452c9f3b128362d433764f19 | <|skeleton|>
class Installer:
"""Symlinks generated files into bazel-tulsi-includes."""
def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None):
"""Initializes the installer with the proper Bazel paths."""
<|body_0|>
def PrepareTulsiIncludes(self):
"""Cr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Installer:
"""Symlinks generated files into bazel-tulsi-includes."""
def __init__(self, bazel_exec_root, preserve_tulsi_includes=True, output_root=None):
"""Initializes the installer with the proper Bazel paths."""
self.bazel_exec_root = bazel_exec_root
self.preserve_tulsi_include... | the_stack_v2_python_sparse | src/TulsiGenerator/Scripts/install_genfiles.py | bazelbuild/tulsi | train | 583 |
500f450bbf8526904ca0447b2b2ec1f819f9d6aa | [
"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... | Service for configuring sinks used to export log entries outside of Stackdriver Logging. | ConfigServiceV2Servicer | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigServiceV2Servicer:
"""Service for configuring sinks used to export log entries outside of Stackdriver Logging."""
def ListSinks(self, request, context):
"""Lists sinks."""
<|body_0|>
def GetSink(self, request, context):
"""Gets a sink."""
<|body_1|>... | stack_v2_sparse_classes_36k_train_005155 | 6,663 | permissive | [
{
"docstring": "Lists sinks.",
"name": "ListSinks",
"signature": "def ListSinks(self, request, context)"
},
{
"docstring": "Gets a sink.",
"name": "GetSink",
"signature": "def GetSink(self, request, context)"
},
{
"docstring": "Creates a sink that exports specified log entries to... | 5 | stack_v2_sparse_classes_30k_train_005845 | Implement the Python class `ConfigServiceV2Servicer` described below.
Class description:
Service for configuring sinks used to export log entries outside of Stackdriver Logging.
Method signatures and docstrings:
- def ListSinks(self, request, context): Lists sinks.
- def GetSink(self, request, context): Gets a sink.
... | Implement the Python class `ConfigServiceV2Servicer` described below.
Class description:
Service for configuring sinks used to export log entries outside of Stackdriver Logging.
Method signatures and docstrings:
- def ListSinks(self, request, context): Lists sinks.
- def GetSink(self, request, context): Gets a sink.
... | 86977c0e2e97011359b619c88db47168181908ea | <|skeleton|>
class ConfigServiceV2Servicer:
"""Service for configuring sinks used to export log entries outside of Stackdriver Logging."""
def ListSinks(self, request, context):
"""Lists sinks."""
<|body_0|>
def GetSink(self, request, context):
"""Gets a sink."""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigServiceV2Servicer:
"""Service for configuring sinks used to export log entries outside of Stackdriver Logging."""
def ListSinks(self, request, context):
"""Lists sinks."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | generated/python/proto-google-cloud-logging-v2/google/cloud/proto/logging/v2/logging_config_pb2_grpc.py | QPC-github/api-client-staging | train | 1 |
3b1bab329e41e23b1d1f16d1df56aa2c0358d835 | [
"key = (category_id, page_id)\npage: PageModel = PageModel.query.get_or_404(key)\nif content_cache.should_cache(key, page_version=page.last_update):\n content_cache.cache(key, page)\nreturn content_cache.get(key, '')",
"key = (category_id, page_id)\npage: PageModel = PageModel.query.get_or_404(key)\nif content... | <|body_start_0|>
key = (category_id, page_id)
page: PageModel = PageModel.query.get_or_404(key)
if content_cache.should_cache(key, page_version=page.last_update):
content_cache.cache(key, page)
return content_cache.get(key, '')
<|end_body_0|>
<|body_start_1|>
key = (... | PageContent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PageContent:
def get(self, category_id, page_id):
"""## Get the cached content of the page located at (category_id, page_id)"""
<|body_0|>
def put(self, category_id, page_id, _transaction):
"""## Set the new content of the page located at (category_id, page_id) ***Re... | stack_v2_sparse_classes_36k_train_005156 | 9,175 | no_license | [
{
"docstring": "## Get the cached content of the page located at (category_id, page_id)",
"name": "get",
"signature": "def get(self, category_id, page_id)"
},
{
"docstring": "## Set the new content of the page located at (category_id, page_id) ***Requires Authentication***",
"name": "put",
... | 2 | null | Implement the Python class `PageContent` described below.
Class description:
Implement the PageContent class.
Method signatures and docstrings:
- def get(self, category_id, page_id): ## Get the cached content of the page located at (category_id, page_id)
- def put(self, category_id, page_id, _transaction): ## Set the... | Implement the Python class `PageContent` described below.
Class description:
Implement the PageContent class.
Method signatures and docstrings:
- def get(self, category_id, page_id): ## Get the cached content of the page located at (category_id, page_id)
- def put(self, category_id, page_id, _transaction): ## Set the... | 651b963ebfe4ff643ea5f3a8cbf79c4c7fceb67a | <|skeleton|>
class PageContent:
def get(self, category_id, page_id):
"""## Get the cached content of the page located at (category_id, page_id)"""
<|body_0|>
def put(self, category_id, page_id, _transaction):
"""## Set the new content of the page located at (category_id, page_id) ***Re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PageContent:
def get(self, category_id, page_id):
"""## Get the cached content of the page located at (category_id, page_id)"""
key = (category_id, page_id)
page: PageModel = PageModel.query.get_or_404(key)
if content_cache.should_cache(key, page_version=page.last_update):
... | the_stack_v2_python_sparse | server/resources/content.py | Website-Pfarre-Machstrasse/Backend | train | 1 | |
240396d6192d944ea6a8f39385c0ecbd62e67128 | [
"super(_HashDropZones, self).__init__(parent)\npen = qt.QPen()\npen.setColor(qt.QColor('#D0D0D0'))\npen.setStyle(qt.Qt.DotLine)\npen.setWidth(2)\nself.__dropPen = pen",
"displayDropZone = False\nif index.isValid():\n model = index.model()\n rowIndex = model.index(index.row(), 0, index.parent())\n rowItem... | <|body_start_0|>
super(_HashDropZones, self).__init__(parent)
pen = qt.QPen()
pen.setColor(qt.QColor('#D0D0D0'))
pen.setStyle(qt.Qt.DotLine)
pen.setWidth(2)
self.__dropPen = pen
<|end_body_0|>
<|body_start_1|>
displayDropZone = False
if index.isValid():
... | Delegate item displaying a drop zone when the item do not contains dataset. | _HashDropZones | [
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HashDropZones:
"""Delegate item displaying a drop zone when the item do not contains dataset."""
def __init__(self, parent=None):
"""Constructor"""
<|body_0|>
def paint(self, painter, option, index):
"""Paint the item :param qt.QPainter painter: A painter :param... | stack_v2_sparse_classes_36k_train_005157 | 34,928 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Paint the item :param qt.QPainter painter: A painter :param qt.QStyleOptionViewItem option: Options of the item to paint :param qt.QModelIndex index: Index of the item to paint",
... | 2 | stack_v2_sparse_classes_30k_train_005633 | Implement the Python class `_HashDropZones` described below.
Class description:
Delegate item displaying a drop zone when the item do not contains dataset.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor
- def paint(self, painter, option, index): Paint the item :param qt.QPainter pain... | Implement the Python class `_HashDropZones` described below.
Class description:
Delegate item displaying a drop zone when the item do not contains dataset.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor
- def paint(self, painter, option, index): Paint the item :param qt.QPainter pain... | 5e33cb69afd2a8b1cfe3183282acdd8b34c1a74f | <|skeleton|>
class _HashDropZones:
"""Delegate item displaying a drop zone when the item do not contains dataset."""
def __init__(self, parent=None):
"""Constructor"""
<|body_0|>
def paint(self, painter, option, index):
"""Paint the item :param qt.QPainter painter: A painter :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _HashDropZones:
"""Delegate item displaying a drop zone when the item do not contains dataset."""
def __init__(self, parent=None):
"""Constructor"""
super(_HashDropZones, self).__init__(parent)
pen = qt.QPen()
pen.setColor(qt.QColor('#D0D0D0'))
pen.setStyle(qt.Qt.D... | the_stack_v2_python_sparse | src/silx/app/view/CustomNxdataWidget.py | silx-kit/silx | train | 120 |
c377fb8d34b52441d13e22f80626ade6cb93905e | [
"_input = [4, 3, 0, 1, 5]\nexpected = 3\nactual = calculate_h_index(_input)\nself.assertEqual(expected, actual)",
"_input = [17, 33, 30, 7, 8, 20, 15, 7, 6, 5, 4]\nexpected = 7\nactual = calculate_h_index(_input)\nself.assertEqual(expected, actual)",
"_input = [0, 0, 0, 1, 0, 0]\nexpected = 1\nactual = calculat... | <|body_start_0|>
_input = [4, 3, 0, 1, 5]
expected = 3
actual = calculate_h_index(_input)
self.assertEqual(expected, actual)
<|end_body_0|>
<|body_start_1|>
_input = [17, 33, 30, 7, 8, 20, 15, 7, 6, 5, 4]
expected = 7
actual = calculate_h_index(_input)
se... | IndexCalculatorTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndexCalculatorTest:
def test_example(self):
"""Tests the given example"""
<|body_0|>
def test_example_2(self):
"""Tests the case where some papers have the same number of citations"""
<|body_1|>
def test_example_3(self):
"""Tests the case where ... | stack_v2_sparse_classes_36k_train_005158 | 1,102 | no_license | [
{
"docstring": "Tests the given example",
"name": "test_example",
"signature": "def test_example(self)"
},
{
"docstring": "Tests the case where some papers have the same number of citations",
"name": "test_example_2",
"signature": "def test_example_2(self)"
},
{
"docstring": "Tes... | 4 | stack_v2_sparse_classes_30k_train_002359 | Implement the Python class `IndexCalculatorTest` described below.
Class description:
Implement the IndexCalculatorTest class.
Method signatures and docstrings:
- def test_example(self): Tests the given example
- def test_example_2(self): Tests the case where some papers have the same number of citations
- def test_ex... | Implement the Python class `IndexCalculatorTest` described below.
Class description:
Implement the IndexCalculatorTest class.
Method signatures and docstrings:
- def test_example(self): Tests the given example
- def test_example_2(self): Tests the case where some papers have the same number of citations
- def test_ex... | 8fecf473a36be126311deeaa42f6f708165feb9a | <|skeleton|>
class IndexCalculatorTest:
def test_example(self):
"""Tests the given example"""
<|body_0|>
def test_example_2(self):
"""Tests the case where some papers have the same number of citations"""
<|body_1|>
def test_example_3(self):
"""Tests the case where ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IndexCalculatorTest:
def test_example(self):
"""Tests the given example"""
_input = [4, 3, 0, 1, 5]
expected = 3
actual = calculate_h_index(_input)
self.assertEqual(expected, actual)
def test_example_2(self):
"""Tests the case where some papers have the sam... | the_stack_v2_python_sparse | challenges/problem_241/unit_test.py | ashishkhiani/Daily-Coding-Problems | train | 0 | |
30cfa9947b157cf50e06797d8b10685d48146194 | [
"self.sheets = sheets\nself.coords = coords\nself.spectrograms = spectrograms\nself.onsets = onsets\nself.spec_context = spec_context\nself.sheet_context = sheet_context\nself.shape = None\nself.staff_height = staff_height\nself.sheet_dim = [self.staff_height, self.sheets[0].shape[1]]\nself.spec_dim = [self.spectro... | <|body_start_0|>
self.sheets = sheets
self.coords = coords
self.spectrograms = spectrograms
self.onsets = onsets
self.spec_context = spec_context
self.sheet_context = sheet_context
self.shape = None
self.staff_height = staff_height
self.sheet_dim =... | Data Pool for spectrogram to sheet snippet hashing | ContinousSpec2SheetHashingPool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContinousSpec2SheetHashingPool:
"""Data Pool for spectrogram to sheet snippet hashing"""
def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True):
"""Constructor"""
<|body_0|>
def prepare_train_entities(self):
... | stack_v2_sparse_classes_36k_train_005159 | 6,224 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True)"
},
{
"docstring": "collect train entities",
"name": "prepare_train_entities",
"signature": "def prepare_tr... | 4 | stack_v2_sparse_classes_30k_train_021446 | Implement the Python class `ContinousSpec2SheetHashingPool` described below.
Class description:
Data Pool for spectrogram to sheet snippet hashing
Method signatures and docstrings:
- def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True): Constructor
- def... | Implement the Python class `ContinousSpec2SheetHashingPool` described below.
Class description:
Data Pool for spectrogram to sheet snippet hashing
Method signatures and docstrings:
- def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True): Constructor
- def... | 0869de4fcf74934b693768001e4d4a16cea829e8 | <|skeleton|>
class ContinousSpec2SheetHashingPool:
"""Data Pool for spectrogram to sheet snippet hashing"""
def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True):
"""Constructor"""
<|body_0|>
def prepare_train_entities(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContinousSpec2SheetHashingPool:
"""Data Pool for spectrogram to sheet snippet hashing"""
def __init__(self, sheets, coords, spectrograms, onsets, spec_context, sheet_context, staff_height=50, shuffle=True):
"""Constructor"""
self.sheets = sheets
self.coords = coords
self.s... | the_stack_v2_python_sparse | audio_sheet_retrieval/utils/alignment.py | CPJKU/audio_sheet_retrieval | train | 23 |
68fbd986055ee502f867c05d45835f5956ef2b8f | [
"self.registeredPlates = open('registeredPlates.txt').read().splitlines()\nif string in self.registeredPlates:\n return True\nelse:\n return False",
"self.restrictedWords = open('restrictedWords.txt').read().splitlines()\nif string in self.restrictedWords:\n return True\nelse:\n return False",
"self... | <|body_start_0|>
self.registeredPlates = open('registeredPlates.txt').read().splitlines()
if string in self.registeredPlates:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
self.restrictedWords = open('restrictedWords.txt').read().splitlines()
... | check | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class check:
def registered(self, string):
"""Checks if string is in registered plates file; returns boolean"""
<|body_0|>
def restricted(self, string):
"""Checks if string is in restricted plates file; returns boolean"""
<|body_1|>
def word(self, string):
... | stack_v2_sparse_classes_36k_train_005160 | 3,194 | permissive | [
{
"docstring": "Checks if string is in registered plates file; returns boolean",
"name": "registered",
"signature": "def registered(self, string)"
},
{
"docstring": "Checks if string is in restricted plates file; returns boolean",
"name": "restricted",
"signature": "def restricted(self, ... | 3 | stack_v2_sparse_classes_30k_train_002282 | Implement the Python class `check` described below.
Class description:
Implement the check class.
Method signatures and docstrings:
- def registered(self, string): Checks if string is in registered plates file; returns boolean
- def restricted(self, string): Checks if string is in restricted plates file; returns bool... | Implement the Python class `check` described below.
Class description:
Implement the check class.
Method signatures and docstrings:
- def registered(self, string): Checks if string is in registered plates file; returns boolean
- def restricted(self, string): Checks if string is in restricted plates file; returns bool... | af04f91e14492d0ddfe7b5ad00e0652e609ca1b5 | <|skeleton|>
class check:
def registered(self, string):
"""Checks if string is in registered plates file; returns boolean"""
<|body_0|>
def restricted(self, string):
"""Checks if string is in restricted plates file; returns boolean"""
<|body_1|>
def word(self, string):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class check:
def registered(self, string):
"""Checks if string is in registered plates file; returns boolean"""
self.registeredPlates = open('registeredPlates.txt').read().splitlines()
if string in self.registeredPlates:
return True
else:
return False
def... | the_stack_v2_python_sparse | Code/Pygame Based/20140326/carPlateRegistrationSystem.py | creatingcrap/PythonPlate | train | 0 | |
a4d8b4f7d435e33388666d172d0a9367a0187ad6 | [
"SegmentSimMeasurement.__init__(self, source_segment, target_segment)\nself.lower_case = lower_case\nself.stopword_removal = stopword_removal\nself.stemming = stemming\nself.stemmer = stemmer\nself.lemmatization = lemmatization",
"s1_tokens = [token for token in self.source_segment.get_instances('part_of_speech',... | <|body_start_0|>
SegmentSimMeasurement.__init__(self, source_segment, target_segment)
self.lower_case = lower_case
self.stopword_removal = stopword_removal
self.stemming = stemming
self.stemmer = stemmer
self.lemmatization = lemmatization
<|end_body_0|>
<|body_start_1|>
... | TokenOverlap | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokenOverlap:
def __init__(self, source_segment, target_segment, lower_case=True, stopword_removal=False, stemming=False, stemmer='porter', lemmatization=False):
""":param source_segment: Segment from source article :param target_segment: Segment from target article :param lower_case: Fl... | stack_v2_sparse_classes_36k_train_005161 | 2,838 | permissive | [
{
"docstring": ":param source_segment: Segment from source article :param target_segment: Segment from target article :param lower_case: Flag, whether all tokens should be lower case :param stopword_removal: Flag, whether stop words should be removed before the computation :param stemming: Flag, whether word st... | 2 | null | Implement the Python class `TokenOverlap` described below.
Class description:
Implement the TokenOverlap class.
Method signatures and docstrings:
- def __init__(self, source_segment, target_segment, lower_case=True, stopword_removal=False, stemming=False, stemmer='porter', lemmatization=False): :param source_segment:... | Implement the Python class `TokenOverlap` described below.
Class description:
Implement the TokenOverlap class.
Method signatures and docstrings:
- def __init__(self, source_segment, target_segment, lower_case=True, stopword_removal=False, stemming=False, stemmer='porter', lemmatization=False): :param source_segment:... | 2e6a85dc9e95ef94bec2339987950f4e88f5d909 | <|skeleton|>
class TokenOverlap:
def __init__(self, source_segment, target_segment, lower_case=True, stopword_removal=False, stemming=False, stemmer='porter', lemmatization=False):
""":param source_segment: Segment from source article :param target_segment: Segment from target article :param lower_case: Fl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TokenOverlap:
def __init__(self, source_segment, target_segment, lower_case=True, stopword_removal=False, stemming=False, stemmer='porter', lemmatization=False):
""":param source_segment: Segment from source article :param target_segment: Segment from target article :param lower_case: Flag, whether al... | the_stack_v2_python_sparse | newssimilarity/segment_sim/token_overlap.py | imackerracher/NewsSimilarity | train | 0 | |
a592506904a136807de4e6ca91df41214353c166 | [
"ans = '#'\nfor i in range(1, 7, 2):\n num = int(color[i:i + 2], 16)\n char = ''\n mind = float('inf')\n for j in range(16):\n dis = abs(j * 16 + j - num)\n if dis < mind:\n mind = dis\n char = j\n ans += str(hex(char))[2:] + str(hex(char))[2:]\nreturn ans",
"M =... | <|body_start_0|>
ans = '#'
for i in range(1, 7, 2):
num = int(color[i:i + 2], 16)
char = ''
mind = float('inf')
for j in range(16):
dis = abs(j * 16 + j - num)
if dis < mind:
mind = dis
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
<|body_0|>
def minSwap(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = '#'
for i in range(1, 7,... | stack_v2_sparse_classes_36k_train_005162 | 1,198 | no_license | [
{
"docstring": ":type color: str :rtype: str",
"name": "similarRGB",
"signature": "def similarRGB(self, color)"
},
{
"docstring": ":type A: List[int] :type B: List[int] :rtype: int",
"name": "minSwap",
"signature": "def minSwap(self, A, B)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020276 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def similarRGB(self, color): :type color: str :rtype: str
- def minSwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def similarRGB(self, color): :type color: str :rtype: str
- def minSwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: int
<|skeleton|>
class Solution:
def simi... | 8790abadd5289024794cd95529187c96111c2bd6 | <|skeleton|>
class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
<|body_0|>
def minSwap(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
ans = '#'
for i in range(1, 7, 2):
num = int(color[i:i + 2], 16)
char = ''
mind = float('inf')
for j in range(16):
dis = abs(j * 16 + j - num)
... | the_stack_v2_python_sparse | contests/contest76.py | minging234/LeetCode_ming | train | 0 | |
c4914f711540455a50a264f12cb383b495c4a6d7 | [
"if len(nums) == 0:\n return []\npre = nums[0] - 1\ni = 0\nl = len(nums)\nj = 0\nwhile i < l:\n if i + j >= l:\n break\n if pre == nums[i]:\n nums.pop(i)\n j += 1\n continue\n i += 1\n pre = nums[i - 1]\nreturn nums",
"if len(nums) == 0:\n return []\npre = nums[0]\nj ... | <|body_start_0|>
if len(nums) == 0:
return []
pre = nums[0] - 1
i = 0
l = len(nums)
j = 0
while i < l:
if i + j >= l:
break
if pre == nums[i]:
nums.pop(i)
j += 1
continue
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def removeDuplicates3(self, nums):
""":type nums: List[int] :rtyp... | stack_v2_sparse_classes_36k_train_005163 | 1,858 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates2",
"signature": "def removeDuplicates2(self, nums)"
},
{
"docstring": "... | 3 | stack_v2_sparse_classes_30k_train_009029 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates2(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates3(self, nums): :t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates2(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates3(self, nums): :t... | a2ae0f1f26980fffef90b058cad8cccee705bf56 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def removeDuplicates3(self, nums):
""":type nums: List[int] :rtyp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) == 0:
return []
pre = nums[0] - 1
i = 0
l = len(nums)
j = 0
while i < l:
if i + j >= l:
break
if pre == n... | the_stack_v2_python_sparse | solution26.py | qingfengwuhen/Leetcode | train | 0 | |
f324d0f7e8fbd7f06ca93dee64fad3919778e466 | [
"self.capacity = capacity\nself.cache = dict()\nself.count = defaultdict(int)\nself.freq = defaultdict(list)",
"if not key in self.cache:\n return -1\n_freq = self.count[key]\nself.count[key] = _freq + 1\nself.freq[_freq].remove(key)\nif not self.freq[_freq]:\n self.freq.pop(_freq)\nself.freq[_freq + 1].app... | <|body_start_0|>
self.capacity = capacity
self.cache = dict()
self.count = defaultdict(int)
self.freq = defaultdict(list)
<|end_body_0|>
<|body_start_1|>
if not key in self.cache:
return -1
_freq = self.count[key]
self.count[key] = _freq + 1
s... | Class which implement LFU cache algorithm | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
"""Class which implement LFU cache algorithm"""
def __init__(self, capacity):
""":type capacity: int :rtype: None"""
<|body_0|>
def get(self, key):
""":type key: str :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key:... | stack_v2_sparse_classes_36k_train_005164 | 7,259 | no_license | [
{
"docstring": ":type capacity: int :rtype: None",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: str :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",... | 3 | null | Implement the Python class `LFUCache` described below.
Class description:
Class which implement LFU cache algorithm
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int :rtype: None
- def get(self, key): :type key: str :rtype: int
- def put(self, key, value): :type key: int :type valu... | Implement the Python class `LFUCache` described below.
Class description:
Class which implement LFU cache algorithm
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int :rtype: None
- def get(self, key): :type key: str :rtype: int
- def put(self, key, value): :type key: int :type valu... | 546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9 | <|skeleton|>
class LFUCache:
"""Class which implement LFU cache algorithm"""
def __init__(self, capacity):
""":type capacity: int :rtype: None"""
<|body_0|>
def get(self, key):
""":type key: str :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
"""Class which implement LFU cache algorithm"""
def __init__(self, capacity):
""":type capacity: int :rtype: None"""
self.capacity = capacity
self.cache = dict()
self.count = defaultdict(int)
self.freq = defaultdict(list)
def get(self, key):
... | the_stack_v2_python_sparse | leetcode/solution_460.py | eselyavka/python | train | 0 |
cc3b6d297715110e3a1773a07372bc2cb8e15c71 | [
"def helper(node):\n if node:\n vals.append(str(node.val))\n helper(node.left)\n helper(node.right)\n else:\n vals.append('null')\nvals = []\nhelper(root)\nreturn ' '.join(vals)",
"def helper():\n try:\n val = next(vals)\n if val == '#':\n return None\... | <|body_start_0|>
def helper(node):
if node:
vals.append(str(node.val))
helper(node.left)
helper(node.right)
else:
vals.append('null')
vals = []
helper(root)
return ' '.join(vals)
<|end_body_0|>
<|bod... | 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_005165 | 1,334 | 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:... | 3f0ffd519404165fd1a735441b212c801fd1ad1e | <|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"""
def helper(node):
if node:
vals.append(str(node.val))
helper(node.left)
helper(node.right)
else:
v... | the_stack_v2_python_sparse | Problems/2300_2399/2331_Evaluate_Boolean_Binary_Tree/Project_Python3/TreeNode/Codec.py | NobuyukiInoue/LeetCode | train | 0 | |
e9ae1c5a76c0f06ce86db07e5bef5cbb0cd580dd | [
"BaseType.__init__(self, cle)\nself.masculin = True\nself.onces_max_contenu = 5\nself.etendre_editeur('on', \"nombre d'onces au maximum\", Entier, self, 'onces_max_contenu')\nself.etendre_editeur('ma', 'genre masculin', Flag, self, 'masculin')\nself._attributs = {'onces_contenu': Attribut(lambda: self.onces_max_con... | <|body_start_0|>
BaseType.__init__(self, cle)
self.masculin = True
self.onces_max_contenu = 5
self.etendre_editeur('on', "nombre d'onces au maximum", Entier, self, 'onces_max_contenu')
self.etendre_editeur('ma', 'genre masculin', Flag, self, 'masculin')
self._attributs = ... | Type d'objet: sac de poudre. | SacPoudre | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SacPoudre:
"""Type d'objet: sac de poudre."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les enveloppes"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
BaseTyp... | stack_v2_sparse_classes_36k_train_005166 | 3,008 | permissive | [
{
"docstring": "Constructeur de l'objet",
"name": "__init__",
"signature": "def __init__(self, cle='')"
},
{
"docstring": "Travail sur les enveloppes",
"name": "travailler_enveloppes",
"signature": "def travailler_enveloppes(self, enveloppes)"
}
] | 2 | null | Implement the Python class `SacPoudre` described below.
Class description:
Type d'objet: sac de poudre.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes | Implement the Python class `SacPoudre` described below.
Class description:
Type d'objet: sac de poudre.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes
<|skeleton|>
class SacPoudre:
"""Type d'objet: ... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class SacPoudre:
"""Type d'objet: sac de poudre."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les enveloppes"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SacPoudre:
"""Type d'objet: sac de poudre."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
BaseType.__init__(self, cle)
self.masculin = True
self.onces_max_contenu = 5
self.etendre_editeur('on', "nombre d'onces au maximum", Entier, self, 'onces_max_con... | the_stack_v2_python_sparse | src/secondaires/navigation/types/sac_poudre.py | vincent-lg/tsunami | train | 5 |
2ef86a20c82f79bb562fe19ce5ab78cd9d9334b8 | [
"super(DumpDeviceState, self).__init__()\nself.devices = devices\nself.target = target\nreturn",
"device = self.devices[parameters.nodes.parameters]\nself.logger.info(str(device))\nif self.target is not None:\n self.target(str(device))\nreturn"
] | <|body_start_0|>
super(DumpDeviceState, self).__init__()
self.devices = devices
self.target = target
return
<|end_body_0|>
<|body_start_1|>
device = self.devices[parameters.nodes.parameters]
self.logger.info(str(device))
if self.target is not None:
se... | A class to record the state of a device. | DumpDeviceState | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
<|body_0|>
def __call__(self, parameters):
"""... | stack_v2_sparse_classes_36k_train_005167 | 832 | permissive | [
{
"docstring": ":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output",
"name": "__init__",
"signature": "def __init__(self, devices, target=None)"
},
{
"docstring": ":param: - `parameters`: a named tuple (expects parameters.nodes.parameters)",
... | 2 | null | Implement the Python class `DumpDeviceState` described below.
Class description:
A class to record the state of a device.
Method signatures and docstrings:
- def __init__(self, devices, target=None): :param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output
- def __call_... | Implement the Python class `DumpDeviceState` described below.
Class description:
A class to record the state of a device.
Method signatures and docstrings:
- def __init__(self, devices, target=None): :param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output
- def __call_... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
<|body_0|>
def __call__(self, parameters):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
super(DumpDeviceState, self).__init__()
self.devices = devices
... | the_stack_v2_python_sparse | apetools/tools/dumpdevicestate.py | russell-n/oldape | train | 0 |
03153bdbab21f56093b286ad879bfdfe66cfc86f | [
"self.name = urdf_joint.name\nself.parent = urdf_joint.parent\nself.child = urdf_joint.child\nself.type = urdf_joint.type\nif urdf_joint.limit is not None:\n self.lower_limit = urdf_joint.limit.lower\n self.upper_limit = urdf_joint.limit.upper\n self.velocity_limit = urdf_joint.limit.velocity\nif urdf_join... | <|body_start_0|>
self.name = urdf_joint.name
self.parent = urdf_joint.parent
self.child = urdf_joint.child
self.type = urdf_joint.type
if urdf_joint.limit is not None:
self.lower_limit = urdf_joint.limit.lower
self.upper_limit = urdf_joint.limit.upper
... | tensorflow module for joint | Joint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Joint:
"""tensorflow module for joint"""
def __init__(self, urdf_joint, dtype=tf.float32):
""":param urdf_joint: joint class from urdf_parser_py :param dtype: data type"""
<|body_0|>
def transformation(self, q=None):
"""homogeneous transformation matrices for the... | stack_v2_sparse_classes_36k_train_005168 | 7,145 | permissive | [
{
"docstring": ":param urdf_joint: joint class from urdf_parser_py :param dtype: data type",
"name": "__init__",
"signature": "def __init__(self, urdf_joint, dtype=tf.float32)"
},
{
"docstring": "homogeneous transformation matrices for the joint :param q: joint configuration :return frame: homog... | 2 | stack_v2_sparse_classes_30k_train_020426 | Implement the Python class `Joint` described below.
Class description:
tensorflow module for joint
Method signatures and docstrings:
- def __init__(self, urdf_joint, dtype=tf.float32): :param urdf_joint: joint class from urdf_parser_py :param dtype: data type
- def transformation(self, q=None): homogeneous transforma... | Implement the Python class `Joint` described below.
Class description:
tensorflow module for joint
Method signatures and docstrings:
- def __init__(self, urdf_joint, dtype=tf.float32): :param urdf_joint: joint class from urdf_parser_py :param dtype: data type
- def transformation(self, q=None): homogeneous transforma... | c612a014f517204b38c552619a441be4b3d7b67f | <|skeleton|>
class Joint:
"""tensorflow module for joint"""
def __init__(self, urdf_joint, dtype=tf.float32):
""":param urdf_joint: joint class from urdf_parser_py :param dtype: data type"""
<|body_0|>
def transformation(self, q=None):
"""homogeneous transformation matrices for the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Joint:
"""tensorflow module for joint"""
def __init__(self, urdf_joint, dtype=tf.float32):
""":param urdf_joint: joint class from urdf_parser_py :param dtype: data type"""
self.name = urdf_joint.name
self.parent = urdf_joint.parent
self.child = urdf_joint.child
sel... | the_stack_v2_python_sparse | rmp2/kinematics/tf_fk.py | Global19/rmp2 | train | 0 |
6540cebe768e0e9792d4004c90bef19dba4bc453 | [
"self.locations = defaultdict(list)\nfor i, w in enumerate(words):\n self.locations[w].append(i)\nprint(self.locations)",
"loc1, loc2 = (self.locations[word1], self.locations[word2])\nl1, l2 = (0, 0)\nmin_diff = float('inf')\nwhile l1 < len(loc1) and l2 < len(loc2):\n min_diff = min(min_diff, abs(loc1[l1] -... | <|body_start_0|>
self.locations = defaultdict(list)
for i, w in enumerate(words):
self.locations[w].append(i)
print(self.locations)
<|end_body_0|>
<|body_start_1|>
loc1, loc2 = (self.locations[word1], self.locations[word2])
l1, l2 = (0, 0)
min_diff = float('i... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.locations = defaultdict(list)
... | stack_v2_sparse_classes_36k_train_005169 | 1,663 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | null | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | 8ba13b3ad15e3dec092970266bfa4f48edb08f2d | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.locations = defaultdict(list)
for i, w in enumerate(words):
self.locations[w].append(i)
print(self.locations)
def shortest(self, word1, word2):
""":type word1: str :type word2: s... | the_stack_v2_python_sparse | _leet/design/shortest-word-distance.py | drcpcg/codebase | train | 0 | |
3b3fbbdf04c39ec05394e72b8cd9e8dfe82fae9f | [
"def suffix():\n res, tmp = ('', '')\n for _ in range(6):\n tmp = letters[random.randint(0, 10000) % 62]\n res += tmp\n return res\nif longUrl in full_tiny:\n return 'http://tinyurl.com/' + full_tiny[longUrl]\nelse:\n suff = suffix()\n full_tiny[longUrl] = suff\n tiny_full[suff] =... | <|body_start_0|>
def suffix():
res, tmp = ('', '')
for _ in range(6):
tmp = letters[random.randint(0, 10000) % 62]
res += tmp
return res
if longUrl in full_tiny:
return 'http://tinyurl.com/' + full_tiny[longUrl]
else... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, longUrl):
"""Encodes a URL to a shortened URL. :type longUrl: str :rtype: str"""
<|body_0|>
def decode(self, shortUrl):
"""Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_005170 | 1,662 | no_license | [
{
"docstring": "Encodes a URL to a shortened URL. :type longUrl: str :rtype: str",
"name": "encode",
"signature": "def encode(self, longUrl)"
},
{
"docstring": "Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str",
"name": "decode",
"signature": "def decode(self,... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, longUrl): Encodes a URL to a shortened URL. :type longUrl: str :rtype: str
- def decode(self, shortUrl): Decodes a shortened URL to its original URL. :type shortUrl: s... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, longUrl): Encodes a URL to a shortened URL. :type longUrl: str :rtype: str
- def decode(self, shortUrl): Decodes a shortened URL to its original URL. :type shortUrl: s... | 74550d68cd3fd2cfcc92e1bf6579ac3b8f31aa75 | <|skeleton|>
class Codec:
def encode(self, longUrl):
"""Encodes a URL to a shortened URL. :type longUrl: str :rtype: str"""
<|body_0|>
def decode(self, shortUrl):
"""Decodes a shortened URL to its original URL. :type shortUrl: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, longUrl):
"""Encodes a URL to a shortened URL. :type longUrl: str :rtype: str"""
def suffix():
res, tmp = ('', '')
for _ in range(6):
tmp = letters[random.randint(0, 10000) % 62]
res += tmp
return res
... | the_stack_v2_python_sparse | hash_table/535_encode_and_decode_tinyurl.py | lawtech0902/py_imooc_algorithm | train | 0 | |
13d013e91ea21a14b0a361accbbe2fbc4ccedfe7 | [
"def decorator(subclass):\n cls.subclasses[file_type] = subclass\n return subclass\nreturn decorator",
"if file_type not in cls.subclasses:\n raise NotImplementedError('Unknown file extension {}'.format(file_type))\nreturn cls.subclasses[file_type](file_name)"
] | <|body_start_0|>
def decorator(subclass):
cls.subclasses[file_type] = subclass
return subclass
return decorator
<|end_body_0|>
<|body_start_1|>
if file_type not in cls.subclasses:
raise NotImplementedError('Unknown file extension {}'.format(file_type))
... | Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров | BaseFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseFile:
"""Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров"""
def register_subclass(cls, file_type):
"""При задании нового подкласса для нового расширения файлов этот декоратор добавляет его в словарь... | stack_v2_sparse_classes_36k_train_005171 | 5,342 | no_license | [
{
"docstring": "При задании нового подкласса для нового расширения файлов этот декоратор добавляет его в словарь подклассов. Возвращает функцию decorator, которая принимает подкласс в качестве аргумента.",
"name": "register_subclass",
"signature": "def register_subclass(cls, file_type)"
},
{
"do... | 2 | stack_v2_sparse_classes_30k_train_016874 | Implement the Python class `BaseFile` described below.
Class description:
Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров
Method signatures and docstrings:
- def register_subclass(cls, file_type): При задании нового подкласса для нового... | Implement the Python class `BaseFile` described below.
Class description:
Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров
Method signatures and docstrings:
- def register_subclass(cls, file_type): При задании нового подкласса для нового... | c3225516640d872b97139a5c2919d216d5370b17 | <|skeleton|>
class BaseFile:
"""Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров"""
def register_subclass(cls, file_type):
"""При задании нового подкласса для нового расширения файлов этот декоратор добавляет его в словарь... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseFile:
"""Решение задачи с помощью staticmethod python3 Скрипт является ригистратором создаваемых подклассов + метод фабрики их экземпляров"""
def register_subclass(cls, file_type):
"""При задании нового подкласса для нового расширения файлов этот декоратор добавляет его в словарь подклассов. ... | the_stack_v2_python_sparse | Homework11-20+22.03/Task3(bd)(2).py | Twicer/Homeworks | train | 0 |
8a942f92372390414918a4d9efc95f4952995b68 | [
"res = cur = 0\nfor i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])):\n cur += v\n res = max(res, cur)\nreturn res",
"l = []\nfor start, end in sorted(intervals):\n if l and l[0] <= start:\n heapq.heapreplace(l, end)\n else:\n heapq.heappush(l, end)\nreturn len(l)",
... | <|body_start_0|>
res = cur = 0
for i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])):
cur += v
res = max(res, cur)
return res
<|end_body_0|>
<|body_start_1|>
l = []
for start, end in sorted(intervals):
if l and l[0] <= start... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minMeetingRooms(self, intervals):
"""골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행."""
<|body_0|>
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
"""start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 ... | stack_v2_sparse_classes_36k_train_005172 | 1,766 | no_license | [
{
"docstring": "골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.",
"name": "minMeetingRooms",
"signature": "def minMeetingRooms(self, intervals)"
},
{
"docstring": "start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 앞 값을 꺼내서 비교해도 그게 최선의 방법이 된다.",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_019322 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minMeetingRooms(self, intervals): 골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.
- def minMeetingRooms(self, intervals: List[List[int]]) -> int: start range를 기준으로 sor... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minMeetingRooms(self, intervals): 골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행.
- def minMeetingRooms(self, intervals: List[List[int]]) -> int: start range를 기준으로 sor... | c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1 | <|skeleton|>
class Solution:
def minMeetingRooms(self, intervals):
"""골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행."""
<|body_0|>
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
"""start range를 기준으로 sorting. heapq를 써서 진행. 처음 풀었던 방법과 다르게, start 값을 순서대로 소팅하면, 항상 맨 ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minMeetingRooms(self, intervals):
"""골때리는 풀이. [start, 1], [end,-1] 로 만들어서 전체를 sorting한후 진행."""
res = cur = 0
for i, v in sorted((x for i, j in intervals for x in [[i, 1], [j, -1]])):
cur += v
res = max(res, cur)
return res
def minMeeti... | the_stack_v2_python_sparse | Leetcode/253.py | hanwgyu/algorithm_problem_solving | train | 5 | |
9a5adfea89cad9d5e7a12b3e94e9cf12f559e555 | [
"site_info: Dict[str, Dict] = {}\nif isinstance(stations, str):\n stations = [s.strip().lower() for s in stations.split(',')]\nelse:\n stations = [s.lower() for s in stations]\nfor sta in stations:\n site_dict = site_info.setdefault(sta, {})\n for module in _MODULES:\n module_name = 'site_coord' ... | <|body_start_0|>
site_info: Dict[str, Dict] = {}
if isinstance(stations, str):
stations = [s.strip().lower() for s in stations.split(',')]
else:
stations = [s.lower() for s in stations]
for sta in stations:
site_dict = site_info.setdefault(sta, {})
... | Main site information class for site information from various sources into unified classes | SiteInfo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiteInfo:
"""Main site information class for site information from various sources into unified classes"""
def get(cls, source: str, source_data: Any, stations: Union[str, Iterable], date: Union[None, datetime]=None, source_path: Union[None, str]=None) -> Dict:
"""Get site informatio... | stack_v2_sparse_classes_36k_train_005173 | 5,047 | permissive | [
{
"docstring": "Get site information dictionary from given source for specified date Args: source: Site information source type: e.g. 'snx' (SINEX file), 'ssc' (SSC file) or other source_data: Source data with site information from specified source type. stations: List of station names. date: Date for getting s... | 2 | null | Implement the Python class `SiteInfo` described below.
Class description:
Main site information class for site information from various sources into unified classes
Method signatures and docstrings:
- def get(cls, source: str, source_data: Any, stations: Union[str, Iterable], date: Union[None, datetime]=None, source_... | Implement the Python class `SiteInfo` described below.
Class description:
Main site information class for site information from various sources into unified classes
Method signatures and docstrings:
- def get(cls, source: str, source_data: Any, stations: Union[str, Iterable], date: Union[None, datetime]=None, source_... | 31939afee943273b23fa0a5ef193cfecfa68d6c0 | <|skeleton|>
class SiteInfo:
"""Main site information class for site information from various sources into unified classes"""
def get(cls, source: str, source_data: Any, stations: Union[str, Iterable], date: Union[None, datetime]=None, source_path: Union[None, str]=None) -> Dict:
"""Get site informatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SiteInfo:
"""Main site information class for site information from various sources into unified classes"""
def get(cls, source: str, source_data: Any, stations: Union[str, Iterable], date: Union[None, datetime]=None, source_path: Union[None, str]=None) -> Dict:
"""Get site information dictionary ... | the_stack_v2_python_sparse | midgard/site_info/site_info.py | kartverket/midgard | train | 18 |
c74f5110a731ed560db7475502ae5e819d5734fb | [
"member = member or ctx.author\ne = disnake.Embed(description='')\nif member.bot:\n e.description = 'This account is a bot.\\n\\n'\ne.description += member.mention\ne.add_field(name='Status', value=member.status)\nif member.activity:\n e.add_field(name='Activity', value=member.activity.name)\ne.set_author(nam... | <|body_start_0|>
member = member or ctx.author
e = disnake.Embed(description='')
if member.bot:
e.description = 'This account is a bot.\n\n'
e.description += member.mention
e.add_field(name='Status', value=member.status)
if member.activity:
e.add_f... | View info about a member. | WhoIs | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WhoIs:
"""View info about a member."""
async def info(self, ctx, *, member: disnake.Member=None):
"""Display information about user or self."""
<|body_0|>
async def newusers(self, ctx, *, count=5):
"""List newly joined members."""
<|body_1|>
async de... | stack_v2_sparse_classes_36k_train_005174 | 2,849 | permissive | [
{
"docstring": "Display information about user or self.",
"name": "info",
"signature": "async def info(self, ctx, *, member: disnake.Member=None)"
},
{
"docstring": "List newly joined members.",
"name": "newusers",
"signature": "async def newusers(self, ctx, *, count=5)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_011980 | Implement the Python class `WhoIs` described below.
Class description:
View info about a member.
Method signatures and docstrings:
- async def info(self, ctx, *, member: disnake.Member=None): Display information about user or self.
- async def newusers(self, ctx, *, count=5): List newly joined members.
- async def av... | Implement the Python class `WhoIs` described below.
Class description:
View info about a member.
Method signatures and docstrings:
- async def info(self, ctx, *, member: disnake.Member=None): Display information about user or self.
- async def newusers(self, ctx, *, count=5): List newly joined members.
- async def av... | b4640f633947f0a9fd902e8ddc95a4b667b85602 | <|skeleton|>
class WhoIs:
"""View info about a member."""
async def info(self, ctx, *, member: disnake.Member=None):
"""Display information about user or self."""
<|body_0|>
async def newusers(self, ctx, *, count=5):
"""List newly joined members."""
<|body_1|>
async de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WhoIs:
"""View info about a member."""
async def info(self, ctx, *, member: disnake.Member=None):
"""Display information about user or self."""
member = member or ctx.author
e = disnake.Embed(description='')
if member.bot:
e.description = 'This account is a bot... | the_stack_v2_python_sparse | cogs/whois.py | Run1e/AceBot | train | 107 |
2b443793f5bf241d46a269834fe49d972471e80b | [
"schema = SaleSchema()\nsale = Sale.get_by_id(sale_id)\nif not sale:\n return (dict(status='fail', message=f'Sale with id {sale_id} not found'), 404)\nsale_data, errors = schema.dumps(sale)\nif errors:\n return (dict(status='fail', message=errors), 500)\nreturn (dict(status='success', data=dict(sale=json.load... | <|body_start_0|>
schema = SaleSchema()
sale = Sale.get_by_id(sale_id)
if not sale:
return (dict(status='fail', message=f'Sale with id {sale_id} not found'), 404)
sale_data, errors = schema.dumps(sale)
if errors:
return (dict(status='fail', message=errors),... | SaleDetailView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SaleDetailView:
def get(self, sale_id):
"""Getting individual sale"""
<|body_0|>
def patch(self, sale_id):
"""Update a single sale"""
<|body_1|>
def delete(self, sale_id):
"""Delete a single sale"""
<|body_2|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_005175 | 2,917 | no_license | [
{
"docstring": "Getting individual sale",
"name": "get",
"signature": "def get(self, sale_id)"
},
{
"docstring": "Update a single sale",
"name": "patch",
"signature": "def patch(self, sale_id)"
},
{
"docstring": "Delete a single sale",
"name": "delete",
"signature": "def ... | 3 | stack_v2_sparse_classes_30k_train_005675 | Implement the Python class `SaleDetailView` described below.
Class description:
Implement the SaleDetailView class.
Method signatures and docstrings:
- def get(self, sale_id): Getting individual sale
- def patch(self, sale_id): Update a single sale
- def delete(self, sale_id): Delete a single sale | Implement the Python class `SaleDetailView` described below.
Class description:
Implement the SaleDetailView class.
Method signatures and docstrings:
- def get(self, sale_id): Getting individual sale
- def patch(self, sale_id): Update a single sale
- def delete(self, sale_id): Delete a single sale
<|skeleton|>
class... | 015d70b8f79df6c1a5629add35767cee52f424f5 | <|skeleton|>
class SaleDetailView:
def get(self, sale_id):
"""Getting individual sale"""
<|body_0|>
def patch(self, sale_id):
"""Update a single sale"""
<|body_1|>
def delete(self, sale_id):
"""Delete a single sale"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SaleDetailView:
def get(self, sale_id):
"""Getting individual sale"""
schema = SaleSchema()
sale = Sale.get_by_id(sale_id)
if not sale:
return (dict(status='fail', message=f'Sale with id {sale_id} not found'), 404)
sale_data, errors = schema.dumps(sale)
... | the_stack_v2_python_sparse | app/controllers/sale.py | MutegekiHenry/project-cohort-backend | train | 0 | |
071f11ab7ea0ce62452c77ef3cc66c59ddcad943 | [
"self.m = m\nself.n = n\nself.k = k\nself.count = 0\nself.visited = set()\nself.dfs(0, 0, 0, 0)\nreturn self.count",
"if not self.pos_available(row, col, row_sum, col_sum) or (row, col) in self.visited:\n return\nself.visited.add((row, col))\nself.count += 1\nself.dfs(row + 1, col, row_sum + 1 if (row + 1) % 1... | <|body_start_0|>
self.m = m
self.n = n
self.k = k
self.count = 0
self.visited = set()
self.dfs(0, 0, 0, 0)
return self.count
<|end_body_0|>
<|body_start_1|>
if not self.pos_available(row, col, row_sum, col_sum) or (row, col) in self.visited:
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int"""
<|body_0|>
def dfs(self, row, col, row_sum, col_sum):
"""parameter: row: int col: int row_sum: int col_sum: int"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_005176 | 2,906 | no_license | [
{
"docstring": "parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int",
"name": "movingCount",
"signature": "def movingCount(self, m: int, n: int, k: int) -> int"
},
{
"docstring": "parameter: row: int col: int row_sum: int col_sum: int",
"name": "dfs",
"signature": "def dfs(se... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def movingCount(self, m: int, n: int, k: int) -> int: parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int
- def dfs(self, row, col, row_sum, col_sum): parameter: row:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def movingCount(self, m: int, n: int, k: int) -> int: parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int
- def dfs(self, row, col, row_sum, col_sum): parameter: row:... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int"""
<|body_0|>
def dfs(self, row, col, row_sum, col_sum):
"""parameter: row: int col: int row_sum: int col_sum: int"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""parameter: m: int, [1, 100] n: int, [1, 100] k: int return: int"""
self.m = m
self.n = n
self.k = k
self.count = 0
self.visited = set()
self.dfs(0, 0, 0, 0)
return self.count
... | the_stack_v2_python_sparse | code/面试题13. 机器人的运动范围.py | AiZhanghan/Leetcode | train | 0 | |
0bd47f621bdac3e959c85edc89a17f5300a0ad7e | [
"assert chunk_size % _CHUNK_SIZE_MULTIPLE == 0, 'chunk_size must be a multiple of %d B' % _CHUNK_SIZE_MULTIPLE\nself.chunk_size = chunk_size\nself.logger = logger\ncredentials = service_account.Credentials.from_service_account_file(json_key_path, scopes=(_GCS_SCOPE,))\nself.client = storage.Client(project='', crede... | <|body_start_0|>
assert chunk_size % _CHUNK_SIZE_MULTIPLE == 0, 'chunk_size must be a multiple of %d B' % _CHUNK_SIZE_MULTIPLE
self.chunk_size = chunk_size
self.logger = logger
credentials = service_account.Credentials.from_service_account_file(json_key_path, scopes=(_GCS_SCOPE,))
... | Wrapper to access Google Cloud Storage. | CloudStorage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger obj... | stack_v2_sparse_classes_36k_train_005177 | 6,756 | permissive | [
{
"docstring": "Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger object to record messages. chunk_size: Files uploaded to GCS are sent in chunks. Must be a multiple of _CHUNK_SIZE_MULTIPLE.",
"name": "__init__",
... | 4 | stack_v2_sparse_classes_30k_train_004005 | Implement the Python class `CloudStorage` described below.
Class description:
Wrapper to access Google Cloud Storage.
Method signatures and docstrings:
- def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE): Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private k... | Implement the Python class `CloudStorage` described below.
Class description:
Wrapper to access Google Cloud Storage.
Method signatures and docstrings:
- def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE): Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private k... | a1b0fccd68987d8cd9c89710adc3c04b868347ec | <|skeleton|>
class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger obj... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger object to record... | the_stack_v2_python_sparse | py/utils/gcs_utils.py | bridder/factory | train | 0 |
1072323eaec3dfe7c4911efcc9c0585703fac048 | [
"log_dir_train = os.path.join(log_dir, 'train')\nlog_dir_val = os.path.join(log_dir, 'val')\nos.makedirs(log_dir_train, exist_ok=True)\nos.makedirs(log_dir_val, exist_ok=True)\nself._summary_writter_train = tf.summary.create_file_writer(log_dir_train)\nself._summary_writter_val = tf.summary.create_file_writer(log_d... | <|body_start_0|>
log_dir_train = os.path.join(log_dir, 'train')
log_dir_val = os.path.join(log_dir, 'val')
os.makedirs(log_dir_train, exist_ok=True)
os.makedirs(log_dir_val, exist_ok=True)
self._summary_writter_train = tf.summary.create_file_writer(log_dir_train)
self._su... | A simple `TensorFlow`-friendly `TensorBoard` wrapper. | TensorBoardLogger | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TensorBoardLogger:
"""A simple `TensorFlow`-friendly `TensorBoard` wrapper."""
def __init__(self, log_dir: str) -> None:
"""Constructs a simgple `TensorBoard` wrapper."""
<|body_0|>
def log(self, split: str, loss: float, overhead_features: types.Array, predictions: types... | stack_v2_sparse_classes_36k_train_005178 | 4,176 | permissive | [
{
"docstring": "Constructs a simgple `TensorBoard` wrapper.",
"name": "__init__",
"signature": "def __init__(self, log_dir: str) -> None"
},
{
"docstring": "Logs the scalar loss and visualizes predictions for qualitative inspection. Args: split: One of {\"train\", \"val\"}, raises error otherwis... | 2 | stack_v2_sparse_classes_30k_train_015903 | Implement the Python class `TensorBoardLogger` described below.
Class description:
A simple `TensorFlow`-friendly `TensorBoard` wrapper.
Method signatures and docstrings:
- def __init__(self, log_dir: str) -> None: Constructs a simgple `TensorBoard` wrapper.
- def log(self, split: str, loss: float, overhead_features:... | Implement the Python class `TensorBoardLogger` described below.
Class description:
A simple `TensorFlow`-friendly `TensorBoard` wrapper.
Method signatures and docstrings:
- def __init__(self, log_dir: str) -> None: Constructs a simgple `TensorBoard` wrapper.
- def log(self, split: str, loss: float, overhead_features:... | 1680aee77a53228412f9bab34068f0a9576c58e3 | <|skeleton|>
class TensorBoardLogger:
"""A simple `TensorFlow`-friendly `TensorBoard` wrapper."""
def __init__(self, log_dir: str) -> None:
"""Constructs a simgple `TensorBoard` wrapper."""
<|body_0|>
def log(self, split: str, loss: float, overhead_features: types.Array, predictions: types... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TensorBoardLogger:
"""A simple `TensorFlow`-friendly `TensorBoard` wrapper."""
def __init__(self, log_dir: str) -> None:
"""Constructs a simgple `TensorBoard` wrapper."""
log_dir_train = os.path.join(log_dir, 'train')
log_dir_val = os.path.join(log_dir, 'val')
os.makedirs(... | the_stack_v2_python_sparse | oatomobile/tf/loggers.py | OATML/oatomobile | train | 177 |
4621d21bed8d7a6cee75c40f3b148beced6c1c80 | [
"from mercury.plugin import AbstractFactory, PUMappingStrategy\nself.edc_id: str = edc_config.edc_id\nself.srv_priority: list[str] = srv_priority\nself.pu_twins: list[ProcessingUnit] = list()\nfor pu_id, pu_config in edc_config.pu_configs.items():\n self.pu_twins.append(ProcessingUnit(f'{pu_id}_slicer', pu_id, p... | <|body_start_0|>
from mercury.plugin import AbstractFactory, PUMappingStrategy
self.edc_id: str = edc_config.edc_id
self.srv_priority: list[str] = srv_priority
self.pu_twins: list[ProcessingUnit] = list()
for pu_id, pu_config in edc_config.pu_configs.items():
self.pu_... | EDCResourceSlicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EDCResourceSlicer:
def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]):
"""Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priori... | stack_v2_sparse_classes_36k_train_005179 | 2,763 | permissive | [
{
"docstring": "Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priority. :param edc_config: configuration parameters of the EDC.",
"name": "__init__",
"signature": "def _... | 2 | null | Implement the Python class `EDCResourceSlicer` described below.
Class description:
Implement the EDCResourceSlicer class.
Method signatures and docstrings:
- def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): Edge Data Center resource slicer. :param srv_priority: list of services in decrea... | Implement the Python class `EDCResourceSlicer` described below.
Class description:
Implement the EDCResourceSlicer class.
Method signatures and docstrings:
- def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): Edge Data Center resource slicer. :param srv_priority: list of services in decrea... | cb425605de3341d27ce43fb326b300cb8ac781f6 | <|skeleton|>
class EDCResourceSlicer:
def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]):
"""Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priori... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EDCResourceSlicer:
def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]):
"""Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priority. :param edc... | the_stack_v2_python_sparse | mercury/model/edcs/edc/r_manager/slicer.py | greenlsi/mercury_mso_framework | train | 2 | |
0cd2651fcda284073141c63060442ef1dafacbc5 | [
"gerrit_setting = self.config.get('gerrit', None)\nif gerrit_setting is not None:\n return gerrit_setting\nrepo = utils.get_git_repo(self.pod.root)\nif repo is None:\n return False\nfor remote in repo.remotes:\n url = remote.config_reader.get('url')\n result = urllib.parse.urlparse(url)\n if result.n... | <|body_start_0|>
gerrit_setting = self.config.get('gerrit', None)
if gerrit_setting is not None:
return gerrit_setting
repo = utils.get_git_repo(self.pod.root)
if repo is None:
return False
for remote in repo.remotes:
url = remote.config_reader... | Gerrit installer. | GerritInstaller | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GerritInstaller:
"""Gerrit installer."""
def should_run(self):
"""Should the installer run?"""
<|body_0|>
def install(self):
"""Install dependencies."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
gerrit_setting = self.config.get('gerrit', None... | stack_v2_sparse_classes_36k_train_005180 | 1,751 | permissive | [
{
"docstring": "Should the installer run?",
"name": "should_run",
"signature": "def should_run(self)"
},
{
"docstring": "Install dependencies.",
"name": "install",
"signature": "def install(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000226 | Implement the Python class `GerritInstaller` described below.
Class description:
Gerrit installer.
Method signatures and docstrings:
- def should_run(self): Should the installer run?
- def install(self): Install dependencies. | Implement the Python class `GerritInstaller` described below.
Class description:
Gerrit installer.
Method signatures and docstrings:
- def should_run(self): Should the installer run?
- def install(self): Install dependencies.
<|skeleton|>
class GerritInstaller:
"""Gerrit installer."""
def should_run(self):
... | 17471c436621ebfd978b51225fa4de05367a53e1 | <|skeleton|>
class GerritInstaller:
"""Gerrit installer."""
def should_run(self):
"""Should the installer run?"""
<|body_0|>
def install(self):
"""Install dependencies."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GerritInstaller:
"""Gerrit installer."""
def should_run(self):
"""Should the installer run?"""
gerrit_setting = self.config.get('gerrit', None)
if gerrit_setting is not None:
return gerrit_setting
repo = utils.get_git_repo(self.pod.root)
if repo is None... | the_stack_v2_python_sparse | grow/sdk/installers/gerrit_installer.py | grow/grow | train | 352 |
6199f31e78653556e281760540ef78c018d13d42 | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), date_of_birth=date_of_birth)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password, date_of_birth=date_of_birth)\nuser.i... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), date_of_birth=date_of_birth)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, date_of_birth, password):
"""Creates and saves a superuser with th... | stack_v2_sparse_classes_36k_train_005181 | 3,282 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, date_of_birth, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"... | 2 | stack_v2_sparse_classes_30k_train_008173 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, emai... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, emai... | 13051e3fdcebff13719914cfa03932e931352fdb | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, date_of_birth, password):
"""Creates and saves a superuser with th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, email, date_of_birth, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email)... | the_stack_v2_python_sparse | agora/accounts/models.py | mc-agora/agora-h | train | 1 | |
90ac2fbed5ce65682195370a2f324ff9354e99ef | [
"project_id, recording_id = util.project_or_object(project, recording)\nurl = self.ARCHIVE_URL.format(base_url=self.url, project_id=project_id, recording_id=recording_id)\nself._no_response(url, method='PUT')",
"project_id, recording_id = util.project_or_object(project, recording)\nurl = self.UNARCHIVE_URL.format... | <|body_start_0|>
project_id, recording_id = util.project_or_object(project, recording)
url = self.ARCHIVE_URL.format(base_url=self.url, project_id=project_id, recording_id=recording_id)
self._no_response(url, method='PUT')
<|end_body_0|>
<|body_start_1|>
project_id, recording_id = util.... | RecordingEndpointBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecordingEndpointBase:
def archive(self, project=None, recording=None):
"""Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: R... | stack_v2_sparse_classes_36k_train_005182 | 9,721 | permissive | [
{
"docstring": "Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: Recording|int",
"name": "archive",
"signature": "def archive(self, project=N... | 3 | stack_v2_sparse_classes_30k_train_002290 | Implement the Python class `RecordingEndpointBase` described below.
Class description:
Implement the RecordingEndpointBase class.
Method signatures and docstrings:
- def archive(self, project=None, recording=None): Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type pr... | Implement the Python class `RecordingEndpointBase` described below.
Class description:
Implement the RecordingEndpointBase class.
Method signatures and docstrings:
- def archive(self, project=None, recording=None): Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type pr... | bece72d06b91de0e33afd2181c59b895dbe7ae1f | <|skeleton|>
class RecordingEndpointBase:
def archive(self, project=None, recording=None):
"""Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: R... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecordingEndpointBase:
def archive(self, project=None, recording=None):
"""Archive a Recording given its Project and Recording ID. :param project: a Project object or ID :type project: basecampy3.endpoints.projects.Project|int :param recording: a Recording object or ID :type recording: Recording|int""... | the_stack_v2_python_sparse | basecampy3/endpoints/_base.py | phistrom/basecampy3 | train | 34 | |
7d35545b6372aec057a4a78c9d8a50f8c8eacd90 | [
"try:\n bubbleSort([1, 2, 3])\nexcept:\n self.fail('Error while calling bubbleSort')",
"items = SwapList([random.randint(0, 2 ** 30) for i in range(1024)], adj=True)\nbubbleSort(items)\nif isIncreasing(items):\n raise unittest.SkipTest('Not implemented yet')\nself.assertTrue(isDecreasing(items), 'Items n... | <|body_start_0|>
try:
bubbleSort([1, 2, 3])
except:
self.fail('Error while calling bubbleSort')
<|end_body_0|>
<|body_start_1|>
items = SwapList([random.randint(0, 2 ** 30) for i in range(1024)], adj=True)
bubbleSort(items)
if isIncreasing(items):
... | TestProblem2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestProblem2:
def test_API(self):
"""P2: Sanity Test: Is bubbleSort callable?"""
<|body_0|>
def test_sortRandomValues(self):
"""P2: Sorting a list of random values"""
<|body_1|>
def test_sortDecreasingValues(self):
"""P2: Sorting a list that is a... | stack_v2_sparse_classes_36k_train_005183 | 11,207 | no_license | [
{
"docstring": "P2: Sanity Test: Is bubbleSort callable?",
"name": "test_API",
"signature": "def test_API(self)"
},
{
"docstring": "P2: Sorting a list of random values",
"name": "test_sortRandomValues",
"signature": "def test_sortRandomValues(self)"
},
{
"docstring": "P2: Sorting... | 3 | stack_v2_sparse_classes_30k_train_015561 | Implement the Python class `TestProblem2` described below.
Class description:
Implement the TestProblem2 class.
Method signatures and docstrings:
- def test_API(self): P2: Sanity Test: Is bubbleSort callable?
- def test_sortRandomValues(self): P2: Sorting a list of random values
- def test_sortDecreasingValues(self):... | Implement the Python class `TestProblem2` described below.
Class description:
Implement the TestProblem2 class.
Method signatures and docstrings:
- def test_API(self): P2: Sanity Test: Is bubbleSort callable?
- def test_sortRandomValues(self): P2: Sorting a list of random values
- def test_sortDecreasingValues(self):... | d4f32507a5f581ad8ee0ce84e6cd92daac0941d7 | <|skeleton|>
class TestProblem2:
def test_API(self):
"""P2: Sanity Test: Is bubbleSort callable?"""
<|body_0|>
def test_sortRandomValues(self):
"""P2: Sorting a list of random values"""
<|body_1|>
def test_sortDecreasingValues(self):
"""P2: Sorting a list that is a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestProblem2:
def test_API(self):
"""P2: Sanity Test: Is bubbleSort callable?"""
try:
bubbleSort([1, 2, 3])
except:
self.fail('Error while calling bubbleSort')
def test_sortRandomValues(self):
"""P2: Sorting a list of random values"""
items ... | the_stack_v2_python_sparse | Homework5/hw5_test.py | pillowfication/ECS-32B | train | 1 | |
fd84b23c0bc4436ff32ff568f1fc235dd551d935 | [
"self.verify_user_permission_for_object(GARDEN_READ, local_garden())\nresponse = await self.client(Operation(operation_type='PLUGIN_LOG_READ_LEGACY'))\nself.set_header('Content-Type', 'application/json; charset=UTF-8')\nself.write(response)",
"self.verify_user_permission_for_object(GARDEN_UPDATE, local_garden())\... | <|body_start_0|>
self.verify_user_permission_for_object(GARDEN_READ, local_garden())
response = await self.client(Operation(operation_type='PLUGIN_LOG_READ_LEGACY'))
self.set_header('Content-Type', 'application/json; charset=UTF-8')
self.write(response)
<|end_body_0|>
<|body_start_1|>
... | LoggingConfigAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoggingConfigAPI:
async def get(self):
"""--- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNUSED type: string responses: 200: description: Logging Configuration for system schema: $ref: '#/definitio... | stack_v2_sparse_classes_36k_train_005184 | 3,955 | permissive | [
{
"docstring": "--- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNUSED type: string responses: 200: description: Logging Configuration for system schema: $ref: '#/definitions/LoggingConfig' 50x: $ref: '#/definitions/50xErr... | 2 | null | Implement the Python class `LoggingConfigAPI` described below.
Class description:
Implement the LoggingConfigAPI class.
Method signatures and docstrings:
- async def get(self): --- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNU... | Implement the Python class `LoggingConfigAPI` described below.
Class description:
Implement the LoggingConfigAPI class.
Method signatures and docstrings:
- async def get(self): --- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNU... | a5fd2dcc2444409e243d3fdaa43d86695e5cb142 | <|skeleton|>
class LoggingConfigAPI:
async def get(self):
"""--- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNUSED type: string responses: 200: description: Logging Configuration for system schema: $ref: '#/definitio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoggingConfigAPI:
async def get(self):
"""--- summary: Get the plugin logging configuration deprecated: true parameters: - name: system_name in: query required: false description: UNUSED type: string responses: 200: description: Logging Configuration for system schema: $ref: '#/definitions/LoggingConf... | the_stack_v2_python_sparse | src/app/beer_garden/api/http/handlers/v1/logging.py | beer-garden/beer-garden | train | 254 | |
c6647138ccbe0e016699fb170d2ccdccdd692ffc | [
"assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nreturn hparams.Config(kernel_size=int(options['k']), num_repeat=int(options['r']), inpu... | <|body_start_0|>
assert isinstance(block_string, str)
ops = block_string.split('_')
options = {}
for op in ops:
splits = re.split('(\\d.*)', op)
if len(splits) >= 2:
key, value = splits[:2]
options[key] = value
return hparam... | Block Decoder for readability. | BlockDecoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlockDecoder:
"""Block Decoder for readability."""
def _decode_block_string(self, block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(self, block):
"""Encodes a block to a string."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_005185 | 8,093 | permissive | [
{
"docstring": "Gets a block through a string notation of arguments.",
"name": "_decode_block_string",
"signature": "def _decode_block_string(self, block_string)"
},
{
"docstring": "Encodes a block to a string.",
"name": "_encode_block_string",
"signature": "def _encode_block_string(self... | 4 | null | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder for readability.
Method signatures and docstrings:
- def _decode_block_string(self, block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(self, block): Encodes a block to a string.
- de... | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder for readability.
Method signatures and docstrings:
- def _decode_block_string(self, block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(self, block): Encodes a block to a string.
- de... | c7392f2bab3165244d1c565b66409fa11fa82367 | <|skeleton|>
class BlockDecoder:
"""Block Decoder for readability."""
def _decode_block_string(self, block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(self, block):
"""Encodes a block to a string."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlockDecoder:
"""Block Decoder for readability."""
def _decode_block_string(self, block_string):
"""Gets a block through a string notation of arguments."""
assert isinstance(block_string, str)
ops = block_string.split('_')
options = {}
for op in ops:
sp... | the_stack_v2_python_sparse | efficientnetv2/effnetv2_configs.py | google/automl | train | 6,415 |
fe052988785549d77342b6202d212b1d7f928855 | [
"if self.payment_method_id == self.env.ref('account_sepa.account_payment_method_sepa_ct'):\n if not self.journal_id.bank_account_id or not self.journal_id.bank_account_id.acc_type == 'iban':\n raise ValidationError(_(\"The journal '%s' requires a proper IBAN account to pay via SEPA. Please configure it fi... | <|body_start_0|>
if self.payment_method_id == self.env.ref('account_sepa.account_payment_method_sepa_ct'):
if not self.journal_id.bank_account_id or not self.journal_id.bank_account_id.acc_type == 'iban':
raise ValidationError(_("The journal '%s' requires a proper IBAN account to pay... | AccountPayment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountPayment:
def _check_bank_account(self):
"""Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio"""
<|body_0|>
def _check_partner_bank_account(self):
"""Ereditiamo questa funzione per rimuovere il controllo de... | stack_v2_sparse_classes_36k_train_005186 | 1,504 | no_license | [
{
"docstring": "Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio",
"name": "_check_bank_account",
"signature": "def _check_bank_account(self)"
},
{
"docstring": "Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Preced... | 2 | stack_v2_sparse_classes_30k_train_012246 | Implement the Python class `AccountPayment` described below.
Class description:
Implement the AccountPayment class.
Method signatures and docstrings:
- def _check_bank_account(self): Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio
- def _check_partner_bank_acco... | Implement the Python class `AccountPayment` described below.
Class description:
Implement the AccountPayment class.
Method signatures and docstrings:
- def _check_bank_account(self): Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio
- def _check_partner_bank_acco... | 616c07d92abcf71a4fae1ae05a979b6e6bae998b | <|skeleton|>
class AccountPayment:
def _check_bank_account(self):
"""Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio"""
<|body_0|>
def _check_partner_bank_account(self):
"""Ereditiamo questa funzione per rimuovere il controllo de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountPayment:
def _check_bank_account(self):
"""Ereditiamo questa funzione per rimuovere il controllo del BIC mancante. Precedentemente era obbligatorio"""
if self.payment_method_id == self.env.ref('account_sepa.account_payment_method_sepa_ct'):
if not self.journal_id.bank_accoun... | the_stack_v2_python_sparse | l10n_it_sepa/models/account_payment.py | addoons/odoo-addoons | train | 0 | |
870bbd3f577353120045a330260fe39c5115b8d1 | [
"Algorithm.__init__(self)\nself.name = 'Gaussian Blur'\nself.parent = 'Preprocessing'\nself.kernelsize = IntegerSlider('kernelsize', 1, 20, 1, 1)\nself.sigmaX = FloatSlider('sigmaX', 1.0, 100.0, 0.1, 1.0)\nself.channel1 = CheckBox('channel1', True)\nself.channel2 = CheckBox('channel2', True)\nself.channel3 = CheckB... | <|body_start_0|>
Algorithm.__init__(self)
self.name = 'Gaussian Blur'
self.parent = 'Preprocessing'
self.kernelsize = IntegerSlider('kernelsize', 1, 20, 1, 1)
self.sigmaX = FloatSlider('sigmaX', 1.0, 100.0, 0.1, 1.0)
self.channel1 = CheckBox('channel1', True)
self... | Gaussian Blur algorithm implementation | AlgBody | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlgBody:
"""Gaussian Blur algorithm implementation"""
def __init__(self):
"""Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurring kernel size that will be used as slider for the UI | ... | stack_v2_sparse_classes_36k_train_005187 | 2,338 | no_license | [
{
"docstring": "Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurring kernel size that will be used as slider for the UI | *sigmaX* : gaussian kernel standard deviation in X direction",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_003021 | Implement the Python class `AlgBody` described below.
Class description:
Gaussian Blur algorithm implementation
Method signatures and docstrings:
- def __init__(self): Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurr... | Implement the Python class `AlgBody` described below.
Class description:
Gaussian Blur algorithm implementation
Method signatures and docstrings:
- def __init__(self): Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurr... | 0dc9becc09da22af3edac90b81b1dd9b1f44fd5b | <|skeleton|>
class AlgBody:
"""Gaussian Blur algorithm implementation"""
def __init__(self):
"""Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurring kernel size that will be used as slider for the UI | ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlgBody:
"""Gaussian Blur algorithm implementation"""
def __init__(self):
"""Gaussian Blur object constructor Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriated category | *kernelsize* : blurring kernel size that will be used as slider for the UI | *sigmaX* : ga... | the_stack_v2_python_sparse | Sebastian_Algorithms_untested/gauss_blur.py | andreasfirczynski/NetworkExtractionFromImages | train | 0 |
8bac80a1cfd9c92ac028478771b477e8275f9ef9 | [
"super().__init__(max_id, poisson_lam, zipf_param, id_shift)\nself.__shuffle_window = shuffle_window\nself.__next_shuffle = shuffle_window\nself.__shuffle_map = np.arange(id_shift + 1, id_shift + max_id + 1)\nif start_shuffled:\n np.random.shuffle(self.__shuffle_map)",
"vals = list(super().get_distribution_map... | <|body_start_0|>
super().__init__(max_id, poisson_lam, zipf_param, id_shift)
self.__shuffle_window = shuffle_window
self.__next_shuffle = shuffle_window
self.__shuffle_map = np.arange(id_shift + 1, id_shift + max_id + 1)
if start_shuffled:
np.random.shuffle(self.__shu... | PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator. | PoissonShuffleZipfGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PoissonShuffleZipfGenerator:
"""PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator."""
def __init__(self, max_id: int=1000, poisson_lam: float=10,... | stack_v2_sparse_classes_36k_train_005188 | 8,929 | no_license | [
{
"docstring": "Construct a new PoissonShuffleZipfGenerator object. :param max_id: Maximum ID of the object. :param poisson_lam: Poisson distribution parameter. :param zipf_param: Zipf distribution parameter. :param id_shift: Shift of the starting item ID. :param shuffle_window: Time window after which populari... | 3 | stack_v2_sparse_classes_30k_train_012627 | Implement the Python class `PoissonShuffleZipfGenerator` described below.
Class description:
PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator.
Method signatures and docst... | Implement the Python class `PoissonShuffleZipfGenerator` described below.
Class description:
PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator.
Method signatures and docst... | eb3bd7d966f75827026e255caaced052ecec9236 | <|skeleton|>
class PoissonShuffleZipfGenerator:
"""PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator."""
def __init__(self, max_id: int=1000, poisson_lam: float=10,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PoissonShuffleZipfGenerator:
"""PoissonShuffleZipfGenerator implements generator with poisson arrivals and Zipf popularity distribution, but every time window item popularity is randomly shuffled. Inherits AbstractTimedGenerator."""
def __init__(self, max_id: int=1000, poisson_lam: float=10, zipf_param: ... | the_stack_v2_python_sparse | src/data/generation/poisson_zipf_trace_generator.py | vladfedchenko/NeuralCaching | train | 1 |
8b085fff21261152e2cd43b3d0704ed56eb23550 | [
"parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName)\nself.url = '/mgr/park/park_redlist/add.do'\ndata = {'redlistParam': carNum, 'parkIds': parkDict['value']}\nre = self.post(self.api, data=data, headers=form_headers)\nreturn re.json()",
"WhilelistDict = self.getDi... | <|body_start_0|>
parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName)
self.url = '/mgr/park/park_redlist/add.do'
data = {'redlistParam': carNum, 'parkIds': parkDict['value']}
re = self.post(self.api, data=data, headers=form_headers)
... | 白名单 | ParkWhitelist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParkWhitelist:
"""白名单"""
def addWhitelist(self, parkName, carNum):
"""录入白名单"""
<|body_0|>
def delWhilelist(self, carNum):
"""删除白名单规则"""
<|body_1|>
def getWhilelistRuleList(self):
"""获取白名单规则列表"""
<|body_2|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_005189 | 13,467 | no_license | [
{
"docstring": "录入白名单",
"name": "addWhitelist",
"signature": "def addWhitelist(self, parkName, carNum)"
},
{
"docstring": "删除白名单规则",
"name": "delWhilelist",
"signature": "def delWhilelist(self, carNum)"
},
{
"docstring": "获取白名单规则列表",
"name": "getWhilelistRuleList",
"signa... | 3 | stack_v2_sparse_classes_30k_train_005759 | Implement the Python class `ParkWhitelist` described below.
Class description:
白名单
Method signatures and docstrings:
- def addWhitelist(self, parkName, carNum): 录入白名单
- def delWhilelist(self, carNum): 删除白名单规则
- def getWhilelistRuleList(self): 获取白名单规则列表 | Implement the Python class `ParkWhitelist` described below.
Class description:
白名单
Method signatures and docstrings:
- def addWhitelist(self, parkName, carNum): 录入白名单
- def delWhilelist(self, carNum): 删除白名单规则
- def getWhilelistRuleList(self): 获取白名单规则列表
<|skeleton|>
class ParkWhitelist:
"""白名单"""
def addWhit... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class ParkWhitelist:
"""白名单"""
def addWhitelist(self, parkName, carNum):
"""录入白名单"""
<|body_0|>
def delWhilelist(self, carNum):
"""删除白名单规则"""
<|body_1|>
def getWhilelistRuleList(self):
"""获取白名单规则列表"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParkWhitelist:
"""白名单"""
def addWhitelist(self, parkName, carNum):
"""录入白名单"""
parkDict = self.getDictBykey(Index(self.Session).getParkingBaseDataTree().json(), 'name', parkName)
self.url = '/mgr/park/park_redlist/add.do'
data = {'redlistParam': carNum, 'parkIds': parkDict... | the_stack_v2_python_sparse | Api/parkingManage_service/carTypeManage_service/carTypeConfig.py | oyebino/pomp_api | train | 1 |
d668fc8065a5ebf6ccac063a9b7e0e6058946935 | [
"reader = csv.reader(data)\nnext(reader)\ninfo = dict()\nfor item in reader:\n cmmd = item[0].strip('+')\n feat = item[1] or None\n desc = re.sub('{.*}', '', item[2]).strip() or None\n kind = tuple((KIND.get(s) for s in item[3].split('/'))) or None\n conf = CONF.get(item[4].split()[0])\n temp = li... | <|body_start_0|>
reader = csv.reader(data)
next(reader)
info = dict()
for item in reader:
cmmd = item[0].strip('+')
feat = item[1] or None
desc = re.sub('{.*}', '', item[2]).strip() or None
kind = tuple((KIND.get(s) for s in item[3].split('... | FTP Command | Command | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
<|body_0|>
def context(self, data):
"""Generate constant context. Args: data (List[str... | stack_v2_sparse_classes_36k_train_005190 | 3,619 | permissive | [
{
"docstring": "Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.",
"name": "process",
"signature": "def process(self, data)"
},
{
"docstring": "Generate constant context. Args: data (List[str]): CSV data. Returns: str: Constan... | 2 | stack_v2_sparse_classes_30k_val_000785 | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data): Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.
- def context(self, data): Generate constant context.... | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data): Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.
- def context(self, data): Generate constant context.... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
<|body_0|>
def context(self, data):
"""Generate constant context. Args: data (List[str... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
reader = csv.reader(data)
next(reader)
info = dict()
for item in reader:
cmm... | the_stack_v2_python_sparse | pcapkit/vendor/ftp/command.py | stjordanis/PyPCAPKit | train | 0 |
b03336620a74a6518aecba253737eb2d8fbdbc62 | [
"super(Yamamoto, self).__init__()\nself.a = array_check(a, 1)\nself.n_1 = int_check(n_1, 1)\nself.n_2 = int_check(n_2, 1)",
"r = np.zeros(shape=self.a.shape)\nfor i, item in enumerate(np.nditer(r, op_flags=['readwrite'])):\n if self.n_1 <= i <= self.a.size - self.n_2 - 1:\n x_forward = self.a[i - self.n... | <|body_start_0|>
super(Yamamoto, self).__init__()
self.a = array_check(a, 1)
self.n_1 = int_check(n_1, 1)
self.n_2 = int_check(n_2, 1)
<|end_body_0|>
<|body_start_1|>
r = np.zeros(shape=self.a.shape)
for i, item in enumerate(np.nditer(r, op_flags=['readwrite'])):
... | Yamamoto mutation detection. | Yamamoto | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Yamamoto:
"""Yamamoto mutation detection."""
def __init__(self, a: array_like, n_1: int, n_2: int) -> None:
""":param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length"""
<|body_0|>
def testing(self):
"""Slide and test.... | stack_v2_sparse_classes_36k_train_005191 | 8,892 | no_license | [
{
"docstring": ":param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length",
"name": "__init__",
"signature": "def __init__(self, a: array_like, n_1: int, n_2: int) -> None"
},
{
"docstring": "Slide and test. :return: class self",
"name": "testing",
... | 4 | stack_v2_sparse_classes_30k_train_014554 | Implement the Python class `Yamamoto` described below.
Class description:
Yamamoto mutation detection.
Method signatures and docstrings:
- def __init__(self, a: array_like, n_1: int, n_2: int) -> None: :param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length
- def testing(s... | Implement the Python class `Yamamoto` described below.
Class description:
Yamamoto mutation detection.
Method signatures and docstrings:
- def __init__(self, a: array_like, n_1: int, n_2: int) -> None: :param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length
- def testing(s... | 1c8d5fbf3676dc81e9f143e93ee2564359519b11 | <|skeleton|>
class Yamamoto:
"""Yamamoto mutation detection."""
def __init__(self, a: array_like, n_1: int, n_2: int) -> None:
""":param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length"""
<|body_0|>
def testing(self):
"""Slide and test.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Yamamoto:
"""Yamamoto mutation detection."""
def __init__(self, a: array_like, n_1: int, n_2: int) -> None:
""":param a: array_like 1-D array :param n_1: int left testing length :param n_2: int right test length"""
super(Yamamoto, self).__init__()
self.a = array_check(a, 1)
... | the_stack_v2_python_sparse | statistics/mutation.py | qliu0/PythonInAirSeaScience | train | 0 |
9d893217539c80cfd22db7c765479b854d4bbfd0 | [
"super().__init__(case_sensitive=case_sensitive)\nself._suggestions = list(suggestions)\nself._for_comparison = self._suggestions if self.case_sensitive else [suggestion.casefold() for suggestion in self._suggestions]",
"for idx, suggestion in enumerate(self._for_comparison):\n if suggestion.startswith(value):... | <|body_start_0|>
super().__init__(case_sensitive=case_sensitive)
self._suggestions = list(suggestions)
self._for_comparison = self._suggestions if self.case_sensitive else [suggestion.casefold() for suggestion in self._suggestions]
<|end_body_0|>
<|body_start_1|>
for idx, suggestion in ... | Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromList(countries, case_sensitive=False)) ``` If the user types ++p++ inside the input... | SuggestFromList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuggestFromList:
"""Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromList(countries, case_sensitive=False)) `... | stack_v2_sparse_classes_36k_train_005192 | 4,616 | permissive | [
{
"docstring": "Creates a suggester based off of a given iterable of possibilities. Args: suggestions: Valid suggestions sorted by decreasing priority. case_sensitive: Whether suggestions are computed in a case sensitive manner or not. The values provided in the argument `suggestions` represent the canonical re... | 2 | null | Implement the Python class `SuggestFromList` described below.
Class description:
Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromL... | Implement the Python class `SuggestFromList` described below.
Class description:
Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromL... | b74ac1e47fdd16133ca567390c99ea19de278c5a | <|skeleton|>
class SuggestFromList:
"""Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromList(countries, case_sensitive=False)) `... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuggestFromList:
"""Give completion suggestions based on a fixed list of options. Example: ```py countries = ["England", "Scotland", "Portugal", "Spain", "France"] class MyApp(App[None]): def compose(self) -> ComposeResult: yield Input(suggester=SuggestFromList(countries, case_sensitive=False)) ``` If the use... | the_stack_v2_python_sparse | src/textual/suggester.py | Textualize/textual | train | 14,818 |
44c992d09eff4a277321a07dd3d7e7778eb6cc81 | [
"if base_driver == None:\n self.driver = webdriver.Chrome()\n self.driver.get('https://work.weixin.qq.com/wework_admin/loginpage_wx?')\n with open('data.yaml', encoding='UTF-8') as f:\n yaml_data = yaml.safe_load(f)\n for cookie in yaml_data:\n self.driver.add_cookie(cookie)\n s... | <|body_start_0|>
if base_driver == None:
self.driver = webdriver.Chrome()
self.driver.get('https://work.weixin.qq.com/wework_admin/loginpage_wx?')
with open('data.yaml', encoding='UTF-8') as f:
yaml_data = yaml.safe_load(f)
for cookie in yaml_d... | 把重复的步骤抽离出来,封装,比如driver实例化 | BasePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasePage:
"""把重复的步骤抽离出来,封装,比如driver实例化"""
def __init__(self, base_driver=None):
"""driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:"""
<|body_0|>
def find(self, by, ele=None):
""":param by:定位方式css ,xpath, id :param ele: 元素定位信息 :return:"""
<|bod... | stack_v2_sparse_classes_36k_train_005193 | 1,651 | no_license | [
{
"docstring": "driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:",
"name": "__init__",
"signature": "def __init__(self, base_driver=None)"
},
{
"docstring": ":param by:定位方式css ,xpath, id :param ele: 元素定位信息 :return:",
"name": "find",
"signature": "def find(self, by, ele=None)"
... | 2 | stack_v2_sparse_classes_30k_train_008526 | Implement the Python class `BasePage` described below.
Class description:
把重复的步骤抽离出来,封装,比如driver实例化
Method signatures and docstrings:
- def __init__(self, base_driver=None): driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:
- def find(self, by, ele=None): :param by:定位方式css ,xpath, id :param ele: 元素定位信息 :ret... | Implement the Python class `BasePage` described below.
Class description:
把重复的步骤抽离出来,封装,比如driver实例化
Method signatures and docstrings:
- def __init__(self, base_driver=None): driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:
- def find(self, by, ele=None): :param by:定位方式css ,xpath, id :param ele: 元素定位信息 :ret... | d32e4af68efc4eb935fe98d1f901f1408ed2e785 | <|skeleton|>
class BasePage:
"""把重复的步骤抽离出来,封装,比如driver实例化"""
def __init__(self, base_driver=None):
"""driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:"""
<|body_0|>
def find(self, by, ele=None):
""":param by:定位方式css ,xpath, id :param ele: 元素定位信息 :return:"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasePage:
"""把重复的步骤抽离出来,封装,比如driver实例化"""
def __init__(self, base_driver=None):
"""driver 重复实例化会导致页面多次启动 解决driver 重复实例化的问题 :param base_driver:"""
if base_driver == None:
self.driver = webdriver.Chrome()
self.driver.get('https://work.weixin.qq.com/wework_admin/login... | the_stack_v2_python_sparse | test_web_wechat/page/base_page.py | yangwei211/HogwartsSDET18 | train | 0 |
b6880a38e4b3c47987ace83bf5be200767f17ec0 | [
"self.ver = ver\nself.desc = desc\nself.parameter_lst = []\nself.resource_lst = []\nself.output_lst = []",
"nodes = []\nfor key, value in data.items():\n node_key = dumper.represent_data(key)\n node_value = dumper.represent_data(value)\n nodes.append((node_key, node_value))\nreturn yaml.nodes.MappingNode... | <|body_start_0|>
self.ver = ver
self.desc = desc
self.parameter_lst = []
self.resource_lst = []
self.output_lst = []
<|end_body_0|>
<|body_start_1|>
nodes = []
for key, value in data.items():
node_key = dumper.represent_data(key)
node_valu... | HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order | HOT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HOT:
"""HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order"""
def __init__(self, ver='2017-02-24', desc=''):
"""Init a HOT Object :param ver (str): Heat template version :param desc (str): Description of the template"""
<|bo... | stack_v2_sparse_classes_36k_train_005194 | 6,215 | no_license | [
{
"docstring": "Init a HOT Object :param ver (str): Heat template version :param desc (str): Description of the template",
"name": "__init__",
"signature": "def __init__(self, ver='2017-02-24', desc='')"
},
{
"docstring": "Represent OrderedDict as YAML node",
"name": "_repr_ordereddict",
... | 3 | stack_v2_sparse_classes_30k_train_005314 | Implement the Python class `HOT` described below.
Class description:
HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order
Method signatures and docstrings:
- def __init__(self, ver='2017-02-24', desc=''): Init a HOT Object :param ver (str): Heat template version :para... | Implement the Python class `HOT` described below.
Class description:
HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order
Method signatures and docstrings:
- def __init__(self, ver='2017-02-24', desc=''): Init a HOT Object :param ver (str): Heat template version :para... | 103d9ffb67e98c6e912a5861b73ad0f06d9df80c | <|skeleton|>
class HOT:
"""HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order"""
def __init__(self, ver='2017-02-24', desc=''):
"""Init a HOT Object :param ver (str): Heat template version :param desc (str): Description of the template"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HOT:
"""HOT Template Constructor Parameters, resources, outputs are stored in a list which preserves the order"""
def __init__(self, ver='2017-02-24', desc=''):
"""Init a HOT Object :param ver (str): Heat template version :param desc (str): Description of the template"""
self.ver = ver
... | the_stack_v2_python_sparse | sfc-ostack/sfcostack/hot.py | stevelorenz/sfc-ostack | train | 4 |
f78a22092081d3b2cebfafb0150811abe9e1b950 | [
"logger.info('Start init transforms')\nself.categorical_features = feature_param.categorical_features\nself.numerical_features = feature_param.numerical_features\nif transform_path:\n logger.debug('Loading transforms')\n self.categorical = load_estimator(transform_path.categorical)\n self.numerical = load_... | <|body_start_0|>
logger.info('Start init transforms')
self.categorical_features = feature_param.categorical_features
self.numerical_features = feature_param.numerical_features
if transform_path:
logger.debug('Loading transforms')
self.categorical = load_estimator(... | Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data | DatasetTransformer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatasetTransformer:
"""Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data"""
def __init__(self, feature_param: FeatureParams, transform_path: TransformPath=None):
"""Load fitted transform if TransformPath i... | stack_v2_sparse_classes_36k_train_005195 | 2,244 | permissive | [
{
"docstring": "Load fitted transform if TransformPath is not None",
"name": "__init__",
"signature": "def __init__(self, feature_param: FeatureParams, transform_path: TransformPath=None)"
},
{
"docstring": "Transform data",
"name": "transform",
"signature": "def transform(self, data: pd... | 2 | stack_v2_sparse_classes_30k_val_000835 | Implement the Python class `DatasetTransformer` described below.
Class description:
Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data
Method signatures and docstrings:
- def __init__(self, feature_param: FeatureParams, transform_path: Tran... | Implement the Python class `DatasetTransformer` described below.
Class description:
Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data
Method signatures and docstrings:
- def __init__(self, feature_param: FeatureParams, transform_path: Tran... | 2679358e6896851241b65c2479b93299750c00a7 | <|skeleton|>
class DatasetTransformer:
"""Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data"""
def __init__(self, feature_param: FeatureParams, transform_path: TransformPath=None):
"""Load fitted transform if TransformPath i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatasetTransformer:
"""Transform categorical and numerical data. E.g. scikit-learn OneHotEncoder for categorical data and StandartScaler numerical data"""
def __init__(self, feature_param: FeatureParams, transform_path: TransformPath=None):
"""Load fitted transform if TransformPath is not None"""... | the_stack_v2_python_sparse | online_inference/src/data/data_transformer.py | made-ml-in-prod-2021/andyst75 | train | 0 |
b1a650b937b507391196567a83dec206663e2280 | [
"self._helper = helper.ImportHelper()\nwith tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw:\n fw.write(MOCK_CONFIG)\n fw.seek(0)\n self._helper.add_config(fw.name)",
"streamer = MockStreamer()\nself._helper.configure_streamer(streamer, data_type='foo:no')\nself.assertEqual(streamer.format_string,... | <|body_start_0|>
self._helper = helper.ImportHelper()
with tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw:
fw.write(MOCK_CONFIG)
fw.seek(0)
self._helper.add_config(fw.name)
<|end_body_0|>
<|body_start_1|>
streamer = MockStreamer()
self._helper... | Test Timesketch import helper. | TimesketchHelperTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimesketchHelperTest:
"""Test Timesketch import helper."""
def setUp(self):
"""Set up the test."""
<|body_0|>
def test_not_config(self):
"""Test a helper that does not match."""
<|body_1|>
def test_sub_column(self):
"""Test a helper that matc... | stack_v2_sparse_classes_36k_train_005196 | 4,792 | permissive | [
{
"docstring": "Set up the test.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test a helper that does not match.",
"name": "test_not_config",
"signature": "def test_not_config(self)"
},
{
"docstring": "Test a helper that matches on sub columns.",
"name... | 5 | stack_v2_sparse_classes_30k_train_002892 | Implement the Python class `TimesketchHelperTest` described below.
Class description:
Test Timesketch import helper.
Method signatures and docstrings:
- def setUp(self): Set up the test.
- def test_not_config(self): Test a helper that does not match.
- def test_sub_column(self): Test a helper that matches on sub colu... | Implement the Python class `TimesketchHelperTest` described below.
Class description:
Test Timesketch import helper.
Method signatures and docstrings:
- def setUp(self): Set up the test.
- def test_not_config(self): Test a helper that does not match.
- def test_sub_column(self): Test a helper that matches on sub colu... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class TimesketchHelperTest:
"""Test Timesketch import helper."""
def setUp(self):
"""Set up the test."""
<|body_0|>
def test_not_config(self):
"""Test a helper that does not match."""
<|body_1|>
def test_sub_column(self):
"""Test a helper that matc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimesketchHelperTest:
"""Test Timesketch import helper."""
def setUp(self):
"""Set up the test."""
self._helper = helper.ImportHelper()
with tempfile.NamedTemporaryFile('w', suffix='.yaml') as fw:
fw.write(MOCK_CONFIG)
fw.seek(0)
self._helper.ad... | the_stack_v2_python_sparse | importer_client/python/timesketch_import_client/helper_test.py | google/timesketch | train | 2,263 |
b0bc7f952261390df420f7192ccb882f9b24aabe | [
"Utils.validate_uuid(goniometry_id)\nif not Goniometry.objects.filter(id=goniometry_id).exists():\n raise ValidationError('The goniometry is not valid!')",
"BodyZoneService.is_valid_body_zone(goniometry['body_zone'])\nnew_goniometry = Goniometry.objects.create(body_zone_id=goniometry['body_zone'], min_abductio... | <|body_start_0|>
Utils.validate_uuid(goniometry_id)
if not Goniometry.objects.filter(id=goniometry_id).exists():
raise ValidationError('The goniometry is not valid!')
<|end_body_0|>
<|body_start_1|>
BodyZoneService.is_valid_body_zone(goniometry['body_zone'])
new_goniometry =... | Service class for goniometry related operations | GoniometryService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoniometryService:
"""Service class for goniometry related operations"""
def is_valid_goniometry(goniometry_id):
"""Checks if the specified goniometry exists :param goniometry_id: if of the goniometry"""
<|body_0|>
def add_goniometry(goniometry, id_treatment):
""... | stack_v2_sparse_classes_36k_train_005197 | 2,899 | no_license | [
{
"docstring": "Checks if the specified goniometry exists :param goniometry_id: if of the goniometry",
"name": "is_valid_goniometry",
"signature": "def is_valid_goniometry(goniometry_id)"
},
{
"docstring": "Creates a goniometry for a new treatment :param goniometry: Goniometry info :param id_tre... | 3 | stack_v2_sparse_classes_30k_train_009338 | Implement the Python class `GoniometryService` described below.
Class description:
Service class for goniometry related operations
Method signatures and docstrings:
- def is_valid_goniometry(goniometry_id): Checks if the specified goniometry exists :param goniometry_id: if of the goniometry
- def add_goniometry(gonio... | Implement the Python class `GoniometryService` described below.
Class description:
Service class for goniometry related operations
Method signatures and docstrings:
- def is_valid_goniometry(goniometry_id): Checks if the specified goniometry exists :param goniometry_id: if of the goniometry
- def add_goniometry(gonio... | 941e8b2870f8724db3d5103dda5157fd597cfcc7 | <|skeleton|>
class GoniometryService:
"""Service class for goniometry related operations"""
def is_valid_goniometry(goniometry_id):
"""Checks if the specified goniometry exists :param goniometry_id: if of the goniometry"""
<|body_0|>
def add_goniometry(goniometry, id_treatment):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GoniometryService:
"""Service class for goniometry related operations"""
def is_valid_goniometry(goniometry_id):
"""Checks if the specified goniometry exists :param goniometry_id: if of the goniometry"""
Utils.validate_uuid(goniometry_id)
if not Goniometry.objects.filter(id=goniom... | the_stack_v2_python_sparse | backend/martin_helder/services/goniometry_service.py | JoaoAlvaroFerreira/FEUP-LGP | train | 1 |
ad1d4f8077bb0ef986bd01297158670b6a6f51e1 | [
"self.id = id\nself.number = number\nself.owner_name = owner_name\nself.owner_address = owner_address\nself.name = name\nself.mtype = mtype\nself.available_balance = available_balance\nself.aggregation_status_code = aggregation_status_code\nself.balance = balance\nself.balance_date = balance_date\nself.average_mont... | <|body_start_0|>
self.id = id
self.number = number
self.owner_name = owner_name
self.owner_address = owner_address
self.name = name
self.mtype = mtype
self.available_balance = available_balance
self.aggregation_status_code = aggregation_status_code
... | Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated) owner_name (string): The name(s) of the account own... | AssetSummaryReportAccount | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated... | stack_v2_sparse_classes_36k_train_005198 | 7,314 | permissive | [
{
"docstring": "Constructor for the AssetSummaryReportAccount class",
"name": "__init__",
"signature": "def __init__(self, id=None, number=None, owner_name=None, owner_address=None, name=None, mtype=None, available_balance=None, aggregation_status_code=None, balance=None, balance_date=None, average_mont... | 2 | stack_v2_sparse_classes_30k_train_000248 | Implement the Python class `AssetSummaryReportAccount` described below.
Class description:
Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all dig... | Implement the Python class `AssetSummaryReportAccount` described below.
Class description:
Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all dig... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated) owner_name ... | the_stack_v2_python_sparse | finicityapi/models/asset_summary_report_account.py | monarchmoney/finicity-python | train | 0 |
6881b9978ead7e89c38dbd6947eb028196135d59 | [
"try:\n payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.datetime.utcnow(), 'iss': 'ken', 'data': {'USER_KEY': USER_KEY, 'login_time': login_time}}\n return jwt.encode(payload, app.Config.SECRET_KEY, algorithm='HS256')\nexcept Exception as e:\n return e... | <|body_start_0|>
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.datetime.utcnow(), 'iss': 'ken', 'data': {'USER_KEY': USER_KEY, 'login_time': login_time}}
return jwt.encode(payload, app.Config.SECRET_KEY, algorithm='HS256')
... | 权限校验、token帮助类 | Auth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
"""权限校验、token帮助类"""
def __encode_auth_token(self, USER_KEY, login_time):
"""生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string"""
<|body_0|>
def __decode_auth_token(self, auth_token):
"""验证Token :param auth_token: :return: inte... | stack_v2_sparse_classes_36k_train_005199 | 4,339 | no_license | [
{
"docstring": "生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string",
"name": "__encode_auth_token",
"signature": "def __encode_auth_token(self, USER_KEY, login_time)"
},
{
"docstring": "验证Token :param auth_token: :return: integer|string",
"name": "__decode_auth_... | 4 | stack_v2_sparse_classes_30k_train_007031 | Implement the Python class `Auth` described below.
Class description:
权限校验、token帮助类
Method signatures and docstrings:
- def __encode_auth_token(self, USER_KEY, login_time): 生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string
- def __decode_auth_token(self, auth_token): 验证Token :param auth... | Implement the Python class `Auth` described below.
Class description:
权限校验、token帮助类
Method signatures and docstrings:
- def __encode_auth_token(self, USER_KEY, login_time): 生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string
- def __decode_auth_token(self, auth_token): 验证Token :param auth... | 68a59e3ffd918c32c1e9be87b60c4dfa74018de7 | <|skeleton|>
class Auth:
"""权限校验、token帮助类"""
def __encode_auth_token(self, USER_KEY, login_time):
"""生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string"""
<|body_0|>
def __decode_auth_token(self, auth_token):
"""验证Token :param auth_token: :return: inte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Auth:
"""权限校验、token帮助类"""
def __encode_auth_token(self, USER_KEY, login_time):
"""生成认证Token :param USER_KEY: int :param login_time: int(timestamp) :return: string"""
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.dat... | the_stack_v2_python_sparse | app/apis/utils/auth_helper.py | tyler2350/flask-restful-demo | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.