blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
759ff7c3d203a7ee35183d86cd5b3115d714edc0
[ "count, base, length = ([0] * 26, ord('a'), 0)\nfor i in range(len(p)):\n if i > 0 and ord(p[i]) - ord(p[i - 1]) in (1, -25):\n length += 1\n else:\n length = 1\n index = ord(p[i]) - base\n count[index] = max(count[index], length)\nprint(count)\nreturn sum(count)", "i, j, res = (0, 1, 0)...
<|body_start_0|> count, base, length = ([0] * 26, ord('a'), 0) for i in range(len(p)): if i > 0 and ord(p[i]) - ord(p[i - 1]) in (1, -25): length += 1 else: length = 1 index = ord(p[i]) - base count[index] = max(count[index]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSubstringInWraproundString(self, p): """:type p: str :rtype: int""" <|body_0|> def findSubstringInWraproundString2(self, p): """:type p: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> count, base, length = ([0] * 2...
stack_v2_sparse_classes_10k_train_002900
2,158
no_license
[ { "docstring": ":type p: str :rtype: int", "name": "findSubstringInWraproundString", "signature": "def findSubstringInWraproundString(self, p)" }, { "docstring": ":type p: str :rtype: int", "name": "findSubstringInWraproundString2", "signature": "def findSubstringInWraproundString2(self,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstringInWraproundString(self, p): :type p: str :rtype: int - def findSubstringInWraproundString2(self, p): :type p: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstringInWraproundString(self, p): :type p: str :rtype: int - def findSubstringInWraproundString2(self, p): :type p: str :rtype: int <|skeleton|> class Solution: ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def findSubstringInWraproundString(self, p): """:type p: str :rtype: int""" <|body_0|> def findSubstringInWraproundString2(self, p): """:type p: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findSubstringInWraproundString(self, p): """:type p: str :rtype: int""" count, base, length = ([0] * 26, ord('a'), 0) for i in range(len(p)): if i > 0 and ord(p[i]) - ord(p[i - 1]) in (1, -25): length += 1 else: leng...
the_stack_v2_python_sparse
code467UniqueSubstringsInWraparoundString.py
cybelewang/leetcode-python
train
0
4d04cfdfd48f34058e147cd16bf684b413ba4533
[ "self.name = name\nself.center = center\nself.bottom_left_corner = bottom_left_corner\nself.bottom_right_corner = bottom_right_corner\nself.top_left_corner = top_left_corner\nself.top_right_corner = top_right_corner\nself.image_contents = image_contents", "if dictionary is None:\n return None\nname = dictionar...
<|body_start_0|> self.name = name self.center = center self.bottom_left_corner = bottom_left_corner self.bottom_right_corner = bottom_right_corner self.top_left_corner = top_left_corner self.top_right_corner = top_right_corner self.image_contents = image_contents ...
Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocation data of your floor plan, either the 'center' or two a...
UpdateNetworkFloorPlanModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkFloorPlanModel: """Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocatio...
stack_v2_sparse_classes_10k_train_002901
5,591
permissive
[ { "docstring": "Constructor for the UpdateNetworkFloorPlanModel class", "name": "__init__", "signature": "def __init__(self, name=None, center=None, bottom_left_corner=None, bottom_right_corner=None, top_left_corner=None, top_right_corner=None, image_contents=None)" }, { "docstring": "Creates an...
2
null
Implement the Python class `UpdateNetworkFloorPlanModel` described below. Class description: Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor pla...
Implement the Python class `UpdateNetworkFloorPlanModel` described below. Class description: Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor pla...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkFloorPlanModel: """Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocatio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkFloorPlanModel: """Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocation data of you...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_floor_plan_model.py
RaulCatalano/meraki-python-sdk
train
1
088ac256a3cf15785085c494bc69912280c63774
[ "client = mock_client(mocker)\nargs = {'user-profile': {'email': 'testdemisto2@paloaltonetworks.com', 'givenname': 'mock_first_name'}}\nmocker.patch.object(client, 'get_user', return_value=None)\nmocker.patch.object(IAMUserProfile, 'map_object', return_value={})\nmocker.patch.object(client, 'create_user', return_va...
<|body_start_0|> client = mock_client(mocker) args = {'user-profile': {'email': 'testdemisto2@paloaltonetworks.com', 'givenname': 'mock_first_name'}} mocker.patch.object(client, 'get_user', return_value=None) mocker.patch.object(IAMUserProfile, 'map_object', return_value={}) mock...
Class to group the update user commands test
TestUpdateUserCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateUserCommand: """Class to group the update user commands test""" def test_update_user_command__non_existing_user(self, mocker): """Given: - An app client object - A user-profile argument that contains user data When: - The user does not exist in the application - create-if-n...
stack_v2_sparse_classes_10k_train_002902
13,964
permissive
[ { "docstring": "Given: - An app client object - A user-profile argument that contains user data When: - The user does not exist in the application - create-if-not-exists parameter is checked - Create User command is enabled - Calling function update_user_command Then: - Ensure the create action is executed - En...
3
null
Implement the Python class `TestUpdateUserCommand` described below. Class description: Class to group the update user commands test Method signatures and docstrings: - def test_update_user_command__non_existing_user(self, mocker): Given: - An app client object - A user-profile argument that contains user data When: -...
Implement the Python class `TestUpdateUserCommand` described below. Class description: Class to group the update user commands test Method signatures and docstrings: - def test_update_user_command__non_existing_user(self, mocker): Given: - An app client object - A user-profile argument that contains user data When: -...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestUpdateUserCommand: """Class to group the update user commands test""" def test_update_user_command__non_existing_user(self, mocker): """Given: - An app client object - A user-profile argument that contains user data When: - The user does not exist in the application - create-if-n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestUpdateUserCommand: """Class to group the update user commands test""" def test_update_user_command__non_existing_user(self, mocker): """Given: - An app client object - A user-profile argument that contains user data When: - The user does not exist in the application - create-if-not-exists par...
the_stack_v2_python_sparse
Packs/PrismaCloud/Integrations/PrismaCloudIAM/PrismaCloudIAM_test.py
demisto/content
train
1,023
d212b6c73ece8e4a11261fbf50c893dddbce2086
[ "def canShip(m):\n t, days = (0, 0)\n for w in weights:\n if t + w > m:\n days += 1\n t = w\n else:\n t += w\n return days + 1 <= D\nl, r = (max(weights), sum(weights))\nwhile l < r:\n mid = l + (r - l) // 2\n if canShip(mid):\n r = mid\n else:...
<|body_start_0|> def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: t += w return days + 1 <= D l, r = (max(weights), sum(weights)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002903
3,083
no_license
[ { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDaysAC", "signature": "def shipWithinDaysAC(self, weights, D)" }, { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDays", "signature": "def shipWithinDays(self, we...
2
stack_v2_sparse_classes_30k_train_003141
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: ...
the_stack_v2_python_sparse
C/CapacityToShipPackagesWithinDDays.py
bssrdf/pyleet
train
2
9c92fbd9297794a203831d22c596a06ad3f1623d
[ "Presentation.__init__(self, pere, detail, attribut, False)\nif pere and detail:\n self.construire(detail)", "detail = self.objet\nsalle = detail.parent\nnouveau_nom = supprimer_accents(arguments)\nif not nouveau_nom:\n self.pere << '|err|Vous devez indiquer un nouveau nom.|ff|'\n return\nif nouveau_nom ...
<|body_start_0|> Presentation.__init__(self, pere, detail, attribut, False) if pere and detail: self.construire(detail) <|end_body_0|> <|body_start_1|> detail = self.objet salle = detail.parent nouveau_nom = supprimer_accents(arguments) if not nouveau_nom: ...
Ce contexte permet d'éditer un detail observable d'une salle.
EdtDetail
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdtDetail: """Ce contexte permet d'éditer un detail observable d'une salle.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def opt_renommer_detail(self, arguments): """Renomme le détail courant. Syntaxe : /n <n...
stack_v2_sparse_classes_10k_train_002904
7,487
permissive
[ { "docstring": "Constructeur de l'éditeur", "name": "__init__", "signature": "def __init__(self, pere, detail=None, attribut=None)" }, { "docstring": "Renomme le détail courant. Syntaxe : /n <nouveau nom>", "name": "opt_renommer_detail", "signature": "def opt_renommer_detail(self, argume...
4
null
Implement the Python class `EdtDetail` described below. Class description: Ce contexte permet d'éditer un detail observable d'une salle. Method signatures and docstrings: - def __init__(self, pere, detail=None, attribut=None): Constructeur de l'éditeur - def opt_renommer_detail(self, arguments): Renomme le détail cou...
Implement the Python class `EdtDetail` described below. Class description: Ce contexte permet d'éditer un detail observable d'une salle. Method signatures and docstrings: - def __init__(self, pere, detail=None, attribut=None): Constructeur de l'éditeur - def opt_renommer_detail(self, arguments): Renomme le détail cou...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class EdtDetail: """Ce contexte permet d'éditer un detail observable d'une salle.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def opt_renommer_detail(self, arguments): """Renomme le détail courant. Syntaxe : /n <n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EdtDetail: """Ce contexte permet d'éditer un detail observable d'une salle.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" Presentation.__init__(self, pere, detail, attribut, False) if pere and detail: self.construire(detail) ...
the_stack_v2_python_sparse
src/primaires/salle/editeurs/redit/edt_detail.py
vincent-lg/tsunami
train
5
f566e586deb45031b1ca6f316e5f706fa765db5c
[ "self = object.__new__(cls)\nself.name = value\nself.value = value\nself.metadata_type = RoleManagerMetadataBase\nreturn self", "self.name = name\nself.value = value\nself.metadata_type = metadata_type\nself.INSTANCES[value] = self", "if self.value:\n boolean = True\nelse:\n boolean = False\nreturn boolea...
<|body_start_0|> self = object.__new__(cls) self.name = value self.value = value self.metadata_type = RoleManagerMetadataBase return self <|end_body_0|> <|body_start_1|> self.name = name self.value = value self.metadata_type = metadata_type self.I...
Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``RoleManagerType``) items Stores the predefined ``RoleManagerType``-s. These can be a...
RoleManagerType
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleManagerType: """Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``RoleManagerType``) items Stores the prede...
stack_v2_sparse_classes_10k_train_002905
5,532
permissive
[ { "docstring": "Creates a new role manager type with the given value. Parameters ---------- value : `int` Value representing the role manager. Returns ------- self : `instance<cls>`", "name": "_from_value", "signature": "def _from_value(cls, value)" }, { "docstring": "Creates a new scheduled eve...
3
null
Implement the Python class `RoleManagerType` described below. Class description: Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``Ro...
Implement the Python class `RoleManagerType` described below. Class description: Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``Ro...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class RoleManagerType: """Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``RoleManagerType``) items Stores the prede...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleManagerType: """Represents a managed role's manager type. Attributes ---------- name : `str` The name of the role manager type. value : `int` The identifier value the role manager type. Class Attributes ---------------- INSTANCES : `dict` of (`int`, ``RoleManagerType``) items Stores the predefined ``RoleM...
the_stack_v2_python_sparse
hata/discord/role/role/preinstanced.py
HuyaneMatsu/hata
train
3
35f62cef9101337ed9ba64411ad848447a7b3c3e
[ "self.field_config = field_config\nself.tokenizer = None\nself.token_embedding = None\nif field_config.vocab_path and field_config.need_convert:\n self.tokenizer = CustomTokenizer(vocab_file=self.field_config.vocab_path)", "src_ids = []\nfor text in batch_text:\n src_id = text.split(' ')\n if self.tokeni...
<|body_start_0|> self.field_config = field_config self.tokenizer = None self.token_embedding = None if field_config.vocab_path and field_config.need_convert: self.tokenizer = CustomTokenizer(vocab_file=self.field_config.vocab_path) <|end_body_0|> <|body_start_1|> src...
return shape= [batch_size,1]
ScalarFieldReader
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" <|body_0|> def convert_texts_to_ids(self, batch_text): """:param batch_text: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002906
2,055
permissive
[ { "docstring": ":param field_config:", "name": "__init__", "signature": "def __init__(self, field_config)" }, { "docstring": ":param batch_text: :return:", "name": "convert_texts_to_ids", "signature": "def convert_texts_to_ids(self, batch_text)" } ]
2
stack_v2_sparse_classes_30k_train_001728
Implement the Python class `ScalarFieldReader` described below. Class description: return shape= [batch_size,1] Method signatures and docstrings: - def __init__(self, field_config): :param field_config: - def convert_texts_to_ids(self, batch_text): :param batch_text: :return:
Implement the Python class `ScalarFieldReader` described below. Class description: return shape= [batch_size,1] Method signatures and docstrings: - def __init__(self, field_config): :param field_config: - def convert_texts_to_ids(self, batch_text): :param batch_text: :return: <|skeleton|> class ScalarFieldReader: ...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" <|body_0|> def convert_texts_to_ids(self, batch_text): """:param batch_text: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScalarFieldReader: """return shape= [batch_size,1]""" def __init__(self, field_config): """:param field_config:""" self.field_config = field_config self.tokenizer = None self.token_embedding = None if field_config.vocab_path and field_config.need_convert: ...
the_stack_v2_python_sparse
research/nlp/senta/src/data/field_reader/scalar_field_reader.py
mindspore-ai/models
train
301
4a3d25c7358022048e0f534ec908b5337c91dbe5
[ "self.config = config\nself.binary = libp2p_node_binary\nself._proc = None", "config_file = '.acn_config'\nself.config.dump(config_file)\ncmd = [self.binary, config_file]\nif self.config.config[AcnNodeConfig.ACN_LOG_FILE] != '':\n self._proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=s...
<|body_start_0|> self.config = config self.binary = libp2p_node_binary self._proc = None <|end_body_0|> <|body_start_1|> config_file = '.acn_config' self.config.dump(config_file) cmd = [self.binary, config_file] if self.config.config[AcnNodeConfig.ACN_LOG_FILE] !...
Deploy an acn node in standalone mode.
AcnNodeStandalone
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcnNodeStandalone: """Deploy an acn node in standalone mode.""" def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str): """Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p_node_binary: path to libp2p node binary""" <|bod...
stack_v2_sparse_classes_10k_train_002907
12,337
permissive
[ { "docstring": "Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p_node_binary: path to libp2p node binary", "name": "__init__", "signature": "def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str)" }, { "docstring": "Run the node.", "nam...
3
null
Implement the Python class `AcnNodeStandalone` described below. Class description: Deploy an acn node in standalone mode. Method signatures and docstrings: - def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str): Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p...
Implement the Python class `AcnNodeStandalone` described below. Class description: Deploy an acn node in standalone mode. Method signatures and docstrings: - def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str): Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class AcnNodeStandalone: """Deploy an acn node in standalone mode.""" def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str): """Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p_node_binary: path to libp2p node binary""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AcnNodeStandalone: """Deploy an acn node in standalone mode.""" def __init__(self, config: AcnNodeConfig, libp2p_node_binary: str): """Initialize a new AcnNodeStandalone object. :param config: node's configuration :param libp2p_node_binary: path to libp2p node binary""" self.config = conf...
the_stack_v2_python_sparse
scripts/acn/run_acn_node_standalone.py
fetchai/agents-aea
train
192
5e45f898473d8664befd3d2f16c416a7138cd3f2
[ "concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser)\nreplications_flags.AddReplicationVolumeArg(parser)\nreplications_flags.AddReplicationReplicationScheduleArg(parser)\nreplications_flags.AddReplicationDestinationVolumeParametersArg(parser)\nflag...
<|body_start_0|> concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser) replications_flags.AddReplicationVolumeArg(parser) replications_flags.AddReplicationReplicationScheduleArg(parser) replications_flags.AddReplicationDes...
Create a Cloud NetApp Volume Replication.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Create a Cloud NetApp Volume Replication.""" def Args(parser): """Add args for creating a Replication.""" <|body_0|> def Run(self, args): """Create a Cloud NetApp Volume Replication in the current project.""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_002908
4,060
permissive
[ { "docstring": "Add args for creating a Replication.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Create a Cloud NetApp Volume Replication in the current project.", "name": "Run", "signature": "def Run(self, args)" } ]
2
null
Implement the Python class `Create` described below. Class description: Create a Cloud NetApp Volume Replication. Method signatures and docstrings: - def Args(parser): Add args for creating a Replication. - def Run(self, args): Create a Cloud NetApp Volume Replication in the current project.
Implement the Python class `Create` described below. Class description: Create a Cloud NetApp Volume Replication. Method signatures and docstrings: - def Args(parser): Add args for creating a Replication. - def Run(self, args): Create a Cloud NetApp Volume Replication in the current project. <|skeleton|> class Creat...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Create: """Create a Cloud NetApp Volume Replication.""" def Args(parser): """Add args for creating a Replication.""" <|body_0|> def Run(self, args): """Create a Cloud NetApp Volume Replication in the current project.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Create: """Create a Cloud NetApp Volume Replication.""" def Args(parser): """Add args for creating a Replication.""" concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser) replications_flags.AddReplicationVolumeArg(p...
the_stack_v2_python_sparse
lib/surface/netapp/volumes/replications/create.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
26537d9382d6f8363261e12c6a0c4e880ac9a552
[ "self.force_delete = force_delete\nself.id = id\nself.include_marked_for_removal = include_marked_for_removal\nself.retry = retry", "if dictionary is None:\n return None\nforce_delete = dictionary.get('forceDelete')\nid = dictionary.get('id')\ninclude_marked_for_removal = dictionary.get('includeMarkedForRemova...
<|body_start_0|> self.force_delete = force_delete self.id = id self.include_marked_for_removal = include_marked_for_removal self.retry = retry <|end_body_0|> <|body_start_1|> if dictionary is None: return None force_delete = dictionary.get('forceDelete') ...
Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, the RemovalState of the vault is changed to 'kMarkedForRemoval' and Eventually vault i...
VaultDeleteParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VaultDeleteParams: """Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, the RemovalState of the vault is changed ...
stack_v2_sparse_classes_10k_train_002909
2,521
permissive
[ { "docstring": "Constructor for the VaultDeleteParams class", "name": "__init__", "signature": "def __init__(self, force_delete=None, id=None, include_marked_for_removal=None, retry=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dic...
2
stack_v2_sparse_classes_30k_train_007150
Implement the Python class `VaultDeleteParams` described below. Class description: Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, th...
Implement the Python class `VaultDeleteParams` described below. Class description: Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, th...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VaultDeleteParams: """Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, the RemovalState of the vault is changed ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VaultDeleteParams: """Implementation of the 'VaultDeleteParams' model. VaultDeleteParams represents the parameters needed to delete a specific vault. Attributes: force_delete (bool): Specifies whether to force delete the vault. If the flag is set to true, the RemovalState of the vault is changed to 'kMarkedFo...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vault_delete_params.py
cohesity/management-sdk-python
train
24
34725e46b81bebc569953c20c9ab09eedc7576e0
[ "self.name = name\nself.subnet = subnet\nself.appliance_ip = appliance_ip\nself.vpn_nat_subnet = vpn_nat_subnet\nself.dhcp_handling = dhcp_handling\nself.dhcp_relay_server_ips = dhcp_relay_server_ips\nself.dhcp_lease_time = dhcp_lease_time\nself.dhcp_boot_options_enabled = dhcp_boot_options_enabled\nself.dhcp_boot_...
<|body_start_0|> self.name = name self.subnet = subnet self.appliance_ip = appliance_ip self.vpn_nat_subnet = vpn_nat_subnet self.dhcp_handling = dhcp_handling self.dhcp_relay_server_ips = dhcp_relay_server_ips self.dhcp_lease_time = dhcp_lease_time self.d...
Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN subnet if VPN and VPN subnet translatio...
UpdateNetworkVlanModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran...
stack_v2_sparse_classes_10k_train_002910
7,095
permissive
[ { "docstring": "Constructor for the UpdateNetworkVlanModel class", "name": "__init__", "signature": "def __init__(self, name=None, subnet=None, appliance_ip=None, vpn_nat_subnet=None, dhcp_handling=None, dhcp_relay_server_ips=None, dhcp_lease_time=None, dhcp_boot_options_enabled=None, dhcp_boot_next_ser...
2
stack_v2_sparse_classes_30k_train_003907
Implement the Python class `UpdateNetworkVlanModel` described below. Class description: Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the...
Implement the Python class `UpdateNetworkVlanModel` described below. Class description: Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN su...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_vlan_model.py
RaulCatalano/meraki-python-sdk
train
1
795453f10a85f9fe6bbec59c84e15847f13d9090
[ "self.id = id\nself.number = number\nself.name = name\nself.balance = balance\nself.mtype = mtype\nself.status = status\nself.customer_id = customer_id\nself.institution_id = institution_id\nself.balance_date = balance_date\nself.created_date = created_date\nself.currency = currency\nself.institution_login_id = ins...
<|body_start_0|> self.id = id self.number = number self.name = name self.balance = balance self.mtype = mtype self.status = status self.customer_id = customer_id self.institution_id = institution_id self.balance_date = balance_date self.cre...
Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: type description here. mtype (string): TODO: type description here. status (st...
Account1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Account1: """Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: type description here. mtype (string): TOD...
stack_v2_sparse_classes_10k_train_002911
4,584
permissive
[ { "docstring": "Constructor for the Account1 class", "name": "__init__", "signature": "def __init__(self, id=None, number=None, name=None, balance=None, mtype=None, status=None, customer_id=None, institution_id=None, balance_date=None, created_date=None, currency=None, institution_login_id=None, display...
2
stack_v2_sparse_classes_30k_train_001271
Implement the Python class `Account1` described below. Class description: Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: typ...
Implement the Python class `Account1` described below. Class description: Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: typ...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class Account1: """Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: type description here. mtype (string): TOD...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Account1: """Implementation of the 'Account1' model. TODO: type model description here. Attributes: id (string): TODO: type description here. number (string): TODO: type description here. name (string): TODO: type description here. balance (float): TODO: type description here. mtype (string): TODO: type descr...
the_stack_v2_python_sparse
finicityapi/models/account_1.py
monarchmoney/finicity-python
train
0
948828e5464d4d07cb1299bb678291e4a74e6529
[ "import Dice\nnumber = Dice.dice.Dicerolling(self)\nres = number\nexp = Dice.dice.rollGet(self)\nself.assertEqual(res, exp)", "import Dice\nnumber = Dice.dice.Dicerolling(self)\nres = number\nexp = 1 <= res <= 6\nself.assertTrue(exp)" ]
<|body_start_0|> import Dice number = Dice.dice.Dicerolling(self) res = number exp = Dice.dice.rollGet(self) self.assertEqual(res, exp) <|end_body_0|> <|body_start_1|> import Dice number = Dice.dice.Dicerolling(self) res = number exp = 1 <= res <=...
This is the unittest for the class Dice
dicetest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dicetest: """This is the unittest for the class Dice""" def testdice1(self): """Tests if rollGet returns the correct number""" <|body_0|> def testdice2(self): """Tests if the dice rolling works, giving a number between 1-6""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_002912
637
permissive
[ { "docstring": "Tests if rollGet returns the correct number", "name": "testdice1", "signature": "def testdice1(self)" }, { "docstring": "Tests if the dice rolling works, giving a number between 1-6", "name": "testdice2", "signature": "def testdice2(self)" } ]
2
stack_v2_sparse_classes_30k_train_001005
Implement the Python class `dicetest` described below. Class description: This is the unittest for the class Dice Method signatures and docstrings: - def testdice1(self): Tests if rollGet returns the correct number - def testdice2(self): Tests if the dice rolling works, giving a number between 1-6
Implement the Python class `dicetest` described below. Class description: This is the unittest for the class Dice Method signatures and docstrings: - def testdice1(self): Tests if rollGet returns the correct number - def testdice2(self): Tests if the dice rolling works, giving a number between 1-6 <|skeleton|> class...
73a8962c762ff48da331c9212f10676f066ed940
<|skeleton|> class dicetest: """This is the unittest for the class Dice""" def testdice1(self): """Tests if rollGet returns the correct number""" <|body_0|> def testdice2(self): """Tests if the dice rolling works, giving a number between 1-6""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class dicetest: """This is the unittest for the class Dice""" def testdice1(self): """Tests if rollGet returns the correct number""" import Dice number = Dice.dice.Dicerolling(self) res = number exp = Dice.dice.rollGet(self) self.assertEqual(res, exp) def te...
the_stack_v2_python_sparse
methoddice/testdice.py
JohanK91/MethodDice
train
0
8a62f6b885148ba8f39a86c9eaf934d56ee9c4e4
[ "with tf.name_scope('MaskedLMTask/losses'):\n metrics = dict([(metric.name, metric) for metric in metrics])\n lm_prediction_losses = tf.keras.losses.sparse_categorical_crossentropy(labels['masked_lm_ids'], tf.cast(model_outputs['mlm_logits'], tf.float32), from_logits=True)\n lm_label_weights = labels['mask...
<|body_start_0|> with tf.name_scope('MaskedLMTask/losses'): metrics = dict([(metric.name, metric) for metric in metrics]) lm_prediction_losses = tf.keras.losses.sparse_categorical_crossentropy(labels['masked_lm_ids'], tf.cast(model_outputs['mlm_logits'], tf.float32), from_logits=True) ...
Task object for Mask language modeling.
TokenDropMaskedLMTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenDropMaskedLMTask: """Task object for Mask language modeling.""" def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]: """Return the final loss, and the masked-lm loss.""" <|body_0|> def train_step(self, inputs, model...
stack_v2_sparse_classes_10k_train_002913
4,551
permissive
[ { "docstring": "Return the final loss, and the masked-lm loss.", "name": "build_losses", "signature": "def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]" }, { "docstring": "Does forward and backward. Args: inputs: a dictionary of input tensors...
3
stack_v2_sparse_classes_30k_train_000113
Implement the Python class `TokenDropMaskedLMTask` described below. Class description: Task object for Mask language modeling. Method signatures and docstrings: - def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]: Return the final loss, and the masked-lm loss. - de...
Implement the Python class `TokenDropMaskedLMTask` described below. Class description: Task object for Mask language modeling. Method signatures and docstrings: - def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]: Return the final loss, and the masked-lm loss. - de...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class TokenDropMaskedLMTask: """Task object for Mask language modeling.""" def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]: """Return the final loss, and the masked-lm loss.""" <|body_0|> def train_step(self, inputs, model...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TokenDropMaskedLMTask: """Task object for Mask language modeling.""" def build_losses(self, labels, model_outputs, metrics, aux_losses=None) -> Tuple[tf.Tensor, tf.Tensor]: """Return the final loss, and the masked-lm loss.""" with tf.name_scope('MaskedLMTask/losses'): metrics ...
the_stack_v2_python_sparse
official/projects/token_dropping/masked_lm.py
jianzhnie/models
train
2
51671e0eb5829e6c208b4dd7afd3867a921e3492
[ "p = hyperparams.Params()\nif not m:\n return p\ndesc = 'See comments for {msg} for description'.format(msg=m.full_name)\nfor f in m.fields:\n if f.containing_oneof:\n continue\n if omit and f.full_name in omit:\n continue\n if f.label == descriptor.FieldDescriptor.LABEL_REPEATED:\n ...
<|body_start_0|> p = hyperparams.Params() if not m: return p desc = 'See comments for {msg} for description'.format(msg=m.full_name) for f in m.fields: if f.containing_oneof: continue if omit and f.full_name in omit: con...
Generate default hyper params for dynamic config components.
Util
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Util: """Generate default hyper params for dynamic config components.""" def CreateParamsForMessage(cls, m, omit=None): """Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each field added will match the proto field names. Nested messa...
stack_v2_sparse_classes_10k_train_002914
4,230
permissive
[ { "docstring": "Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each field added will match the proto field names. Nested messages will be added recursively. Parameters will be initialized to None or the empty list. Note that one_of messages are skipped and no h...
3
null
Implement the Python class `Util` described below. Class description: Generate default hyper params for dynamic config components. Method signatures and docstrings: - def CreateParamsForMessage(cls, m, omit=None): Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each f...
Implement the Python class `Util` described below. Class description: Generate default hyper params for dynamic config components. Method signatures and docstrings: - def CreateParamsForMessage(cls, m, omit=None): Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each f...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Util: """Generate default hyper params for dynamic config components.""" def CreateParamsForMessage(cls, m, omit=None): """Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each field added will match the proto field names. Nested messa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Util: """Generate default hyper params for dynamic config components.""" def CreateParamsForMessage(cls, m, omit=None): """Proto to hyper params conversion. Method will define hyperparameters matching a protocol message. Each field added will match the proto field names. Nested messages will be a...
the_stack_v2_python_sparse
cognate_inpaint_neighbors/neighbors/model/util.py
Jimmy-INL/google-research
train
1
fa3038ae9ffe3c69d5ffed859cbfa10975664a3b
[ "self.problem = problem\nself.u = problem.T\nself.params = {'snes_type': 'newtonls', 'mat_type': 'matfree', 'ksp_type': 'gmres', 'pc_type': 'python', 'pc_python_type': 'firedrake.AssembledPC', 'assembled_pc_type': 'hypre', 'assembled_pc_factor_mat_solver_type': 'mumps', 'assembled_pc_hypre_type': 'boomeramg', 'asse...
<|body_start_0|> self.problem = problem self.u = problem.T self.params = {'snes_type': 'newtonls', 'mat_type': 'matfree', 'ksp_type': 'gmres', 'pc_type': 'python', 'pc_python_type': 'firedrake.AssembledPC', 'assembled_pc_type': 'hypre', 'assembled_pc_factor_mat_solver_type': 'mumps', 'assembled_...
A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.
Solver
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the S...
stack_v2_sparse_classes_10k_train_002915
3,977
permissive
[ { "docstring": "Initialise the Solver. Args: problem (TTiP.problem.Problem): The problem to solve.", "name": "__init__", "signature": "def __init__(self, problem)" }, { "docstring": "Setup and solve the nonlinear problem. Save value to file given. Any additional keyword arguments are passed to t...
3
stack_v2_sparse_classes_30k_train_007107
Implement the Python class `Solver` described below. Class description: A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver. Method signatures and do...
Implement the Python class `Solver` described below. Class description: A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver. Method signatures and do...
cc4e7f7b9abb498893aaa05e2b25416f513905b0
<|skeleton|> class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the S...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the Solver. Args: ...
the_stack_v2_python_sparse
TTiP/core/solver.py
AndrewLister-STFC/TTiP
train
0
ac88a8dc489c850231c74a64c197c011485dfbf6
[ "self.table = []\nfor i in range(len(w)):\n self.table += [i] * w[i]", "total = len(self.table)\nrnd = random.randint(0, total - 1)\nreturn self.table[rnd]" ]
<|body_start_0|> self.table = [] for i in range(len(w)): self.table += [i] * w[i] <|end_body_0|> <|body_start_1|> total = len(self.table) rnd = random.randint(0, total - 1) return self.table[rnd] <|end_body_1|>
Solution_MLE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.table = [] for i in range(len(w)): self.table += [i] * w[i] <|end_b...
stack_v2_sparse_classes_10k_train_002916
1,874
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution_MLE` described below. Class description: Implement the Solution_MLE class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution_MLE` described below. Class description: Implement the Solution_MLE class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""...
ce68f5af57f772185211f4e81952d0345a6d23cb
<|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution_MLE: def __init__(self, w): """:type w: List[int]""" self.table = [] for i in range(len(w)): self.table += [i] * w[i] def pickIndex(self): """:rtype: int""" total = len(self.table) rnd = random.randint(0, total - 1) return self....
the_stack_v2_python_sparse
Previous/528_Random_Pick_with_Weight.py
xizhang77/LeetCode
train
0
e50c8a57edf736b2ca0a59d501a8c27f9e50638c
[ "user_name = request.GET.get('user_name', None)\ntry:\n user = BigfishUser.objects.get(username=user_name)\nexcept:\n return Response(rsp_msg_400('该用户不存在'), status=status.HTTP_200_OK)\nversion = Version.objects.all().order_by('-version_code').first()\ntry:\n identity_version = IdentityVersion.objects.get(i...
<|body_start_0|> user_name = request.GET.get('user_name', None) try: user = BigfishUser.objects.get(username=user_name) except: return Response(rsp_msg_400('该用户不存在'), status=status.HTTP_200_OK) version = Version.objects.all().order_by('-version_code').first() ...
VersionViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/Super...
stack_v2_sparse_classes_10k_train_002917
7,575
no_license
[ { "docstring": "更新版本 :param request: { \"user_name\": \"10720001\" } :return: { \"data\": { \"version_name\": \"1.2.7\", \"apk_size\": 30140, \"message\": \"1231qweqw\", \"apk_code\": 20, \"version_code\": 1, \"folder_name\": \"http://127.0.0.1:8000/media/version/1.2.7/SuperFishTeacher.apk\" }, \"message\": \"s...
3
stack_v2_sparse_classes_30k_train_000976
Implement the Python class `VersionViews` described below. Class description: Implement the VersionViews class. Method signatures and docstrings: - def update_version(self, request): 更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw...
Implement the Python class `VersionViews` described below. Class description: Implement the VersionViews class. Method signatures and docstrings: - def update_version(self, request): 更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw...
4189fdcacc20795a4778b53c9d47d6fdd3e71811
<|skeleton|> class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/Super...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VersionViews: def update_version(self, request): """更新版本 :param request: { "user_name": "10720001" } :return: { "data": { "version_name": "1.2.7", "apk_size": 30140, "message": "1231qweqw", "apk_code": 20, "version_code": 1, "folder_name": "http://127.0.0.1:8000/media/version/1.2.7/SuperFishTeacher.ap...
the_stack_v2_python_sparse
bigfish/apps/versionupdate/views.py
hyu9999/bigfish
train
0
bdbb3e95204c2bd3f5ca28ae7fb38a2111782372
[ "self.pers = persistence\nself.logger = logging.getLogger('app')\nself.cfg = cfg", "try:\n self.logger.debug('Password Reset attempt %s', user_id)\n password_reset_token = ''\n nosqldb = self.pers.nosql_db\n db_user_record = nosqldb['users'].find_one({'$or': [{'username': user_id}, {'email': user_id}]...
<|body_start_0|> self.pers = persistence self.logger = logging.getLogger('app') self.cfg = cfg <|end_body_0|> <|body_start_1|> try: self.logger.debug('Password Reset attempt %s', user_id) password_reset_token = '' nosqldb = self.pers.nosql_db ...
Web user authentication database helper
PasswordResetDBHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" <|body_0|> def create_password_reset_token(self, user_id): """Initiate a password reset with a complex token, multi step""" ...
stack_v2_sparse_classes_10k_train_002918
4,820
no_license
[ { "docstring": "Class initialization", "name": "__init__", "signature": "def __init__(self, persistence, cfg)" }, { "docstring": "Initiate a password reset with a complex token, multi step", "name": "create_password_reset_token", "signature": "def create_password_reset_token(self, user_i...
4
stack_v2_sparse_classes_30k_train_001662
Implement the Python class `PasswordResetDBHelper` described below. Class description: Web user authentication database helper Method signatures and docstrings: - def __init__(self, persistence, cfg): Class initialization - def create_password_reset_token(self, user_id): Initiate a password reset with a complex token...
Implement the Python class `PasswordResetDBHelper` described below. Class description: Web user authentication database helper Method signatures and docstrings: - def __init__(self, persistence, cfg): Class initialization - def create_password_reset_token(self, user_id): Initiate a password reset with a complex token...
3c774731b054c38a273371450a451c951d73b726
<|skeleton|> class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" <|body_0|> def create_password_reset_token(self, user_id): """Initiate a password reset with a complex token, multi step""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PasswordResetDBHelper: """Web user authentication database helper""" def __init__(self, persistence, cfg): """Class initialization""" self.pers = persistence self.logger = logging.getLogger('app') self.cfg = cfg def create_password_reset_token(self, user_id): ...
the_stack_v2_python_sparse
genesis/passwordresetdbhelper.py
wbmartin/exodus-app
train
0
6bb16b612543b0821297c8ed8df68020445d9dd4
[ "super().__init__(screen)\nself.faction = faction\nif self.faction == Faction.Allied:\n self.base_speed = Settings.player_bullet_base_speed\nelse:\n self.base_speed = Settings.enemy_bullet_base_speed\nself.base_damage = Settings.bullet_base_damage\nself.set_position(starting_position)\nself.angle = starting_a...
<|body_start_0|> super().__init__(screen) self.faction = faction if self.faction == Faction.Allied: self.base_speed = Settings.player_bullet_base_speed else: self.base_speed = Settings.enemy_bullet_base_speed self.base_damage = Settings.bullet_base_damage ...
A class to manage projectiles fired by anyone.
AbstractProjectile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractProjectile: """A class to manage projectiles fired by anyone.""" def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction): """Create a projectile at a given position moving through a given angle""" <|body_0|> def...
stack_v2_sparse_classes_10k_train_002919
1,184
no_license
[ { "docstring": "Create a projectile at a given position moving through a given angle", "name": "__init__", "signature": "def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction)" }, { "docstring": "Move the bullet through the screen.", "name...
2
stack_v2_sparse_classes_30k_train_000967
Implement the Python class `AbstractProjectile` described below. Class description: A class to manage projectiles fired by anyone. Method signatures and docstrings: - def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction): Create a projectile at a given position mo...
Implement the Python class `AbstractProjectile` described below. Class description: A class to manage projectiles fired by anyone. Method signatures and docstrings: - def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction): Create a projectile at a given position mo...
e06bbf5210f653554e22d558558e4bac8f739e4a
<|skeleton|> class AbstractProjectile: """A class to manage projectiles fired by anyone.""" def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction): """Create a projectile at a given position moving through a given angle""" <|body_0|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AbstractProjectile: """A class to manage projectiles fired by anyone.""" def __init__(self, screen, starting_position, starting_angle, damage_multiplier, speed_multiplier, faction): """Create a projectile at a given position moving through a given angle""" super().__init__(screen) ...
the_stack_v2_python_sparse
game_sprites/projectiles/abstract_projectile.py
Mocardo/jogo-ces22
train
0
056944e23ef4a406a65a8d028260ad145efa2ddf
[ "d = {}\nfor t in tasks:\n if t in d:\n d[t] += 1\n else:\n d[t] = 1\npq = queue.PriorityQueue()\nfor k, v in d.items():\n pq.put(-v)\nans = 0\nwhile not pq.empty():\n time = 0\n tmp = []\n while time <= n and (not pq.empty()):\n v = pq.get()\n if -v > 1:\n t...
<|body_start_0|> d = {} for t in tasks: if t in d: d[t] += 1 else: d[t] = 1 pq = queue.PriorityQueue() for k, v in d.items(): pq.put(-v) ans = 0 while not pq.empty(): time = 0 tmp ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def leastInterval2(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_0|> def leastInterval1(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_1|> def leastInterval3(self, tasks, n): ...
stack_v2_sparse_classes_10k_train_002920
2,596
no_license
[ { "docstring": ":type tasks: List[str] :type n: int :rtype: int", "name": "leastInterval2", "signature": "def leastInterval2(self, tasks, n)" }, { "docstring": ":type tasks: List[str] :type n: int :rtype: int", "name": "leastInterval1", "signature": "def leastInterval1(self, tasks, n)" ...
4
stack_v2_sparse_classes_30k_train_002462
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastInterval2(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def leastInterval1(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def le...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastInterval2(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def leastInterval1(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def le...
763674fcbe271af3d21eed790c3968c4d33f7b09
<|skeleton|> class Solution: def leastInterval2(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_0|> def leastInterval1(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_1|> def leastInterval3(self, tasks, n): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def leastInterval2(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" d = {} for t in tasks: if t in d: d[t] += 1 else: d[t] = 1 pq = queue.PriorityQueue() for k, v in d.items(): ...
the_stack_v2_python_sparse
621_task_scheduler/621.py
guzhoudiaoke/leetcode_python3
train
0
fec7700de7b07f68226f7ef00f1f1845d569f3d9
[ "key_name = 'The Mark'\nthe_mark = db.get(datastore_types.Key.from_path(cls.kind(), key_name))\nif the_mark is None:\n next_start = now() - datetime.timedelta(seconds=60)\n the_mark = PollingMarker(key_name=key_name, next_start=next_start, current_key=None)\nreturn the_mark", "now_time = now()\nif self.next...
<|body_start_0|> key_name = 'The Mark' the_mark = db.get(datastore_types.Key.from_path(cls.kind(), key_name)) if the_mark is None: next_start = now() - datetime.timedelta(seconds=60) the_mark = PollingMarker(key_name=key_name, next_start=next_start, current_key=None) ...
Keeps track of the current position in the bootstrap polling process.
PollingMarker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollingMarker: """Keeps track of the current position in the bootstrap polling process.""" def get(cls, now=datetime.datetime.utcnow): """Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns the current time as a UTC datetime.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_002921
30,847
no_license
[ { "docstring": "Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns the current time as a UTC datetime.", "name": "get", "signature": "def get(cls, now=datetime.datetime.utcnow)" }, { "docstring": "Returns True if the bootstrap polling should progress. May modi...
2
stack_v2_sparse_classes_30k_train_002813
Implement the Python class `PollingMarker` described below. Class description: Keeps track of the current position in the bootstrap polling process. Method signatures and docstrings: - def get(cls, now=datetime.datetime.utcnow): Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns th...
Implement the Python class `PollingMarker` described below. Class description: Keeps track of the current position in the bootstrap polling process. Method signatures and docstrings: - def get(cls, now=datetime.datetime.utcnow): Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns th...
e28ffc2c685a7ee92b0686462e61bb06255a65ac
<|skeleton|> class PollingMarker: """Keeps track of the current position in the bootstrap polling process.""" def get(cls, now=datetime.datetime.utcnow): """Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns the current time as a UTC datetime.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PollingMarker: """Keeps track of the current position in the bootstrap polling process.""" def get(cls, now=datetime.datetime.utcnow): """Returns the current PollingMarker, creating it if it doesn't exist. Args: now: Returns the current time as a UTC datetime.""" key_name = 'The Mark' ...
the_stack_v2_python_sparse
hub/hubmodel.py
PaulKinlan/Amplifriend
train
3
537afaca93922f63ec238470e55622e3fe17f6cd
[ "self.threshold_method = threshold_method\nself.threshold = threshold\nself.cf = filters.CompoundUniformFilter(samples)\nself.mf = filters.MaximumFilter(2 * samples + 1)", "cfilt = self.cf.filter_image(image)\nmfilt = self.mf.filter_image(cfilt)\nif 'std' in self.threshold_method:\n threshold = np.std(self.cf....
<|body_start_0|> self.threshold_method = threshold_method self.threshold = threshold self.cf = filters.CompoundUniformFilter(samples) self.mf = filters.MaximumFilter(2 * samples + 1) <|end_body_0|> <|body_start_1|> cfilt = self.cf.filter_image(image) mfilt = self.mf.filt...
Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold.
Estimate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Estimate: """Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold.""" def __init__(self, samples, threshold_method, threshold): """Initialise the position estimator. Paramete...
stack_v2_sparse_classes_10k_train_002922
9,306
no_license
[ { "docstring": "Initialise the position estimator. Parameters ---------- samples : int Size of kernel used in filtering. threshold_method : str Threshold method (either `std` or `manual`). threshold : float, optional Intensity threshold for position estimation - to be used if threshold_method is `manual`.", ...
2
stack_v2_sparse_classes_30k_train_005861
Implement the Python class `Estimate` described below. Class description: Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold. Method signatures and docstrings: - def __init__(self, samples, threshold_method...
Implement the Python class `Estimate` described below. Class description: Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold. Method signatures and docstrings: - def __init__(self, samples, threshold_method...
8fdb4122788d0967536ac3f14759e1f32a0c616e
<|skeleton|> class Estimate: """Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold.""" def __init__(self, samples, threshold_method, threshold): """Initialise the position estimator. Paramete...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Estimate: """Estimate the position of bright spots in a fluorescence image using a compound uniform filter. Spots are retained if their grey level value is above the threshold.""" def __init__(self, samples, threshold_method, threshold): """Initialise the position estimator. Parameters ----------...
the_stack_v2_python_sparse
smlm_analysis/localise/estimate.py
drmatthews/SMLM_analysis
train
0
42fb7ce224ffc89425c8ebadd8f8e749612d64e2
[ "XB = np.dot(self.exog, params)\nendog = self.endog\nreturn np.exp(XB) - endog * XB + np.log(factorial(endog))", "if not hasattr(self, result):\n raise ValueError\nelse:\n mu = np.exp(np.dot(exog, params))\n return stats.poisson(mu, loc=0)" ]
<|body_start_0|> XB = np.dot(self.exog, params) endog = self.endog return np.exp(XB) - endog * XB + np.log(factorial(endog)) <|end_body_0|> <|body_start_1|> if not hasattr(self, result): raise ValueError else: mu = np.exp(np.dot(exog, params)) ...
Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradients and Hessian and all resulting statistics are based on numerical differenti...
PoissonGMLE
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PoissonGMLE: """Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradients and Hessian and all resulting stati...
stack_v2_sparse_classes_10k_train_002923
10,838
permissive
[ { "docstring": "Loglikelihood of Poisson model Parameters ---------- params : array-like The parameters of the model. Returns ------- The log likelihood of the model evaluated at `params` Notes -------- .. math :: \\\\ln L=\\\\sum_{i=1}^{n}\\\\left[-\\\\lambda_{i}+y_{i}x_{i}^{\\\\prime}\\\\beta-\\\\ln y_{i}!\\\...
2
null
Implement the Python class `PoissonGMLE` described below. Class description: Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradie...
Implement the Python class `PoissonGMLE` described below. Class description: Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradie...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class PoissonGMLE: """Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradients and Hessian and all resulting stati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PoissonGMLE: """Maximum Likelihood Estimation of Poisson Model This is an example for generic MLE which has the same statistical model as discretemod.Poisson. Except for defining the negative log-likelihood method, all methods and results are generic. Gradients and Hessian and all resulting statistics are bas...
the_stack_v2_python_sparse
pkgs/statsmodels-0.6.1-np110py27_0/lib/python2.7/site-packages/statsmodels/miscmodels/count.py
wangyum/Anaconda
train
11
177b716b76c9a75e8f64a7cac9e0a9ae545e4fe0
[ "persistent_query_keyword = PersistentQueryKeyword(user_id=str(self.context['request'].user.id), content=validated_data['content'] if 'content' in validated_data else None, name=validated_data['name'] if 'name' in validated_data else None)\npersistent_query_keyword_api.upsert(persistent_query_keyword, self.context[...
<|body_start_0|> persistent_query_keyword = PersistentQueryKeyword(user_id=str(self.context['request'].user.id), content=validated_data['content'] if 'content' in validated_data else None, name=validated_data['name'] if 'name' in validated_data else None) persistent_query_keyword_api.upsert(persistent_q...
persistent query keyword serializer
PersistentQueryKeywordSerializer
[ "NIST-Software", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersistentQueryKeywordSerializer: """persistent query keyword serializer""" def create(self, validated_data): """Create and return a new `PersistentQueryKeyword` instance, given the validated data.""" <|body_0|> def update(self, persistent_query_keyword, validated_data):...
stack_v2_sparse_classes_10k_train_002924
3,197
permissive
[ { "docstring": "Create and return a new `PersistentQueryKeyword` instance, given the validated data.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `PersistentQueryKeyword` instance, given the validated data.", "name": "up...
2
stack_v2_sparse_classes_30k_train_003747
Implement the Python class `PersistentQueryKeywordSerializer` described below. Class description: persistent query keyword serializer Method signatures and docstrings: - def create(self, validated_data): Create and return a new `PersistentQueryKeyword` instance, given the validated data. - def update(self, persistent...
Implement the Python class `PersistentQueryKeywordSerializer` described below. Class description: persistent query keyword serializer Method signatures and docstrings: - def create(self, validated_data): Create and return a new `PersistentQueryKeyword` instance, given the validated data. - def update(self, persistent...
d85d18363c65be3cdffc2fdd79797a50ef65cb2a
<|skeleton|> class PersistentQueryKeywordSerializer: """persistent query keyword serializer""" def create(self, validated_data): """Create and return a new `PersistentQueryKeyword` instance, given the validated data.""" <|body_0|> def update(self, persistent_query_keyword, validated_data):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PersistentQueryKeywordSerializer: """persistent query keyword serializer""" def create(self, validated_data): """Create and return a new `PersistentQueryKeyword` instance, given the validated data.""" persistent_query_keyword = PersistentQueryKeyword(user_id=str(self.context['request'].us...
the_stack_v2_python_sparse
core_explore_keyword_app/rest/persistent_query_keyword/serializers.py
usnistgov/core_explore_keyword_app
train
0
2a9a821f01405c06ab68c56de156e868e99d147a
[ "parser = parent.add_parser('attach', help='attach to container')\nparser.add_argument('--image', help='image to instantiate and attach to')\nparser.add_argument('command', nargs='*', help='image to instantiate and attach to')\nparser.set_defaults(class_=cls, method='attach')", "super().__init__(args)\nif not arg...
<|body_start_0|> parser = parent.add_parser('attach', help='attach to container') parser.add_argument('--image', help='image to instantiate and attach to') parser.add_argument('command', nargs='*', help='image to instantiate and attach to') parser.set_defaults(class_=cls, method='attach'...
Class for attaching to a running container.
Attach
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attach: """Class for attaching to a running container.""" def subparser(cls, parent): """Add Attach command to parent parser.""" <|body_0|> def __init__(self, args): """Construct Attach class.""" <|body_1|> def attach(self): """Attach to inst...
stack_v2_sparse_classes_10k_train_002925
2,057
permissive
[ { "docstring": "Add Attach command to parent parser.", "name": "subparser", "signature": "def subparser(cls, parent)" }, { "docstring": "Construct Attach class.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Attach to instantiated image.", "n...
3
stack_v2_sparse_classes_30k_train_001175
Implement the Python class `Attach` described below. Class description: Class for attaching to a running container. Method signatures and docstrings: - def subparser(cls, parent): Add Attach command to parent parser. - def __init__(self, args): Construct Attach class. - def attach(self): Attach to instantiated image.
Implement the Python class `Attach` described below. Class description: Class for attaching to a running container. Method signatures and docstrings: - def subparser(cls, parent): Add Attach command to parent parser. - def __init__(self, args): Construct Attach class. - def attach(self): Attach to instantiated image....
94a46127cb0db2b6187186788a941ec72af476dd
<|skeleton|> class Attach: """Class for attaching to a running container.""" def subparser(cls, parent): """Add Attach command to parent parser.""" <|body_0|> def __init__(self, args): """Construct Attach class.""" <|body_1|> def attach(self): """Attach to inst...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Attach: """Class for attaching to a running container.""" def subparser(cls, parent): """Add Attach command to parent parser.""" parser = parent.add_parser('attach', help='attach to container') parser.add_argument('--image', help='image to instantiate and attach to') parse...
the_stack_v2_python_sparse
pypodman/pypodman/lib/actions/attach_action.py
4383/python-podman
train
0
1f9ba8647301914a4961c0ba940186474cba209e
[ "fake_head = ListNode(0)\np, p1, p2 = (fake_head, l1, l2)\nwhile p1 and p2:\n if p1.val < p2.val:\n p.next = ListNode(p1.val)\n p1 = p1.next\n else:\n p.next = ListNode(p2.val)\n p2 = p2.next\n p = p.next\np.next = p1 or p2\nreturn fake_head.next", "if not l1 or not l2:\n r...
<|body_start_0|> fake_head = ListNode(0) p, p1, p2 = (fake_head, l1, l2) while p1 and p2: if p1.val < p2.val: p.next = ListNode(p1.val) p1 = p1.next else: p.next = ListNode(p2.val) p2 = p2.next p ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_recursive(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_002926
1,522
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_iterative", "signature": "def mergeTwoLists_iterative(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_recursive", "signature":...
2
stack_v2_sparse_classes_30k_train_001093
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_iterative(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_recursive(self, l1, l2): :type l1: ListNode :type l2: ListNo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_iterative(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists_recursive(self, l1, l2): :type l1: ListNode :type l2: ListNo...
9ac54720f571a4bea09d0cceb0039381a78df9e8
<|skeleton|> class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists_recursive(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists_iterative(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" fake_head = ListNode(0) p, p1, p2 = (fake_head, l1, l2) while p1 and p2: if p1.val < p2.val: p.next = ListNode(p1.val) p...
the_stack_v2_python_sparse
code/021_merge-two-sorted-lists.py
linhdvu14/leetcode-solutions
train
2
fb966322b9d5f78d5e116d502db6e94c96fc455a
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('DescribeMaterialList', params, headers=headers)\n response = json.loads(body)\n model = models.DescribeMaterialListResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('DescribeMaterialList', params, headers=headers) response = json.loads(body) model = models.DescribeMaterialListResponse() model._deserialize(res...
FacefusionClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListR...
stack_v2_sparse_classes_10k_train_002927
5,785
permissive
[ { "docstring": "通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListRequest` :rtype: :class:`tencentcloud.facefusion.v20181201.models.Descr...
4
stack_v2_sparse_classes_30k_train_006970
Implement the Python class `FacefusionClient` described below. Class description: Implement the FacefusionClient class. Method signatures and docstrings: - def DescribeMaterialList(self, request): 通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for De...
Implement the Python class `FacefusionClient` described below. Class description: Implement the FacefusionClient class. Method signatures and docstrings: - def DescribeMaterialList(self, request): 通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for De...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListR...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListRequest` :rtype...
the_stack_v2_python_sparse
tencentcloud/facefusion/v20181201/facefusion_client.py
TencentCloud/tencentcloud-sdk-python
train
594
6ad1b647fb85a1c6260e9b8833bd72085dd1f4f7
[ "securityPartitions = zoneManager.getDevicesByType(AlarmPartition)\nif len(securityPartitions) > 0:\n if AlarmPartition.STATE_ARM_AWAY == securityPartitions[0].getArmMode():\n return True\nreturn False", "securityPartitions = zoneManager.getDevicesByType(AlarmPartition)\nif len(securityPartitions) > 0:\...
<|body_start_0|> securityPartitions = zoneManager.getDevicesByType(AlarmPartition) if len(securityPartitions) > 0: if AlarmPartition.STATE_ARM_AWAY == securityPartitions[0].getArmMode(): return True return False <|end_body_0|> <|body_start_1|> securityPartiti...
Provide quick access to the alarm partition of the zones.
SecurityManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" <|body_0|> def isArmedStay(zoneManager): """:return: True if at least one zone is armed-stay""" ...
stack_v2_sparse_classes_10k_train_002928
2,333
no_license
[ { "docstring": ":return: True if at least one zone is armed-away", "name": "isArmedAway", "signature": "def isArmedAway(zoneManager)" }, { "docstring": ":return: True if at least one zone is armed-stay", "name": "isArmedStay", "signature": "def isArmedStay(zoneManager)" } ]
2
stack_v2_sparse_classes_30k_train_000833
Implement the Python class `SecurityManager` described below. Class description: Provide quick access to the alarm partition of the zones. Method signatures and docstrings: - def isArmedAway(zoneManager): :return: True if at least one zone is armed-away - def isArmedStay(zoneManager): :return: True if at least one zo...
Implement the Python class `SecurityManager` described below. Class description: Provide quick access to the alarm partition of the zones. Method signatures and docstrings: - def isArmedAway(zoneManager): :return: True if at least one zone is armed-away - def isArmedStay(zoneManager): :return: True if at least one zo...
c64c9e109173277b6b4b2473adaac9d2da623cdb
<|skeleton|> class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" <|body_0|> def isArmedStay(zoneManager): """:return: True if at least one zone is armed-stay""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SecurityManager: """Provide quick access to the alarm partition of the zones.""" def isArmedAway(zoneManager): """:return: True if at least one zone is armed-away""" securityPartitions = zoneManager.getDevicesByType(AlarmPartition) if len(securityPartitions) > 0: if Al...
the_stack_v2_python_sparse
legacy-jython-code/aaa_modules/security_manager.py
yfaway/openhab-rules
train
10
2b5a9ccd91976fe2552abe89c222e3942f7b54e0
[ "try:\n cart = Cart.objects.get(created_by=request.user)\n serializer = CartItemSerializer(CartItem.objects.filter(cart=cart, purchased=False), many=True)\n return JsonResponse({'message': 'list of item in the cart', 'data': serializer.data}, status=200)\nexcept Exception as e:\n logger.error(e, exc_inf...
<|body_start_0|> try: cart = Cart.objects.get(created_by=request.user) serializer = CartItemSerializer(CartItem.objects.filter(cart=cart, purchased=False), many=True) return JsonResponse({'message': 'list of item in the cart', 'data': serializer.data}, status=200) exc...
AddToCartView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddToCartView: def get(self, request): """Get cart items""" <|body_0|> def post(self, request): """Add items to cart""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: cart = Cart.objects.get(created_by=request.user) serial...
stack_v2_sparse_classes_10k_train_002929
5,301
no_license
[ { "docstring": "Get cart items", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Add items to cart", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002596
Implement the Python class `AddToCartView` described below. Class description: Implement the AddToCartView class. Method signatures and docstrings: - def get(self, request): Get cart items - def post(self, request): Add items to cart
Implement the Python class `AddToCartView` described below. Class description: Implement the AddToCartView class. Method signatures and docstrings: - def get(self, request): Get cart items - def post(self, request): Add items to cart <|skeleton|> class AddToCartView: def get(self, request): """Get cart ...
367cccca72f0eae6c3ccb70fabb371dc905f915e
<|skeleton|> class AddToCartView: def get(self, request): """Get cart items""" <|body_0|> def post(self, request): """Add items to cart""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddToCartView: def get(self, request): """Get cart items""" try: cart = Cart.objects.get(created_by=request.user) serializer = CartItemSerializer(CartItem.objects.filter(cart=cart, purchased=False), many=True) return JsonResponse({'message': 'list of item in...
the_stack_v2_python_sparse
course/views/cart_view.py
vshaladhav97/first_kick
train
0
2dcfb82d0599322fff085ffb434c6808b8cc2af3
[ "self.feature_score = feature_score\nself.sampler_name = sampler_name\nself.regression_model = regression_model", "device = select_device()\nsample = []\nsorted_score = sorted(self.feature_score, key=itemgetter('score'), reverse=True)\ncnt = 0\ni = 0\nwhile cnt < n_sample:\n if sorted_score[i] not in already_s...
<|body_start_0|> self.feature_score = feature_score self.sampler_name = sampler_name self.regression_model = regression_model <|end_body_0|> <|body_start_1|> device = select_device() sample = [] sorted_score = sorted(self.feature_score, key=itemgetter('score'), reverse=T...
RegressionSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressionSampler: def __init__(self, sampler_name, regression_model, feature_score): """:param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': int, 'score':tensor}""" <|body_0|> def select_batch(self, n_sample, already_selected): ...
stack_v2_sparse_classes_10k_train_002930
1,977
permissive
[ { "docstring": ":param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': int, 'score':tensor}", "name": "__init__", "signature": "def __init__(self, sampler_name, regression_model, feature_score)" }, { "docstring": ":param feature_path: :param self: :param reg...
2
stack_v2_sparse_classes_30k_train_000263
Implement the Python class `RegressionSampler` described below. Class description: Implement the RegressionSampler class. Method signatures and docstrings: - def __init__(self, sampler_name, regression_model, feature_score): :param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': ...
Implement the Python class `RegressionSampler` described below. Class description: Implement the RegressionSampler class. Method signatures and docstrings: - def __init__(self, sampler_name, regression_model, feature_score): :param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': ...
bd75971b94f055fded6125c1d136b1ea188b75f0
<|skeleton|> class RegressionSampler: def __init__(self, sampler_name, regression_model, feature_score): """:param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': int, 'score':tensor}""" <|body_0|> def select_batch(self, n_sample, already_selected): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegressionSampler: def __init__(self, sampler_name, regression_model, feature_score): """:param sampler_name: :param regression_model: :param feature_score: :list[dict] {'image_id': int, 'score':tensor}""" self.feature_score = feature_score self.sampler_name = sampler_name self...
the_stack_v2_python_sparse
liuy/implementation/RegressorSampler.py
liuy-61/al_ins_seg
train
3
f1f2ab8a2dd361b8dd32ad5e25f9c3c0393a02d9
[ "if controller is not None:\n if not is_string(controller):\n raise ValueError('Controller name must be a string')\n controller = controller.strip()\n if not controller:\n _logger.warning('Empty controller name given')\n controller = None\n elif ' ' in controller:\n raise Val...
<|body_start_0|> if controller is not None: if not is_string(controller): raise ValueError('Controller name must be a string') controller = controller.strip() if not controller: _logger.warning('Empty controller name given') con...
@Provides decorator Defines an interface exported by a component.
Provides
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Provides: """@Provides decorator Defines an interface exported by a component.""" def __init__(self, specifications, controller=None): """Sets up a provided service. A service controller can be defined to enable or disable the service. :param specifications: A list of provided interf...
stack_v2_sparse_classes_10k_train_002931
41,418
permissive
[ { "docstring": "Sets up a provided service. A service controller can be defined to enable or disable the service. :param specifications: A list of provided interface(s) name(s) (can't be empty) :param controller: Name of the service controller class field (optional) :raise ValueError: If the specifications are ...
2
stack_v2_sparse_classes_30k_train_006627
Implement the Python class `Provides` described below. Class description: @Provides decorator Defines an interface exported by a component. Method signatures and docstrings: - def __init__(self, specifications, controller=None): Sets up a provided service. A service controller can be defined to enable or disable the ...
Implement the Python class `Provides` described below. Class description: @Provides decorator Defines an interface exported by a component. Method signatures and docstrings: - def __init__(self, specifications, controller=None): Sets up a provided service. A service controller can be defined to enable or disable the ...
686556cdde20beba77ae202de9969be46feed5e2
<|skeleton|> class Provides: """@Provides decorator Defines an interface exported by a component.""" def __init__(self, specifications, controller=None): """Sets up a provided service. A service controller can be defined to enable or disable the service. :param specifications: A list of provided interf...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Provides: """@Provides decorator Defines an interface exported by a component.""" def __init__(self, specifications, controller=None): """Sets up a provided service. A service controller can be defined to enable or disable the service. :param specifications: A list of provided interface(s) name(s...
the_stack_v2_python_sparse
python/src/lib/python/pelix/ipopo/decorators.py
cohorte/cohorte-runtime
train
3
300807ca340381ed02b2f1ca77674a4080ebac22
[ "if not head or not head.next:\n return head\nfast, slow = (head.next, head)\nwhile fast and fast.next:\n fast = fast.next.next\n slow = slow.next\nsecond = slow.next\nslow.next = None\nl = self.sortList(head)\nr = self.sortList(second)\nreturn self.merge(l, r)", "if not l or not r:\n return l or r\ni...
<|body_start_0|> if not head or not head.next: return head fast, slow = (head.next, head) while fast and fast.next: fast = fast.next.next slow = slow.next second = slow.next slow.next = None l = self.sortList(head) r = self.sort...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def merge(self, l, r): """:type l: ListNode :type r: ListNode :rtype: ListNode""" <|body_1|> def sortList_1(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_10k_train_002932
4,222
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "sortList", "signature": "def sortList(self, head)" }, { "docstring": ":type l: ListNode :type r: ListNode :rtype: ListNode", "name": "merge", "signature": "def merge(self, l, r)" }, { "docstring": ":type head: ListN...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def merge(self, l, r): :type l: ListNode :type r: ListNode :rtype: ListNode - def sortList_1(self, head): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def merge(self, l, r): :type l: ListNode :type r: ListNode :rtype: ListNode - def sortList_1(self, head): :type ...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def merge(self, l, r): """:type l: ListNode :type r: ListNode :rtype: ListNode""" <|body_1|> def sortList_1(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" if not head or not head.next: return head fast, slow = (head.next, head) while fast and fast.next: fast = fast.next.next slow = slow.next second = slow.ne...
the_stack_v2_python_sparse
Solutions/0148_sortList.py
YoupengLi/leetcode-sorting
train
3
54b7e8e44014323b74024b48a00592d00bffc4e8
[ "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...
Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs.
JobServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobServiceServicer: """Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs.""" def CreateJob(self, request,...
stack_v2_sparse_classes_10k_train_002933
4,689
no_license
[ { "docstring": "Creates a training or a batch prediction job.", "name": "CreateJob", "signature": "def CreateJob(self, request, context)" }, { "docstring": "Lists the jobs in the project.", "name": "ListJobs", "signature": "def ListJobs(self, request, context)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_001783
Implement the Python class `JobServiceServicer` described below. Class description: Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction job...
Implement the Python class `JobServiceServicer` described below. Class description: Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction job...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class JobServiceServicer: """Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs.""" def CreateJob(self, request,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JobServiceServicer: """Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs.""" def CreateJob(self, request, context): ...
the_stack_v2_python_sparse
google/cloud/ml/v1/job_service_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
4505e5d322791156ea24b49dfa24d5e501d3c43a
[ "my_dict = defaultdict(list)\nfor index, num in enumerate(nums):\n if my_dict[num] and index - my_dict[num][-1] <= k:\n return True\n my_dict[num].append(index)\nreturn False", "my_dict = {}\nfor index, num in enumerate(nums):\n if num in my_dict and index - my_dict[num] <= k:\n return True...
<|body_start_0|> my_dict = defaultdict(list) for index, num in enumerate(nums): if my_dict[num] and index - my_dict[num][-1] <= k: return True my_dict[num].append(index) return False <|end_body_0|> <|body_start_1|> my_dict = {} for index, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_10k_train_002934
813
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def containsNearbyDuplicate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate2", "signature": "def contai...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate2(self, nums, k): :type nums: List[int] :type k: int :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate2(self, nums, k): :type nums: List[int] :type k: int :rty...
cefa2f08667de4d2973274de3ff29a31a7d25eda
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" my_dict = defaultdict(list) for index, num in enumerate(nums): if my_dict[num] and index - my_dict[num][-1] <= k: return True my_dict[num]...
the_stack_v2_python_sparse
219/Solution.py
zhangruochi/leetcode
train
14
008fd01e24115e77b6f93e255232261e66da16cf
[ "super().__init__()\nassert kernel_size % 2 == 1, 'Kernel size must be odd number.'\nassert len(upsample_scales) == len(upsample_kernel_sizes)\nassert len(resblock_dilations) == len(resblock_kernel_sizes)\nself.num_upsamples = len(upsample_kernel_sizes)\nself.num_blocks = len(resblock_kernel_sizes)\nself.input_conv...
<|body_start_0|> super().__init__() assert kernel_size % 2 == 1, 'Kernel size must be odd number.' assert len(upsample_scales) == len(upsample_kernel_sizes) assert len(resblock_dilations) == len(resblock_kernel_sizes) self.num_upsamples = len(upsample_kernel_sizes) self.n...
Avocodo generator module.
AvocodoGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AvocodoGenerator: """Avocodo generator module.""" def __init__(self, in_channels: int=80, out_channels: int=1, channels: int=512, global_channels: int=-1, kernel_size: int=7, upsample_scales: List[int]=[8, 8, 2, 2], upsample_kernel_sizes: List[int]=[16, 16, 4, 4], resblock_kernel_sizes: List...
stack_v2_sparse_classes_10k_train_002935
29,046
permissive
[ { "docstring": "Initialize AvocodoGenerator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. channels (int): Number of hidden representation channels. global_channels (int): Number of global conditioning channels. kernel_size (int): Kernel size of initial...
5
null
Implement the Python class `AvocodoGenerator` described below. Class description: Avocodo generator module. Method signatures and docstrings: - def __init__(self, in_channels: int=80, out_channels: int=1, channels: int=512, global_channels: int=-1, kernel_size: int=7, upsample_scales: List[int]=[8, 8, 2, 2], upsample...
Implement the Python class `AvocodoGenerator` described below. Class description: Avocodo generator module. Method signatures and docstrings: - def __init__(self, in_channels: int=80, out_channels: int=1, channels: int=512, global_channels: int=-1, kernel_size: int=7, upsample_scales: List[int]=[8, 8, 2, 2], upsample...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class AvocodoGenerator: """Avocodo generator module.""" def __init__(self, in_channels: int=80, out_channels: int=1, channels: int=512, global_channels: int=-1, kernel_size: int=7, upsample_scales: List[int]=[8, 8, 2, 2], upsample_kernel_sizes: List[int]=[16, 16, 4, 4], resblock_kernel_sizes: List...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AvocodoGenerator: """Avocodo generator module.""" def __init__(self, in_channels: int=80, out_channels: int=1, channels: int=512, global_channels: int=-1, kernel_size: int=7, upsample_scales: List[int]=[8, 8, 2, 2], upsample_kernel_sizes: List[int]=[16, 16, 4, 4], resblock_kernel_sizes: List[int]=[3, 7, ...
the_stack_v2_python_sparse
espnet2/gan_svs/avocodo/avocodo.py
espnet/espnet
train
7,242
64afc0a3d40b5cfa056454125a537b828f83d3c2
[ "if value == '':\n raise ValueError(\"value can't be an empty string\")\nreturn value", "if not validate_isbn_digit(value):\n raise ValueError('value is not a valid ISBN')\nreturn value", "if value < 1:\n raise ValueError(\"number of pages can't be 0 or less\")\nreturn value" ]
<|body_start_0|> if value == '': raise ValueError("value can't be an empty string") return value <|end_body_0|> <|body_start_1|> if not validate_isbn_digit(value): raise ValueError('value is not a valid ISBN') return value <|end_body_1|> <|body_start_2|> ...
Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.
BookV2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookV2: """Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.""" def validate_not_empty(cls, value: str, **kwargs) -> str: """Verifica se os campos informados não estão vazios.""" <|body_0|> def validate_isbn(cls, val...
stack_v2_sparse_classes_10k_train_002936
2,791
no_license
[ { "docstring": "Verifica se os campos informados não estão vazios.", "name": "validate_not_empty", "signature": "def validate_not_empty(cls, value: str, **kwargs) -> str" }, { "docstring": "Verifica se o ISBN informado é válido.", "name": "validate_isbn", "signature": "def validate_isbn(...
3
stack_v2_sparse_classes_30k_train_003780
Implement the Python class `BookV2` described below. Class description: Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos. Method signatures and docstrings: - def validate_not_empty(cls, value: str, **kwargs) -> str: Verifica se os campos informados não estão vazi...
Implement the Python class `BookV2` described below. Class description: Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos. Method signatures and docstrings: - def validate_not_empty(cls, value: str, **kwargs) -> str: Verifica se os campos informados não estão vazi...
11d8391f0db79331892884a391750810399a3c45
<|skeleton|> class BookV2: """Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.""" def validate_not_empty(cls, value: str, **kwargs) -> str: """Verifica se os campos informados não estão vazios.""" <|body_0|> def validate_isbn(cls, val...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BookV2: """Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.""" def validate_not_empty(cls, value: str, **kwargs) -> str: """Verifica se os campos informados não estão vazios.""" if value == '': raise ValueError("value can...
the_stack_v2_python_sparse
usando-o-pydantic/books/models.py
plainspooky/giovannireisnunes
train
11
c506c4115e9a29e10e005c12702987e735f96f3d
[ "if digits[-1] < 9:\n digits[-1] += 1\n return digits\nelse:\n str_s = str()\n result = []\n for i in range(len(digits)):\n str_s += str(digits[i])\n for i in str(int(str_s) + 1):\n result.append(int(i))\n return result", "index = len(digits)\nif index == 0:\n return digits\n...
<|body_start_0|> if digits[-1] < 9: digits[-1] += 1 return digits else: str_s = str() result = [] for i in range(len(digits)): str_s += str(digits[i]) for i in str(int(str_s) + 1): result.append(int(i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne1(self, digits: List[int]) -> List[int]: """执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return:""" <|body_0|> def plusOne(self, digits: List[int]) -> List[int]: """执行用时: 24 ms , 在所有 Py...
stack_v2_sparse_classes_10k_train_002937
2,456
no_license
[ { "docstring": "执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return:", "name": "plusOne1", "signature": "def plusOne1(self, digits: List[int]) -> List[int]" }, { "docstring": "执行用时: 24 ms , 在所有 Python3 提交中击败了 99.67% 的用户 内存消耗: 14.7 MB ,...
3
stack_v2_sparse_classes_30k_train_000984
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne1(self, digits: List[int]) -> List[int]: 执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return: - def plusOn...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne1(self, digits: List[int]) -> List[int]: 执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return: - def plusOn...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def plusOne1(self, digits: List[int]) -> List[int]: """执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return:""" <|body_0|> def plusOne(self, digits: List[int]) -> List[int]: """执行用时: 24 ms , 在所有 Py...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne1(self, digits: List[int]) -> List[int]: """执行用时: 40 ms , 在所有 Python3 提交中击败了 57.89% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 21.62% 的用户 :param digits: :return:""" if digits[-1] < 9: digits[-1] += 1 return digits else: str_s = str()...
the_stack_v2_python_sparse
plus_one.py
nomboy/leetcode
train
0
c1fb96d281ff340126642b38e421cb45381803dd
[ "config = current_app.cea_config\ndashboards = cea.plots.read_dashboards(config, current_app.plot_cache)\nreturn dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index]", "form = api.payload\nconfig = current_app.cea_config\ntemp_config = cea.config.Configuration()\ndashboards = cea.plots.read_dashboa...
<|body_start_0|> config = current_app.cea_config dashboards = cea.plots.read_dashboards(config, current_app.plot_cache) return dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index] <|end_body_0|> <|body_start_1|> form = api.payload config = current_app.cea_config ...
DashboardPlot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashboardPlot: def get(self, dashboard_index, plot_index): """Get Dashboard Plot""" <|body_0|> def put(self, dashboard_index, plot_index): """Create/Replace a new Plot at specified index""" <|body_1|> def delete(self, dashboard_index, plot_index): ...
stack_v2_sparse_classes_10k_train_002938
9,106
permissive
[ { "docstring": "Get Dashboard Plot", "name": "get", "signature": "def get(self, dashboard_index, plot_index)" }, { "docstring": "Create/Replace a new Plot at specified index", "name": "put", "signature": "def put(self, dashboard_index, plot_index)" }, { "docstring": "Delete Plot ...
3
null
Implement the Python class `DashboardPlot` described below. Class description: Implement the DashboardPlot class. Method signatures and docstrings: - def get(self, dashboard_index, plot_index): Get Dashboard Plot - def put(self, dashboard_index, plot_index): Create/Replace a new Plot at specified index - def delete(s...
Implement the Python class `DashboardPlot` described below. Class description: Implement the DashboardPlot class. Method signatures and docstrings: - def get(self, dashboard_index, plot_index): Get Dashboard Plot - def put(self, dashboard_index, plot_index): Create/Replace a new Plot at specified index - def delete(s...
b84bcefdfdfc2bc0e009b5284b74391a957995ac
<|skeleton|> class DashboardPlot: def get(self, dashboard_index, plot_index): """Get Dashboard Plot""" <|body_0|> def put(self, dashboard_index, plot_index): """Create/Replace a new Plot at specified index""" <|body_1|> def delete(self, dashboard_index, plot_index): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DashboardPlot: def get(self, dashboard_index, plot_index): """Get Dashboard Plot""" config = current_app.cea_config dashboards = cea.plots.read_dashboards(config, current_app.plot_cache) return dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index] def put(sel...
the_stack_v2_python_sparse
cea/interfaces/dashboard/api/dashboard.py
architecture-building-systems/CityEnergyAnalyst
train
166
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car'))\nnew_spec.save()\nreturn new_spec", "instance.key = validated_data.get('key', instance.key)\ninstance.value = validated_data.get('value', instance.val...
<|body_start_0|> new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car')) new_spec.save() return new_spec <|end_body_0|> <|body_start_1|> instance.key = validated_data.get('key', in...
SpecificationSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Specification` instance""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_002939
6,342
no_license
[ { "docstring": "create and return new 'Specification' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `Specification` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_006555
Implement the Python class `SpecificationSerializer` described below. Class description: Implement the SpecificationSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Specification' instance - def update(self, instance, validated_data): Update and return an ...
Implement the Python class `SpecificationSerializer` described below. Class description: Implement the SpecificationSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Specification' instance - def update(self, instance, validated_data): Update and return an ...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Specification` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpecificationSerializer: def create(self, validated_data): """create and return new 'Specification' instance""" new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car')) new_spec.sa...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
91442f6d224b496bd35061a83b4e0e9c7d1a677b
[ "self.nums = nums\nself.cacheId = None\nself.candidates = []", "if self.cacheId != target:\n self.cacheId = target\n self.candidates[:] = []\n for index, i in enumerate(self.nums):\n if i == target:\n self.candidates.append(index)\nreturn self.candidates[random.randint(0, len(self.candi...
<|body_start_0|> self.nums = nums self.cacheId = None self.candidates = [] <|end_body_0|> <|body_start_1|> if self.cacheId != target: self.cacheId = target self.candidates[:] = [] for index, i in enumerate(self.nums): if i == target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums = nums self.cacheId = None ...
stack_v2_sparse_classes_10k_train_002940
800
no_license
[ { "docstring": ":type nums: List[int] :type numsSize: int", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type target: int :rtype: int", "name": "pick", "signature": "def pick(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_001492
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int <|skeleton|> class Solution: def __init__(self, ...
01498cd07e552d8ddf7b7fb7f8b8c71f303a4a87
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" self.nums = nums self.cacheId = None self.candidates = [] def pick(self, target): """:type target: int :rtype: int""" if self.cacheId != target: self.cacheId = t...
the_stack_v2_python_sparse
leetcode/398. Random Pick Index/398._Random_Pick_Index_2.py
tyge318/tyge318.github.io
train
1
b38989d148a7bdbe085c2511acd1689c1b1fa96c
[ "if minfo is None:\n minfo = {}\nsuper(ResetPeerStatsMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.PeerIDList = minfo.get('PeerIDList', [])\nself.MetricList = minfo.get('MetricList', [])", "result = super(ResetPeerStatsMessage, self).dump()\nr...
<|body_start_0|> if minfo is None: minfo = {} super(ResetPeerStatsMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.PeerIDList = minfo.get('PeerIDList', []) self.MetricList = minfo.get('Metric...
Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules....
ResetPeerStatsMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetPeerStatsMessage: """Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. Syst...
stack_v2_sparse_classes_10k_train_002941
13,482
permissive
[ { "docstring": "Constructor for the ResetPeerStatsMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attri...
2
stack_v2_sparse_classes_30k_train_006053
Implement the Python class `ResetPeerStatsMessage` described below. Class description: Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whethe...
Implement the Python class `ResetPeerStatsMessage` described below. Class description: Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whethe...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class ResetPeerStatsMessage: """Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. Syst...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResetPeerStatsMessage: """Reset peer stats messages are sent to a peer node to request it to reset statistics about specified peer connections. Attributes: ResetPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages h...
the_stack_v2_python_sparse
validator/gossip/messages/gossip_debug.py
aludvik/sawtooth-core
train
0
114a26f379a54a0ca74551d5906e6c0040134bfb
[ "super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.reduction = reduction\nself.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob, attention=False, attention_type=attention_type...
<|body_start_0|> super().__init__() self.in_chans = in_chans self.out_chans = out_chans self.chans = chans self.num_pool_layers = num_pool_layers self.drop_prob = drop_prob self.reduction = reduction self.down_sample_layers = nn.ModuleList([ConvBlock(in_ch...
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
CSEUnetModelTakeLatentDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSEUnetModelTakeLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi...
stack_v2_sparse_classes_10k_train_002942
10,589
no_license
[ { "docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ...
2
stack_v2_sparse_classes_30k_val_000049
Implement the Python class `CSEUnetModelTakeLatentDecoder` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com...
Implement the Python class `CSEUnetModelTakeLatentDecoder` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com...
219652c8a08c4f2f682acd9f95a4e1b3fd36b70b
<|skeleton|> class CSEUnetModelTakeLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CSEUnetModelTakeLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234...
the_stack_v2_python_sparse
lemawarersn_unet_conv_redundancy_removed_relu/chattn.py
Bala93/Holistic-MRI-Reconstruction
train
1
99090aa4fad4c9ba36cc4895c2779a3f4498a7c4
[ "user = getattr(request._request, 'user', None)\nif not user or not user.is_active:\n return None\nself.enforce_csrf(request)\nreturn (user, None)", "reason = CSRFCheck().process_view(request, None, (), {})\nif reason:\n raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)" ]
<|body_start_0|> user = getattr(request._request, 'user', None) if not user or not user.is_active: return None self.enforce_csrf(request) return (user, None) <|end_body_0|> <|body_start_1|> reason = CSRFCheck().process_view(request, None, (), {}) if reason: ...
Use Django's session framework for authentication.
SessionAuthentication
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_csrf(self, request): ""...
stack_v2_sparse_classes_10k_train_002943
8,216
permissive
[ { "docstring": "Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Enforce CSRF validation for session based authentication.", "name": "enforce_csrf", ...
2
stack_v2_sparse_classes_30k_train_000245
Implement the Python class `SessionAuthentication` described below. Class description: Use Django's session framework for authentication. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`. - def enforce...
Implement the Python class `SessionAuthentication` described below. Class description: Use Django's session framework for authentication. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`. - def enforce...
7e3dedddbe821283d909393f333eed4acd452953
<|skeleton|> class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_csrf(self, request): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" user = getattr(request._request, 'user', None) if not user or no...
the_stack_v2_python_sparse
api/authentication.py
erigones/esdc-ce
train
123
5a33546340dfb068cef5289b43b5decb19e22a92
[ "left = 0\nright = len(height) - 1\nleft_max = right_max = water = 0\nwhile left < right:\n if height[left] <= height[right]:\n if height[left] >= left_max:\n left_max = height[left]\n else:\n water += left_max - height[left]\n left += 1\n else:\n if height[ri...
<|body_start_0|> left = 0 right = len(height) - 1 left_max = right_max = water = 0 while left < right: if height[left] <= height[right]: if height[left] >= left_max: left_max = height[left] else: water +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 用两个指针来做""" <|body_0|> def trap1(self, height): """动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定...
stack_v2_sparse_classes_10k_train_002944
1,983
no_license
[ { "docstring": ":type height: List[int] :rtype: int 用两个指针来做", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": "动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定是左边做大元素和右边最大元素较小的...
2
stack_v2_sparse_classes_30k_train_006714
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 用两个指针来做 - def trap1(self, height): 动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 用两个指针来做 - def trap1(self, height): 动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i...
11ad9d3841de09c0b4dc3a667e7e63c3558656a5
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 用两个指针来做""" <|body_0|> def trap1(self, height): """动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int 用两个指针来做""" left = 0 right = len(height) - 1 left_max = right_max = water = 0 while left < right: if height[left] <= height[right]: if height[left] >= left_max: ...
the_stack_v2_python_sparse
trapping-rain-water.py
ganlanshu/leetcode
train
0
6085c3fc8b08f9cc24ecae36b7d32f8b26182e3c
[ "roman_symbols = ['M', 'D', 'C', 'L', 'X', 'V', 'I']\nnumbers = [1000, 500, 100, 50, 10, 5, 1]\nroman = []\nfor idx, n in enumerate(numbers):\n i, num = (num / n, num % n)\n if i > 3:\n last = roman.pop()\n if last == '':\n li = [roman_symbols[idx], roman_symbols[idx - 1]]\n el...
<|body_start_0|> roman_symbols = ['M', 'D', 'C', 'L', 'X', 'V', 'I'] numbers = [1000, 500, 100, 50, 10, 5, 1] roman = [] for idx, n in enumerate(numbers): i, num = (num / n, num % n) if i > 3: last = roman.pop() if last == '': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intToRoman(self, num): """http://en.wikipedia.org/wiki/Roman_numerals""" <|body_0|> def intToRoman2(self, num): """little bit improvement""" <|body_1|> def intToRoman3(self, num): """recursive version""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_10k_train_002945
2,501
no_license
[ { "docstring": "http://en.wikipedia.org/wiki/Roman_numerals", "name": "intToRoman", "signature": "def intToRoman(self, num)" }, { "docstring": "little bit improvement", "name": "intToRoman2", "signature": "def intToRoman2(self, num)" }, { "docstring": "recursive version", "na...
3
stack_v2_sparse_classes_30k_train_002318
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intToRoman(self, num): http://en.wikipedia.org/wiki/Roman_numerals - def intToRoman2(self, num): little bit improvement - def intToRoman3(self, num): recursive version
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intToRoman(self, num): http://en.wikipedia.org/wiki/Roman_numerals - def intToRoman2(self, num): little bit improvement - def intToRoman3(self, num): recursive version <|ske...
c10ed7710cfbb74fd068e5c5d05d45564ad22194
<|skeleton|> class Solution: def intToRoman(self, num): """http://en.wikipedia.org/wiki/Roman_numerals""" <|body_0|> def intToRoman2(self, num): """little bit improvement""" <|body_1|> def intToRoman3(self, num): """recursive version""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def intToRoman(self, num): """http://en.wikipedia.org/wiki/Roman_numerals""" roman_symbols = ['M', 'D', 'C', 'L', 'X', 'V', 'I'] numbers = [1000, 500, 100, 50, 10, 5, 1] roman = [] for idx, n in enumerate(numbers): i, num = (num / n, num % n) ...
the_stack_v2_python_sparse
leetcode/python/integer-to-roman.py
deepgully/codes
train
1
36ebfbd99598734f82e688a20403ec0c57c577b6
[ "self.generic_visit(node)\nis_multiple = len(node.targets) > 1\nis_compound = any(map(is_sequence_node, node.targets))\nis_simple = not is_compound\nif is_simple and is_multiple:\n return self.visit_simple_assign(node)\nelif is_compound and (is_multiple or is_sequence_node(node.value)):\n return self.visit_co...
<|body_start_0|> self.generic_visit(node) is_multiple = len(node.targets) > 1 is_compound = any(map(is_sequence_node, node.targets)) is_simple = not is_compound if is_simple and is_multiple: return self.visit_simple_assign(node) elif is_compound and (is_multip...
Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expressions.html#evaluation-order This normalization is ...
EliminateMultipleTargets
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expr...
stack_v2_sparse_classes_10k_train_002946
15,969
permissive
[ { "docstring": "Replace multiple assignment with single assignments.", "name": "visit_Assign", "signature": "def visit_Assign(self, node)" }, { "docstring": "Visit assignment node whose targets are all simple.", "name": "visit_simple_assign", "signature": "def visit_simple_assign(self, n...
4
stack_v2_sparse_classes_30k_train_005125
Implement the Python class `EliminateMultipleTargets` described below. Class description: Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: h...
Implement the Python class `EliminateMultipleTargets` described below. Class description: Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: h...
a6097d36c8863925c774f04155e2af6cc8cb3859
<|skeleton|> class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expressions.html#...
the_stack_v2_python_sparse
flowgraph/trace/ast_transform.py
epatters/pyflowgraph
train
2
f79227895895befb9d6477caac884e53171e7c28
[ "super().__init__(parent, Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)\nself.question = str(question)\nself.style = style\nself.initUi()", "self.questionLabel = QLabel(self.question)\nself.questionLabel.setWordWrap(True)\nstyleBtn = '\\n QPushButton {\\n font-family: Asap;\\n fon...
<|body_start_0|> super().__init__(parent, Qt.FramelessWindowHint | Qt.WindowSystemMenuHint) self.question = str(question) self.style = style self.initUi() <|end_body_0|> <|body_start_1|> self.questionLabel = QLabel(self.question) self.questionLabel.setWordWrap(True) ...
Dialog to ask a question.
QuestionDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionDialog: """Dialog to ask a question.""" def __init__(self, parent, question, style=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> def paintEvent(self, event): """Set window background color.""" <|bo...
stack_v2_sparse_classes_10k_train_002947
27,111
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, parent, question, style=None)" }, { "docstring": "Ui Setup.", "name": "initUi", "signature": "def initUi(self)" }, { "docstring": "Set window background color.", "name": "paintEvent", "signature"...
3
stack_v2_sparse_classes_30k_train_002516
Implement the Python class `QuestionDialog` described below. Class description: Dialog to ask a question. Method signatures and docstrings: - def __init__(self, parent, question, style=None): Init. - def initUi(self): Ui Setup. - def paintEvent(self, event): Set window background color.
Implement the Python class `QuestionDialog` described below. Class description: Dialog to ask a question. Method signatures and docstrings: - def __init__(self, parent, question, style=None): Init. - def initUi(self): Ui Setup. - def paintEvent(self, event): Set window background color. <|skeleton|> class QuestionDi...
a5d18593e689123cac34af552628ed2818ca5d59
<|skeleton|> class QuestionDialog: """Dialog to ask a question.""" def __init__(self, parent, question, style=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> def paintEvent(self, event): """Set window background color.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionDialog: """Dialog to ask a question.""" def __init__(self, parent, question, style=None): """Init.""" super().__init__(parent, Qt.FramelessWindowHint | Qt.WindowSystemMenuHint) self.question = str(question) self.style = style self.initUi() def initUi(s...
the_stack_v2_python_sparse
Dialogs.py
edgary777/lonchepos
train
0
54f88c0e4b171c1d19d72011ea4e774ab71db650
[ "if values['mode'] == 'master':\n values['puppet_server'] = ''\n values['puppet_port'] = ''\n values['puppet_log'] = ''\n values['puppet_extra_opts'] = ''\n if 'puppetmaster_ports' in values:\n values['puppetmaster_ports'] = re.split('[ ,]+', values['puppetmaster_ports'])\nelse:\n values['p...
<|body_start_0|> if values['mode'] == 'master': values['puppet_server'] = '' values['puppet_port'] = '' values['puppet_log'] = '' values['puppet_extra_opts'] = '' if 'puppetmaster_ports' in values: values['puppetmaster_ports'] = re.spli...
Puppet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Puppet: def renderContext(self, values): """Validate values""" <|body_0|> def renderContextVariable(self, variable, value): """Final transformations on the variables""" <|body_1|> <|end_skeleton|> <|body_start_0|> if values['mode'] == 'master': ...
stack_v2_sparse_classes_10k_train_002948
2,044
no_license
[ { "docstring": "Validate values", "name": "renderContext", "signature": "def renderContext(self, values)" }, { "docstring": "Final transformations on the variables", "name": "renderContextVariable", "signature": "def renderContextVariable(self, variable, value)" } ]
2
stack_v2_sparse_classes_30k_train_003810
Implement the Python class `Puppet` described below. Class description: Implement the Puppet class. Method signatures and docstrings: - def renderContext(self, values): Validate values - def renderContextVariable(self, variable, value): Final transformations on the variables
Implement the Python class `Puppet` described below. Class description: Implement the Puppet class. Method signatures and docstrings: - def renderContext(self, values): Validate values - def renderContextVariable(self, variable, value): Final transformations on the variables <|skeleton|> class Puppet: def rende...
aacb83e9656b73edd1cac71dfcad4890a9bcc669
<|skeleton|> class Puppet: def renderContext(self, values): """Validate values""" <|body_0|> def renderContextVariable(self, variable, value): """Final transformations on the variables""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Puppet: def renderContext(self, values): """Validate values""" if values['mode'] == 'master': values['puppet_server'] = '' values['puppet_port'] = '' values['puppet_log'] = '' values['puppet_extra_opts'] = '' if 'puppetmaster_ports' i...
the_stack_v2_python_sparse
src/cvmo/core/plugin/puppet.py
cernvm/cernvm-online
train
1
8f02b1a1282199fd012756dfbc111afa1a50d0cb
[ "number = self.validate_number(number)\nif number == 1:\n bottom = 0\n top = self.per_page - self.delta\nelse:\n bottom = (number - 1) * self.per_page - self.delta\n top = bottom + self.per_page\nif top + self.orphans >= self.count:\n top = self.count\nreturn Page(self.object_list[bottom:top], number...
<|body_start_0|> number = self.validate_number(number) if number == 1: bottom = 0 top = self.per_page - self.delta else: bottom = (number - 1) * self.per_page - self.delta top = bottom + self.per_page if top + self.orphans >= self.count: ...
DeltaFirstPagePaginator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeltaFirstPagePaginator: def page(self, number): """Returns first page with `per_page` - `delta` entries.""" <|body_0|> def num_pages(self): """Return the total number of pages. Add delta elements to the count to get all pages.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_10k_train_002949
1,054
no_license
[ { "docstring": "Returns first page with `per_page` - `delta` entries.", "name": "page", "signature": "def page(self, number)" }, { "docstring": "Return the total number of pages. Add delta elements to the count to get all pages.", "name": "num_pages", "signature": "def num_pages(self)" ...
2
stack_v2_sparse_classes_30k_test_000318
Implement the Python class `DeltaFirstPagePaginator` described below. Class description: Implement the DeltaFirstPagePaginator class. Method signatures and docstrings: - def page(self, number): Returns first page with `per_page` - `delta` entries. - def num_pages(self): Return the total number of pages. Add delta ele...
Implement the Python class `DeltaFirstPagePaginator` described below. Class description: Implement the DeltaFirstPagePaginator class. Method signatures and docstrings: - def page(self, number): Returns first page with `per_page` - `delta` entries. - def num_pages(self): Return the total number of pages. Add delta ele...
e1a019c8fdf5c9ff6a384a45b56bffef128b78c1
<|skeleton|> class DeltaFirstPagePaginator: def page(self, number): """Returns first page with `per_page` - `delta` entries.""" <|body_0|> def num_pages(self): """Return the total number of pages. Add delta elements to the count to get all pages.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeltaFirstPagePaginator: def page(self, number): """Returns first page with `per_page` - `delta` entries.""" number = self.validate_number(number) if number == 1: bottom = 0 top = self.per_page - self.delta else: bottom = (number - 1) * self....
the_stack_v2_python_sparse
apps/ideas/paginators.py
liqd/a4-advocate-europe
train
8
00dae8042704e80640a7e55b555150b0f19433fc
[ "pt_r = np.array([[-1, -3], [0, -2]])\npt_r -= pt_r.min()\npt_c = pt_r.T\npt = np.stack((pt_r, pt_c), axis=0).astype(float)\npt /= pt.max()\ngame = MatrixGame(pt, seed=0)\nsolver = qre_anneal_sym.Solver(temperature=100, proj_grad=False, euclidean=True, lrs=(0.0001, 0.0001), exp_thresh=0.01, rnd_init=True, seed=0)\n...
<|body_start_0|> pt_r = np.array([[-1, -3], [0, -2]]) pt_r -= pt_r.min() pt_c = pt_r.T pt = np.stack((pt_r, pt_c), axis=0).astype(float) pt /= pt.max() game = MatrixGame(pt, seed=0) solver = qre_anneal_sym.Solver(temperature=100, proj_grad=False, euclidean=True, l...
AdidasTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdidasTest: def test_adidas_on_prisoners_dilemma(self): """Tests ADIDAS on a 2-player prisoner's dilemma game.""" <|body_0|> def test_adidas_on_elfarol(self): """Test ADIDAS on a 10-player, symmetric El Farol bar game.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_002950
3,284
permissive
[ { "docstring": "Tests ADIDAS on a 2-player prisoner's dilemma game.", "name": "test_adidas_on_prisoners_dilemma", "signature": "def test_adidas_on_prisoners_dilemma(self)" }, { "docstring": "Test ADIDAS on a 10-player, symmetric El Farol bar game.", "name": "test_adidas_on_elfarol", "sig...
2
stack_v2_sparse_classes_30k_train_001097
Implement the Python class `AdidasTest` described below. Class description: Implement the AdidasTest class. Method signatures and docstrings: - def test_adidas_on_prisoners_dilemma(self): Tests ADIDAS on a 2-player prisoner's dilemma game. - def test_adidas_on_elfarol(self): Test ADIDAS on a 10-player, symmetric El F...
Implement the Python class `AdidasTest` described below. Class description: Implement the AdidasTest class. Method signatures and docstrings: - def test_adidas_on_prisoners_dilemma(self): Tests ADIDAS on a 2-player prisoner's dilemma game. - def test_adidas_on_elfarol(self): Test ADIDAS on a 10-player, symmetric El F...
ee149736f7d85e16c119a463eee338c6d4c2ceb0
<|skeleton|> class AdidasTest: def test_adidas_on_prisoners_dilemma(self): """Tests ADIDAS on a 2-player prisoner's dilemma game.""" <|body_0|> def test_adidas_on_elfarol(self): """Test ADIDAS on a 10-player, symmetric El Farol bar game.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdidasTest: def test_adidas_on_prisoners_dilemma(self): """Tests ADIDAS on a 2-player prisoner's dilemma game.""" pt_r = np.array([[-1, -3], [0, -2]]) pt_r -= pt_r.min() pt_c = pt_r.T pt = np.stack((pt_r, pt_c), axis=0).astype(float) pt /= pt.max() game ...
the_stack_v2_python_sparse
open_spiel/python/algorithms/adidas_test.py
lanctot/open_spiel
train
1
bfad6bfbc02b9bcd2423361806c38537356f56d4
[ "def merge_sort(nums, nums_copy, start, end):\n if start >= end:\n return\n start1 = start\n end1 = (start + end) // 2\n start2 = end1 + 1\n end2 = end\n merge_sort(nums, nums_copy, start1, end1)\n merge_sort(nums, nums_copy, start2, end2)\n k = start\n while start1 <= end1 and sta...
<|body_start_0|> def merge_sort(nums, nums_copy, start, end): if start >= end: return start1 = start end1 = (start + end) // 2 start2 = end1 + 1 end2 = end merge_sort(nums, nums_copy, start1, end1) merge_sort(num...
执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间""" def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors2(self, nums): ...
stack_v2_sparse_classes_10k_train_002951
3,257
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors", "signature": "def sortColors(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors2", "signature": "def sortColors2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004365
Implement the Python class `Solution` described below. Class description: 执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间 Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead....
Implement the Python class `Solution` described below. Class description: 执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间 Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead....
af4b922484879365921fa4252edf57fe19e53e6a
<|skeleton|> class Solution: """执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间""" def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors2(self, nums): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """执行结果:通过 执行用时:48 ms, 在所有 Python3 提交中击败了15.36%的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了8.49%的用户 自己写的归并排序,有点慢!!! 归并排序的缺点,需要使用O(N)的额外数组空间""" def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" def merge_sort(nums, nums_copy, start, end): i...
the_stack_v2_python_sparse
LeetCode/leetcode#075.py
wsldwo/Python
train
0
dfb6dffb0f177d15b329a7ec41cdbdf6521be772
[ "try:\n serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True)\n return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)\nexcept Exception as e:\n info_message = 'Internal Server Error'\n logger.error(info_message, e)\n return JsonR...
<|body_start_0|> try: serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exception as e: info_message = 'Internal Server Error' ...
RadiologistReportFilesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadiologistReportFilesView: def get(self, request): """Get all sellers""" <|body_0|> def post(self, request): """Save seller data""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: serializer = RadiologistReportFilesSerializers(Radiolo...
stack_v2_sparse_classes_10k_train_002952
31,833
no_license
[ { "docstring": "Get all sellers", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Save seller data", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_006608
Implement the Python class `RadiologistReportFilesView` described below. Class description: Implement the RadiologistReportFilesView class. Method signatures and docstrings: - def get(self, request): Get all sellers - def post(self, request): Save seller data
Implement the Python class `RadiologistReportFilesView` described below. Class description: Implement the RadiologistReportFilesView class. Method signatures and docstrings: - def get(self, request): Get all sellers - def post(self, request): Save seller data <|skeleton|> class RadiologistReportFilesView: def g...
b63849983a592fd6a1f654191020fd86aa0787ae
<|skeleton|> class RadiologistReportFilesView: def get(self, request): """Get all sellers""" <|body_0|> def post(self, request): """Save seller data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RadiologistReportFilesView: def get(self, request): """Get all sellers""" try: serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) exc...
the_stack_v2_python_sparse
radiologist/views.py
RupeshKurlekar/biocare
train
1
e87a8683d4300f34018575e8d42abaf0fb780b5c
[ "self._model = model\nself.path = path\nself.external_data_path = external_data_path\nself.size_threshold = size_threshold\nself.all_tensors_to_one_file = all_tensors_to_one_file", "model, _ = util.invoke_if_callable(self._model)\nG_LOGGER.info(f'Saving ONNX model to: {self.path}')\nif self.external_data_path is ...
<|body_start_0|> self._model = model self.path = path self.external_data_path = external_data_path self.size_threshold = size_threshold self.all_tensors_to_one_file = all_tensors_to_one_file <|end_body_0|> <|body_start_1|> model, _ = util.invoke_if_callable(self._model) ...
Functor that saves an ONNX model to the specified path.
SaveOnnx
[ "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.Mo...
stack_v2_sparse_classes_10k_train_002953
37,448
permissive
[ { "docstring": "Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.ModelProto]): An ONNX model or a callable that returns one. path (str): Path at which to write the ONNX model. external_data_path (str): Path to save external data. This is always a relative path; e...
2
null
Implement the Python class `SaveOnnx` described below. Class description: Functor that saves an ONNX model to the specified path. Method signatures and docstrings: - def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): Saves an ONNX model to the specified path. ...
Implement the Python class `SaveOnnx` described below. Class description: Functor that saves an ONNX model to the specified path. Method signatures and docstrings: - def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): Saves an ONNX model to the specified path. ...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.Mo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.ModelProto]): A...
the_stack_v2_python_sparse
tools/Polygraphy/polygraphy/backend/onnx/loader.py
NVIDIA/TensorRT
train
8,026
40a15310b790c7932bcda06941d80f6183e8507f
[ "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\nreturn max(self.rob1(nums[:-1]), self.rob1(nums[1:]))", "size = len(num)\nif size == 0:\n return 0\nif size == 1:\n return num[0]\ndp = [0] * (size + 1)\ndp[0] = 0\ndp[1] = num[0]\nfor i in range(2, size + 1):\n dp[i] = max(dp[i - 1], d...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return nums[0] return max(self.rob1(nums[:-1]), self.rob1(nums[1:])) <|end_body_0|> <|body_start_1|> size = len(num) if size == 0: return 0 if size == 1: return num[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, num): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 if len(nums) == 1: ...
stack_v2_sparse_classes_10k_train_002954
2,121
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob1", "signature": "def rob1(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_003197
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, num): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, num): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): ""...
fa638c7fda3802e9f4e0751a2c4c084edf09a441
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, num): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 if len(nums) == 1: return nums[0] return max(self.rob1(nums[:-1]), self.rob1(nums[1:])) def rob1(self, num): """:type nums: List[int] :rtype: int"""...
the_stack_v2_python_sparse
python/Dynamic Programming/213.House Robber II.py
EvanJamesMG/Leetcode
train
5
037b81d5fc2915be31411588c120f790c9a0b5c2
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.printUsageByPrinter'.casefold():\n from ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
PrintUsage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrintUsage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Prin...
stack_v2_sparse_classes_10k_train_002955
5,663
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: PrintUsage", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pa...
3
null
Implement the Python class `PrintUsage` described below. Class description: Implement the PrintUsage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: Creates a new instance of the appropriate class based on discriminator value Args: pa...
Implement the Python class `PrintUsage` described below. Class description: Implement the PrintUsage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: Creates a new instance of the appropriate class based on discriminator value Args: pa...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PrintUsage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Prin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrintUsage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintUsage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: PrintUsage""" ...
the_stack_v2_python_sparse
msgraph/generated/models/print_usage.py
microsoftgraph/msgraph-sdk-python
train
135
40606cd2eaf7ff4d64ad74d4605912873ac3b6f5
[ "if vocab is None:\n vocab = default_vocab(default_vocab_size)\nwith tf.device('cpu'):\n self._table = tf.lookup.StaticVocabularyTable(tf.lookup.KeyValueTensorInitializer(vocab, tf.range(len(vocab), dtype=tf.int64)), num_oov_buckets=num_oov_buckets)", "@tf.function(input_signature=[tf.TensorSpec(shape=[None...
<|body_start_0|> if vocab is None: vocab = default_vocab(default_vocab_size) with tf.device('cpu'): self._table = tf.lookup.StaticVocabularyTable(tf.lookup.KeyValueTensorInitializer(vocab, tf.range(len(vocab), dtype=tf.int64)), num_oov_buckets=num_oov_buckets) <|end_body_0|> <|b...
Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples.
StackoverflowTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackoverflowTokenizer: """Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples.""" def __init__(self, vocab: Optional[List[str]]=None, default_vocab_size: Optional[int]=10000, num_oov_buckets: int=1): """Initializes a tokenizer. Args: vocab: Option...
stack_v2_sparse_classes_10k_train_002956
8,376
permissive
[ { "docstring": "Initializes a tokenizer. Args: vocab: Optional vocabulary. If specified, `default_vocab_size` is ignored. If None, `default_vocab_size` is used to load the standard vocabulary. This vocabulary should NOT have special tokens PAD, EOS, BOS, and OOV. The special tokens are added and handled automat...
2
stack_v2_sparse_classes_30k_train_000764
Implement the Python class `StackoverflowTokenizer` described below. Class description: Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples. Method signatures and docstrings: - def __init__(self, vocab: Optional[List[str]]=None, default_vocab_size: Optional[int]=10000, num_oov_buck...
Implement the Python class `StackoverflowTokenizer` described below. Class description: Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples. Method signatures and docstrings: - def __init__(self, vocab: Optional[List[str]]=None, default_vocab_size: Optional[int]=10000, num_oov_buck...
b78a052a0445a32270c446e778e0c0b73df854ed
<|skeleton|> class StackoverflowTokenizer: """Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples.""" def __init__(self, vocab: Optional[List[str]]=None, default_vocab_size: Optional[int]=10000, num_oov_buckets: int=1): """Initializes a tokenizer. Args: vocab: Option...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StackoverflowTokenizer: """Tokenizer for the `tokens` feature in stackoverflow. See :meth:`load_data` for examples.""" def __init__(self, vocab: Optional[List[str]]=None, default_vocab_size: Optional[int]=10000, num_oov_buckets: int=1): """Initializes a tokenizer. Args: vocab: Optional vocabulary...
the_stack_v2_python_sparse
fedjax/datasets/stackoverflow.py
jaehunro/fedjax
train
0
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return ScanSerializerV6\nelif self.request.version == 'v7':\n return ScanSerializerV6", "if request.version == 'v6':\n return self._list_v6(request)\nelif request.version == 'v7':\n return self._list_v6(request)\nraise Http404()", "started = rest_util.parse_timest...
<|body_start_0|> if self.request.version == 'v6': return ScanSerializerV6 elif self.request.version == 'v7': return ScanSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6': return self._list_v6(request) elif request.version == 'v7'...
This view is the endpoint for retrieving the list of all Scan process.
ScansView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScansView: """This view is the endpoint for retrieving the list of all Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves the l...
stack_v2_sparse_classes_10k_train_002957
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Retrieves the list of all Scan process and returns it in JSON form :param request: the HTTP GET re...
5
null
Implement the Python class `ScansView` described below. Class description: This view is the endpoint for retrieving the list of all Scan process. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self, requ...
Implement the Python class `ScansView` described below. Class description: This view is the endpoint for retrieving the list of all Scan process. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self, requ...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class ScansView: """This view is the endpoint for retrieving the list of all Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves the l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScansView: """This view is the endpoint for retrieving the list of all Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" if self.request.version == 'v6': return ScanSerializerV6 eli...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
a0d465e69f3bc97209e2bc3e56f12378e27eacf9
[ "self.model_type = model_type\nself.batch_size = batch_size\nself.save_dir = save_dir\nif model_type == 'resnet':\n m = models.resnet152(pretrained=True)\n self.features = nn.Sequential(*[mod for n, mod in m._modules.items() if n not in ['avgpool', 'fc']])\nelif model_type == 'densenet':\n m = models.dense...
<|body_start_0|> self.model_type = model_type self.batch_size = batch_size self.save_dir = save_dir if model_type == 'resnet': m = models.resnet152(pretrained=True) self.features = nn.Sequential(*[mod for n, mod in m._modules.items() if n not in ['avgpool', 'fc']]...
Image Featurizer.
ImgFeaturizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImgFeaturizer: """Image Featurizer.""" def __init__(self, model_type, batch_size, save_dir): """Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving img features.""" <|body_0|> def transform(se...
stack_v2_sparse_classes_10k_train_002958
2,563
no_license
[ { "docstring": "Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving img features.", "name": "__init__", "signature": "def __init__(self, model_type, batch_size, save_dir)" }, { "docstring": "Transform imgs to features...
2
stack_v2_sparse_classes_30k_train_003914
Implement the Python class `ImgFeaturizer` described below. Class description: Image Featurizer. Method signatures and docstrings: - def __init__(self, model_type, batch_size, save_dir): Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving ...
Implement the Python class `ImgFeaturizer` described below. Class description: Image Featurizer. Method signatures and docstrings: - def __init__(self, model_type, batch_size, save_dir): Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving ...
fbfa1766dbc52cbf39036abe1a44f9315fad4a5c
<|skeleton|> class ImgFeaturizer: """Image Featurizer.""" def __init__(self, model_type, batch_size, save_dir): """Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving img features.""" <|body_0|> def transform(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImgFeaturizer: """Image Featurizer.""" def __init__(self, model_type, batch_size, save_dir): """Initialize ImgFeatureizer. Args ---- batch_size : int, batch size for data loader. save_dir : string, path to directory for saving img features.""" self.model_type = model_type self.bat...
the_stack_v2_python_sparse
preprocessing/img_featurizer.py
estebandito22/MC-BERT
train
0
5e53b81f0e2794d3d95e17b1762dd2492bf41c25
[ "self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme\nself.loginController = LoginController(toJson, pwdScheme=pwdScheme)\nCreateController.__init__(self, User, None, recordValueProvider=recordValueProvider)", "try:\n createKwargs = dict(json)\n createKwargs['password'] = self.pwdScheme.ma...
<|body_start_0|> self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme self.loginController = LoginController(toJson, pwdScheme=pwdScheme) CreateController.__init__(self, User, None, recordValueProvider=recordValueProvider) <|end_body_0|> <|body_start_1|> try: ...
Controller to register a user
RegisterController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterController: """Controller to register a user""" def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): """Initialize the Register Controller""" <|body_0|> def performWithJSON(self, json=None): """Create a User record with the given credenti...
stack_v2_sparse_classes_10k_train_002959
1,277
permissive
[ { "docstring": "Initialize the Register Controller", "name": "__init__", "signature": "def __init__(self, toJson, pwdScheme=None, recordValueProvider=None)" }, { "docstring": "Create a User record with the given credentials", "name": "performWithJSON", "signature": "def performWithJSON(s...
2
null
Implement the Python class `RegisterController` described below. Class description: Controller to register a user Method signatures and docstrings: - def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): Initialize the Register Controller - def performWithJSON(self, json=None): Create a User record wi...
Implement the Python class `RegisterController` described below. Class description: Controller to register a user Method signatures and docstrings: - def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): Initialize the Register Controller - def performWithJSON(self, json=None): Create a User record wi...
2a54293181c1c2b1a2b840ddee4d4d80177efb33
<|skeleton|> class RegisterController: """Controller to register a user""" def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): """Initialize the Register Controller""" <|body_0|> def performWithJSON(self, json=None): """Create a User record with the given credenti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegisterController: """Controller to register a user""" def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): """Initialize the Register Controller""" self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme self.loginController = LoginController(toJso...
the_stack_v2_python_sparse
data/train/python/99f7f822e985fbf40ac8620e7a822e58c4b138e0register_controller.py
harshp8l/deep-learning-lang-detection
train
0
283c28bc1bef0f0d4a6851ce8feed887180c31a8
[ "mimetype = self.context.resource_mimetype()\nif mimetype:\n mime_parts = mimetype.split('/')\n for view_name in ['%s_%s' % tuple(mime_parts), mime_parts[0], 'default']:\n view = queryMultiAdapter((self.context, self.request), name='resource_%s' % view_name)\n if view:\n return view._...
<|body_start_0|> mimetype = self.context.resource_mimetype() if mimetype: mime_parts = mimetype.split('/') for view_name in ['%s_%s' % tuple(mime_parts), mime_parts[0], 'default']: view = queryMultiAdapter((self.context, self.request), name='resource_%s' % view_na...
A view to display a resource.
ATResourceView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ATResourceView: """A view to display a resource.""" def resource_view(self): """Returns the view for the resource based on its mimetype.""" <|body_0|> def resource(self): """Renders the resource.""" <|body_1|> <|end_skeleton|> <|body_start_0|> m...
stack_v2_sparse_classes_10k_train_002960
1,247
no_license
[ { "docstring": "Returns the view for the resource based on its mimetype.", "name": "resource_view", "signature": "def resource_view(self)" }, { "docstring": "Renders the resource.", "name": "resource", "signature": "def resource(self)" } ]
2
stack_v2_sparse_classes_30k_train_007165
Implement the Python class `ATResourceView` described below. Class description: A view to display a resource. Method signatures and docstrings: - def resource_view(self): Returns the view for the resource based on its mimetype. - def resource(self): Renders the resource.
Implement the Python class `ATResourceView` described below. Class description: A view to display a resource. Method signatures and docstrings: - def resource_view(self): Returns the view for the resource based on its mimetype. - def resource(self): Renders the resource. <|skeleton|> class ATResourceView: """A v...
bd7ca0793d35bbdbc83200d27650fe024d1f432e
<|skeleton|> class ATResourceView: """A view to display a resource.""" def resource_view(self): """Returns the view for the resource based on its mimetype.""" <|body_0|> def resource(self): """Renders the resource.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ATResourceView: """A view to display a resource.""" def resource_view(self): """Returns the view for the resource based on its mimetype.""" mimetype = self.context.resource_mimetype() if mimetype: mime_parts = mimetype.split('/') for view_name in ['%s_%s' %...
the_stack_v2_python_sparse
groundwire/atresources/browser/atresource.py
collective/groundwire.atresources
train
0
7f7363430380b5165615220db708e3c1596e3861
[ "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...
UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. The followi...
UserAPIServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAPIServicer: """UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interp...
stack_v2_sparse_classes_10k_train_002961
5,753
no_license
[ { "docstring": "Gets the information about an user by its user id.", "name": "GetUser", "signature": "def GetUser(self, request, context)" }, { "docstring": "Gets the groups of a user.", "name": "GetUserGroups", "signature": "def GetUserGroups(self, request, context)" }, { "docst...
4
stack_v2_sparse_classes_30k_test_000245
Implement the Python class `UserAPIServicer` described below. Class description: UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTI...
Implement the Python class `UserAPIServicer` described below. Class description: UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTI...
dad1a042b38db5f8bedcac3b6af25066f4d6eef9
<|skeleton|> class UserAPIServicer: """UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserAPIServicer: """UserProvider API. The UserProvider API is responsible for creating a key-value map according to user userprovider. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as desc...
the_stack_v2_python_sparse
cs3/identity/user/v1beta1/user_api_pb2_grpc.py
SamuAlfageme/python-cs3apis
train
0
aa4c6f10795ae00117ff3fdeb1c77f2b2f3964e7
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosStoreAppAssignmentSettings()", "from .mobile_app_assignment_settings import MobileAppAssignmentSettings\nfrom .mobile_app_assignment_settings import MobileAppAssignmentSettings\nfields: Dict[str, Callable[[Any], None]] = {'isRemovab...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosStoreAppAssignmentSettings() <|end_body_0|> <|body_start_1|> from .mobile_app_assignment_settings import MobileAppAssignmentSettings from .mobile_app_assignment_settings import Mobile...
Contains properties used to assign an iOS Store mobile app to a group.
IosStoreAppAssignmentSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosStoreAppAssignmentSettings: """Contains properties used to assign an iOS Store mobile app to a group.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosStoreAppAssignmentSettings: """Creates a new instance of the appropriate class based on discrimi...
stack_v2_sparse_classes_10k_train_002962
3,409
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: IosStoreAppAssignmentSettings", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
stack_v2_sparse_classes_30k_train_006978
Implement the Python class `IosStoreAppAssignmentSettings` described below. Class description: Contains properties used to assign an iOS Store mobile app to a group. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosStoreAppAssignmentSettings: Creates ...
Implement the Python class `IosStoreAppAssignmentSettings` described below. Class description: Contains properties used to assign an iOS Store mobile app to a group. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosStoreAppAssignmentSettings: Creates ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosStoreAppAssignmentSettings: """Contains properties used to assign an iOS Store mobile app to a group.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosStoreAppAssignmentSettings: """Creates a new instance of the appropriate class based on discrimi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IosStoreAppAssignmentSettings: """Contains properties used to assign an iOS Store mobile app to a group.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosStoreAppAssignmentSettings: """Creates a new instance of the appropriate class based on discriminator value A...
the_stack_v2_python_sparse
msgraph/generated/models/ios_store_app_assignment_settings.py
microsoftgraph/msgraph-sdk-python
train
135
c7e8906553914cb951cb023b1af42c20752c8be1
[ "assert_pycocotools_installed('PyCOCOWrapper')\nCOCO.__init__(self, annotation_file=None)\nself._eval_type = 'box'\nif gt_dataset:\n self.dataset = gt_dataset\n self.createIndex()", "res = COCO()\nres.dataset['images'] = copy.deepcopy(self.dataset['images'])\nres.dataset['categories'] = copy.deepcopy(self.d...
<|body_start_0|> assert_pycocotools_installed('PyCOCOWrapper') COCO.__init__(self, annotation_file=None) self._eval_type = 'box' if gt_dataset: self.dataset = gt_dataset self.createIndex() <|end_body_0|> <|body_start_1|> res = COCO() res.dataset['...
COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external annotation dictionary.
PyCOCOWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyCOCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using th...
stack_v2_sparse_classes_10k_train_002963
8,149
permissive
[ { "docstring": "Instantiates a COCO-style API object. Args: eval_type: either 'box' or 'mask'. annotation_file: a JSON file that stores annotations of the eval dataset. This is required if `gt_dataset` is not provided. gt_dataset: the groundtruth eval dataset in COCO API format.", "name": "__init__", "s...
2
null
Implement the Python class `PyCOCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support ...
Implement the Python class `PyCOCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support ...
e83f229f1b7b847cd712d5cd4810097d3e06d14e
<|skeleton|> class PyCOCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PyCOCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external an...
the_stack_v2_python_sparse
keras_cv/metrics/coco/pycoco_wrapper.py
keras-team/keras-cv
train
818
442b6cfa1a9cf18acc2f172b4e8b762538b00071
[ "assert len(ids) == 1, 'This option should only be used for a single id at a time.'\nir_model_data = self.pool.get('ir.model.data')\nres = {}\npicking = self.browse(cr, uid, ids[0])\ntry:\n template_id = ir_model_data.get_object_reference(cr, uid, 'openforce_sale', 'openforce_ddt_email_template')[1]\nexcept Valu...
<|body_start_0|> assert len(ids) == 1, 'This option should only be used for a single id at a time.' ir_model_data = self.pool.get('ir.model.data') res = {} picking = self.browse(cr, uid, ids[0]) try: template_id = ir_model_data.get_object_reference(cr, uid, 'openforce...
stock_picking_out
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_out: def action_ddt_sent(self, cr, uid, ids, context=None): """This function opens a window to compose an email, with the edi invoice template message loaded by default""" <|body_0|> def _total_amount(self, cr, uid, ids, name, args, context=None): """Co...
stack_v2_sparse_classes_10k_train_002964
10,203
no_license
[ { "docstring": "This function opens a window to compose an email, with the edi invoice template message loaded by default", "name": "action_ddt_sent", "signature": "def action_ddt_sent(self, cr, uid, ids, context=None)" }, { "docstring": "Compute the attendances, analytic lines timesheets and di...
2
stack_v2_sparse_classes_30k_train_001856
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def action_ddt_sent(self, cr, uid, ids, context=None): This function opens a window to compose an email, with the edi invoice template message loaded by default...
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def action_ddt_sent(self, cr, uid, ids, context=None): This function opens a window to compose an email, with the edi invoice template message loaded by default...
78fc164679b690bcf84866987266838de134bc2f
<|skeleton|> class stock_picking_out: def action_ddt_sent(self, cr, uid, ids, context=None): """This function opens a window to compose an email, with the edi invoice template message loaded by default""" <|body_0|> def _total_amount(self, cr, uid, ids, name, args, context=None): """Co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class stock_picking_out: def action_ddt_sent(self, cr, uid, ids, context=None): """This function opens a window to compose an email, with the edi invoice template message loaded by default""" assert len(ids) == 1, 'This option should only be used for a single id at a time.' ir_model_data = s...
the_stack_v2_python_sparse
openforce_sale/stock/picking.py
alessandrocamilli/7-openforce-addons
train
1
85f82fd233c92a6959977eda259030bfddc12bc5
[ "if isinstance(levels, int):\n levels = np.arange(levels)\nself.est = estimator\nself.levels = levels\nself.tmpshape = None", "levels = self.levels\nexpanded_levels = levels[None, :]\nsamples = self.est.forward(x)\ntmp = samples * expanded_levels\nself.tmpshape = tmp.shape\nreturn tmp.sum(axis=-1)", "levels ...
<|body_start_0|> if isinstance(levels, int): levels = np.arange(levels) self.est = estimator self.levels = levels self.tmpshape = None <|end_body_0|> <|body_start_1|> levels = self.levels expanded_levels = levels[None, :] samples = self.est.forward(x)...
An encoder that embds a continuous encoder, which encourages values to cluster at discrete states.
DiscreteEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscreteEncoder: """An encoder that embds a continuous encoder, which encourages values to cluster at discrete states.""" def __init__(self, estimator, levels): """Create a new DiscreteEncoder. Parameters ---------- estimator : an initialized estimator for example GumbelSoftmax() lev...
stack_v2_sparse_classes_10k_train_002965
7,697
permissive
[ { "docstring": "Create a new DiscreteEncoder. Parameters ---------- estimator : an initialized estimator for example GumbelSoftmax() levels : int or numpy.ndarray if int, self-generates arange(levels) else, expected to be K discrete, non-overlapping integer states", "name": "__init__", "signature": "def...
4
stack_v2_sparse_classes_30k_train_005073
Implement the Python class `DiscreteEncoder` described below. Class description: An encoder that embds a continuous encoder, which encourages values to cluster at discrete states. Method signatures and docstrings: - def __init__(self, estimator, levels): Create a new DiscreteEncoder. Parameters ---------- estimator :...
Implement the Python class `DiscreteEncoder` described below. Class description: An encoder that embds a continuous encoder, which encourages values to cluster at discrete states. Method signatures and docstrings: - def __init__(self, estimator, levels): Create a new DiscreteEncoder. Parameters ---------- estimator :...
af89c94d500a274eda664188ddb97fcae30c6ac5
<|skeleton|> class DiscreteEncoder: """An encoder that embds a continuous encoder, which encourages values to cluster at discrete states.""" def __init__(self, estimator, levels): """Create a new DiscreteEncoder. Parameters ---------- estimator : an initialized estimator for example GumbelSoftmax() lev...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DiscreteEncoder: """An encoder that embds a continuous encoder, which encourages values to cluster at discrete states.""" def __init__(self, estimator, levels): """Create a new DiscreteEncoder. Parameters ---------- estimator : an initialized estimator for example GumbelSoftmax() levels : int or ...
the_stack_v2_python_sparse
prysm/x/optym/activation.py
brandondube/prysm
train
192
47e7b338024ef97cdc18c802c2a78541bc48b14e
[ "super().__init__()\nself.reduction = reduction\nself.axis = axis", "if not isinstance(y_true, Tensor):\n y_true = y_true.class_id\nif not isinstance(y_pred, Tensor):\n y_pred = y_pred.class_id\npred_class = y_pred.argmax(dim=self.axis)\ntrue_class = y_true.long()\ncorrect_predictions = pred_class == true_c...
<|body_start_0|> super().__init__() self.reduction = reduction self.axis = axis <|end_body_0|> <|body_start_1|> if not isinstance(y_true, Tensor): y_true = y_true.class_id if not isinstance(y_pred, Tensor): y_pred = y_pred.class_id pred_class = y_...
SparseCategoricalAccuracy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseCategoricalAccuracy: def __init__(self, model=None, reduction: str='mean', axis=-1): """Compute the sparse mean squared error. Sparse means that the targets are not one hot encoded. :param reduction: Specifies the reduction to apply to the output: `'none'` | `'mean'` | `'sum'`. `'n...
stack_v2_sparse_classes_10k_train_002966
4,640
permissive
[ { "docstring": "Compute the sparse mean squared error. Sparse means that the targets are not one hot encoded. :param reduction: Specifies the reduction to apply to the output: `'none'` | `'mean'` | `'sum'`. `'none'`: no reduction will be applied, `'mean'`: the sum of the output will be divided by the number of ...
2
stack_v2_sparse_classes_30k_train_004437
Implement the Python class `SparseCategoricalAccuracy` described below. Class description: Implement the SparseCategoricalAccuracy class. Method signatures and docstrings: - def __init__(self, model=None, reduction: str='mean', axis=-1): Compute the sparse mean squared error. Sparse means that the targets are not one...
Implement the Python class `SparseCategoricalAccuracy` described below. Class description: Implement the SparseCategoricalAccuracy class. Method signatures and docstrings: - def __init__(self, model=None, reduction: str='mean', axis=-1): Compute the sparse mean squared error. Sparse means that the targets are not one...
0c7fb170d62f193dbbb2018f7b8d42f713178bb8
<|skeleton|> class SparseCategoricalAccuracy: def __init__(self, model=None, reduction: str='mean', axis=-1): """Compute the sparse mean squared error. Sparse means that the targets are not one hot encoded. :param reduction: Specifies the reduction to apply to the output: `'none'` | `'mean'` | `'sum'`. `'n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SparseCategoricalAccuracy: def __init__(self, model=None, reduction: str='mean', axis=-1): """Compute the sparse mean squared error. Sparse means that the targets are not one hot encoded. :param reduction: Specifies the reduction to apply to the output: `'none'` | `'mean'` | `'sum'`. `'none'`: no redu...
the_stack_v2_python_sparse
deeptech/training/losses/classification.py
penguinmenac3/deeptech
train
1
c858f3e2a1977317f395dfe0f1e4948d519aaa6b
[ "if x == 0:\n return x\nupper = x / 2 + 1\nlower = 1\nwhile upper - lower > 1:\n middle = int((upper + lower) / 2)\n if x > middle ** 2:\n lower = middle\n elif x < middle ** 2:\n upper = middle\n elif x == middle ** 2:\n return middle\nreturn lower", "if x <= 1:\n return x\...
<|body_start_0|> if x == 0: return x upper = x / 2 + 1 lower = 1 while upper - lower > 1: middle = int((upper + lower) / 2) if x > middle ** 2: lower = middle elif x < middle ** 2: upper = middle ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt_float(self, x): """this method is useful for if we need to retun a more accurate float number type x: int rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002967
1,038
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" }, { "docstring": "this method is useful for if we need to retun a more accurate float number type x: int rtype: float", "name": "mySqrt_float", "signature": "def mySqrt_float(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrt_float(self, x): this method is useful for if we need to retun a more accurate float number type x: int rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrt_float(self, x): this method is useful for if we need to retun a more accurate float number type x: int rtype: float <|...
54d777e11b91c5debe49c1aef723234c66a5d2cc
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt_float(self, x): """this method is useful for if we need to retun a more accurate float number type x: int rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" if x == 0: return x upper = x / 2 + 1 lower = 1 while upper - lower > 1: middle = int((upper + lower) / 2) if x > middle ** 2: lower = middle el...
the_stack_v2_python_sparse
leetcode_solution/math/#69.Sqrt.py
HsiangHung/Code-Challenges
train
0
0ec5394fe250feccaceb3daed9c66bfd6c188bde
[ "super(VDSMImportLog, self).parse_content(content)\nsplited_file_name = self.file_name.split('-')\nself.vm_uuid = '-'.join(splited_file_name[1:-1])\n_datetime = splited_file_name[-1].replace('.log', '')\ntry:\n self.file_datetime = datetime.strptime(_datetime, '%Y%m%dT%H%M%S')\nexcept:\n self.file_datetime = ...
<|body_start_0|> super(VDSMImportLog, self).parse_content(content) splited_file_name = self.file_name.split('-') self.vm_uuid = '-'.join(splited_file_name[1:-1]) _datetime = splited_file_name[-1].replace('.log', '') try: self.file_datetime = datetime.strptime(_datetim...
Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and storage-type have different lengths Example: >>> log = vdsm_import_logs.get('pr...
VDSMImportLog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VDSMImportLog: """Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and storage-type have different lengths Ex...
stack_v2_sparse_classes_10k_train_002968
11,713
permissive
[ { "docstring": "Parse ``import-@UUID-@datetime.log`` log file.", "name": "parse_content", "signature": "def parse_content(self, content)" }, { "docstring": "Find all the (available) logs that are after the given time stamp. If `s` is not supplied, then all lines are used. Otherwise, only the lin...
2
null
Implement the Python class `VDSMImportLog` described below. Class description: Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and...
Implement the Python class `VDSMImportLog` described below. Class description: Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and...
b0ea07fc3f4dd8801b505fe70e9b36e628152c4a
<|skeleton|> class VDSMImportLog: """Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and storage-type have different lengths Ex...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VDSMImportLog: """Parser for the log file detailing virtual machine imports. Sample log file:: [ 0.2] preparing for copy [ 0.2] Copying disk 1/1 to /rhev/data-center/958ca292-9126/f524d2ba-155a/images/502f5598-335d-/d4b140c8-9cd5 [ 0.0] >>> source, dest, and storage-type have different lengths Example: >>> lo...
the_stack_v2_python_sparse
insights/parsers/vdsm_log.py
RedHatInsights/insights-core
train
144
5e6fd7af273e4b69cdadb9c3324341d542123d57
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Authentication()", "from .authentication_method import AuthenticationMethod\nfrom .email_authentication_method import EmailAuthenticationMethod\nfrom .entity import Entity\nfrom .fido2_authentication_method import Fido2AuthenticationMe...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Authentication() <|end_body_0|> <|body_start_1|> from .authentication_method import AuthenticationMethod from .email_authentication_method import EmailAuthenticationMethod from ....
Authentication
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k_train_002969
8,427
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Authentication", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
null
Implement the Python class `Authentication` described below. Class description: Implement the Authentication class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `Authentication` described below. Class description: Implement the Authentication class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Authentica...
the_stack_v2_python_sparse
msgraph/generated/models/authentication.py
microsoftgraph/msgraph-sdk-python
train
135
3f3e1afad41a4469c7e251f93567751df01defd2
[ "self.carange = carange\nself.crrange = crrange\nself.seed = seed\nself.ma = len(carange[0]) + 1 if carange is not None else None\nself.mr = len(crrange[0]) + 1 if crrange is not None else None\nif seed is not None:\n ts.setseed(seed)", "if seed is not None:\n ts.setseed(seed)\nif self.ma is not None:\n ...
<|body_start_0|> self.carange = carange self.crrange = crrange self.seed = seed self.ma = len(carange[0]) + 1 if carange is not None else None self.mr = len(crrange[0]) + 1 if crrange is not None else None if seed is not None: ts.setseed(seed) <|end_body_0|> ...
PolyPhaseErrorGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolyPhaseErrorGenerator: def __init__(self, carange=None, crrange=None, seed=None): """Polynominal phase error generator. Args: carange (None or tuple or list, optional): List of coefficients range of phase error in azimuth direction. crrange (None or tuple or list, optional): List of co...
stack_v2_sparse_classes_10k_train_002970
8,808
permissive
[ { "docstring": "Polynominal phase error generator. Args: carange (None or tuple or list, optional): List of coefficients range of phase error in azimuth direction. crrange (None or tuple or list, optional): List of coefficients range of phase error in range direction. seed (None or int, optional): The random se...
2
stack_v2_sparse_classes_30k_train_003322
Implement the Python class `PolyPhaseErrorGenerator` described below. Class description: Implement the PolyPhaseErrorGenerator class. Method signatures and docstrings: - def __init__(self, carange=None, crrange=None, seed=None): Polynominal phase error generator. Args: carange (None or tuple or list, optional): List ...
Implement the Python class `PolyPhaseErrorGenerator` described below. Class description: Implement the PolyPhaseErrorGenerator class. Method signatures and docstrings: - def __init__(self, carange=None, crrange=None, seed=None): Polynominal phase error generator. Args: carange (None or tuple or list, optional): List ...
05a46610d68bc884743a483565279f361ade5384
<|skeleton|> class PolyPhaseErrorGenerator: def __init__(self, carange=None, crrange=None, seed=None): """Polynominal phase error generator. Args: carange (None or tuple or list, optional): List of coefficients range of phase error in azimuth direction. crrange (None or tuple or list, optional): List of co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PolyPhaseErrorGenerator: def __init__(self, carange=None, crrange=None, seed=None): """Polynominal phase error generator. Args: carange (None or tuple or list, optional): List of coefficients range of phase error in azimuth direction. crrange (None or tuple or list, optional): List of coefficients ran...
the_stack_v2_python_sparse
torchsar/autofocus/phase_error_model.py
wrccrwx/torchsar
train
0
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(Encoder, self).__init__()\nK = sampling_rate // 8000\nself.spectrogram = Spectrogram(n_fft=1024 * K, hop=256 * K, mels=num_mels, sr=sampling_rate)\nself.filters = nn.ModuleList([])\nfilter_width = num_mels\nfor l in range(layers):\n n = N // 4\n k = kernel_size * 2 ** l\n self.filters.append(nn.Conv...
<|body_start_0|> super(Encoder, self).__init__() K = sampling_rate // 8000 self.spectrogram = Spectrogram(n_fft=1024 * K, hop=256 * K, mels=num_mels, sr=sampling_rate) self.filters = nn.ModuleList([]) filter_width = num_mels for l in range(layers): n = N // 4 ...
Encodes the waveforms into the latent representation
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encodes the waveforms into the latent representation""" def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate): """Arguments: N {int} -- Dimension of the output latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- ...
stack_v2_sparse_classes_10k_train_002971
37,269
no_license
[ { "docstring": "Arguments: N {int} -- Dimension of the output latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the convolutions layers {int} -- Number of parallel convolutions with different kernel sizes num_mels {int} -- Number of mel filters in the mel spectr...
2
stack_v2_sparse_classes_30k_train_001283
Implement the Python class `Encoder` described below. Class description: Encodes the waveforms into the latent representation Method signatures and docstrings: - def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate): Arguments: N {int} -- Dimension of the output latent representation kernel_size...
Implement the Python class `Encoder` described below. Class description: Encodes the waveforms into the latent representation Method signatures and docstrings: - def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate): Arguments: N {int} -- Dimension of the output latent representation kernel_size...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Encoder: """Encodes the waveforms into the latent representation""" def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate): """Arguments: N {int} -- Dimension of the output latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Encoder: """Encodes the waveforms into the latent representation""" def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate): """Arguments: N {int} -- Dimension of the output latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
04295c02a91de6178cb7dbea7dd23c3ae98b3991
[ "if not root:\n return []\nqueue = [root]\nres = []\nwhile queue:\n child = []\n node = []\n for q in queue:\n if q:\n child.append(q.val)\n if q.left:\n node.append(q.left)\n if q.right:\n node.append(q.right)\n queue = node\n ...
<|body_start_0|> if not root: return [] queue = [root] res = [] while queue: child = [] node = [] for q in queue: if q: child.append(q.val) if q.left: node.appe...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrderBfs(self, root: TreeNode) -> List[List[int]]: """bfs""" <|body_0|> def levelOrder(self, root: TreeNode) -> List[List[int]]: """dfs :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_002972
1,746
no_license
[ { "docstring": "bfs", "name": "levelOrderBfs", "signature": "def levelOrderBfs(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "dfs :param root: :return:", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrderBfs(self, root: TreeNode) -> List[List[int]]: bfs - def levelOrder(self, root: TreeNode) -> List[List[int]]: dfs :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrderBfs(self, root: TreeNode) -> List[List[int]]: bfs - def levelOrder(self, root: TreeNode) -> List[List[int]]: dfs :param root: :return: <|skeleton|> class Solution:...
1a1abf5aabdd23755769efaa6c33579bc5b0917b
<|skeleton|> class Solution: def levelOrderBfs(self, root: TreeNode) -> List[List[int]]: """bfs""" <|body_0|> def levelOrder(self, root: TreeNode) -> List[List[int]]: """dfs :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrderBfs(self, root: TreeNode) -> List[List[int]]: """bfs""" if not root: return [] queue = [root] res = [] while queue: child = [] node = [] for q in queue: if q: chi...
the_stack_v2_python_sparse
Week_03/G20190343020041/LeetCode_102_0041.py
algorithm005-class02/algorithm005-class02
train
45
6926353fdae3345fd9c58cba4e88b821d6076eee
[ "def dfs(root):\n if not root:\n res.append('None')\n return\n res.append(str(root.val))\n dfs(root.left)\n dfs(root.right)\nres = []\ndfs(root)\nreturn ','.join(res)", "def recursiveDeserialize(stringList):\n if stringList[0] == 'None':\n stringList.pop(0)\n return None...
<|body_start_0|> def dfs(root): if not root: res.append('None') return res.append(str(root.val)) dfs(root.left) dfs(root.right) res = [] dfs(root) return ','.join(res) <|end_body_0|> <|body_start_1|> ...
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_10k_train_002973
2,513
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004850
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:...
d4d138716db9bfa236c87c25ae582a76a14faa28
<|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_10k
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 dfs(root): if not root: res.append('None') return res.append(str(root.val)) dfs(root.left) dfs(root.ri...
the_stack_v2_python_sparse
SerializeAndDeserializeBinaryTree.py
aaronfox/LeetCode-Work
train
0
6b9f314578c330d2d5bb937481033b46cec20ff6
[ "ret = []\nif not root:\n return None\nQ = Queue()\nQ.put(root)\nwhile not Q.empty():\n count = Q.qsize()\n tmp = []\n for i in range(count):\n nd = Q.get()\n tmp.append(nd.val)\n if nd.left:\n Q.put(nd.left)\n if nd.right:\n Q.put(nd.right)\n ret.app...
<|body_start_0|> ret = [] if not root: return None Q = Queue() Q.put(root) while not Q.empty(): count = Q.qsize() tmp = [] for i in range(count): nd = Q.get() tmp.append(nd.val) if nd....
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def averageOfLevels1(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_0|> def averageOfLevels2(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [] if n...
stack_v2_sparse_classes_10k_train_002974
1,720
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[float]", "name": "averageOfLevels1", "signature": "def averageOfLevels1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[float]", "name": "averageOfLevels2", "signature": "def averageOfLevels2(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def averageOfLevels1(self, root): :type root: TreeNode :rtype: List[float] - def averageOfLevels2(self, root): :type root: TreeNode :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def averageOfLevels1(self, root): :type root: TreeNode :rtype: List[float] - def averageOfLevels2(self, root): :type root: TreeNode :rtype: List[float] <|skeleton|> class Soluti...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def averageOfLevels1(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_0|> def averageOfLevels2(self, root): """:type root: TreeNode :rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def averageOfLevels1(self, root): """:type root: TreeNode :rtype: List[float]""" ret = [] if not root: return None Q = Queue() Q.put(root) while not Q.empty(): count = Q.qsize() tmp = [] for i in range(co...
the_stack_v2_python_sparse
leetcode/637.py
liuweilin17/algorithm
train
3
43bc742e88650eb5c8cbe3c29336985cf2a8c8c7
[ "super(KNNDist, self).__init__()\nself.k = k\nself.alpha = alpha", "B, K = pc.shape[:2]\npc = pc.transpose(2, 1)\ninner = -2.0 * torch.matmul(pc.transpose(2, 1), pc)\nxx = torch.sum(pc ** 2, dim=1, keepdim=True)\ndist = xx + inner + xx.transpose(2, 1)\nassert dist.min().item() >= -1e-06\nneg_value, _ = (-dist).to...
<|body_start_0|> super(KNNDist, self).__init__() self.k = k self.alpha = alpha <|end_body_0|> <|body_start_1|> B, K = pc.shape[:2] pc = pc.transpose(2, 1) inner = -2.0 * torch.matmul(pc.transpose(2, 1), pc) xx = torch.sum(pc ** 2, dim=1, keepdim=True) dis...
KNNDist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" <|body_0|> def forward(self, pc, wei...
stack_v2_sparse_classes_10k_train_002975
11,583
permissive
[ { "docstring": "Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.", "name": "__init__", "signature": "def __init__(self, k=5, alpha=1.05)" }, { "docstring": "K...
2
stack_v2_sparse_classes_30k_val_000042
Implement the Python class `KNNDist` described below. Class description: Implement the KNNDist class. Method signatures and docstrings: - def __init__(self, k=5, alpha=1.05): Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): thresh...
Implement the Python class `KNNDist` described below. Class description: Implement the KNNDist class. Method signatures and docstrings: - def __init__(self, k=5, alpha=1.05): Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): thresh...
4e2462b66fa1eac90cfbf61fa0dc635d223fdf2f
<|skeleton|> class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" <|body_0|> def forward(self, pc, wei...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KNNDist: def __init__(self, k=5, alpha=1.05): """Compute kNN distance punishment within a point cloud. Args: k (int, optional): kNN neighbor num. Defaults to 5. alpha (float, optional): threshold = mean + alpha * std. Defaults to 1.05.""" super(KNNDist, self).__init__() self.k = k ...
the_stack_v2_python_sparse
baselines/attack/util/dist_utils.py
code-roamer/IF-Defense
train
0
4b612ccddcca123d374e51540159ac2215f18f3c
[ "current_identity = import_user()\ncontainers = []\nfor c in lxc.list_containers():\n container = Container.query.filter_by(name=c).first()\n if container.id in current_identity.containers or current_identity.admin:\n infos = lwp.ct_infos(c)\n container_json = container.__jsonapi__()\n co...
<|body_start_0|> current_identity = import_user() containers = [] for c in lxc.list_containers(): container = Container.query.filter_by(name=c).first() if container.id in current_identity.containers or current_identity.admin: infos = lwp.ct_infos(c) ...
ContainersList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainersList: def get(self): """Get containers list""" <|body_0|> def post(self): """Create container""" <|body_1|> <|end_skeleton|> <|body_start_0|> current_identity = import_user() containers = [] for c in lxc.list_containers(): ...
stack_v2_sparse_classes_10k_train_002976
46,738
permissive
[ { "docstring": "Get containers list", "name": "get", "signature": "def get(self)" }, { "docstring": "Create container", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003136
Implement the Python class `ContainersList` described below. Class description: Implement the ContainersList class. Method signatures and docstrings: - def get(self): Get containers list - def post(self): Create container
Implement the Python class `ContainersList` described below. Class description: Implement the ContainersList class. Method signatures and docstrings: - def get(self): Get containers list - def post(self): Create container <|skeleton|> class ContainersList: def get(self): """Get containers list""" ...
3439a2dd0bd527c5d604801fec3a5aac904a72e2
<|skeleton|> class ContainersList: def get(self): """Get containers list""" <|body_0|> def post(self): """Create container""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContainersList: def get(self): """Get containers list""" current_identity = import_user() containers = [] for c in lxc.list_containers(): container = Container.query.filter_by(name=c).first() if container.id in current_identity.containers or current_iden...
the_stack_v2_python_sparse
app/views.py
taidos/lxc-rest
train
0
5b9ce0393b608fe830a7ac00f32ded5d74f34480
[ "node = XMLHelper.build_node_from_string(ResourceInfoBuilder.RESOURCE_TEMPLATE)\nnode.set('Name', resource_info.name)\nnode.set('ResourceFamilyName', resource_info.family_name)\nnode.set('ResourceModelName', resource_info.model_name)\nnode.set('SerialNumber', resource_info.serial_number)\nnode.set('Address', resour...
<|body_start_0|> node = XMLHelper.build_node_from_string(ResourceInfoBuilder.RESOURCE_TEMPLATE) node.set('Name', resource_info.name) node.set('ResourceFamilyName', resource_info.family_name) node.set('ResourceModelName', resource_info.model_name) node.set('SerialNumber', resource...
Build resource info node.
ResourceInfoBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceInfoBuilder: """Build resource info node.""" def _build_resource_node(resource_info: ResourceInfo) -> Element: """Build resource xml node.""" <|body_0|> def _build_attribute_node(attribute: Attribute) -> Element: """Build attribute node. :type attribute: ...
stack_v2_sparse_classes_10k_train_002977
3,487
no_license
[ { "docstring": "Build resource xml node.", "name": "_build_resource_node", "signature": "def _build_resource_node(resource_info: ResourceInfo) -> Element" }, { "docstring": "Build attribute node. :type attribute: cloudshell.layer_one.core.response.resource_info.entities.base.Attribute # noqa: E5...
5
stack_v2_sparse_classes_30k_train_003529
Implement the Python class `ResourceInfoBuilder` described below. Class description: Build resource info node. Method signatures and docstrings: - def _build_resource_node(resource_info: ResourceInfo) -> Element: Build resource xml node. - def _build_attribute_node(attribute: Attribute) -> Element: Build attribute no...
Implement the Python class `ResourceInfoBuilder` described below. Class description: Build resource info node. Method signatures and docstrings: - def _build_resource_node(resource_info: ResourceInfo) -> Element: Build resource xml node. - def _build_attribute_node(attribute: Attribute) -> Element: Build attribute no...
82562665834908294136bbe8e7bc46da1a21b8e2
<|skeleton|> class ResourceInfoBuilder: """Build resource info node.""" def _build_resource_node(resource_info: ResourceInfo) -> Element: """Build resource xml node.""" <|body_0|> def _build_attribute_node(attribute: Attribute) -> Element: """Build attribute node. :type attribute: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResourceInfoBuilder: """Build resource info node.""" def _build_resource_node(resource_info: ResourceInfo) -> Element: """Build resource xml node.""" node = XMLHelper.build_node_from_string(ResourceInfoBuilder.RESOURCE_TEMPLATE) node.set('Name', resource_info.name) node.se...
the_stack_v2_python_sparse
cloudshell/layer_one/core/response/resource_info/resource_info_builder.py
QualiSystems/cloudshell-L1-networking-core
train
1
fb8950ec16af1f232f6be7b3262e0b8da5413090
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "Label(self, text='Укажите ваш любимый жанр кино.').grid(row=0, column=0, sticky=W)\nLabel(self, text='Выберите ровно 1:').grid(row=1, column=0, sticky=W)\nself.favorite = StringVar()\nself.favorite.set(None)\nRadiobutton(self, text=...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> Label(self, text='Укажите ваш любимый жанр кино.').grid(row=0, column=0, sticky=W) Label(self, text='Выберите ровно 1:').grid(row=1, column=0, sticky=W) ...
GUI-Приложение, позволяющее выбрать только один жанр
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" <|body_0|> def create_widgets(self): """Создает элементы, с помощью которых пользователь будет выбирать""" <|body_1|> def u...
stack_v2_sparse_classes_10k_train_002978
2,726
no_license
[ { "docstring": "Инициализируем рамку", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Создает элементы, с помощью которых пользователь будет выбирать", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "Обновляет...
3
stack_v2_sparse_classes_30k_train_002668
Implement the Python class `Application` described below. Class description: GUI-Приложение, позволяющее выбрать только один жанр Method signatures and docstrings: - def __init__(self, master): Инициализируем рамку - def create_widgets(self): Создает элементы, с помощью которых пользователь будет выбирать - def updat...
Implement the Python class `Application` described below. Class description: GUI-Приложение, позволяющее выбрать только один жанр Method signatures and docstrings: - def __init__(self, master): Инициализируем рамку - def create_widgets(self): Создает элементы, с помощью которых пользователь будет выбирать - def updat...
5c3342fca0ad705a7719770894ee2480b62bf593
<|skeleton|> class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" <|body_0|> def create_widgets(self): """Создает элементы, с помощью которых пользователь будет выбирать""" <|body_1|> def u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Создает элементы, с помощью ...
the_stack_v2_python_sparse
Chapter_10/movie_chooser2.py
BlackJin1/FirstProgramm
train
0
8d9be2ff8b8ac9e088adef79f4e58bfeccb68d13
[ "context = {'measurements_form': forms.DatasetTypeMeasurementsForm(), 'flags_definition_form': forms.DatasetTypeFlagsDefinitionForm(), 'dataset_type_id': dataset_type_id}\ndataset_type = models.DatasetType.objects.using('agdc').get(id=dataset_type_id)\ncontext.update(utils.forms_from_definition(dataset_type.definit...
<|body_start_0|> context = {'measurements_form': forms.DatasetTypeMeasurementsForm(), 'flags_definition_form': forms.DatasetTypeFlagsDefinitionForm(), 'dataset_type_id': dataset_type_id} dataset_type = models.DatasetType.objects.using('agdc').get(id=dataset_type_id) context.update(utils.forms_fr...
Main end piont for viewing or adding a dataset type
DatasetTypeView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetTypeView: """Main end piont for viewing or adding a dataset type""" def get(self, request, dataset_type_id=None): """View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, DatasetTypeFlagsDefinitionForm dataset_type_id: id/pk of the d...
stack_v2_sparse_classes_10k_train_002979
10,227
permissive
[ { "docstring": "View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, DatasetTypeFlagsDefinitionForm dataset_type_id: id/pk of the dataset type", "name": "get", "signature": "def get(self, request, dataset_type_id=None)" }, { "docstring": "Add a datase...
2
stack_v2_sparse_classes_30k_train_003452
Implement the Python class `DatasetTypeView` described below. Class description: Main end piont for viewing or adding a dataset type Method signatures and docstrings: - def get(self, request, dataset_type_id=None): View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, Datas...
Implement the Python class `DatasetTypeView` described below. Class description: Main end piont for viewing or adding a dataset type Method signatures and docstrings: - def get(self, request, dataset_type_id=None): View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, Datas...
ef50e918df89313f130d735e7cb7c0a069da410e
<|skeleton|> class DatasetTypeView: """Main end piont for viewing or adding a dataset type""" def get(self, request, dataset_type_id=None): """View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, DatasetTypeFlagsDefinitionForm dataset_type_id: id/pk of the d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DatasetTypeView: """Main end piont for viewing or adding a dataset type""" def get(self, request, dataset_type_id=None): """View a dataset type and all its attributes Context: Bound forms for: DatasetTypeMeasurementsForm, DatasetTypeFlagsDefinitionForm dataset_type_id: id/pk of the dataset type""...
the_stack_v2_python_sparse
apps/data_cube_manager/views/dataset_type.py
ceos-seo/data_cube_ui
train
47
7007de2fcf60e7f6c4ce3ba3aa18aa104a4dd5ed
[ "from numpy import array, dot, arccos, pi\nx = self.positionRelativeToSample(element)\nx = array(x)\nfrom . import units\nm = units.length.meter\ntry:\n x + m\n x /= m\nexcept:\n pass\nlx = vlen(x)\nbeam = self.request_coordinate_system().neutronBeamDirection\nlbeam = vlen(array(beam))\ncost = dot(x, beam)...
<|body_start_0|> from numpy import array, dot, arccos, pi x = self.positionRelativeToSample(element) x = array(x) from . import units m = units.length.meter try: x + m x /= m except: pass lx = vlen(x) beam = self...
A geometer that is most useful for inelastic direct-geometry chopper spectrometer.
ARCSGeometer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: Th...
stack_v2_sparse_classes_10k_train_002980
4,790
no_license
[ { "docstring": "scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: The element or the element signature Output: scattering angle, in radian Exceptions: KeyError Notes: scattering angle means angle from moderator to sample t...
2
stack_v2_sparse_classes_30k_train_006830
Implement the Python class `ARCSGeometer` described below. Class description: A geometer that is most useful for inelastic direct-geometry chopper spectrometer. Method signatures and docstrings: - def scatteringAngle(self, element): scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle...
Implement the Python class `ARCSGeometer` described below. Class description: A geometer that is most useful for inelastic direct-geometry chopper spectrometer. Method signatures and docstrings: - def scatteringAngle(self, element): scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle...
7d6fb88e7ec8245c488ab7988a8518de57dd73df
<|skeleton|> class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: Th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: The element or ...
the_stack_v2_python_sparse
instrument/geometers/ARCSGeometer.py
danse-inelastic/instrument
train
0
8a811a0ece610f3c3f50cf6a572fa198a6b2a4be
[ "if sk:\n self.n = sk.n\n self.h = sk.h\nelif n and h:\n self.n = n\n self.h = h\nelse:\n raise Exception('Public Key construction failed: insufficient/wrong arguments')\nself.signature_bound = Params[self.n]['sig_bound']\nself.sig_bytelen = Params[self.n]['sig_bytelen']", "rep = 'Public for n = {n...
<|body_start_0|> if sk: self.n = sk.n self.h = sk.h elif n and h: self.n = n self.h = h else: raise Exception('Public Key construction failed: insufficient/wrong arguments') self.signature_bound = Params[self.n]['sig_bound'] ...
This class contains methods for performing public key operations in Falcon.
PublicKey
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" <|body_0|> def __repr__(self): """Print the object in readable form.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_002981
15,043
permissive
[ { "docstring": "Initialize a public key.", "name": "__init__", "signature": "def __init__(self, sk=None, n=None, h=None)" }, { "docstring": "Print the object in readable form.", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "Hash a message to a point in ...
4
stack_v2_sparse_classes_30k_train_003360
Implement the Python class `PublicKey` described below. Class description: This class contains methods for performing public key operations in Falcon. Method signatures and docstrings: - def __init__(self, sk=None, n=None, h=None): Initialize a public key. - def __repr__(self): Print the object in readable form. - de...
Implement the Python class `PublicKey` described below. Class description: This class contains methods for performing public key operations in Falcon. Method signatures and docstrings: - def __init__(self, sk=None, n=None, h=None): Initialize a public key. - def __repr__(self): Print the object in readable form. - de...
1480c1e71b624a147dc0a18aa043f1101435ba85
<|skeleton|> class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" <|body_0|> def __repr__(self): """Print the object in readable form.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" if sk: self.n = sk.n self.h = sk.h elif n and h: self.n = n self...
the_stack_v2_python_sparse
falcon/falcon.py
samuelgoh1525/falcon-blockchain
train
4
a6969c4bb9254320d5b80320ce10af94b3d87767
[ "self.choice_enum = choice_enum\nkwargs.update({'required': kwargs.get('required', False), 'allow_null': kwargs.get('allow_null', True), 'help_text': f'String value of the enum.'})\nsuper().__init__(*args, **kwargs)", "if isinstance(data, int):\n try:\n self.choice_enum(data)\n except ValueError:\n ...
<|body_start_0|> self.choice_enum = choice_enum kwargs.update({'required': kwargs.get('required', False), 'allow_null': kwargs.get('allow_null', True), 'help_text': f'String value of the enum.'}) super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> if isinstance(data, int):...
DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value }
ChoiceEnumField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChoiceEnumField: """DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value }""" def __init__(self, choice_enum: Type[_Enum], *args, **kwargs) -> None: """Regular initializing :param choice_enum: Choic...
stack_v2_sparse_classes_10k_train_002982
1,985
no_license
[ { "docstring": "Regular initializing :param choice_enum: ChoiceEnum to work with. :param only_value: used for representing value only.", "name": "__init__", "signature": "def __init__(self, choice_enum: Type[_Enum], *args, **kwargs) -> None" }, { "docstring": "Convert raw value into enum.", ...
3
stack_v2_sparse_classes_30k_train_001749
Implement the Python class `ChoiceEnumField` described below. Class description: DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value } Method signatures and docstrings: - def __init__(self, choice_enum: Type[_Enum], *args, **kwargs...
Implement the Python class `ChoiceEnumField` described below. Class description: DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value } Method signatures and docstrings: - def __init__(self, choice_enum: Type[_Enum], *args, **kwargs...
fa794d08a3892f45e9e69fd226b53fb0bfa75145
<|skeleton|> class ChoiceEnumField: """DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value }""" def __init__(self, choice_enum: Type[_Enum], *args, **kwargs) -> None: """Regular initializing :param choice_enum: Choic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChoiceEnumField: """DictField to deal with ChoiceEnums with structure below: { "name": "FOO_BAR" # variable name "value": "foo and bar" # human readable value }""" def __init__(self, choice_enum: Type[_Enum], *args, **kwargs) -> None: """Regular initializing :param choice_enum: ChoiceEnum to work...
the_stack_v2_python_sparse
api/v1/serializer_fields.py
NitinSatpal/mybill-server
train
0
d5efbeedc0121decab2eca5964be7d7b33df4197
[ "super().__init__()\nself.autoscaleX = utils.AutoscaleState.OFF\nself.minimumX = 0\nself.maximumX = 100\nself.pixelRangeAdditionX = 25\nself.autoscaleY = utils.AutoscaleState.OFF\nself.minimumY = 0\nself.maximumY = 100\nself.pixelRangeAdditionY = 25\nself.numHistogramBins = 40", "self.autoscaleX = getattr(utils.A...
<|body_start_0|> super().__init__() self.autoscaleX = utils.AutoscaleState.OFF self.minimumX = 0 self.maximumX = 100 self.pixelRangeAdditionX = 25 self.autoscaleY = utils.AutoscaleState.OFF self.minimumY = 0 self.maximumY = 100 self.pixelRangeAddit...
Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y component 1D centroid line plot. maximumX : int ...
CentroidPlotConfig
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y co...
stack_v2_sparse_classes_10k_train_002983
4,267
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Translate config to class attributes. Parameters ---------- config : dict The configuration to translate.", "name": "fromDict", "signature": "def fromDict(self, config)" }, ...
3
stack_v2_sparse_classes_30k_train_004714
Implement the Python class `CentroidPlotConfig` described below. Class description: Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.Auto...
Implement the Python class `CentroidPlotConfig` described below. Class description: Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.Auto...
3d0242276198126240667ba13e95b7bdf901d053
<|skeleton|> class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y component 1D ce...
the_stack_v2_python_sparse
spot_motion_monitor/config/centroid_plot_config.py
lsst-sitcom/spot_motion_monitor
train
0
85d99c349eaed6abb904cab48233eb3b76b78124
[ "if not fields:\n fields = ('id',)\ndb_sess = db_session.create_session()\narticle = db_sess.query(Article).get(article_id)\nif not article:\n raise ArticleNotFoundError\nreturn article.to_dict(only=fields)", "if not fields:\n fields = ('id',)\ndb_sess = db_session.create_session()\narticles = db_sess.qu...
<|body_start_0|> if not fields: fields = ('id',) db_sess = db_session.create_session() article = db_sess.query(Article).get(article_id) if not article: raise ArticleNotFoundError return article.to_dict(only=fields) <|end_body_0|> <|body_start_1|> ...
Класс для работы с моделью Article
ArticleModelWorker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleModelWorker: """Класс для работы с моделью Article""" def get_article(article_id, fields=('id', 'title')): """Статья в JSON формате. Применяется в основном в API""" <|body_0|> def get_all_articles(fields=('id', 'title'), author=None, sorted_by='create_date', limit...
stack_v2_sparse_classes_10k_train_002984
5,022
no_license
[ { "docstring": "Статья в JSON формате. Применяется в основном в API", "name": "get_article", "signature": "def get_article(article_id, fields=('id', 'title'))" }, { "docstring": "Список статей в JSON формате. Применяется в основном в API", "name": "get_all_articles", "signature": "def ge...
6
stack_v2_sparse_classes_30k_train_007020
Implement the Python class `ArticleModelWorker` described below. Class description: Класс для работы с моделью Article Method signatures and docstrings: - def get_article(article_id, fields=('id', 'title')): Статья в JSON формате. Применяется в основном в API - def get_all_articles(fields=('id', 'title'), author=None...
Implement the Python class `ArticleModelWorker` described below. Class description: Класс для работы с моделью Article Method signatures and docstrings: - def get_article(article_id, fields=('id', 'title')): Статья в JSON формате. Применяется в основном в API - def get_all_articles(fields=('id', 'title'), author=None...
1bc59640f13ae4fe6582bb10c9093ff3d671aeb1
<|skeleton|> class ArticleModelWorker: """Класс для работы с моделью Article""" def get_article(article_id, fields=('id', 'title')): """Статья в JSON формате. Применяется в основном в API""" <|body_0|> def get_all_articles(fields=('id', 'title'), author=None, sorted_by='create_date', limit...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArticleModelWorker: """Класс для работы с моделью Article""" def get_article(article_id, fields=('id', 'title')): """Статья в JSON формате. Применяется в основном в API""" if not fields: fields = ('id',) db_sess = db_session.create_session() article = db_sess.q...
the_stack_v2_python_sparse
model_workers/article.py
KosenokIvan/articles_website
train
1
b85aaa0672f5f3600d8a08215e59bebde4f9c3f4
[ "pools = [_GkeNodePoolTargetParser.Parse(dataproc, gke_cluster, arg_pool, support_shuffle_service) for arg_pool in arg_pools]\nGkeNodePoolTargetsParser._ValidateUniqueNames(pools)\nGkeNodePoolTargetsParser._ValidateRoles(dataproc, pools)\nGkeNodePoolTargetsParser._ValidatePoolsHaveSameLocation(pools)\nGkeNodePoolTa...
<|body_start_0|> pools = [_GkeNodePoolTargetParser.Parse(dataproc, gke_cluster, arg_pool, support_shuffle_service) for arg_pool in arg_pools] GkeNodePoolTargetsParser._ValidateUniqueNames(pools) GkeNodePoolTargetsParser._ValidateRoles(dataproc, pools) GkeNodePoolTargetsParser._ValidatePo...
Parses all the --pools flags into a list of GkeNodePoolTarget messages.
GkeNodePoolTargetsParser
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GkeNodePoolTargetsParser: """Parses all the --pools flags into a list of GkeNodePoolTarget messages.""" def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): """Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc ...
stack_v2_sparse_classes_10k_train_002985
19,343
permissive
[ { "docstring": "Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc API version to use for GkeNodePoolTarget messages. gke_cluster: The GKE cluster's relative name, for example, 'projects/p1/locations/l1/clusters/c1'. arg_pools: The list of dict[str, any] generat...
5
stack_v2_sparse_classes_30k_train_004322
Implement the Python class `GkeNodePoolTargetsParser` described below. Class description: Parses all the --pools flags into a list of GkeNodePoolTarget messages. Method signatures and docstrings: - def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): Parses all the --pools flags into a list of ...
Implement the Python class `GkeNodePoolTargetsParser` described below. Class description: Parses all the --pools flags into a list of GkeNodePoolTarget messages. Method signatures and docstrings: - def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): Parses all the --pools flags into a list of ...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class GkeNodePoolTargetsParser: """Parses all the --pools flags into a list of GkeNodePoolTarget messages.""" def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): """Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GkeNodePoolTargetsParser: """Parses all the --pools flags into a list of GkeNodePoolTarget messages.""" def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): """Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc API version t...
the_stack_v2_python_sparse
lib/googlecloudsdk/command_lib/dataproc/gke_clusters.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
adfd234506b58be05a053865476d654fe3d3f82d
[ "conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='zhangroot', db='hlrfw_test', unix_socket='/var/run/mysqld/mysqld.sock', cursorclass=pymysql.cursors.DictCursor)\ncur = conn.cursor()\ntry:\n cur.execute(sql)\n conn.commit()\nexcept Exception as e:\n conn.rollback()\nfinally:\n co...
<|body_start_0|> conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='zhangroot', db='hlrfw_test', unix_socket='/var/run/mysqld/mysqld.sock', cursorclass=pymysql.cursors.DictCursor) cur = conn.cursor() try: cur.execute(sql) conn.commit() except...
MyDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyDatabase: def modify_data(self, sql): """- 执行sql语句""" <|body_0|> def select_last_data(self, sql): """- 返回sql的最后一条数据""" <|body_1|> def select_all_data(slef, sql): """- 返回所有符合sql语句的数据""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002986
2,241
no_license
[ { "docstring": "- 执行sql语句", "name": "modify_data", "signature": "def modify_data(self, sql)" }, { "docstring": "- 返回sql的最后一条数据", "name": "select_last_data", "signature": "def select_last_data(self, sql)" }, { "docstring": "- 返回所有符合sql语句的数据", "name": "select_all_data", "si...
3
stack_v2_sparse_classes_30k_train_007067
Implement the Python class `MyDatabase` described below. Class description: Implement the MyDatabase class. Method signatures and docstrings: - def modify_data(self, sql): - 执行sql语句 - def select_last_data(self, sql): - 返回sql的最后一条数据 - def select_all_data(slef, sql): - 返回所有符合sql语句的数据
Implement the Python class `MyDatabase` described below. Class description: Implement the MyDatabase class. Method signatures and docstrings: - def modify_data(self, sql): - 执行sql语句 - def select_last_data(self, sql): - 返回sql的最后一条数据 - def select_all_data(slef, sql): - 返回所有符合sql语句的数据 <|skeleton|> class MyDatabase: ...
61f81163583582c1f5816909f1e3829686c572d7
<|skeleton|> class MyDatabase: def modify_data(self, sql): """- 执行sql语句""" <|body_0|> def select_last_data(self, sql): """- 返回sql的最后一条数据""" <|body_1|> def select_all_data(slef, sql): """- 返回所有符合sql语句的数据""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyDatabase: def modify_data(self, sql): """- 执行sql语句""" conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='zhangroot', db='hlrfw_test', unix_socket='/var/run/mysqld/mysqld.sock', cursorclass=pymysql.cursors.DictCursor) cur = conn.cursor() try: ...
the_stack_v2_python_sparse
hlrfw/database/MyDatabase.py
253765620/xuzhibo_work
train
0
7466c1601403866ca6b6be942ac5e4939b4f2188
[ "if not grid:\n return 0\nm, n = (len(grid), len(grid[0]))\ndp = [[0 for i in range(n)] for j in range(m)]\ndp[0][0] = grid[0][0]\nfor i in range(1, m):\n dp[i][0] = dp[i - 1][0] + grid[i][0]\nfor j in range(1, n):\n dp[0][j] = dp[0][j - 1] + grid[0][j]\nfor i in range(1, m):\n for j in range(1, n):\n ...
<|body_start_0|> if not grid: return 0 m, n = (len(grid), len(grid[0])) dp = [[0 for i in range(n)] for j in range(m)] dp[0][0] = grid[0][0] for i in range(1, m): dp[i][0] = dp[i - 1][0] + grid[i][0] for j in range(1, n): dp[0][j] = dp[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum2(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> def minPathSum3(self, grid): """:type grid: List[List[int]] :rtyp...
stack_v2_sparse_classes_10k_train_002987
3,941
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minPathSum", "signature": "def minPathSum(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minPathSum2", "signature": "def minPathSum2(self, grid)" }, { "docstring": ":type grid: ...
4
stack_v2_sparse_classes_30k_test_000406
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum2(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum3(self, grid): :type gr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum2(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum3(self, grid): :type gr...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum2(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> def minPathSum3(self, grid): """:type grid: List[List[int]] :rtyp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" if not grid: return 0 m, n = (len(grid), len(grid[0])) dp = [[0 for i in range(n)] for j in range(m)] dp[0][0] = grid[0][0] for i in range(1, m): dp[i][0]...
the_stack_v2_python_sparse
64. Minimum Path Sum/minimum_path.py
Macielyoung/LeetCode
train
1
0fec9cb4b8d86dfaea25aec8c1361f09dd7e1b5d
[ "super(Embedding, self).__init__()\nself.N_freqs = N_freqs\nself.in_channels = in_channels\nself.funcs = [torch.sin, torch.cos]\nself.out_channels = in_channels * (len(self.funcs) * N_freqs + 1)\nif logscale:\n self.freq_bands = 2 ** torch.linspace(0, N_freqs - 1, N_freqs)\nelse:\n self.freq_bands = torch.lin...
<|body_start_0|> super(Embedding, self).__init__() self.N_freqs = N_freqs self.in_channels = in_channels self.funcs = [torch.sin, torch.cos] self.out_channels = in_channels * (len(self.funcs) * N_freqs + 1) if logscale: self.freq_bands = 2 ** torch.linspace(0,...
Embedding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: def __init__(self, in_channels, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" <|body_0|> def forward(self, x): """Embeds x to (x, sin...
stack_v2_sparse_classes_10k_train_002988
18,983
no_license
[ { "docstring": "Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)", "name": "__init__", "signature": "def __init__(self, in_channels, N_freqs, logscale=True)" }, { "docstring": "Embeds x to (x, sin(2^k x), co...
2
stack_v2_sparse_classes_30k_train_001379
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self, in_channels, N_freqs, logscale=True): Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both ...
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self, in_channels, N_freqs, logscale=True): Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both ...
3b6e9d85e77077d1ad3b669fe88799d6a19e6d99
<|skeleton|> class Embedding: def __init__(self, in_channels, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" <|body_0|> def forward(self, x): """Embeds x to (x, sin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Embedding: def __init__(self, in_channels, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" super(Embedding, self).__init__() self.N_freqs = N_freqs self.in_c...
the_stack_v2_python_sparse
models/nert.py
jcn16/nert
train
0
7f91ea3c98907597d5448f682966786f1d91b46c
[ "self._value = cookie\nself._quoted = False\nif len(self._value) > 1 and self._value.startswith('\"') and self._value.endswith('\"'):\n self._value = self._value[1:-1]\n self._quoted = True", "if self._quoted:\n yield ('\"' + payload + '\"')\nelse:\n yield payload" ]
<|body_start_0|> self._value = cookie self._quoted = False if len(self._value) > 1 and self._value.startswith('"') and self._value.endswith('"'): self._value = self._value[1:-1] self._quoted = True <|end_body_0|> <|body_start_1|> if self._quoted: yiel...
This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.
SimpleCookie
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleCookie: """This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.""" def __init__(self, cookie): """Sets the string and removes quotes.""" <|body_0|> def replace(self, payload): """Replace entire cookie...
stack_v2_sparse_classes_10k_train_002989
3,236
permissive
[ { "docstring": "Sets the string and removes quotes.", "name": "__init__", "signature": "def __init__(self, cookie)" }, { "docstring": "Replace entire cookie value and add back quotes. List will have a single item. :param payload: payload string :return: list of replacements", "name": "replac...
2
stack_v2_sparse_classes_30k_train_002424
Implement the Python class `SimpleCookie` described below. Class description: This is for simple cookies. They are normally single values. The entire value can be replaced with a payload. Method signatures and docstrings: - def __init__(self, cookie): Sets the string and removes quotes. - def replace(self, payload): ...
Implement the Python class `SimpleCookie` described below. Class description: This is for simple cookies. They are normally single values. The entire value can be replaced with a payload. Method signatures and docstrings: - def __init__(self, cookie): Sets the string and removes quotes. - def replace(self, payload): ...
4483b301034a096b716646a470a6642b3df8ce61
<|skeleton|> class SimpleCookie: """This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.""" def __init__(self, cookie): """Sets the string and removes quotes.""" <|body_0|> def replace(self, payload): """Replace entire cookie...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleCookie: """This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.""" def __init__(self, cookie): """Sets the string and removes quotes.""" self._value = cookie self._quoted = False if len(self._value) > 1 and sel...
the_stack_v2_python_sparse
ava/parsers/cookie.py
indeedsecurity/ava-ce
train
3
222a401d10fb35279cd9603571d067ea60195720
[ "resource_args.AddDatabaseResourceArg(parser, 'to update')\ngroup_parser = parser.add_argument_group(mutex=True)\nflags.EnableDropProtection().AddToParser(group_parser)\nbase.ASYNC_FLAG.AddToParser(parser)", "op = databases.Update(args.CONCEPTS.database.Parse(), args.enable_drop_protection)\nif args.async_:\n ...
<|body_start_0|> resource_args.AddDatabaseResourceArg(parser, 'to update') group_parser = parser.add_argument_group(mutex=True) flags.EnableDropProtection().AddToParser(group_parser) base.ASYNC_FLAG.AddToParser(parser) <|end_body_0|> <|body_start_1|> op = databases.Update(args.C...
Update a Cloud Spanner database.
Update
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Update: """Update a Cloud Spanner database.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed."""...
stack_v2_sparse_classes_10k_train_002990
2,534
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_000388
Implement the Python class `Update` described below. Class description: Update a Cloud Spanner database. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line...
Implement the Python class `Update` described below. Class description: Update a Cloud Spanner database. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Update: """Update a Cloud Spanner database.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Update: """Update a Cloud Spanner database.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" reso...
the_stack_v2_python_sparse
lib/surface/spanner/databases/update.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
20a5f6a70f8cfff97b42bfca47adc83319c0195a
[ "Thread.__init__(self)\nself.tasks = tasks\nself.daemon = True\nself.start()", "while 1:\n func, args, kargs = self.tasks.get()\n try:\n func(*args, **kargs)\n except Exception as e:\n print(e)\n finally:\n self.tasks.task_done()" ]
<|body_start_0|> Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() <|end_body_0|> <|body_start_1|> while 1: func, args, kargs = self.tasks.get() try: func(*args, **kargs) except Exception as e: ...
Thread executing tasks from a given tasks queue
Worker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" <|body_0|> def run(self): """Run the worker thread""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_002991
2,523
permissive
[ { "docstring": "Constructor :param tasks: queue containing tasks to execute", "name": "__init__", "signature": "def __init__(self, tasks)" }, { "docstring": "Run the worker thread", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_003573
Implement the Python class `Worker` described below. Class description: Thread executing tasks from a given tasks queue Method signatures and docstrings: - def __init__(self, tasks): Constructor :param tasks: queue containing tasks to execute - def run(self): Run the worker thread
Implement the Python class `Worker` described below. Class description: Thread executing tasks from a given tasks queue Method signatures and docstrings: - def __init__(self, tasks): Constructor :param tasks: queue containing tasks to execute - def run(self): Run the worker thread <|skeleton|> class Worker: """T...
09692f8d2300172c41ce25331361875c56d0ba4a
<|skeleton|> class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" <|body_0|> def run(self): """Run the worker thread""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() def run(self): """Run th...
the_stack_v2_python_sparse
DEVS Modelling and Simulation/pythonpdevs/src/pypdevs/threadpool.py
baturayo/Modeling-of-Software-Intensive-Systems
train
2
5eae4fc521669e25024b4e7526a1b103c984d9a4
[ "srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir')\nworkdir = tf_cfg.cfg.get('Tempesta', 'workdir')\ntemplate = '%s/etc/js_challenge.tpl' % srcdir\njs_code = '%s/etc/js_challenge.js.tpl' % srcdir\nremote.tempesta.run_cmd('cp %s %s' % (js_code, workdir))\nremote.tempesta.run_cmd('cp %s %s/js1.tpl' % (template, workdir))...
<|body_start_0|> srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir') workdir = tf_cfg.cfg.get('Tempesta', 'workdir') template = '%s/etc/js_challenge.tpl' % srcdir js_code = '%s/etc/js_challenge.js.tpl' % srcdir remote.tempesta.run_cmd('cp %s %s' % (js_code, workdir)) remote.tem...
JSChallengeAfterReload
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSChallengeAfterReload: def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for each vhost.""" <|body_0|> def test(self): """Clients sends the validating request after reload just in time and p...
stack_v2_sparse_classes_10k_train_002992
24,777
no_license
[ { "docstring": "Templates for JS challenge are modified by start script, create a copy of default template for each vhost.", "name": "prepare_js_templates", "signature": "def prepare_js_templates(self)" }, { "docstring": "Clients sends the validating request after reload just in time and passes ...
2
null
Implement the Python class `JSChallengeAfterReload` described below. Class description: Implement the JSChallengeAfterReload class. Method signatures and docstrings: - def prepare_js_templates(self): Templates for JS challenge are modified by start script, create a copy of default template for each vhost. - def test(...
Implement the Python class `JSChallengeAfterReload` described below. Class description: Implement the JSChallengeAfterReload class. Method signatures and docstrings: - def prepare_js_templates(self): Templates for JS challenge are modified by start script, create a copy of default template for each vhost. - def test(...
d56358ea653dbb367624937197ce5e489abf0b00
<|skeleton|> class JSChallengeAfterReload: def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for each vhost.""" <|body_0|> def test(self): """Clients sends the validating request after reload just in time and p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JSChallengeAfterReload: def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for each vhost.""" srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir') workdir = tf_cfg.cfg.get('Tempesta', 'workdir') template = '%s/...
the_stack_v2_python_sparse
sessions/test_js_challenge.py
tempesta-tech/tempesta-test
train
13
67766d909c914465132ff891909fd2f7b2d68b3d
[ "if n <= 0 or k < 0:\n return ''\nres = []\n\ndef helper(i, temp):\n if len(temp) == n:\n res.append(temp)\n return\n for j in range(1, n + 1):\n if str(j) in temp:\n continue\n helper(j, temp + str(j))\nhelper(0, '')\nprint(res)\nreturn res[k - 1]", "if n == 0:\n ...
<|body_start_0|> if n <= 0 or k < 0: return '' res = [] def helper(i, temp): if len(temp) == n: res.append(temp) return for j in range(1, n + 1): if str(j) in temp: continue h...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getPermutation(self, n: int, k: int) -> str: """可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制""" <|body_0|> def getPermutation1(self, n: int, k: int) -> str: """123, 1为首字母,有23,32 ,2! 第n个位置的数字,由 k // (n-1)! 决定""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002993
1,879
no_license
[ { "docstring": "可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制", "name": "getPermutation", "signature": "def getPermutation(self, n: int, k: int) -> str" }, { "docstring": "123, 1为首字母,有23,32 ,2! 第n个位置的数字,由 k // (n-1)! 决定", "name": "getPermutation1", "signature": "def getPermutation1(self, n: int, k: int)...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n: int, k: int) -> str: 可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制 - def getPermutation1(self, n: int, k: int) -> str: 123, 1为首字母,有23,32 ,2! 第n个位置的数字,由 k // (n-1)! 决定
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n: int, k: int) -> str: 可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制 - def getPermutation1(self, n: int, k: int) -> str: 123, 1为首字母,有23,32 ,2! 第n个位置的数字,由 k // (n-1)! 决定...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def getPermutation(self, n: int, k: int) -> str: """可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制""" <|body_0|> def getPermutation1(self, n: int, k: int) -> str: """123, 1为首字母,有23,32 ,2! 第n个位置的数字,由 k // (n-1)! 决定""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getPermutation(self, n: int, k: int) -> str: """可以使用回溯法来做,套用模板 需要求出所有解,超出时间限制""" if n <= 0 or k < 0: return '' res = [] def helper(i, temp): if len(temp) == n: res.append(temp) return for j in ra...
the_stack_v2_python_sparse
StringOperation/getPermutation.py
Philex5/codingPractice
train
0
51ba188f797c263aebb91c02b922df7478b794bd
[ "QMimeData.__init__(self)\nself._local_instance = p_data\nif p_data is not None:\n try:\n p_data = dumps(p_data)\n except Exception:\n return\n self.setData(self.MIME_TYPE, dumps(p_data.__class__) + p_data)", "if self._local_instance is not None:\n return self._local_instance\nio = Strin...
<|body_start_0|> QMimeData.__init__(self) self._local_instance = p_data if p_data is not None: try: p_data = dumps(p_data) except Exception: return self.setData(self.MIME_TYPE, dumps(p_data.__class__) + p_data) <|end_body_0|> <...
The OrcMimeData wraps a Python instance as MIME data.
OrcMimeData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" <|body_0|> def instance(self): """Return the instance.""" <|body_1|> <|end_skeleton|> <|body_start_0|> QMime...
stack_v2_sparse_classes_10k_train_002994
13,946
no_license
[ { "docstring": "Initialise the instance.", "name": "__init__", "signature": "def __init__(self, p_data=None)" }, { "docstring": "Return the instance.", "name": "instance", "signature": "def instance(self)" } ]
2
stack_v2_sparse_classes_30k_train_002558
Implement the Python class `OrcMimeData` described below. Class description: The OrcMimeData wraps a Python instance as MIME data. Method signatures and docstrings: - def __init__(self, p_data=None): Initialise the instance. - def instance(self): Return the instance.
Implement the Python class `OrcMimeData` described below. Class description: The OrcMimeData wraps a Python instance as MIME data. Method signatures and docstrings: - def __init__(self, p_data=None): Initialise the instance. - def instance(self): Return the instance. <|skeleton|> class OrcMimeData: """The OrcMim...
f3ccbbceaed4f4996f6907a2f4880c2fd3f82bbb
<|skeleton|> class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" <|body_0|> def instance(self): """Return the instance.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" QMimeData.__init__(self) self._local_instance = p_data if p_data is not None: try: p_data = dumps(p_data) ...
the_stack_v2_python_sparse
OrcView/Lib/LibTree.py
pubselenium/OrcTestToolsKit
train
0
9be1e23c6c24af6fd14e2478b3c7cb9c6b07b552
[ "self.max_depth = max_depth\nself.save_images = save_images\nself.clock = time.time()\nself.t_buffer = t_buffer\nself.output_dir = output_dir\nself.data_dir = path.join(self.output_dir, '{}'.format(time.strftime('%d_%b_%Y_%H:%M', time.localtime())))\nif self.save_images:\n ensureDir(self.data_dir)\npass\nnp.warn...
<|body_start_0|> self.max_depth = max_depth self.save_images = save_images self.clock = time.time() self.t_buffer = t_buffer self.output_dir = output_dir self.data_dir = path.join(self.output_dir, '{}'.format(time.strftime('%d_%b_%Y_%H:%M', time.localtime()))) if ...
Object to get data from R200
Camera
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Camera: """Object to get data from R200""" def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): """Intitalizes Camera object""" <|body_0|> def connect(self): """Establishes connection to R200 camera""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_002995
6,258
permissive
[ { "docstring": "Intitalizes Camera object", "name": "__init__", "signature": "def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/')" }, { "docstring": "Establishes connection to R200 camera", "name": "connect", "signature": "def connect(self)" }, { ...
5
stack_v2_sparse_classes_30k_test_000270
Implement the Python class `Camera` described below. Class description: Object to get data from R200 Method signatures and docstrings: - def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): Intitalizes Camera object - def connect(self): Establishes connection to R200 camera - def ...
Implement the Python class `Camera` described below. Class description: Object to get data from R200 Method signatures and docstrings: - def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): Intitalizes Camera object - def connect(self): Establishes connection to R200 camera - def ...
08fe54fe37df89ffc7e6378125bb14ad5bead421
<|skeleton|> class Camera: """Object to get data from R200""" def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): """Intitalizes Camera object""" <|body_0|> def connect(self): """Establishes connection to R200 camera""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Camera: """Object to get data from R200""" def __init__(self, max_depth=4.0, save_images=False, t_buffer=5, output_dir='./Trials/'): """Intitalizes Camera object""" self.max_depth = max_depth self.save_images = save_images self.clock = time.time() self.t_buffer = t...
the_stack_v2_python_sparse
Camera/camera.py
marioliu/AutonomousQuadblade
train
0
ec07f6fa25e8536bc98f276fcf3f6582056efbc2
[ "flags.AddParentFlagsToParser(parser)\nparser.add_argument('RECOMMENDATION', type=str, help='Recommendation id which will be marked as active')\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--recommender', metavar='RECOMMENDER', required=True, help='Rec...
<|body_start_0|> flags.AddParentFlagsToParser(parser) parser.add_argument('RECOMMENDATION', type=str, help='Recommendation id which will be marked as active') parser.add_argument('--location', metavar='LOCATION', required=True, help='Location') parser.add_argument('--recommender', metava...
Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organization. ## EXAMPLES To mark a recommenation as ACTIVE: $ {command} RECOMMENDATION...
MarkActive
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarkActive: """Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organization. ## EXAMPLES To mark a recommenation...
stack_v2_sparse_classes_10k_train_002996
2,733
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Run 'gcloud recommender recomme...
2
null
Implement the Python class `MarkActive` described below. Class description: Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organizati...
Implement the Python class `MarkActive` described below. Class description: Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organizati...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class MarkActive: """Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organization. ## EXAMPLES To mark a recommenation...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MarkActive: """Mark Active operations for a recommendation. Mark a recommendation's state as ACTIVE. Can be applied to recommendations in DISMISSED state. This currently supports the following parent entities: project, billing account, folder, and organization. ## EXAMPLES To mark a recommenation as ACTIVE: $...
the_stack_v2_python_sparse
lib/surface/recommender/recommendations/mark_active.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
ebcb97e058c714c3c336aa38be84fa4228d4f6f6
[ "if not root:\n return []\nres = []\nqueue = [root]\nwhile queue:\n level_node = []\n temp = []\n for i in queue:\n level_node.append(i.val)\n if i.left:\n temp.append(i.left)\n if i.right:\n temp.append(i.right)\n res.append(level_node)\n queue = temp\nr...
<|body_start_0|> if not root: return [] res = [] queue = [root] while queue: level_node = [] temp = [] for i in queue: level_node.append(i.val) if i.left: temp.append(i.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" <|body_0|> def levelOrder1(self, root: TreeNode) -> List[List[int]]: """递归""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return []...
stack_v2_sparse_classes_10k_train_002997
1,795
no_license
[ { "docstring": "bfs 迭代:相对来说用队列就能实现", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "递归", "name": "levelOrder1", "signature": "def levelOrder1(self, root: TreeNode) -> List[List[int]]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: bfs 迭代:相对来说用队列就能实现 - def levelOrder1(self, root: TreeNode) -> List[List[int]]: 递归
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: bfs 迭代:相对来说用队列就能实现 - def levelOrder1(self, root: TreeNode) -> List[List[int]]: 递归 <|skeleton|> class Solution: def ...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" <|body_0|> def levelOrder1(self, root: TreeNode) -> List[List[int]]: """递归""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" if not root: return [] res = [] queue = [root] while queue: level_node = [] temp = [] for i in queue: level_node.a...
the_stack_v2_python_sparse
算法/Week_02/102. 二叉树的层序遍历.py
RichieSong/algorithm
train
0
0c19baaed8b431a649a08a96819e1047e32afe55
[ "try:\n getattr(logging, value.upper())\nexcept AttributeError as err:\n raise ValueError(f'{value.upper()} is not a valid level') from err\nreturn value.upper()", "assert issubclass(self.__class__, MixinLoggingSettings)\nassert hasattr(self, 'LOG_LEVEL')\nreturn getattr(logging, self.LOG_LEVEL.upper())" ]
<|body_start_0|> try: getattr(logging, value.upper()) except AttributeError as err: raise ValueError(f'{value.upper()} is not a valid level') from err return value.upper() <|end_body_0|> <|body_start_1|> assert issubclass(self.__class__, MixinLoggingSettings) ...
USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging
MixinLoggingSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" <|body_0|> def log_level(self) -> int: ...
stack_v2_sparse_classes_10k_train_002998
862
permissive
[ { "docstring": "Standard implementation for @validator(\"LOG_LEVEL\")", "name": "validate_log_level", "signature": "def validate_log_level(cls, value: str) -> str" }, { "docstring": "Can be used in logging.setLogLevel()", "name": "log_level", "signature": "def log_level(self) -> int" }...
2
stack_v2_sparse_classes_30k_train_006339
Implement the Python class `MixinLoggingSettings` described below. Class description: USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging Method signatures and docstrings: - def validate_log_level(cls, value: str) -> str: Standard implementation for @validator("LOG_LEVEL") - def...
Implement the Python class `MixinLoggingSettings` described below. Class description: USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging Method signatures and docstrings: - def validate_log_level(cls, value: str) -> str: Standard implementation for @validator("LOG_LEVEL") - def...
f4c57ffc7b494ac06a2692cb5539d3acfd3d1d63
<|skeleton|> class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" <|body_0|> def log_level(self) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" try: getattr(logging, value.upper()) except ...
the_stack_v2_python_sparse
packages/settings-library/src/settings_library/utils_logging.py
ITISFoundation/osparc-simcore
train
39
081caee2d7425799f53590fdd7fc6c64c37aff29
[ "self.problem = problem\nself.agents = agents\nself.max_value = max_value\nself.path_set = PathSet(self.agents, self.problem.heuristic)\nself.cats = []\nif cat is not None:\n self.cats.append(cat)\nself.cats.append(self.path_set.cat)\nself.stat_tracker = stat_tracker", "agents = copy(self.agents)\ngroups = []\...
<|body_start_0|> self.problem = problem self.agents = agents self.max_value = max_value self.path_set = PathSet(self.agents, self.problem.heuristic) self.cats = [] if cat is not None: self.cats.append(cat) self.cats.append(self.path_set.cat) se...
Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group
IDSolver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IDSolver: """Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group""" def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')): ...
stack_v2_sparse_classes_10k_train_002999
4,961
permissive
[ { "docstring": "Constructs an IDSolver instance :param problem: MAPF problem instance that needs to be solved :param agents: Agents that belong to the problem :param cat: Additional Collision Avoidance Table that should be used in calculating the result :param stat_tracker Statistic tracker :param max_value: Ma...
3
stack_v2_sparse_classes_30k_train_004318
Implement the Python class `IDSolver` described below. Class description: Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group Method signatures and docstrings: - def __init__(self, problem: MAPFProblem, agents: List[A...
Implement the Python class `IDSolver` described below. Class description: Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group Method signatures and docstrings: - def __init__(self, problem: MAPFProblem, agents: List[A...
13d8716f932bb98398fe8e190e668ee65bcf0f34
<|skeleton|> class IDSolver: """Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group""" def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IDSolver: """Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group""" def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')): """Cons...
the_stack_v2_python_sparse
src/solver/epeastar/independence_detection.py
tbvanderwoude/matching-epea-star
train
0