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 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
be7f35f4965cd3444bb23533ab5e812ab1bee08e | [
"assert isinstance(name, str)\nassert max_level in (3, 5)\nassert isinstance(damage_type, DamageType)\nif co_mp is None:\n co_mp = [0, 0]\nself.name, self.max_level = (name, max_level)\nself.co_ad, self.co_ap, self.co_hp, self.co_mp = (co_ad, co_ap, co_hp, co_mp)\nself.damage_type = damage_type\nself.extra_func ... | <|body_start_0|>
assert isinstance(name, str)
assert max_level in (3, 5)
assert isinstance(damage_type, DamageType)
if co_mp is None:
co_mp = [0, 0]
self.name, self.max_level = (name, max_level)
self.co_ad, self.co_ap, self.co_hp, self.co_mp = (co_ad, co_ap, c... | 技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种 | Ability | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ability:
"""技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种"""
def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=None, damage_type=DamageType.ad, extra_func=None):
""":param name: :param max_level: :param co_ad: :param co_ap: :param co_hp: :param rare_da... | stack_v2_sparse_classes_75kplus_train_003900 | 13,336 | no_license | [
{
"docstring": ":param name: :param max_level: :param co_ad: :param co_ap: :param co_hp: :param rare_damage: :param co_mp: :param co_all: :param damage_type: :param extra_func:",
"name": "__init__",
"signature": "def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=No... | 3 | stack_v2_sparse_classes_30k_train_029200 | Implement the Python class `Ability` described below.
Class description:
技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种
Method signatures and docstrings:
- def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=None, damage_type=DamageType.ad, extra_func=None): :param name: :param max_level:... | Implement the Python class `Ability` described below.
Class description:
技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种
Method signatures and docstrings:
- def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=None, damage_type=DamageType.ad, extra_func=None): :param name: :param max_level:... | e240a800bfd11ffc1ef78e02aaff4682e65e09ad | <|skeleton|>
class Ability:
"""技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种"""
def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=None, damage_type=DamageType.ad, extra_func=None):
""":param name: :param max_level: :param co_ad: :param co_ap: :param co_hp: :param rare_da... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ability:
"""技能 描述技能的裸伤害(无装备) 系数加成 伤害类型 目前伤害类型只能是一种"""
def __init__(self, name, max_level, co_ad, co_ap, co_hp, rare_damage, co_mp=None, co_all=None, damage_type=DamageType.ad, extra_func=None):
""":param name: :param max_level: :param co_ad: :param co_ap: :param co_hp: :param rare_damage: :param ... | the_stack_v2_python_sparse | lol/unitmodel.py | war16641/python | train | 0 |
2b8f5385e461c8ff946930c1049432cc48882c09 | [
"logger.configure('./.test')\nnenv = 10\nenv = make_env('CartPole-v1', nenv)\nenv = VecObsNormWrapper(env, log_prob=1.0)\nprint(env.observation_space)\nenv.reset()\nassert env.t == 0\nfor _ in range(5):\n env.step(np.array([env.action_space.sample() for _ in range(nenv)]))\nstate = env.state_dict()\nassert state... | <|body_start_0|>
logger.configure('./.test')
nenv = 10
env = make_env('CartPole-v1', nenv)
env = VecObsNormWrapper(env, log_prob=1.0)
print(env.observation_space)
env.reset()
assert env.t == 0
for _ in range(5):
env.step(np.array([env.action_sp... | Test. | TestObNorm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestObNorm:
"""Test."""
def test_vec(self):
"""Test vec wrapper."""
<|body_0|>
def test_nested_observations(self):
"""Test nested observations."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
logger.configure('./.test')
nenv = 10
... | stack_v2_sparse_classes_75kplus_train_003901 | 7,837 | no_license | [
{
"docstring": "Test vec wrapper.",
"name": "test_vec",
"signature": "def test_vec(self)"
},
{
"docstring": "Test nested observations.",
"name": "test_nested_observations",
"signature": "def test_nested_observations(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019254 | Implement the Python class `TestObNorm` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_vec(self): Test vec wrapper.
- def test_nested_observations(self): Test nested observations. | Implement the Python class `TestObNorm` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_vec(self): Test vec wrapper.
- def test_nested_observations(self): Test nested observations.
<|skeleton|>
class TestObNorm:
"""Test."""
def test_vec(self):
"""Test vec wrapp... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class TestObNorm:
"""Test."""
def test_vec(self):
"""Test vec wrapper."""
<|body_0|>
def test_nested_observations(self):
"""Test nested observations."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestObNorm:
"""Test."""
def test_vec(self):
"""Test vec wrapper."""
logger.configure('./.test')
nenv = 10
env = make_env('CartPole-v1', nenv)
env = VecObsNormWrapper(env, log_prob=1.0)
print(env.observation_space)
env.reset()
assert env.t ==... | the_stack_v2_python_sparse | dl/rl/envs/obs_norm_wrappers.py | cbschaff/dl | train | 1 |
b69f442a65f2e9c8f819e76d75ef6f48b2cb1056 | [
"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... | The MruV server service provides procedures for managing game platform server actions. | MruVServerServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
<|body_0|>
def GetRegisteredServers(self, request, ... | stack_v2_sparse_classes_75kplus_train_003902 | 9,501 | permissive | [
{
"docstring": "Register instance of server for further managing.",
"name": "RegisterServer",
"signature": "def RegisterServer(self, request, context)"
},
{
"docstring": "Get all registered servers.",
"name": "GetRegisteredServers",
"signature": "def GetRegisteredServers(self, request, c... | 5 | stack_v2_sparse_classes_30k_train_050438 | Implement the Python class `MruVServerServiceServicer` described below.
Class description:
The MruV server service provides procedures for managing game platform server actions.
Method signatures and docstrings:
- def RegisterServer(self, request, context): Register instance of server for further managing.
- def GetR... | Implement the Python class `MruVServerServiceServicer` described below.
Class description:
The MruV server service provides procedures for managing game platform server actions.
Method signatures and docstrings:
- def RegisterServer(self, request, context): Register instance of server for further managing.
- def GetR... | 2a640f7667d23f39e50ccc9ba73c98138c6839b5 | <|skeleton|>
class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
<|body_0|>
def GetRegisteredServers(self, request, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_d... | the_stack_v2_python_sparse | server/server_pb2_grpc.py | MruV-RP/mruv-pb_python | train | 0 |
33ae91c7452eefeeb3dbc8a1200c3367daf4496f | [
"try:\n volumeList = SanApi().getVolumeList()\n response = volumeList.getCleanDict()\nexcept Exception as ex:\n self._logger.error(str(ex))\n self.handleException(ex)\n response = self.errorResponse(str(ex))\n return self.formatResponse(response)",
"try:\n volume = SanApi().addVolume(storageA... | <|body_start_0|>
try:
volumeList = SanApi().getVolumeList()
response = volumeList.getCleanDict()
except Exception as ex:
self._logger.error(str(ex))
self.handleException(ex)
response = self.errorResponse(str(ex))
return self.formatR... | Admin SAN controller class. DEPRECATED. | SanController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SanController:
"""Admin SAN controller class. DEPRECATED."""
def getVolumeList(self):
"""Return list of all available volumes"""
<|body_0|>
def addVolume(self, storageAdapter, size, nameFormat='*', shared=False):
"""Add volume to the SAN system"""
<|body_... | stack_v2_sparse_classes_75kplus_train_003903 | 3,159 | permissive | [
{
"docstring": "Return list of all available volumes",
"name": "getVolumeList",
"signature": "def getVolumeList(self)"
},
{
"docstring": "Add volume to the SAN system",
"name": "addVolume",
"signature": "def addVolume(self, storageAdapter, size, nameFormat='*', shared=False)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_001411 | Implement the Python class `SanController` described below.
Class description:
Admin SAN controller class. DEPRECATED.
Method signatures and docstrings:
- def getVolumeList(self): Return list of all available volumes
- def addVolume(self, storageAdapter, size, nameFormat='*', shared=False): Add volume to the SAN syst... | Implement the Python class `SanController` described below.
Class description:
Admin SAN controller class. DEPRECATED.
Method signatures and docstrings:
- def getVolumeList(self): Return list of all available volumes
- def addVolume(self, storageAdapter, size, nameFormat='*', shared=False): Add volume to the SAN syst... | 56d808d7836cd15d6c6748cbf704cdea4407fef6 | <|skeleton|>
class SanController:
"""Admin SAN controller class. DEPRECATED."""
def getVolumeList(self):
"""Return list of all available volumes"""
<|body_0|>
def addVolume(self, storageAdapter, size, nameFormat='*', shared=False):
"""Add volume to the SAN system"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SanController:
"""Admin SAN controller class. DEPRECATED."""
def getVolumeList(self):
"""Return list of all available volumes"""
try:
volumeList = SanApi().getVolumeList()
response = volumeList.getCleanDict()
except Exception as ex:
self._logger... | the_stack_v2_python_sparse | src/installer/src/tortuga/web_service/controllers/sanController.py | UnivaCorporation/tortuga | train | 33 |
45985f0a94fd9f4c62e27464d128c0b76636051f | [
"self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself._servs = servs\nself._apps = apps\nself._socket.bind((self._servs.ip_addr, self._apps.tcp_port))\nself._socket.listen(self._servs.listen_clients)",
"try:\n while 1:\n connection, addres = self._socket.accept()\n print('Connec... | <|body_start_0|>
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._servs = servs
self._apps = apps
self._socket.bind((self._servs.ip_addr, self._apps.tcp_port))
self._socket.listen(self._servs.listen_clients)
<|end_body_0|>
<|body_start_1|>
try:
... | Session in server. | ServerSession | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServerSession:
"""Session in server."""
def __init__(self, servs, apps):
"""Making TCP-connection"""
<|body_0|>
def start(self):
"""Start session for client."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self._socket = socket.socket(socket.AF_... | stack_v2_sparse_classes_75kplus_train_003904 | 6,121 | no_license | [
{
"docstring": "Making TCP-connection",
"name": "__init__",
"signature": "def __init__(self, servs, apps)"
},
{
"docstring": "Start session for client.",
"name": "start",
"signature": "def start(self)"
}
] | 2 | null | Implement the Python class `ServerSession` described below.
Class description:
Session in server.
Method signatures and docstrings:
- def __init__(self, servs, apps): Making TCP-connection
- def start(self): Start session for client. | Implement the Python class `ServerSession` described below.
Class description:
Session in server.
Method signatures and docstrings:
- def __init__(self, servs, apps): Making TCP-connection
- def start(self): Start session for client.
<|skeleton|>
class ServerSession:
"""Session in server."""
def __init__(se... | 90c3bf7fa3688878b2ffd1abc2b763fed4739091 | <|skeleton|>
class ServerSession:
"""Session in server."""
def __init__(self, servs, apps):
"""Making TCP-connection"""
<|body_0|>
def start(self):
"""Start session for client."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServerSession:
"""Session in server."""
def __init__(self, servs, apps):
"""Making TCP-connection"""
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._servs = servs
self._apps = apps
self._socket.bind((self._servs.ip_addr, self._apps.tcp_port))... | the_stack_v2_python_sparse | bin/protocol.py | ILikePythonAndDjango/MyChat | train | 0 |
b61ab93495b669f2bee0af4540e64bb974c4fc60 | [
"if not email:\n raise ValueError('Uers must have an email address')\nemail = self.normalize_email(email)\nif profile_picture == None:\n profile_picture = 'photos/user.gif'\nuser = self.model(email=email, name=name, profile_picture=profile_picture, highest_degree_earned=highest_degree_earned, college_name=col... | <|body_start_0|>
if not email:
raise ValueError('Uers must have an email address')
email = self.normalize_email(email)
if profile_picture == None:
profile_picture = 'photos/user.gif'
user = self.model(email=email, name=name, profile_picture=profile_picture, highes... | Helps Django work with our custom user model. | UserProfileManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserProfileManager:
"""Helps Django work with our custom user model."""
def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, skill_6, join_date, password=None):
"""Creates a new user pro... | stack_v2_sparse_classes_75kplus_train_003905 | 7,179 | no_license | [
{
"docstring": "Creates a new user profile object.",
"name": "create_user",
"signature": "def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, skill_6, join_date, password=None)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_005640 | Implement the Python class `UserProfileManager` described below.
Class description:
Helps Django work with our custom user model.
Method signatures and docstrings:
- def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, s... | Implement the Python class `UserProfileManager` described below.
Class description:
Helps Django work with our custom user model.
Method signatures and docstrings:
- def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, s... | 9c2c472f6a9bfd0d74f49f1fdd9625c71f2ad7aa | <|skeleton|>
class UserProfileManager:
"""Helps Django work with our custom user model."""
def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, skill_6, join_date, password=None):
"""Creates a new user pro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserProfileManager:
"""Helps Django work with our custom user model."""
def create_user(self, email, name, profile_picture, highest_degree_earned, college_name, graduation_year, skill_1, skill_2, skill_3, skill_4, skill_5, skill_6, join_date, password=None):
"""Creates a new user profile object."... | the_stack_v2_python_sparse | profiles/models.py | aquibxv/findem | train | 1 |
c0a26c4ee40c5e7a1bc91eb030c4c311b14be04b | [
"if mock_dispatcher is None:\n dispatcher = CheckerDispatcher()\nelse:\n dispatcher = mock_dispatcher\nif mock_increment_error_count is None:\n\n def increment_error_count():\n \"\"\"Increment the total count of reported errors.\"\"\"\n self.error_count += 1\nelse:\n increment_error_count ... | <|body_start_0|>
if mock_dispatcher is None:
dispatcher = CheckerDispatcher()
else:
dispatcher = mock_dispatcher
if mock_increment_error_count is None:
def increment_error_count():
"""Increment the total count of reported errors."""
... | A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance. | StyleProcessor | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StyleProcessor:
"""A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance."""
def __init__(self, configuration, mock_dispatcher=None, mock_increment_error_count=None, mock_carriage_checker_class=No... | stack_v2_sparse_classes_75kplus_train_003906 | 23,775 | permissive | [
{
"docstring": "Create an instance. Args: configuration: A StyleProcessorConfiguration instance. mock_dispatcher: A mock CheckerDispatcher instance. This parameter is for unit testing. Defaults to a CheckerDispatcher instance. mock_increment_error_count: A mock error-count incrementer. mock_carriage_checker_cla... | 3 | stack_v2_sparse_classes_30k_train_044227 | Implement the Python class `StyleProcessor` described below.
Class description:
A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance.
Method signatures and docstrings:
- def __init__(self, configuration, mock_dispatcher=N... | Implement the Python class `StyleProcessor` described below.
Class description:
A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance.
Method signatures and docstrings:
- def __init__(self, configuration, mock_dispatcher=N... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class StyleProcessor:
"""A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance."""
def __init__(self, configuration, mock_dispatcher=None, mock_increment_error_count=None, mock_carriage_checker_class=No... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StyleProcessor:
"""A ProcessorBase for checking style. Attributes: error_count: An integer that is the total number of reported errors for the lifetime of this instance."""
def __init__(self, configuration, mock_dispatcher=None, mock_increment_error_count=None, mock_carriage_checker_class=None):
... | the_stack_v2_python_sparse | third_party/blink/tools/blinkpy/style/checker.py | chromium/chromium | train | 17,408 |
3a33bb497ea6281b6ce41d076ce36547b105cb0b | [
"self._trees_num = trees_num\nself._depth = depth\nself._output_logits_dim = output_logits_dim\nself._smooth_step_param = smooth_step_param\nself._parallelize_over_samples = parallelize_over_samples\nself._sum_outputs = sum_outputs\nself._split_initializer = keras.initializers.get(split_initializer)\nself._leaf_ini... | <|body_start_0|>
self._trees_num = trees_num
self._depth = depth
self._output_logits_dim = output_logits_dim
self._smooth_step_param = smooth_step_param
self._parallelize_over_samples = parallelize_over_samples
self._sum_outputs = sum_outputs
self._split_initializ... | A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be routed in a hard way (i.e., sent to only one child) or in a soft way. T... | TEL | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TEL:
"""A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be routed in a hard way (i.e., sent to only... | stack_v2_sparse_classes_75kplus_train_003907 | 8,204 | permissive | [
{
"docstring": "Initializes neural trees layer.",
"name": "__init__",
"signature": "def __init__(self, output_logits_dim, trees_num=1, depth=3, smooth_step_param=1.0, sum_outputs=True, parallelize_over_samples=False, split_initializer=RandomUniform(-0.01, 0.01), leaf_initializer=RandomUniform(-0.01, 0.0... | 5 | stack_v2_sparse_classes_30k_train_049612 | Implement the Python class `TEL` described below.
Class description:
A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be r... | Implement the Python class `TEL` described below.
Class description:
A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be r... | 727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7 | <|skeleton|>
class TEL:
"""A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be routed in a hard way (i.e., sent to only... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TEL:
"""A custom layer containing additive differentiable decision trees. Each tree in the layer is composed of splitting (internal) nodes and leaves. A splitting node "routes" the samples left or right based on the corresponding activation. Samples can be routed in a hard way (i.e., sent to only one child) o... | the_stack_v2_python_sparse | tf_trees/tel.py | Ayoob7/google-research | train | 2 |
1ec2a8a7f7599332eeb6b3512e271e9ea773e59e | [
"super(SpectralNormConv2D, self).__init__()\nself.filters = filters\nself.kernel_size = kernel_size\nself.stride = stride\nself.padding = padding.upper()\nself.iteration = iteration\nself.scope = scope",
"with tf.variable_scope(self.scope):\n w = tf.get_variable('kernel', shape=[self.kernel_size, self.kernel_s... | <|body_start_0|>
super(SpectralNormConv2D, self).__init__()
self.filters = filters
self.kernel_size = kernel_size
self.stride = stride
self.padding = padding.upper()
self.iteration = iteration
self.scope = scope
<|end_body_0|>
<|body_start_1|>
with tf.var... | SpectralNormConv2D | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpectralNormConv2D:
def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'):
"""Convolutional layer containing a wrapper to spectral_norm() :param filters: (int) number of filters :param kernel_size: (int) kernel size for the convolutional layer... | stack_v2_sparse_classes_75kplus_train_003908 | 3,440 | permissive | [
{
"docstring": "Convolutional layer containing a wrapper to spectral_norm() :param filters: (int) number of filters :param kernel_size: (int) kernel size for the convolutional layer :param stride: (int) stride for the convolutional layer :param padding: (str) padding to apply to the convolved tensor :param iter... | 2 | stack_v2_sparse_classes_30k_train_014634 | Implement the Python class `SpectralNormConv2D` described below.
Class description:
Implement the SpectralNormConv2D class.
Method signatures and docstrings:
- def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): Convolutional layer containing a wrapper to spectral_norm(... | Implement the Python class `SpectralNormConv2D` described below.
Class description:
Implement the SpectralNormConv2D class.
Method signatures and docstrings:
- def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'): Convolutional layer containing a wrapper to spectral_norm(... | fc05d70d411d20147075392c14fced274c1bf6ee | <|skeleton|>
class SpectralNormConv2D:
def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'):
"""Convolutional layer containing a wrapper to spectral_norm() :param filters: (int) number of filters :param kernel_size: (int) kernel size for the convolutional layer... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpectralNormConv2D:
def __init__(self, filters, kernel_size=3, stride=1, padding='same', iteration=1, scope='sn_conv'):
"""Convolutional layer containing a wrapper to spectral_norm() :param filters: (int) number of filters :param kernel_size: (int) kernel size for the convolutional layer :param stride... | the_stack_v2_python_sparse | idas/losses/models/_internal/_sdnet/layers/spectral_norm.py | gvalvano/multiscale-adversarial-attention-gates | train | 40 | |
8d4ef2030156e35ba3062b13eb9c440cd71a0e36 | [
"self.nombreProyecto = nombreProyecto\nself.projectLeaderId = projectLeaderId\nself.fechaInicio = fechaInicio\nself.fechaFinalizacion = fechaFinalizacion\nself.observacion = observacion\nself.presupuesto = presupuesto\nself.estado = estado",
"self.nombreProyecto = nombreProyecto\nself.projectLeaderId = projectLea... | <|body_start_0|>
self.nombreProyecto = nombreProyecto
self.projectLeaderId = projectLeaderId
self.fechaInicio = fechaInicio
self.fechaFinalizacion = fechaFinalizacion
self.observacion = observacion
self.presupuesto = presupuesto
self.estado = estado
<|end_body_0|>... | Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, FechaFinalizacion, fases, projectLeader, Observacion, Presupuesto | Proyecto | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Proyecto:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, FechaFinalizacion, fases, projectLeader,... | stack_v2_sparse_classes_75kplus_train_003909 | 4,142 | no_license | [
{
"docstring": "Metodo para establecer valores de atributos de la clase. @type nombreProyecto : string @param nombreProyecto : nombre del proyecto @type projectLeaderId : Integer @param projectLeaderId : id del project leader @type fechaInicio : date @param fechaInicio : fecha de inicio del proyecto @type fecha... | 2 | stack_v2_sparse_classes_30k_train_016287 | Implement the Python class `Proyecto` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, F... | Implement the Python class `Proyecto` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, F... | 9262320d4ff52bd3592365cd232f8dedff4f64da | <|skeleton|>
class Proyecto:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, FechaFinalizacion, fases, projectLeader,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Proyecto:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de PROYECTO Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Atributos de la clase: idProyecto, nombreProyecto, FechaInicio, FechaFinalizacion, fases, projectLeader, Observacion,... | the_stack_v2_python_sparse | models/proyectoModelo.py | jemaromaster/WAPM | train | 0 |
0199f93f852d0f1dad8dce51c4bd2c2f64898011 | [
"timestamp_string = plist_key.get(plist_value_name, None)\nif not timestamp_string:\n return None\ntry:\n timestamp = float(timestamp_string)\nexcept (TypeError, ValueError):\n parser_mediator.ProduceExtractionWarning('unable to convert Cocoa timestamp: {0:s} to a floating-point value'.format(timestamp_str... | <|body_start_0|>
timestamp_string = plist_key.get(plist_value_name, None)
if not timestamp_string:
return None
try:
timestamp = float(timestamp_string)
except (TypeError, ValueError):
parser_mediator.ProduceExtractionWarning('unable to convert Cocoa ti... | Plist parser plugin for Safari history plist files. | SafariHistoryPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SafariHistoryPlugin:
"""Plist parser plugin for Safari history plist files."""
def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name):
"""Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interacti... | stack_v2_sparse_classes_75kplus_train_003910 | 3,790 | permissive | [
{
"docstring": "Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. plist_key (object): plist key. plist_value_name (str): name of the value in the plist key. Returns: dfdatetime.Ti... | 2 | stack_v2_sparse_classes_30k_train_019223 | Implement the Python class `SafariHistoryPlugin` described below.
Class description:
Plist parser plugin for Safari history plist files.
Method signatures and docstrings:
- def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): Retrieves a date and time value from a Cocoa timestamp. A... | Implement the Python class `SafariHistoryPlugin` described below.
Class description:
Plist parser plugin for Safari history plist files.
Method signatures and docstrings:
- def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): Retrieves a date and time value from a Cocoa timestamp. A... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class SafariHistoryPlugin:
"""Plist parser plugin for Safari history plist files."""
def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name):
"""Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interacti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SafariHistoryPlugin:
"""Plist parser plugin for Safari history plist files."""
def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name):
"""Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interactions between p... | the_stack_v2_python_sparse | plaso/parsers/plist_plugins/safari_history.py | log2timeline/plaso | train | 1,506 |
57a055ac684c7315733995a63ae148bc0a7acd88 | [
"parentDir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))\nself._quotePath = parentDir + '/clean_quotes/'\nself._tradePath = parentDir + '/clean_trades/'\nself._dataName = dataName\nself._valMatrix = []\nself._dateList = ['']\nstartDate = datetime(2007, 6, 20)\nendDate = datetime(2007, 9... | <|body_start_0|>
parentDir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
self._quotePath = parentDir + '/clean_quotes/'
self._tradePath = parentDir + '/clean_trades/'
self._dataName = dataName
self._valMatrix = []
self._dateList = ['']
... | A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file based on the matrix generated | MatrixToCSV | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MatrixToCSV:
"""A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file based on the matrix generated"""
de... | stack_v2_sparse_classes_75kplus_train_003911 | 3,923 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, dataName)"
},
{
"docstring": "method to generate a matrix for specified data Parameters ----- func: function i.e., lambda x: x.computeMinReturns()",
"name": "matrixGenerator",
"signature": "def matrixGener... | 3 | stack_v2_sparse_classes_30k_train_013268 | Implement the Python class `MatrixToCSV` described below.
Class description:
A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file b... | Implement the Python class `MatrixToCSV` described below.
Class description:
A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file b... | 4aabbb41b2e9ce18172e010527c59d53ffb95984 | <|skeleton|>
class MatrixToCSV:
"""A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file based on the matrix generated"""
de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MatrixToCSV:
"""A class that take a binary trade data file and calculate the lag return Attributes ------ _dataName : dataName Data needed to compute Method ------ matrixGenerator(self) Generate matrix for acquired data csvGeneratro(self) Generate csv file based on the matrix generated"""
def __init__(se... | the_stack_v2_python_sparse | Homework3/CovMatrix/MatrixToCSV.py | nateehuang/AlgorTradingGithub | train | 0 |
db61ba8bb68ca237bade264cca61074760db525a | [
"integral_strategy_settings = member_models.IntegralStrategySettings.select().dj_where(webapp_id=self.corp.webapp_id).first()\nif not integral_strategy_settings:\n return MallConfigFactory.get(self.corp).create_default_integral_strategy()\nelse:\n return IntegralStrategy(integral_strategy_settings)",
"mall_... | <|body_start_0|>
integral_strategy_settings = member_models.IntegralStrategySettings.select().dj_where(webapp_id=self.corp.webapp_id).first()
if not integral_strategy_settings:
return MallConfigFactory.get(self.corp).create_default_integral_strategy()
else:
return Integra... | MallConfigRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MallConfigRepository:
def get_integral_strategy(self):
"""获得积分策略"""
<|body_0|>
def get_webapp_config(self):
"""获得WebappConfig对象"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
integral_strategy_settings = member_models.IntegralStrategySettings.selec... | stack_v2_sparse_classes_75kplus_train_003912 | 1,596 | no_license | [
{
"docstring": "获得积分策略",
"name": "get_integral_strategy",
"signature": "def get_integral_strategy(self)"
},
{
"docstring": "获得WebappConfig对象",
"name": "get_webapp_config",
"signature": "def get_webapp_config(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018215 | Implement the Python class `MallConfigRepository` described below.
Class description:
Implement the MallConfigRepository class.
Method signatures and docstrings:
- def get_integral_strategy(self): 获得积分策略
- def get_webapp_config(self): 获得WebappConfig对象 | Implement the Python class `MallConfigRepository` described below.
Class description:
Implement the MallConfigRepository class.
Method signatures and docstrings:
- def get_integral_strategy(self): 获得积分策略
- def get_webapp_config(self): 获得WebappConfig对象
<|skeleton|>
class MallConfigRepository:
def get_integral_st... | 39860a451678ab50ad93ce8ebe2ef8490af65d62 | <|skeleton|>
class MallConfigRepository:
def get_integral_strategy(self):
"""获得积分策略"""
<|body_0|>
def get_webapp_config(self):
"""获得WebappConfig对象"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MallConfigRepository:
def get_integral_strategy(self):
"""获得积分策略"""
integral_strategy_settings = member_models.IntegralStrategySettings.select().dj_where(webapp_id=self.corp.webapp_id).first()
if not integral_strategy_settings:
return MallConfigFactory.get(self.corp).create... | the_stack_v2_python_sparse | business/mall/config/mall_config_repository.py | chengdg/gaia | train | 0 | |
247febe185a6f8fdbde65c0e7e86f695bf001a05 | [
"matrix_new = []\nn = len(matrix)\nfor x in range(n):\n matrix_new.append([])\nfor i, rv in enumerate(matrix):\n for j, cv in enumerate(rv):\n matrix_new[j].insert(0, cv)\nmatrix[:] = matrix_new",
"n = len(matrix)\nfor i in range(n // 2):\n for j in range((n + 1) // 2):\n temp = matrix[i][j... | <|body_start_0|>
matrix_new = []
n = len(matrix)
for x in range(n):
matrix_new.append([])
for i, rv in enumerate(matrix):
for j, cv in enumerate(rv):
matrix_new[j].insert(0, cv)
matrix[:] = matrix_new
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate(self, matrix) -> None:
"""思路:matrix_new[col][n - row - 1] = matrix[row][col]"""
<|body_0|>
def rotate2(self, matrix) -> None:
"""思路:元素按圈顺时针旋转,如:1、11、16、15一个圈,1、10、12、13一个圈 关键等式:matrix_new[col][n-row-1] = matrix[row][col] 1. temp = matrix[col][n-r... | stack_v2_sparse_classes_75kplus_train_003913 | 1,894 | no_license | [
{
"docstring": "思路:matrix_new[col][n - row - 1] = matrix[row][col]",
"name": "rotate",
"signature": "def rotate(self, matrix) -> None"
},
{
"docstring": "思路:元素按圈顺时针旋转,如:1、11、16、15一个圈,1、10、12、13一个圈 关键等式:matrix_new[col][n-row-1] = matrix[row][col] 1. temp = matrix[col][n-row-1] matrix[col][n-row-1... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix) -> None: 思路:matrix_new[col][n - row - 1] = matrix[row][col]
- def rotate2(self, matrix) -> None: 思路:元素按圈顺时针旋转,如:1、11、16、15一个圈,1、10、12、13一个圈 关键等式:matrix_n... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix) -> None: 思路:matrix_new[col][n - row - 1] = matrix[row][col]
- def rotate2(self, matrix) -> None: 思路:元素按圈顺时针旋转,如:1、11、16、15一个圈,1、10、12、13一个圈 关键等式:matrix_n... | 55601265c1dcbf25a9ebedec3025b3d2ca3f05f0 | <|skeleton|>
class Solution:
def rotate(self, matrix) -> None:
"""思路:matrix_new[col][n - row - 1] = matrix[row][col]"""
<|body_0|>
def rotate2(self, matrix) -> None:
"""思路:元素按圈顺时针旋转,如:1、11、16、15一个圈,1、10、12、13一个圈 关键等式:matrix_new[col][n-row-1] = matrix[row][col] 1. temp = matrix[col][n-r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotate(self, matrix) -> None:
"""思路:matrix_new[col][n - row - 1] = matrix[row][col]"""
matrix_new = []
n = len(matrix)
for x in range(n):
matrix_new.append([])
for i, rv in enumerate(matrix):
for j, cv in enumerate(rv):
... | the_stack_v2_python_sparse | matrix.py | 356108814/algorithm | train | 0 | |
aa1d3baaa7763c1db1d8c22648f4b9571a626e8e | [
"super(ClearCaseRepositoryInfo, self).__init__(path, base_path)\nself.vobtag = vobtag\nself.tool = tool",
"path = info['repopath']\nself.path = path\nself.base_path = path",
"RemovedInRBTools40Warning.warn('The find_server_repository_info method is deprecated, and will be removed in RBTools 4.0. If you need to ... | <|body_start_0|>
super(ClearCaseRepositoryInfo, self).__init__(path, base_path)
self.vobtag = vobtag
self.tool = tool
<|end_body_0|>
<|body_start_1|>
path = info['repopath']
self.path = path
self.base_path = path
<|end_body_1|>
<|body_start_2|>
RemovedInRBTools4... | A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ. | ClearCaseRepositoryInfo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClearCaseRepositoryInfo:
"""A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ."""
def __init__(self, path, base_path, vobtag, tool=None):
"""Initialize the repsitory info. Args: path (uni... | stack_v2_sparse_classes_75kplus_train_003914 | 48,097 | permissive | [
{
"docstring": "Initialize the repsitory info. Args: path (unicode): The path of the repository. base_path (unicode): The relative path between the repository root and the working directory. vobtag (unicode): The VOB tag for the repository. tool (rbtools.clients.SCMClient): The SCM client.",
"name": "__init... | 3 | stack_v2_sparse_classes_30k_train_047878 | Implement the Python class `ClearCaseRepositoryInfo` described below.
Class description:
A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ.
Method signatures and docstrings:
- def __init__(self, path, base_path, vobtag, t... | Implement the Python class `ClearCaseRepositoryInfo` described below.
Class description:
A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ.
Method signatures and docstrings:
- def __init__(self, path, base_path, vobtag, t... | b106c84c274c59f7944ba5bf7706d865c78a3408 | <|skeleton|>
class ClearCaseRepositoryInfo:
"""A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ."""
def __init__(self, path, base_path, vobtag, tool=None):
"""Initialize the repsitory info. Args: path (uni... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClearCaseRepositoryInfo:
"""A representation of a ClearCase source code repository. This version knows how to find a matching repository on the server even if the URLs differ."""
def __init__(self, path, base_path, vobtag, tool=None):
"""Initialize the repsitory info. Args: path (unicode): The pa... | the_stack_v2_python_sparse | rbtools/clients/clearcase.py | anirudha-banerjee/rbtools | train | 1 |
2fb0f1d98471f905ee90db70b97835795a8ddce9 | [
"cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True)\ncontext = {'cities_subscriptions': cities_subscriptions}\nreturn render(request, self.template_name, context)",
"subscription_pk = request.POST.get('subscription_pk', '')\nnext = request.POST.get('next', '')\nif subscription_pk:\n ... | <|body_start_0|>
cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True)
context = {'cities_subscriptions': cities_subscriptions}
return render(request, self.template_name, context)
<|end_body_0|>
<|body_start_1|>
subscription_pk = request.POST.get('subscription_... | Manage cities' subscriptions | CitiesManagementView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CitiesManagementView:
"""Manage cities' subscriptions"""
def get(self, request, *args, **kwargs):
"""GET request handler."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""POST request handler."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003915 | 5,471 | no_license | [
{
"docstring": "GET request handler.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "POST request handler.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013948 | Implement the Python class `CitiesManagementView` described below.
Class description:
Manage cities' subscriptions
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): GET request handler.
- def post(self, request, *args, **kwargs): POST request handler. | Implement the Python class `CitiesManagementView` described below.
Class description:
Manage cities' subscriptions
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): GET request handler.
- def post(self, request, *args, **kwargs): POST request handler.
<|skeleton|>
class CitiesManagementVie... | b0702a8f7f60de6db9de7f712108e68d66f07f61 | <|skeleton|>
class CitiesManagementView:
"""Manage cities' subscriptions"""
def get(self, request, *args, **kwargs):
"""GET request handler."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""POST request handler."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CitiesManagementView:
"""Manage cities' subscriptions"""
def get(self, request, *args, **kwargs):
"""GET request handler."""
cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True)
context = {'cities_subscriptions': cities_subscriptions}
return rend... | the_stack_v2_python_sparse | getdeal/apps/profiles/views.py | PankeshGupta/getdeal | train | 0 |
09bda41fa073c3e9ecdc3e92343d94b8c2a3172b | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center. | MerchantCenterLinkServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MerchantCenterLinkServiceServicer:
"""Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center."""
def ListMerchantCenterLinks(self, request, context):
"""Returns Merchant Center links available for th... | stack_v2_sparse_classes_75kplus_train_003916 | 4,994 | permissive | [
{
"docstring": "Returns Merchant Center links available for this customer.",
"name": "ListMerchantCenterLinks",
"signature": "def ListMerchantCenterLinks(self, request, context)"
},
{
"docstring": "Returns the Merchant Center link in full detail.",
"name": "GetMerchantCenterLink",
"signa... | 3 | stack_v2_sparse_classes_30k_train_025372 | Implement the Python class `MerchantCenterLinkServiceServicer` described below.
Class description:
Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center.
Method signatures and docstrings:
- def ListMerchantCenterLinks(self, request,... | Implement the Python class `MerchantCenterLinkServiceServicer` described below.
Class description:
Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center.
Method signatures and docstrings:
- def ListMerchantCenterLinks(self, request,... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class MerchantCenterLinkServiceServicer:
"""Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center."""
def ListMerchantCenterLinks(self, request, context):
"""Returns Merchant Center links available for th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MerchantCenterLinkServiceServicer:
"""Proto file describing the MerchantCenterLink service. This service allows management of links between Google Ads and Google Merchant Center."""
def ListMerchantCenterLinks(self, request, context):
"""Returns Merchant Center links available for this customer."... | the_stack_v2_python_sparse | google/ads/google_ads/v3/proto/services/merchant_center_link_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
0d6258fd183701035f7a9d5ba101e0704e0b8223 | [
"maxLength = 0\nfor numUnique in range(1, 26):\n maxLength = max(self.longestSubstringOfRepeatChar(s, k, numUnique), maxLength)\nreturn maxLength",
"charMap = {}\nstart = 0\nnumUnique = 0\nnumNoLessThanK = 0\nmaxLength = 0\nfor end in range(len(s)):\n count = charMap.get(s[end], 0) + 1\n charMap[s[end]] ... | <|body_start_0|>
maxLength = 0
for numUnique in range(1, 26):
maxLength = max(self.longestSubstringOfRepeatChar(s, k, numUnique), maxLength)
return maxLength
<|end_body_0|>
<|body_start_1|>
charMap = {}
start = 0
numUnique = 0
numNoLessThanK = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestSubstring(self, s, k):
""":type s: str :type k: int :rtype: int"""
<|body_0|>
def longestSubstringOfRepeatChar(self, s, k, numUniqueTarget):
""":type s: str :type k: int k repeat :type targetCount: int number of different characters :rtype: int""... | stack_v2_sparse_classes_75kplus_train_003917 | 1,571 | no_license | [
{
"docstring": ":type s: str :type k: int :rtype: int",
"name": "longestSubstring",
"signature": "def longestSubstring(self, s, k)"
},
{
"docstring": ":type s: str :type k: int k repeat :type targetCount: int number of different characters :rtype: int",
"name": "longestSubstringOfRepeatChar"... | 2 | stack_v2_sparse_classes_30k_train_044537 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int
- def longestSubstringOfRepeatChar(self, s, k, numUniqueTarget): :type s: str :type k: int k repeat :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int
- def longestSubstringOfRepeatChar(self, s, k, numUniqueTarget): :type s: str :type k: int k repeat :type ... | c2fbf457d5da366c67c7a1f17fb2be9b2833d441 | <|skeleton|>
class Solution:
def longestSubstring(self, s, k):
""":type s: str :type k: int :rtype: int"""
<|body_0|>
def longestSubstringOfRepeatChar(self, s, k, numUniqueTarget):
""":type s: str :type k: int k repeat :type targetCount: int number of different characters :rtype: int""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestSubstring(self, s, k):
""":type s: str :type k: int :rtype: int"""
maxLength = 0
for numUnique in range(1, 26):
maxLength = max(self.longestSubstringOfRepeatChar(s, k, numUnique), maxLength)
return maxLength
def longestSubstringOfRepeatChar... | the_stack_v2_python_sparse | mySolutions/395. Longest Substring with At Least K Repeating Characters/395. Longest Substring with At Least K Repeating Characters.py | brandonhyc/note_collection | train | 0 | |
f11bf711c3507b110345e8a7e7a729e5fa03ec03 | [
"super().__init__(coordinator=coordinator)\nself.entity_description = description\nself._attr_unique_id = f'{sensor_id}_{description.key}'\nself._attr_extra_state_attributes = {ATTR_SENSOR_ID: sensor_id}\nself._attr_device_info = DeviceInfo(configuration_url=f'https://devices.sensor.community/sensors/{sensor_id}/se... | <|body_start_0|>
super().__init__(coordinator=coordinator)
self.entity_description = description
self._attr_unique_id = f'{sensor_id}_{description.key}'
self._attr_extra_state_attributes = {ATTR_SENSOR_ID: sensor_id}
self._attr_device_info = DeviceInfo(configuration_url=f'https:/... | Implementation of a Sensor.Community sensor. | SensorCommunitySensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SensorCommunitySensor:
"""Implementation of a Sensor.Community sensor."""
def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None:
"""Initialize the Sensor.Community sensor."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_003918 | 4,501 | permissive | [
{
"docstring": "Initialize the Sensor.Community sensor.",
"name": "__init__",
"signature": "def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None"
},
{
"docstring": "Return the state of the device.",
"name":... | 2 | stack_v2_sparse_classes_30k_train_050958 | Implement the Python class `SensorCommunitySensor` described below.
Class description:
Implementation of a Sensor.Community sensor.
Method signatures and docstrings:
- def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None: Initialize... | Implement the Python class `SensorCommunitySensor` described below.
Class description:
Implementation of a Sensor.Community sensor.
Method signatures and docstrings:
- def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None: Initialize... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class SensorCommunitySensor:
"""Implementation of a Sensor.Community sensor."""
def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None:
"""Initialize the Sensor.Community sensor."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SensorCommunitySensor:
"""Implementation of a Sensor.Community sensor."""
def __init__(self, *, coordinator: DataUpdateCoordinator, description: SensorEntityDescription, sensor_id: int, show_on_map: bool) -> None:
"""Initialize the Sensor.Community sensor."""
super().__init__(coordinator=... | the_stack_v2_python_sparse | homeassistant/components/luftdaten/sensor.py | home-assistant/core | train | 35,501 |
0a709c3f0eec183fc3c8fb349c6ed5fc1322b43b | [
"if len(queryset) > 1:\n self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR)\n return None\nresponse = HttpResponse(content_type='text/plain')\ncert = queryset.first()\nresponse.write(crypto.dump_certificate(crypto.FILETYPE_TEXT, cert.get_certificate()))\nreturn response",... | <|body_start_0|>
if len(queryset) > 1:
self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR)
return None
response = HttpResponse(content_type='text/plain')
cert = queryset.first()
response.write(crypto.dump_certificate(crypto.FIL... | Admin model for certificates. | CertificateAdmin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CertificateAdmin:
"""Admin model for certificates."""
def view_certificate(self, request, queryset):
"""View a text version of the certificate."""
<|body_0|>
def download_certificate(self, request, queryset):
"""Download a certificate."""
<|body_1|>
<|en... | stack_v2_sparse_classes_75kplus_train_003919 | 4,814 | permissive | [
{
"docstring": "View a text version of the certificate.",
"name": "view_certificate",
"signature": "def view_certificate(self, request, queryset)"
},
{
"docstring": "Download a certificate.",
"name": "download_certificate",
"signature": "def download_certificate(self, request, queryset)"... | 2 | stack_v2_sparse_classes_30k_train_047922 | Implement the Python class `CertificateAdmin` described below.
Class description:
Admin model for certificates.
Method signatures and docstrings:
- def view_certificate(self, request, queryset): View a text version of the certificate.
- def download_certificate(self, request, queryset): Download a certificate. | Implement the Python class `CertificateAdmin` described below.
Class description:
Admin model for certificates.
Method signatures and docstrings:
- def view_certificate(self, request, queryset): View a text version of the certificate.
- def download_certificate(self, request, queryset): Download a certificate.
<|ske... | 1c3608e0a02aaba9bd8594d80a247d692cbd04ad | <|skeleton|>
class CertificateAdmin:
"""Admin model for certificates."""
def view_certificate(self, request, queryset):
"""View a text version of the certificate."""
<|body_0|>
def download_certificate(self, request, queryset):
"""Download a certificate."""
<|body_1|>
<|en... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CertificateAdmin:
"""Admin model for certificates."""
def view_certificate(self, request, queryset):
"""View a text version of the certificate."""
if len(queryset) > 1:
self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR)
return ... | the_stack_v2_python_sparse | webca/webca/web/admin.py | jesusfer/webca | train | 0 |
bef2520547f752eb2ce8b2dea23a9bba33337d66 | [
"self.cloud_usage_perf_stats = cloud_usage_perf_stats\nself.data_reduction_ratio = data_reduction_ratio\nself.data_usage_stats = data_usage_stats\nself.id = id\nself.local_usage_perf_stats = local_usage_perf_stats\nself.logical_stats = logical_stats\nself.usage_perf_stats = usage_perf_stats",
"if dictionary is No... | <|body_start_0|>
self.cloud_usage_perf_stats = cloud_usage_perf_stats
self.data_reduction_ratio = data_reduction_ratio
self.data_usage_stats = data_usage_stats
self.id = id
self.local_usage_perf_stats = local_usage_perf_stats
self.logical_stats = logical_stats
sel... | Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier by the Cohesity Cluster. data_reduction_ratio (float): Provides the ratio of C... | ClusterStats | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterStats:
"""Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier by the Cohesity Cluster. data_reductio... | stack_v2_sparse_classes_75kplus_train_003920 | 4,880 | permissive | [
{
"docstring": "Constructor for the ClusterStats class",
"name": "__init__",
"signature": "def __init__(self, cloud_usage_perf_stats=None, data_reduction_ratio=None, data_usage_stats=None, id=None, local_usage_perf_stats=None, logical_stats=None, usage_perf_stats=None)"
},
{
"docstring": "Create... | 2 | stack_v2_sparse_classes_30k_train_002070 | Implement the Python class `ClusterStats` described below.
Class description:
Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier... | Implement the Python class `ClusterStats` described below.
Class description:
Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ClusterStats:
"""Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier by the Cohesity Cluster. data_reductio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClusterStats:
"""Implementation of the 'ClusterStats' model. Specifies statistics about this Cohesity Cluster. Attributes: cloud_usage_perf_stats (UsageAndPerformanceStats): Provides usage and performance statistics for the remote data stored on a Cloud Tier by the Cohesity Cluster. data_reduction_ratio (floa... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cluster_stats.py | cohesity/management-sdk-python | train | 24 |
9eb915dbdb329656814ccd5161e2d79cdd7d6816 | [
"self._coordinate_start = coordinate_start\nself._include_pos = include_pos\nself._seq = Seq.Seq(seq, DNAAlphabet())",
"assert self._coordinate_start == 0 or self._coordinate_start == 1\nassert pos >= 0\nif self._coordinate_start == 1:\n assert pos >= 1\nif rev_strand is True:\n upstream, downstream = (down... | <|body_start_0|>
self._coordinate_start = coordinate_start
self._include_pos = include_pos
self._seq = Seq.Seq(seq, DNAAlphabet())
<|end_body_0|>
<|body_start_1|>
assert self._coordinate_start == 0 or self._coordinate_start == 1
assert pos >= 0
if self._coordinate_start ... | Extract subsequences from a given DNA sequence | SubSeqExtractor | [
"ISC",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubSeqExtractor:
"""Extract subsequences from a given DNA sequence"""
def __init__(self, seq, coordinate_start=1, include_pos=True):
"""seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include_pos - If True then the given position is given; otherwis... | stack_v2_sparse_classes_75kplus_train_003921 | 2,332 | permissive | [
{
"docstring": "seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include_pos - If True then the given position is given; otherwise only the sequence before or after the position are returned. Is later down- and upstream sequence are requeste this argument has has no influence ... | 2 | stack_v2_sparse_classes_30k_train_022749 | Implement the Python class `SubSeqExtractor` described below.
Class description:
Extract subsequences from a given DNA sequence
Method signatures and docstrings:
- def __init__(self, seq, coordinate_start=1, include_pos=True): seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include... | Implement the Python class `SubSeqExtractor` described below.
Class description:
Extract subsequences from a given DNA sequence
Method signatures and docstrings:
- def __init__(self, seq, coordinate_start=1, include_pos=True): seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include... | a3b55cfc27058f78355ba29acc56e523e7a55fc1 | <|skeleton|>
class SubSeqExtractor:
"""Extract subsequences from a given DNA sequence"""
def __init__(self, seq, coordinate_start=1, include_pos=True):
"""seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include_pos - If True then the given position is given; otherwis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubSeqExtractor:
"""Extract subsequences from a given DNA sequence"""
def __init__(self, seq, coordinate_start=1, include_pos=True):
"""seq - sequence string coordinate_start - 0 for 0-based system; 1 for 1-based system include_pos - If True then the given position is given; otherwise only the se... | the_stack_v2_python_sparse | kufpybio/subseqextract.py | fengwangjiang/kufpybio | train | 0 |
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420 | [
"comments = CommentsShopItems.query.order_by(asc(CommentsShopItems.ShopItemID), asc(CommentsShopItems.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'shopitemID': comment.ShopItemID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'crea... | <|body_start_0|>
comments = CommentsShopItems.query.order_by(asc(CommentsShopItems.ShopItemID), asc(CommentsShopItems.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'shopitemID': comment.ShopItemID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comme... | ShopItemCommentsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShopItemCommentsView:
def index(self):
"""Return all comments for all shopitems."""
<|body_0|>
def get(self, shopitem_id):
"""Return the comments for a specific shopitem."""
<|body_1|>
def post(self):
"""Add a comment to a shopitem specified in t... | stack_v2_sparse_classes_75kplus_train_003922 | 26,847 | permissive | [
{
"docstring": "Return all comments for all shopitems.",
"name": "index",
"signature": "def index(self)"
},
{
"docstring": "Return the comments for a specific shopitem.",
"name": "get",
"signature": "def get(self, shopitem_id)"
},
{
"docstring": "Add a comment to a shopitem speci... | 5 | stack_v2_sparse_classes_30k_train_030864 | Implement the Python class `ShopItemCommentsView` described below.
Class description:
Implement the ShopItemCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all shopitems.
- def get(self, shopitem_id): Return the comments for a specific shopitem.
- def post(self): Add a... | Implement the Python class `ShopItemCommentsView` described below.
Class description:
Implement the ShopItemCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all shopitems.
- def get(self, shopitem_id): Return the comments for a specific shopitem.
- def post(self): Add a... | 62f8e8e904e379541193f0cbb91a8434b47f538f | <|skeleton|>
class ShopItemCommentsView:
def index(self):
"""Return all comments for all shopitems."""
<|body_0|>
def get(self, shopitem_id):
"""Return the comments for a specific shopitem."""
<|body_1|>
def post(self):
"""Add a comment to a shopitem specified in t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShopItemCommentsView:
def index(self):
"""Return all comments for all shopitems."""
comments = CommentsShopItems.query.order_by(asc(CommentsShopItems.ShopItemID), asc(CommentsShopItems.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'shopitemID': comme... | the_stack_v2_python_sparse | apps/comments/views.py | Torniojaws/vortech-backend | train | 0 | |
28de5fe99b8805911f53ee9c31f5aa62e82436a8 | [
"self.in_channels = 1\nself.out_channels = 2\nself.height = 512\nself.width = 512\nself.rare_class = 0\nself.frequencies = [0.07, 0.93]\nself.bundle_size = 20\nself.base_dir = Path(lis_dir)\nself.train_dir = self.base_dir / 'training'\nself.val_dir = self.base_dir / 'validation'\nself.x_n_pfx = 'x-ntl-'\nself.y_n_p... | <|body_start_0|>
self.in_channels = 1
self.out_channels = 2
self.height = 512
self.width = 512
self.rare_class = 0
self.frequencies = [0.07, 0.93]
self.bundle_size = 20
self.base_dir = Path(lis_dir)
self.train_dir = self.base_dir / 'training'
... | Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command | LiSAdapter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LiSAdapter:
"""Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command"""
def __init__(self, lis_dir, trn_lim=-1):
"""Constructor for the LiS A... | stack_v2_sparse_classes_75kplus_train_003923 | 3,999 | no_license | [
{
"docstring": "Constructor for the LiS Adapter object Takes root lis directory on this machine and optionally a limit on how many bundles to use",
"name": "__init__",
"signature": "def __init__(self, lis_dir, trn_lim=-1)"
},
{
"docstring": "Load a bundle from disk Provide location, prefixes, an... | 4 | stack_v2_sparse_classes_30k_train_022562 | Implement the Python class `LiSAdapter` described below.
Class description:
Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command
Method signatures and docstrings:
- def __ini... | Implement the Python class `LiSAdapter` described below.
Class description:
Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command
Method signatures and docstrings:
- def __ini... | 4a74a86740196f927ee3f6519983393a083c3083 | <|skeleton|>
class LiSAdapter:
"""Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command"""
def __init__(self, lis_dir, trn_lim=-1):
"""Constructor for the LiS A... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LiSAdapter:
"""Adapter for Liver Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command"""
def __init__(self, lis_dir, trn_lim=-1):
"""Constructor for the LiS Adapter object... | the_stack_v2_python_sparse | learning/adapters/lisadapter.py | neheller/eus18 | train | 0 |
9185c159e4bf7d09fe85272ae235f7210e097ca8 | [
"try:\n avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE))\nexcept ValueError:\n avatar_size = AVATAR_DEFAULT_SIZE\ntry:\n if not is_group_member(group_id, request.user.username):\n error_msg = 'Permission denied.'\n return api_error(status.HTTP_403_FORBIDDEN, error_msg)\n... | <|body_start_0|>
try:
avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE))
except ValueError:
avatar_size = AVATAR_DEFAULT_SIZE
try:
if not is_group_member(group_id, request.user.username):
error_msg = 'Permission denied.'
... | GroupMembers | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupMembers:
def get(self, request, group_id, format=None):
"""Get all group members."""
<|body_0|>
def post(self, request, group_id):
"""Add a group member."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
avatar_size = int(request... | stack_v2_sparse_classes_75kplus_train_003924 | 12,521 | permissive | [
{
"docstring": "Get all group members.",
"name": "get",
"signature": "def get(self, request, group_id, format=None)"
},
{
"docstring": "Add a group member.",
"name": "post",
"signature": "def post(self, request, group_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_033738 | Implement the Python class `GroupMembers` described below.
Class description:
Implement the GroupMembers class.
Method signatures and docstrings:
- def get(self, request, group_id, format=None): Get all group members.
- def post(self, request, group_id): Add a group member. | Implement the Python class `GroupMembers` described below.
Class description:
Implement the GroupMembers class.
Method signatures and docstrings:
- def get(self, request, group_id, format=None): Get all group members.
- def post(self, request, group_id): Add a group member.
<|skeleton|>
class GroupMembers:
def ... | 13b3ed26a04248211ef91ca70dccc617be27a3c3 | <|skeleton|>
class GroupMembers:
def get(self, request, group_id, format=None):
"""Get all group members."""
<|body_0|>
def post(self, request, group_id):
"""Add a group member."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupMembers:
def get(self, request, group_id, format=None):
"""Get all group members."""
try:
avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE))
except ValueError:
avatar_size = AVATAR_DEFAULT_SIZE
try:
if not is_group_me... | the_stack_v2_python_sparse | fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/group_members.py | syncwerk/syncwerk-server-restapi | train | 0 | |
3f186a212a0a320aaddac7c92036bc2c94a168d4 | [
"self.eta = eta\nself.epsilon = epsilon\nself.classifiers = None\nself.penalty = penalty\nself.l2_lambda = l2_lambda\nself.max_iter = max_iter\nself.verbose = verbose",
"n_classifiers = _calculate_number_classes(y)\nif self.verbose:\n print('n_classifiers', n_classifiers)\nclassifiers = []\nfor k in range(n_cl... | <|body_start_0|>
self.eta = eta
self.epsilon = epsilon
self.classifiers = None
self.penalty = penalty
self.l2_lambda = l2_lambda
self.max_iter = max_iter
self.verbose = verbose
<|end_body_0|>
<|body_start_1|>
n_classifiers = _calculate_number_classes(y)
... | Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions. | MulticlassLogisticRegression | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MulticlassLogisticRegression:
"""Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions."""
def __init__(self, eta, epsilon, penalty=None, l2_lambda=0, max_iter=100, ver... | stack_v2_sparse_classes_75kplus_train_003925 | 7,643 | no_license | [
{
"docstring": "Initializes an instance. :param eta: float, learning rate :param epsilon: float, convergence threshold :param penalty: str, penalty type to use. Default is None. Current implementation allows 'l2'. :param l2_lambda: float, value of l2 penalty if that penalty is used. Default is 0. :param max_ite... | 4 | stack_v2_sparse_classes_30k_train_006389 | Implement the Python class `MulticlassLogisticRegression` described below.
Class description:
Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions.
Method signatures and docstrings:
- def __ini... | Implement the Python class `MulticlassLogisticRegression` described below.
Class description:
Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions.
Method signatures and docstrings:
- def __ini... | 13bccaec8d90e70715d2d8791c9098ff141ae377 | <|skeleton|>
class MulticlassLogisticRegression:
"""Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions."""
def __init__(self, eta, epsilon, penalty=None, l2_lambda=0, max_iter=100, ver... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MulticlassLogisticRegression:
"""Implements multiclass logistic regression. This version stores the binary Logistic Regression classifiers fit to each class, and it uses the classifiers directly for predictions."""
def __init__(self, eta, epsilon, penalty=None, l2_lambda=0, max_iter=100, verbose=False):
... | the_stack_v2_python_sparse | packages/linear_model/MulticlassLogisticRegression.py | ryanquinnnelson/CMU-02620-Taxonomic-Binning-for-Metagenomics | train | 0 |
0741dc62d058ccf4b9cf9c7cbb908327fbd08d82 | [
"super(PositionalEncoding1D, self).__init__()\nself.channels = channels\ninv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / channels)\nself.register_buffer('inv_freq', inv_freq)",
"if len(tensor.shape) != 3:\n raise RuntimeError('The input tensor has to be 3d!')\nbatch_size, x, orig_ch = tensor.... | <|body_start_0|>
super(PositionalEncoding1D, self).__init__()
self.channels = channels
inv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / channels)
self.register_buffer('inv_freq', inv_freq)
<|end_body_0|>
<|body_start_1|>
if len(tensor.shape) != 3:
ra... | PositionalEncoding1D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PositionalEncoding1D:
def __init__(self, channels):
""":param channels: The last dimension of the tensor you want to apply pos emb to."""
<|body_0|>
def forward(self, tensor):
""":param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding Matr... | stack_v2_sparse_classes_75kplus_train_003926 | 1,214 | permissive | [
{
"docstring": ":param channels: The last dimension of the tensor you want to apply pos emb to.",
"name": "__init__",
"signature": "def __init__(self, channels)"
},
{
"docstring": ":param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding Matrix of size (batch_size, x, ... | 2 | stack_v2_sparse_classes_30k_train_004046 | Implement the Python class `PositionalEncoding1D` described below.
Class description:
Implement the PositionalEncoding1D class.
Method signatures and docstrings:
- def __init__(self, channels): :param channels: The last dimension of the tensor you want to apply pos emb to.
- def forward(self, tensor): :param tensor: ... | Implement the Python class `PositionalEncoding1D` described below.
Class description:
Implement the PositionalEncoding1D class.
Method signatures and docstrings:
- def __init__(self, channels): :param channels: The last dimension of the tensor you want to apply pos emb to.
- def forward(self, tensor): :param tensor: ... | f220017f8218c8ce311e9ffa1ee205ef0e735fc5 | <|skeleton|>
class PositionalEncoding1D:
def __init__(self, channels):
""":param channels: The last dimension of the tensor you want to apply pos emb to."""
<|body_0|>
def forward(self, tensor):
""":param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding Matr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PositionalEncoding1D:
def __init__(self, channels):
""":param channels: The last dimension of the tensor you want to apply pos emb to."""
super(PositionalEncoding1D, self).__init__()
self.channels = channels
inv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / chan... | the_stack_v2_python_sparse | models/total3d/modules/positional_encoding.py | mertkiray/EndtoEnd3DSceneUnderstandingWithAttention | train | 5 | |
d90b1c61aaa98971395f564c51b399d53347e3b3 | [
"self.bytes_per_second = bytes_per_second\nself.io_rate = io_rate\nself.time_periods = time_periods",
"if dictionary is None:\n return None\nbytes_per_second = dictionary.get('bytesPerSecond')\nio_rate = dictionary.get('ioRate')\ntime_periods = cohesity_management_sdk.models.time_of_a_week.TimeOfAWeek.from_dic... | <|body_start_0|>
self.bytes_per_second = bytes_per_second
self.io_rate = io_rate
self.time_periods = time_periods
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
bytes_per_second = dictionary.get('bytesPerSecond')
io_rate = dictionary.get('... | Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Specifies the value to override the regular maximum bandwidth rate (rateLimitBytesPerSec) for ... | BandwidthLimitOverride | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BandwidthLimitOverride:
"""Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Specifies the value to override the regular ... | stack_v2_sparse_classes_75kplus_train_003927 | 2,465 | permissive | [
{
"docstring": "Constructor for the BandwidthLimitOverride class",
"name": "__init__",
"signature": "def __init__(self, bytes_per_second=None, io_rate=None, time_periods=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repr... | 2 | null | Implement the Python class `BandwidthLimitOverride` described below.
Class description:
Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Speci... | Implement the Python class `BandwidthLimitOverride` described below.
Class description:
Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Speci... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class BandwidthLimitOverride:
"""Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Specifies the value to override the regular ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BandwidthLimitOverride:
"""Implementation of the 'BandwidthLimitOverride' model. Specifies bandwidth limit override value to be enforced during the specified daily time period for the specified days of the week. Attributes: bytes_per_second (long|int): Specifies the value to override the regular maximum bandw... | the_stack_v2_python_sparse | cohesity_management_sdk/models/bandwidth_limit_override.py | cohesity/management-sdk-python | train | 24 |
50a1d992eaa56a9f2e62d6eb2304b70ddd5b1d39 | [
"user_id = request.user.id\nself.queryset = get_list_or_404(Inventory, user=user_id)\nreturn super().list(request, *args, **kwargs)",
"inventory_pk = kwargs['pk']\nuser_id = request.user.id\nget_object_or_404(Inventory, id=inventory_pk, user=user_id)\nreturn super().destroy(request, *args, **kwargs)"
] | <|body_start_0|>
user_id = request.user.id
self.queryset = get_list_or_404(Inventory, user=user_id)
return super().list(request, *args, **kwargs)
<|end_body_0|>
<|body_start_1|>
inventory_pk = kwargs['pk']
user_id = request.user.id
get_object_or_404(Inventory, id=invento... | RetrieveDeleteInventoryGenericViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetrieveDeleteInventoryGenericViewSet:
def list(self, request, *args, **kwargs):
"""Func retrieves user inventory by user id"""
<|body_0|>
def destroy(self, request, *args, **kwargs):
"""Func deletes user inventory"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_003928 | 5,132 | no_license | [
{
"docstring": "Func retrieves user inventory by user id",
"name": "list",
"signature": "def list(self, request, *args, **kwargs)"
},
{
"docstring": "Func deletes user inventory",
"name": "destroy",
"signature": "def destroy(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000122 | Implement the Python class `RetrieveDeleteInventoryGenericViewSet` described below.
Class description:
Implement the RetrieveDeleteInventoryGenericViewSet class.
Method signatures and docstrings:
- def list(self, request, *args, **kwargs): Func retrieves user inventory by user id
- def destroy(self, request, *args, *... | Implement the Python class `RetrieveDeleteInventoryGenericViewSet` described below.
Class description:
Implement the RetrieveDeleteInventoryGenericViewSet class.
Method signatures and docstrings:
- def list(self, request, *args, **kwargs): Func retrieves user inventory by user id
- def destroy(self, request, *args, *... | bde0151de5281cd035990efebe83523d3c4b486c | <|skeleton|>
class RetrieveDeleteInventoryGenericViewSet:
def list(self, request, *args, **kwargs):
"""Func retrieves user inventory by user id"""
<|body_0|>
def destroy(self, request, *args, **kwargs):
"""Func deletes user inventory"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RetrieveDeleteInventoryGenericViewSet:
def list(self, request, *args, **kwargs):
"""Func retrieves user inventory by user id"""
user_id = request.user.id
self.queryset = get_list_or_404(Inventory, user=user_id)
return super().list(request, *args, **kwargs)
def destroy(self... | the_stack_v2_python_sparse | users/views.py | PavelMartysiuk/trading_platform | train | 0 | |
2f15bc3b67451693e44d9ded02e45536d0b5624c | [
"try:\n user = User.objects.get(Q(email=username) | Q(username=username))\n if user.check_password(password):\n return user\nexcept User.DoesNotExist:\n return None",
"try:\n return User.objects.get(pk=user_id)\nexcept User.DoesNotExist:\n return None"
] | <|body_start_0|>
try:
user = User.objects.get(Q(email=username) | Q(username=username))
if user.check_password(password):
return user
except User.DoesNotExist:
return None
<|end_body_0|>
<|body_start_1|>
try:
return User.objects.ge... | Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair. | EmailAuthBackend | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailAuthBackend:
"""Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair."""
def authenticate(self, username=None, password=None):
"""Authenticate a user based on email address as the user name."""
<|body_0|>... | stack_v2_sparse_classes_75kplus_train_003929 | 1,699 | permissive | [
{
"docstring": "Authenticate a user based on email address as the user name.",
"name": "authenticate",
"signature": "def authenticate(self, username=None, password=None)"
},
{
"docstring": "Get a User object from the user_id.",
"name": "get_user",
"signature": "def get_user(self, user_id... | 2 | stack_v2_sparse_classes_30k_train_018167 | Implement the Python class `EmailAuthBackend` described below.
Class description:
Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.
Method signatures and docstrings:
- def authenticate(self, username=None, password=None): Authenticate a user based... | Implement the Python class `EmailAuthBackend` described below.
Class description:
Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair.
Method signatures and docstrings:
- def authenticate(self, username=None, password=None): Authenticate a user based... | a24b1db9c42c6af4b939f9dd0181fc9eaf5076f1 | <|skeleton|>
class EmailAuthBackend:
"""Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair."""
def authenticate(self, username=None, password=None):
"""Authenticate a user based on email address as the user name."""
<|body_0|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailAuthBackend:
"""Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair."""
def authenticate(self, username=None, password=None):
"""Authenticate a user based on email address as the user name."""
try:
user =... | the_stack_v2_python_sparse | drf_tools/auth/authentications.py | seebass/drf-tools | train | 5 |
f6969b55c9d9e596a0beeeab9d6495ab2a065ad2 | [
"super(FFNNoSharing, self).__init__(**kwargs)\nself.num_tasks = num_tasks\ninput_modules = []\ninner_modules = []\noutput_modules = []\nin_feature_list = [i[0] for i in in_features.values()]\nfor _ in range(self.num_tasks):\n if None in in_feature_list:\n raise ValueError('Trying to use linear layer with ... | <|body_start_0|>
super(FFNNoSharing, self).__init__(**kwargs)
self.num_tasks = num_tasks
input_modules = []
inner_modules = []
output_modules = []
in_feature_list = [i[0] for i in in_features.values()]
for _ in range(self.num_tasks):
if None in in_feat... | FFNNoSharing. FFN With no weight sharing across tasks | FFNNoSharing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FFNNoSharing:
"""FFNNoSharing. FFN With no weight sharing across tasks"""
def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_output: bool=False, **kwargs):
"""__init__. Args:"""
<|b... | stack_v2_sparse_classes_75kplus_train_003930 | 28,307 | no_license | [
{
"docstring": "__init__. Args:",
"name": "__init__",
"signature": "def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_output: bool=False, **kwargs)"
},
{
"docstring": "Forward pass, return logits",
... | 2 | null | Implement the Python class `FFNNoSharing` described below.
Class description:
FFNNoSharing. FFN With no weight sharing across tasks
Method signatures and docstrings:
- def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_outp... | Implement the Python class `FFNNoSharing` described below.
Class description:
FFNNoSharing. FFN With no weight sharing across tasks
Method signatures and docstrings:
- def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_outp... | 84c9026c78bec9a2267960a87080b71beba5c305 | <|skeleton|>
class FFNNoSharing:
"""FFNNoSharing. FFN With no weight sharing across tasks"""
def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_output: bool=False, **kwargs):
"""__init__. Args:"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FFNNoSharing:
"""FFNNoSharing. FFN With no weight sharing across tasks"""
def __init__(self, in_features: dict, layers: int=3, hidden_size: int=100, model_dropout: float=0.1, regression: bool=False, num_tasks: int=1, no_output: bool=False, **kwargs):
"""__init__. Args:"""
super(FFNNoShari... | the_stack_v2_python_sparse | enzpred/models/torch_models.py | liudongliangHI/enz-pred | train | 0 |
43491ccb78ad5d926715538405e405a91ea56563 | [
"app = SequencingExperimentGenomicFile.query.get(kf_id)\nif app is None:\n abort(404, 'could not find {} `{}`'.format('sequencing_experiment_genomic_file', kf_id))\nreturn SequencingExperimentGenomicFileSchema().jsonify(app)",
"app = SequencingExperimentGenomicFile.query.get(kf_id)\nif app is None:\n abort(... | <|body_start_0|>
app = SequencingExperimentGenomicFile.query.get(kf_id)
if app is None:
abort(404, 'could not find {} `{}`'.format('sequencing_experiment_genomic_file', kf_id))
return SequencingExperimentGenomicFileSchema().jsonify(app)
<|end_body_0|>
<|body_start_1|>
app = ... | SequencingExperimentGenomicFile API | SequencingExperimentGenomicFileAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequencingExperimentGenomicFileAPI:
"""SequencingExperimentGenomicFile API"""
def get(self, kf_id):
"""Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentGenomicFile"""
<|body_0|>
def patch(self, kf_... | stack_v2_sparse_classes_75kplus_train_003931 | 5,985 | permissive | [
{
"docstring": "Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentGenomicFile",
"name": "get",
"signature": "def get(self, kf_id)"
},
{
"docstring": "Update an existing sequencing_experiment_genomic_file. Allows partial upd... | 3 | stack_v2_sparse_classes_30k_train_004289 | Implement the Python class `SequencingExperimentGenomicFileAPI` described below.
Class description:
SequencingExperimentGenomicFile API
Method signatures and docstrings:
- def get(self, kf_id): Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentG... | Implement the Python class `SequencingExperimentGenomicFileAPI` described below.
Class description:
SequencingExperimentGenomicFile API
Method signatures and docstrings:
- def get(self, kf_id): Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentG... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class SequencingExperimentGenomicFileAPI:
"""SequencingExperimentGenomicFile API"""
def get(self, kf_id):
"""Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentGenomicFile"""
<|body_0|>
def patch(self, kf_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SequencingExperimentGenomicFileAPI:
"""SequencingExperimentGenomicFile API"""
def get(self, kf_id):
"""Get a sequencing_experiment_genomic_file by id --- template: path: get_by_id.yml properties: resource: SequencingExperimentGenomicFile"""
app = SequencingExperimentGenomicFile.query.get(... | the_stack_v2_python_sparse | dataservice/api/sequencing_experiment_genomic_file/resources.py | kids-first/kf-api-dataservice | train | 9 |
65039e99fc95e20a312e8d0470bd0433469dcfd8 | [
"self.archive_log_keep_days = archive_log_keep_days\nself.database_node_list = database_node_list\nself.database_unique_name = database_unique_name\nself.database_uuid = database_uuid\nself.default_channel_count = default_channel_count\nself.enable_dg_primary_backup = enable_dg_primary_backup\nself.max_node_count =... | <|body_start_0|>
self.archive_log_keep_days = archive_log_keep_days
self.database_node_list = database_node_list
self.database_unique_name = database_unique_name
self.database_uuid = database_uuid
self.default_channel_count = default_channel_count
self.enable_dg_primary_b... | Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should be stored. database_node_list (list of OracleDatabaseNode): Array of nodes of a database. S... | OracleDatabaseNodeChannel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OracleDatabaseNodeChannel:
"""Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should be stored. database_node_list (list of... | stack_v2_sparse_classes_75kplus_train_003932 | 4,722 | permissive | [
{
"docstring": "Constructor for the OracleDatabaseNodeChannel class",
"name": "__init__",
"signature": "def __init__(self, archive_log_keep_days=None, database_node_list=None, database_unique_name=None, database_uuid=None, default_channel_count=None, enable_dg_primary_backup=None, max_node_count=None, r... | 2 | stack_v2_sparse_classes_30k_test_001501 | Implement the Python class `OracleDatabaseNodeChannel` described below.
Class description:
Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should... | Implement the Python class `OracleDatabaseNodeChannel` described below.
Class description:
Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class OracleDatabaseNodeChannel:
"""Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should be stored. database_node_list (list of... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OracleDatabaseNodeChannel:
"""Implementation of the 'OracleDatabaseNodeChannel' model. Specifies node and channel info required for the backup and restore of a database. Attributes: archive_log_keep_days (int): Specifies the number of days archive log should be stored. database_node_list (list of OracleDataba... | the_stack_v2_python_sparse | cohesity_management_sdk/models/oracle_database_node_channel.py | cohesity/management-sdk-python | train | 24 |
0e3cf994647639950a90ba77d55f474b43a9231e | [
"new_date = fields.datetime.today()\nif self.date < new_date:\n raise ValidationError(_('Configure expiry date greater than current date!'))",
"emp_obj = self.env['hr.employee']\nobj_mail_server = self.env['ir.mail_server']\nuser = self.env.user\nmail_server_record = obj_mail_server.search([], limit=1)\nif not... | <|body_start_0|>
new_date = fields.datetime.today()
if self.date < new_date:
raise ValidationError(_('Configure expiry date greater than current date!'))
<|end_body_0|>
<|body_start_1|>
emp_obj = self.env['hr.employee']
obj_mail_server = self.env['ir.mail_server']
us... | Defining studen news. | StudentNews | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StudentNews:
"""Defining studen news."""
def checknews_dates(self):
"""Check news date."""
<|body_0|>
def news_update(self):
"""Method to send email to student for news update"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
new_date = fields.dat... | stack_v2_sparse_classes_75kplus_train_003933 | 38,006 | no_license | [
{
"docstring": "Check news date.",
"name": "checknews_dates",
"signature": "def checknews_dates(self)"
},
{
"docstring": "Method to send email to student for news update",
"name": "news_update",
"signature": "def news_update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000613 | Implement the Python class `StudentNews` described below.
Class description:
Defining studen news.
Method signatures and docstrings:
- def checknews_dates(self): Check news date.
- def news_update(self): Method to send email to student for news update | Implement the Python class `StudentNews` described below.
Class description:
Defining studen news.
Method signatures and docstrings:
- def checknews_dates(self): Check news date.
- def news_update(self): Method to send email to student for news update
<|skeleton|>
class StudentNews:
"""Defining studen news."""
... | 6a9793f3a15da9eed40bf840b1d9a46457c5fd55 | <|skeleton|>
class StudentNews:
"""Defining studen news."""
def checknews_dates(self):
"""Check news date."""
<|body_0|>
def news_update(self):
"""Method to send email to student for news update"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StudentNews:
"""Defining studen news."""
def checknews_dates(self):
"""Check news date."""
new_date = fields.datetime.today()
if self.date < new_date:
raise ValidationError(_('Configure expiry date greater than current date!'))
def news_update(self):
"""Me... | the_stack_v2_python_sparse | school/models/school.py | JayVora-SerpentCS/OdooEduERP | train | 121 |
5b338ec865bcedb5f8523d2d62aff3d41011076f | [
"self.args = args\nself.num_iterations = args.num_iterations\nself.csv_reporter = CSVReporter(args)",
"for iteration in range(self.num_iterations):\n logging.info('Running simulation iteration {}/{}'.format(iteration + 1, self.num_iterations))\n simulation = Simulation(self.args, iteration, self.csv_reporte... | <|body_start_0|>
self.args = args
self.num_iterations = args.num_iterations
self.csv_reporter = CSVReporter(args)
<|end_body_0|>
<|body_start_1|>
for iteration in range(self.num_iterations):
logging.info('Running simulation iteration {}/{}'.format(iteration + 1, self.num_ite... | Class representing an experiment, consisting of multiple simulation runs. | Experiment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Experiment:
"""Class representing an experiment, consisting of multiple simulation runs."""
def __init__(self, args):
"""Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program."""
<|body_0|>
def run(self):
"""Ru... | stack_v2_sparse_classes_75kplus_train_003934 | 894 | permissive | [
{
"docstring": "Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program.",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Runs the experiment.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002519 | Implement the Python class `Experiment` described below.
Class description:
Class representing an experiment, consisting of multiple simulation runs.
Method signatures and docstrings:
- def __init__(self, args): Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program... | Implement the Python class `Experiment` described below.
Class description:
Class representing an experiment, consisting of multiple simulation runs.
Method signatures and docstrings:
- def __init__(self, args): Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program... | a535c2ac0c125175541c3f31181b1d75bf90b63b | <|skeleton|>
class Experiment:
"""Class representing an experiment, consisting of multiple simulation runs."""
def __init__(self, args):
"""Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program."""
<|body_0|>
def run(self):
"""Ru... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Experiment:
"""Class representing an experiment, consisting of multiple simulation runs."""
def __init__(self, args):
"""Constructs an instance of this class. :param args: The parsed commandline arguments passed to this program."""
self.args = args
self.num_iterations = args.num_i... | the_stack_v2_python_sparse | danger_zone/experiment.py | gandreadis/danger-zone | train | 0 |
f6e5d8f39f13398c15f9e7542387985244354741 | [
"self.df = data\nself.cat_attr = cat_attr\nself.num_attr = num_attr",
"ax = sns.boxplot(x=self.cat_attr, y=self.num_attr, data=self.df)\nplt.xticks(rotation=90)\nplt.savefig('graphs/' + 'Boxplot of ' + str(self.cat_attr) + ' and ' + str(self.cat_attr) + '.pdf', format='pdf')\nplt.show()"
] | <|body_start_0|>
self.df = data
self.cat_attr = cat_attr
self.num_attr = num_attr
<|end_body_0|>
<|body_start_1|>
ax = sns.boxplot(x=self.cat_attr, y=self.num_attr, data=self.df)
plt.xticks(rotation=90)
plt.savefig('graphs/' + 'Boxplot of ' + str(self.cat_attr) + ' and '... | This is the class for visulization methods of categorical feature vs. numerical feature | nvc_graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class nvc_graph:
"""This is the class for visulization methods of categorical feature vs. numerical feature"""
def __init__(self, data, cat_attr, num_attr):
"""Constructor"""
<|body_0|>
def box_plot(self):
"""get the dataframe and desired attributions. Return ====== re... | stack_v2_sparse_classes_75kplus_train_003935 | 891 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, data, cat_attr, num_attr)"
},
{
"docstring": "get the dataframe and desired attributions. Return ====== return boxplot of attributions",
"name": "box_plot",
"signature": "def box_plot(self)"
}
] | 2 | null | Implement the Python class `nvc_graph` described below.
Class description:
This is the class for visulization methods of categorical feature vs. numerical feature
Method signatures and docstrings:
- def __init__(self, data, cat_attr, num_attr): Constructor
- def box_plot(self): get the dataframe and desired attributi... | Implement the Python class `nvc_graph` described below.
Class description:
This is the class for visulization methods of categorical feature vs. numerical feature
Method signatures and docstrings:
- def __init__(self, data, cat_attr, num_attr): Constructor
- def box_plot(self): get the dataframe and desired attributi... | dc9185cbc5e65650d985ebecf877a157c8c19a13 | <|skeleton|>
class nvc_graph:
"""This is the class for visulization methods of categorical feature vs. numerical feature"""
def __init__(self, data, cat_attr, num_attr):
"""Constructor"""
<|body_0|>
def box_plot(self):
"""get the dataframe and desired attributions. Return ====== re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class nvc_graph:
"""This is the class for visulization methods of categorical feature vs. numerical feature"""
def __init__(self, data, cat_attr, num_attr):
"""Constructor"""
self.df = data
self.cat_attr = cat_attr
self.num_attr = num_attr
def box_plot(self):
"""get... | the_stack_v2_python_sparse | sj2384/nvc_graph.py | ds-ga-1007/final_project | train | 0 |
3c4b114a9c3eed4783d30677fe874c8ddcefa2dc | [
"super().__init__(in_features, out_features, bias=bias)\nweights = torch.full((out_features, in_features), sigma_init)\nself.sigma_weight = nn.Parameter(weights)\nepsilon_weight = torch.zeros(out_features, in_features)\nself.register_buffer('epsilon_weight', epsilon_weight)\nif bias:\n bias = torch.full((out_fea... | <|body_start_0|>
super().__init__(in_features, out_features, bias=bias)
weights = torch.full((out_features, in_features), sigma_init)
self.sigma_weight = nn.Parameter(weights)
epsilon_weight = torch.zeros(out_features, in_features)
self.register_buffer('epsilon_weight', epsilon_w... | Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19 | NoisyLinear | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoisyLinear:
"""Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19"""
def __init__(self, in_features: int, out_features: int, sigma_init: float=0.017, bias: ... | stack_v2_sparse_classes_75kplus_train_003936 | 15,112 | permissive | [
{
"docstring": "Args: in_features: number of inputs out_features: number of outputs sigma_init: initial fill value of noisy weights bias: flag to include bias to linear layer",
"name": "__init__",
"signature": "def __init__(self, in_features: int, out_features: int, sigma_init: float=0.017, bias: bool=T... | 3 | stack_v2_sparse_classes_30k_train_003935 | Implement the Python class `NoisyLinear` described below.
Class description:
Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19
Method signatures and docstrings:
- def __init__(self, ... | Implement the Python class `NoisyLinear` described below.
Class description:
Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19
Method signatures and docstrings:
- def __init__(self, ... | bdf311369b236c1e3d0336c7ed4ba249854f8606 | <|skeleton|>
class NoisyLinear:
"""Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19"""
def __init__(self, in_features: int, out_features: int, sigma_init: float=0.017, bias: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NoisyLinear:
"""Noisy Layer using Independent Gaussian Noise. based on https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition/blob/master/ Chapter08/lib/dqn_extra.py#L19"""
def __init__(self, in_features: int, out_features: int, sigma_init: float=0.017, bias: bool=True) ->... | the_stack_v2_python_sparse | src/pl_bolts/models/rl/common/networks.py | Lightning-Universe/lightning-bolts | train | 76 |
63d0c290475cd872d4e0c53ed8d78f4cbd133bcd | [
"def replace(match_obj):\n \"\"\"\n Returns the match text prefixed with backslash\n\n :param re.match match_obj: The match.\n\n :rtype: str\n \"\"\"\n return '\\\\' + match_obj.group(0)\nreturn re.sub('[\\\\\\\\{}]', replace, text)",
"def replace(match_obj):\n ... | <|body_start_0|>
def replace(match_obj):
"""
Returns the match text prefixed with backslash
:param re.match match_obj: The match.
:rtype: str
"""
return '\\' + match_obj.group(0)
return re.sub('[\\\... | Utility class with functions for generating SDoc code. | SDoc | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SDoc:
"""Utility class with functions for generating SDoc code."""
def escape(text: str) -> str:
"""Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string."""
<|body_0|>
def unescape(text: str) -> str:
"""Returns an unescaped S... | stack_v2_sparse_classes_75kplus_train_003937 | 1,442 | permissive | [
{
"docstring": "Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.",
"name": "escape",
"signature": "def escape(text: str) -> str"
},
{
"docstring": "Returns an unescaped SDoc escaped string. I.e. removes back slashes. :param str text: The SDoc escaped st... | 2 | stack_v2_sparse_classes_30k_train_030153 | Implement the Python class `SDoc` described below.
Class description:
Utility class with functions for generating SDoc code.
Method signatures and docstrings:
- def escape(text: str) -> str: Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.
- def unescape(text: str) -> str: R... | Implement the Python class `SDoc` described below.
Class description:
Utility class with functions for generating SDoc code.
Method signatures and docstrings:
- def escape(text: str) -> str: Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.
- def unescape(text: str) -> str: R... | 589c2a27eceebb7d96c14744c1632bdbdee9be52 | <|skeleton|>
class SDoc:
"""Utility class with functions for generating SDoc code."""
def escape(text: str) -> str:
"""Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string."""
<|body_0|>
def unescape(text: str) -> str:
"""Returns an unescaped S... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SDoc:
"""Utility class with functions for generating SDoc code."""
def escape(text: str) -> str:
"""Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string."""
def replace(match_obj):
"""
Returns the match text prefixed wi... | the_stack_v2_python_sparse | sdoc/helper/SDoc.py | SDoc/py-sdoc | train | 2 |
fd245947dd9512226f8e90622a907d9a1a639817 | [
"self._z_nodes = z_nodes.astype(np.float64)\nself._redshifts = redshifts.astype(np.float64)\nself._values = values.astype(np.float64)",
"bounds = []\nfor i in range(len(p0)):\n bounds.append([min_val, max_val])\nres = scipy.optimize.minimize(self, p0, method='L-BFGS-B', bounds=bounds, jac=False, options={'maxf... | <|body_start_0|>
self._z_nodes = z_nodes.astype(np.float64)
self._redshifts = redshifts.astype(np.float64)
self._values = values.astype(np.float64)
<|end_body_0|>
<|body_start_1|>
bounds = []
for i in range(len(p0)):
bounds.append([min_val, max_val])
res = sc... | Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity. | MedZFitter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MedZFitter:
"""Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity."""
def __init__(self, z_nodes, redshifts, values):
"""Instantiate a MedZFitter object Parameters ---------- z_nodes: `np.array` Float array for reds... | stack_v2_sparse_classes_75kplus_train_003938 | 45,530 | permissive | [
{
"docstring": "Instantiate a MedZFitter object Parameters ---------- z_nodes: `np.array` Float array for redshift nodes redshifts: `np.array` Float array of input redshifts to fit values: `np.array` Float array of color values to fit",
"name": "__init__",
"signature": "def __init__(self, z_nodes, redsh... | 3 | stack_v2_sparse_classes_30k_train_002361 | Implement the Python class `MedZFitter` described below.
Class description:
Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity.
Method signatures and docstrings:
- def __init__(self, z_nodes, redshifts, values): Instantiate a MedZFitter object Param... | Implement the Python class `MedZFitter` described below.
Class description:
Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity.
Method signatures and docstrings:
- def __init__(self, z_nodes, redshifts, values): Instantiate a MedZFitter object Param... | d3a8b432c2f3a20aa518a7781c0f2aa315624855 | <|skeleton|>
class MedZFitter:
"""Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity."""
def __init__(self, z_nodes, redshifts, values):
"""Instantiate a MedZFitter object Parameters ---------- z_nodes: `np.array` Float array for reds... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MedZFitter:
"""Class to fit a spline to the median value as a function of redshift. This can be the color or magnitude or any quantity."""
def __init__(self, z_nodes, redshifts, values):
"""Instantiate a MedZFitter object Parameters ---------- z_nodes: `np.array` Float array for redshift nodes re... | the_stack_v2_python_sparse | redmapper/fitters.py | erykoff/redmapper | train | 20 |
dc874cc2b7d09809b3aeb5176ddec88074389b26 | [
"record.message = record.getMessage()\nif self.usesTime():\n record.asctime = self.formatTime(record, self.datefmt)\ns = self._fmt % record.__dict__\nif record.exc_info:\n if not hasattr(record, 'exc_text_ext'):\n setattr(record, 'exc_text_ext', self.formatException(record.exc_info))\nif getattr(record... | <|body_start_0|>
record.message = record.getMessage()
if self.usesTime():
record.asctime = self.formatTime(record, self.datefmt)
s = self._fmt % record.__dict__
if record.exc_info:
if not hasattr(record, 'exc_text_ext'):
setattr(record, 'exc_text_e... | ExcPlusFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExcPlusFormatter:
def format(self, record):
"""Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out.... | stack_v2_sparse_classes_75kplus_train_003939 | 8,048 | no_license | [
{
"docstring": "Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using ... | 2 | stack_v2_sparse_classes_30k_train_049527 | Implement the Python class `ExcPlusFormatter` described below.
Class description:
Implement the ExcPlusFormatter class.
Method signatures and docstrings:
- def format(self, record): Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yie... | Implement the Python class `ExcPlusFormatter` described below.
Class description:
Implement the ExcPlusFormatter class.
Method signatures and docstrings:
- def format(self, record): Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yie... | c3bbadde24330fb2dff4aa2c32cc6b11e044fbc9 | <|skeleton|>
class ExcPlusFormatter:
def format(self, record):
"""Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExcPlusFormatter:
def format(self, record):
"""Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message a... | the_stack_v2_python_sparse | Libraries/prosuite_logging.py | EAC-Technology/eApp-Builder | train | 0 | |
fe4f3dfb9f50d327a65d55c45e1aada262597ced | [
"if not root:\n return\ndq = deque([root])\nseq = []\nwhile dq:\n node = dq.popleft()\n if node is None:\n seq.append('null')\n continue\n seq.append(str(node.val))\n dq.extend([node.left, node.right])\nreturn ','.join(seq)",
"if not data:\n return\nseq = data.split(',')\nroot = Tr... | <|body_start_0|>
if not root:
return
dq = deque([root])
seq = []
while dq:
node = dq.popleft()
if node is None:
seq.append('null')
continue
seq.append(str(node.val))
dq.extend([node.left, node.rig... | 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_75kplus_train_003940 | 3,285 | 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_val_003009 | 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:... | dcebf49d1e024b9e69c4d9606c8afb32b9d07029 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return
dq = deque([root])
seq = []
while dq:
node = dq.popleft()
if node is None:
seq.append('nul... | the_stack_v2_python_sparse | 297. Serialize and Deserialize Binary Tree.py | Katherinaxxx/leetcode | train | 3 | |
ce22feb12eb00bab9a46204ad60c56592f9080f7 | [
"self.flag = False\nself.ultrasonic_sensor = ev3.UltrasonicSensor('in2')\nself.robot = robot",
"distance = self.ultrasonic_sensor.distance_centimeters\nif distance > 15:\n flag = True\n self.robot.runforever(0.1)\nelse:\n flag = False\n self.robot.turnLeftforever(0.3)"
] | <|body_start_0|>
self.flag = False
self.ultrasonic_sensor = ev3.UltrasonicSensor('in2')
self.robot = robot
<|end_body_0|>
<|body_start_1|>
distance = self.ultrasonic_sensor.distance_centimeters
if distance > 15:
flag = True
self.robot.runforever(0.1)
... | ExitCrowd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExitCrowd:
def __init__(self, robot=None):
"""Set up motors/robot and sensors here"""
<|body_0|>
def run(self):
"""One cycle of feedback loop: read sensors, choose movement, set movement."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.flag = F... | stack_v2_sparse_classes_75kplus_train_003941 | 4,473 | no_license | [
{
"docstring": "Set up motors/robot and sensors here",
"name": "__init__",
"signature": "def __init__(self, robot=None)"
},
{
"docstring": "One cycle of feedback loop: read sensors, choose movement, set movement.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015961 | Implement the Python class `ExitCrowd` described below.
Class description:
Implement the ExitCrowd class.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up motors/robot and sensors here
- def run(self): One cycle of feedback loop: read sensors, choose movement, set movement. | Implement the Python class `ExitCrowd` described below.
Class description:
Implement the ExitCrowd class.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up motors/robot and sensors here
- def run(self): One cycle of feedback loop: read sensors, choose movement, set movement.
<|skeleton|>
cla... | 01732d90d5099a3ac3b723ff05376d27208d534a | <|skeleton|>
class ExitCrowd:
def __init__(self, robot=None):
"""Set up motors/robot and sensors here"""
<|body_0|>
def run(self):
"""One cycle of feedback loop: read sensors, choose movement, set movement."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExitCrowd:
def __init__(self, robot=None):
"""Set up motors/robot and sensors here"""
self.flag = False
self.ultrasonic_sensor = ev3.UltrasonicSensor('in2')
self.robot = robot
def run(self):
"""One cycle of feedback loop: read sensors, choose movement, set movement... | the_stack_v2_python_sparse | Activity3/reactiveCode.py | tianyoul/AI-Robotics | train | 0 | |
44a3a37cfd6486f4e627abb7f127b2e5b5ded5b7 | [
"self.vocab_size = vocab_size\nself.embed_dim = embed_dim\nself.regularizer = regularizer if trainable == True else None\nself.random_seed = random_seed\nself.trainable = trainable\nself.scope = scope\nself.device_spec = get_device_spec(default_gpu_id, num_gpus)\nwith tf.variable_scope(self.scope, reuse=tf.AUTO_REU... | <|body_start_0|>
self.vocab_size = vocab_size
self.embed_dim = embed_dim
self.regularizer = regularizer if trainable == True else None
self.random_seed = random_seed
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, n... | Embedding layer | Embedding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Embedding:
"""Embedding layer"""
def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding'):
"""initialize embedding layer"""
<|body_0|>
def __call__(self, input_data):
"""call embed... | stack_v2_sparse_classes_75kplus_train_003942 | 3,009 | permissive | [
{
"docstring": "initialize embedding layer",
"name": "__init__",
"signature": "def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding')"
},
{
"docstring": "call embedding layer",
"name": "__call__",
"signa... | 2 | stack_v2_sparse_classes_30k_train_031243 | Implement the Python class `Embedding` described below.
Class description:
Embedding layer
Method signatures and docstrings:
- def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding'): initialize embedding layer
- def __call__(self, in... | Implement the Python class `Embedding` described below.
Class description:
Embedding layer
Method signatures and docstrings:
- def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding'): initialize embedding layer
- def __call__(self, in... | 05fcbec15e359e3db86af6c3798c13be8a6c58ee | <|skeleton|>
class Embedding:
"""Embedding layer"""
def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding'):
"""initialize embedding layer"""
<|body_0|>
def __call__(self, input_data):
"""call embed... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Embedding:
"""Embedding layer"""
def __init__(self, vocab_size, embed_dim, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='embedding'):
"""initialize embedding layer"""
self.vocab_size = vocab_size
self.embed_dim = embed_dim
self.regul... | the_stack_v2_python_sparse | sequence_labeling/layer/embedding.py | stevezheng23/sequence_labeling_tf | train | 18 |
4dae80063d7d58f8cabfa6e8e4c0f2ca819f427b | [
"super(Actor, self).__init__()\nself.max_action = args.high_action\nself.fc1 = nn.Linear(args.obs_shape[agent_identifier], 64)\nself.fc2 = nn.Linear(64, 64)\nself.fc3 = nn.Linear(64, 64)\nself.action_out = nn.Linear(64, args.action_shape[agent_identifier])",
"x = F.relu(self.fc1(x))\nx = F.relu(self.fc2(x))\nx = ... | <|body_start_0|>
super(Actor, self).__init__()
self.max_action = args.high_action
self.fc1 = nn.Linear(args.obs_shape[agent_identifier], 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 64)
self.action_out = nn.Linear(64, args.action_shape[agent_identifier])
<|en... | Actor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Actor:
def __init__(self, args, agent_identifier) -> None:
"""Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent"""
<|body_0|>
def forward(self, x):
"""Conduct a forward pass of the model :param x input of ... | stack_v2_sparse_classes_75kplus_train_003943 | 1,994 | no_license | [
{
"docstring": "Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent",
"name": "__init__",
"signature": "def __init__(self, args, agent_identifier) -> None"
},
{
"docstring": "Conduct a forward pass of the model :param x input of the mod... | 2 | stack_v2_sparse_classes_30k_train_053820 | Implement the Python class `Actor` described below.
Class description:
Implement the Actor class.
Method signatures and docstrings:
- def __init__(self, args, agent_identifier) -> None: Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent
- def forward(self, ... | Implement the Python class `Actor` described below.
Class description:
Implement the Actor class.
Method signatures and docstrings:
- def __init__(self, args, agent_identifier) -> None: Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent
- def forward(self, ... | 728e3d817e860fcb035f6a02de5cb66bd557aa55 | <|skeleton|>
class Actor:
def __init__(self, args, agent_identifier) -> None:
"""Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent"""
<|body_0|>
def forward(self, x):
"""Conduct a forward pass of the model :param x input of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Actor:
def __init__(self, args, agent_identifier) -> None:
"""Initializes the Actor model :param args dictionary of args :param agent_identifier identifier for current agent"""
super(Actor, self).__init__()
self.max_action = args.high_action
self.fc1 = nn.Linear(args.obs_shape[... | the_stack_v2_python_sparse | multi_agent/policies/MADDPG/actor_critic.py | yubryanj/Multi-Agent-Reinforcement-Learning-on-Finance-Graphs | train | 0 | |
967f07f17bd7592ae11624adf5b5570d48232120 | [
"nodes = dict()\nfor c in set([c for w in words for c in w]):\n nodes[c] = Node(c)\nfor w1, w2 in zip(words, words[1:]):\n for c1, c2 in zip(w1, w2):\n if c1 != c2:\n n1 = nodes[c1]\n if c2 not in n1.edges:\n n1.edges.add(c2)\n nodes[c2].in_degree += ... | <|body_start_0|>
nodes = dict()
for c in set([c for w in words for c in w]):
nodes[c] = Node(c)
for w1, w2 in zip(words, words[1:]):
for c1, c2 in zip(w1, w2):
if c1 != c2:
n1 = nodes[c1]
if c2 not in n1.edges:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def alienOrder_v1(self, words: List[str]) -> str:
"""Use a Node structure to store the graph data."""
<|body_0|>
def alienOrder_v2(self, words: List[str]) -> str:
"""Use two structures (dict and Counter) to store the information."""
<|body_1|>
<|en... | stack_v2_sparse_classes_75kplus_train_003944 | 5,541 | no_license | [
{
"docstring": "Use a Node structure to store the graph data.",
"name": "alienOrder_v1",
"signature": "def alienOrder_v1(self, words: List[str]) -> str"
},
{
"docstring": "Use two structures (dict and Counter) to store the information.",
"name": "alienOrder_v2",
"signature": "def alienOr... | 2 | stack_v2_sparse_classes_30k_train_004858 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def alienOrder_v1(self, words: List[str]) -> str: Use a Node structure to store the graph data.
- def alienOrder_v2(self, words: List[str]) -> str: Use two structures (dict and C... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def alienOrder_v1(self, words: List[str]) -> str: Use a Node structure to store the graph data.
- def alienOrder_v2(self, words: List[str]) -> str: Use two structures (dict and C... | 97a2386f5e3adbd7138fd123810c3232bdf7f622 | <|skeleton|>
class Solution:
def alienOrder_v1(self, words: List[str]) -> str:
"""Use a Node structure to store the graph data."""
<|body_0|>
def alienOrder_v2(self, words: List[str]) -> str:
"""Use two structures (dict and Counter) to store the information."""
<|body_1|>
<|en... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def alienOrder_v1(self, words: List[str]) -> str:
"""Use a Node structure to store the graph data."""
nodes = dict()
for c in set([c for w in words for c in w]):
nodes[c] = Node(c)
for w1, w2 in zip(words, words[1:]):
for c1, c2 in zip(w1, w2):... | the_stack_v2_python_sparse | python3/trees_and_graphs/alien_dictionary.py | victorchu/algorithms | train | 0 | |
5053cac83b58fd2396e201ce2bf9db7d0a10f63b | [
"filter_date = date.today()\nwarehouses = self.env['stock.warehouse'].search([])\nfor warehouse_id in warehouses:\n self.sudo().get_order(warehouse_id, filter_date)",
"foodics_history_obj = self.env['foodics.pos.history']\norder_mapping_obj = self.env['foodics.orders.mapping']\nauth_token = self.env['foodics.c... | <|body_start_0|>
filter_date = date.today()
warehouses = self.env['stock.warehouse'].search([])
for warehouse_id in warehouses:
self.sudo().get_order(warehouse_id, filter_date)
<|end_body_0|>
<|body_start_1|>
foodics_history_obj = self.env['foodics.pos.history']
orde... | FoodicsGetOrder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FoodicsGetOrder:
def _call_get_order(self):
"""Called by cron job"""
<|body_0|>
def get_order(self, warehouse_id, filter_date):
"""Request url = "https://dash.foodics.com/api/v2/orders?filters%5Bbusiness_date%5D=2020-03-30&filters%5Bbranch_hid%5D=_27864a87 Method - G... | stack_v2_sparse_classes_75kplus_train_003945 | 30,803 | no_license | [
{
"docstring": "Called by cron job",
"name": "_call_get_order",
"signature": "def _call_get_order(self)"
},
{
"docstring": "Request url = \"https://dash.foodics.com/api/v2/orders?filters%5Bbusiness_date%5D=2020-03-30&filters%5Bbranch_hid%5D=_27864a87 Method - GET payload = {} headers = { 'X-busi... | 2 | stack_v2_sparse_classes_30k_train_038792 | Implement the Python class `FoodicsGetOrder` described below.
Class description:
Implement the FoodicsGetOrder class.
Method signatures and docstrings:
- def _call_get_order(self): Called by cron job
- def get_order(self, warehouse_id, filter_date): Request url = "https://dash.foodics.com/api/v2/orders?filters%5Bbusi... | Implement the Python class `FoodicsGetOrder` described below.
Class description:
Implement the FoodicsGetOrder class.
Method signatures and docstrings:
- def _call_get_order(self): Called by cron job
- def get_order(self, warehouse_id, filter_date): Request url = "https://dash.foodics.com/api/v2/orders?filters%5Bbusi... | a9b74b95632add738a84cd1157c64dd3cb71097d | <|skeleton|>
class FoodicsGetOrder:
def _call_get_order(self):
"""Called by cron job"""
<|body_0|>
def get_order(self, warehouse_id, filter_date):
"""Request url = "https://dash.foodics.com/api/v2/orders?filters%5Bbusiness_date%5D=2020-03-30&filters%5Bbranch_hid%5D=_27864a87 Method - G... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FoodicsGetOrder:
def _call_get_order(self):
"""Called by cron job"""
filter_date = date.today()
warehouses = self.env['stock.warehouse'].search([])
for warehouse_id in warehouses:
self.sudo().get_order(warehouse_id, filter_date)
def get_order(self, warehouse_id... | the_stack_v2_python_sparse | foodics_bridge/models/order.py | falla-restaurant/falla | train | 0 | |
01da2ef384535d76ffaa4ad10128e1da03367f85 | [
"self.username = 'root'\nself.password = 'mysql'\nself.url = '127.0.0.1'\nself.port = 3306\nself.database = 'campus'\nself.conn = pymysql.connect(self.url, port=self.port, database=self.database, user=self.username, password=self.password)\nself.cursor = self.conn.cursor()\nself.table_name = 'campus_' + time.strfti... | <|body_start_0|>
self.username = 'root'
self.password = 'mysql'
self.url = '127.0.0.1'
self.port = 3306
self.database = 'campus'
self.conn = pymysql.connect(self.url, port=self.port, database=self.database, user=self.username, password=self.password)
self.cursor =... | CampusPublicOpinionPipeline | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampusPublicOpinionPipeline:
def __init__(self):
"""Create mysql connect and create saving table :return:"""
<|body_0|>
def process_item(self, item, spider):
"""Save file to mysql :param item: :param spider: :return:"""
<|body_1|>
def close_spider(self, ... | stack_v2_sparse_classes_75kplus_train_003946 | 3,133 | permissive | [
{
"docstring": "Create mysql connect and create saving table :return:",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Save file to mysql :param item: :param spider: :return:",
"name": "process_item",
"signature": "def process_item(self, item, spider)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_040849 | Implement the Python class `CampusPublicOpinionPipeline` described below.
Class description:
Implement the CampusPublicOpinionPipeline class.
Method signatures and docstrings:
- def __init__(self): Create mysql connect and create saving table :return:
- def process_item(self, item, spider): Save file to mysql :param ... | Implement the Python class `CampusPublicOpinionPipeline` described below.
Class description:
Implement the CampusPublicOpinionPipeline class.
Method signatures and docstrings:
- def __init__(self): Create mysql connect and create saving table :return:
- def process_item(self, item, spider): Save file to mysql :param ... | a6ed670ad332bd456572eeff707bd5fc14186b3d | <|skeleton|>
class CampusPublicOpinionPipeline:
def __init__(self):
"""Create mysql connect and create saving table :return:"""
<|body_0|>
def process_item(self, item, spider):
"""Save file to mysql :param item: :param spider: :return:"""
<|body_1|>
def close_spider(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CampusPublicOpinionPipeline:
def __init__(self):
"""Create mysql connect and create saving table :return:"""
self.username = 'root'
self.password = 'mysql'
self.url = '127.0.0.1'
self.port = 3306
self.database = 'campus'
self.conn = pymysql.connect(self.... | the_stack_v2_python_sparse | 01_crawl_cases/campus_public_opinion/campus_public_opinion/pipelines.py | zlj-zz/python-crawler | train | 0 | |
bc0c02e5fc2df950cb679085af50d58dc45eaa5a | [
"action_space = Bag([])\naction_space.seed(seed=seed)\nsuper().__init__(initial_state=initial_state, default_reward=default_reward, seed=seed, action_space=action_space)\nself.finals = {}\nself.finals.update({(9, i): 20 for i in range(3)})\nself.finals.update({(12, i): 30 for i in range(5)})\nself.asteroids = {(5, ... | <|body_start_0|>
action_space = Bag([])
action_space.seed(seed=seed)
super().__init__(initial_state=initial_state, default_reward=default_reward, seed=seed, action_space=action_space)
self.finals = {}
self.finals.update({(9, i): 20 for i in range(3)})
self.finals.update({... | SpaceExplorationAcyclic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpaceExplorationAcyclic:
def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed: int=0):
""":param initial_state: Initial state where start the agent. :param default_reward: (mission_success, radiation) :param seed: Seed used for np.random.RandomState method.... | stack_v2_sparse_classes_75kplus_train_003947 | 4,842 | no_license | [
{
"docstring": ":param initial_state: Initial state where start the agent. :param default_reward: (mission_success, radiation) :param seed: Seed used for np.random.RandomState method.",
"name": "__init__",
"signature": "def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed:... | 4 | null | Implement the Python class `SpaceExplorationAcyclic` described below.
Class description:
Implement the SpaceExplorationAcyclic class.
Method signatures and docstrings:
- def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed: int=0): :param initial_state: Initial state where start the age... | Implement the Python class `SpaceExplorationAcyclic` described below.
Class description:
Implement the SpaceExplorationAcyclic class.
Method signatures and docstrings:
- def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed: int=0): :param initial_state: Initial state where start the age... | b51c64c867e15356c9f978839fd0040182324edd | <|skeleton|>
class SpaceExplorationAcyclic:
def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed: int=0):
""":param initial_state: Initial state where start the agent. :param default_reward: (mission_success, radiation) :param seed: Seed used for np.random.RandomState method.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpaceExplorationAcyclic:
def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0, -1), seed: int=0):
""":param initial_state: Initial state where start the agent. :param default_reward: (mission_success, radiation) :param seed: Seed used for np.random.RandomState method."""
ac... | the_stack_v2_python_sparse | environments/space_exploration_acyclic.py | Pozas91/tiadas | train | 1 | |
2eca398160128d3fec4d1131b505e7134e9a2f3c | [
"parent = self.parent()\nif parent and parent.window():\n point = parent.window().geometry().center()\n point.setX(point.x() - self.width() / 2.0)\n point.setY(point.y() - self.height() / 2.0)\n self.move(point)\nreturn super(PySideDialog, self).exec_(*args)",
"parent = self.parent()\nif parent and pa... | <|body_start_0|>
parent = self.parent()
if parent and parent.window():
point = parent.window().geometry().center()
point.setX(point.x() - self.width() / 2.0)
point.setY(point.y() - self.height() / 2.0)
self.move(point)
return super(PySideDialog, se... | PySideDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PySideDialog:
def exec_(self, *args):
"""Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result"""
<|body_0|>
def show(self, *args):
"""Ensure the dialogs are properly centered - doesn't seem to happen automa... | stack_v2_sparse_classes_75kplus_train_003948 | 9,204 | no_license | [
{
"docstring": "Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result",
"name": "exec_",
"signature": "def exec_(self, *args)"
},
{
"docstring": "Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySid... | 2 | stack_v2_sparse_classes_30k_val_001289 | Implement the Python class `PySideDialog` described below.
Class description:
Implement the PySideDialog class.
Method signatures and docstrings:
- def exec_(self, *args): Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result
- def show(self, *args): Ensure ... | Implement the Python class `PySideDialog` described below.
Class description:
Implement the PySideDialog class.
Method signatures and docstrings:
- def exec_(self, *args): Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result
- def show(self, *args): Ensure ... | df2fcdecda5bce98e4235ffddde1e99f334562cc | <|skeleton|>
class PySideDialog:
def exec_(self, *args):
"""Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result"""
<|body_0|>
def show(self, *args):
"""Ensure the dialogs are properly centered - doesn't seem to happen automa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PySideDialog:
def exec_(self, *args):
"""Ensure the dialogs are properly centered - doesn't seem to happen automatically with PySide. :return <int> result"""
parent = self.parent()
if parent and parent.window():
point = parent.window().geometry().center()
point.... | the_stack_v2_python_sparse | projexui/qt/pyside_wrapper.py | kanooshka/DPS_PIPELINE | train | 3 | |
88b41f47d56e0e0007548269507ce60ab0971eb1 | [
"self.env.revert_snapshot('ready_with_3_slaves')\nself.prepare_plugins()\nself.helpers.create_cluster(name=self.__class__.__name__)\nself.activate_plugins()",
"self.check_run('deploy_toolchain')\nself.env.revert_snapshot('ready_with_3_slaves')\nself.prepare_plugins()\nself.helpers.create_cluster(name=self.__class... | <|body_start_0|>
self.env.revert_snapshot('ready_with_3_slaves')
self.prepare_plugins()
self.helpers.create_cluster(name=self.__class__.__name__)
self.activate_plugins()
<|end_body_0|>
<|body_start_1|>
self.check_run('deploy_toolchain')
self.env.revert_snapshot('ready_wi... | Class for smoke testing the LMA Toolchain plugins. | TestToolchain | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestToolchain:
"""Class for smoke testing the LMA Toolchain plugins."""
def install_toolchain(self):
"""Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. Install the plugins 3. Create a cluster 4. Check that the ... | stack_v2_sparse_classes_75kplus_train_003949 | 5,173 | no_license | [
{
"docstring": "Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. Install the plugins 3. Create a cluster 4. Check that the plugins can be enabled Duration 20m",
"name": "install_toolchain",
"signature": "def install_toolchain(self)... | 5 | stack_v2_sparse_classes_30k_train_023960 | Implement the Python class `TestToolchain` described below.
Class description:
Class for smoke testing the LMA Toolchain plugins.
Method signatures and docstrings:
- def install_toolchain(self): Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. I... | Implement the Python class `TestToolchain` described below.
Class description:
Class for smoke testing the LMA Toolchain plugins.
Method signatures and docstrings:
- def install_toolchain(self): Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. I... | 179249df2d206eeabb3955c9dc8cb78cac3c36c6 | <|skeleton|>
class TestToolchain:
"""Class for smoke testing the LMA Toolchain plugins."""
def install_toolchain(self):
"""Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. Install the plugins 3. Create a cluster 4. Check that the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestToolchain:
"""Class for smoke testing the LMA Toolchain plugins."""
def install_toolchain(self):
"""Install the LMA Toolchain plugins and check it exists Scenario: 1. Upload the LMA Toolchain plugins to the master node 2. Install the plugins 3. Create a cluster 4. Check that the plugins can b... | the_stack_v2_python_sparse | stacklight_tests/toolchain/test_smoke_bvt.py | rkhozinov/stacklight-integration-tests | train | 1 |
e5f2dd93d91e529223e7075c9498df9c1938db9c | [
"parser.add_argument('--ratio-success', dest='ratio', type=float, default=0.5)\nparser.add_argument('--interval', dest='interval', type=int, default=5)\nparser.add_argument('--poll', action='store_true', dest='poll', default=False)\nparser.add_argument('--keep-files', action='store_true', dest='keep', default=False... | <|body_start_0|>
parser.add_argument('--ratio-success', dest='ratio', type=float, default=0.5)
parser.add_argument('--interval', dest='interval', type=int, default=5)
parser.add_argument('--poll', action='store_true', dest='poll', default=False)
parser.add_argument('--keep-files', action... | Simulates Pearson responses | Command | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Simulates Pearson responses"""
def add_arguments(self, parser):
"""Configure command args"""
<|body_0|>
def handle(self, *args, **options):
"""Handle the command"""
<|body_1|>
def handle_poll(self, ratio, keep):
"""Handle a poll i... | stack_v2_sparse_classes_75kplus_train_003950 | 5,861 | no_license | [
{
"docstring": "Configure command args",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring": "Handle the command",
"name": "handle",
"signature": "def handle(self, *args, **options)"
},
{
"docstring": "Handle a poll interval",
"name": "ha... | 6 | stack_v2_sparse_classes_30k_train_048316 | Implement the Python class `Command` described below.
Class description:
Simulates Pearson responses
Method signatures and docstrings:
- def add_arguments(self, parser): Configure command args
- def handle(self, *args, **options): Handle the command
- def handle_poll(self, ratio, keep): Handle a poll interval
- def h... | Implement the Python class `Command` described below.
Class description:
Simulates Pearson responses
Method signatures and docstrings:
- def add_arguments(self, parser): Configure command args
- def handle(self, *args, **options): Handle the command
- def handle_poll(self, ratio, keep): Handle a poll interval
- def h... | 1df800eda5f827c012881e569629a29b660c7c25 | <|skeleton|>
class Command:
"""Simulates Pearson responses"""
def add_arguments(self, parser):
"""Configure command args"""
<|body_0|>
def handle(self, *args, **options):
"""Handle the command"""
<|body_1|>
def handle_poll(self, ratio, keep):
"""Handle a poll i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Command:
"""Simulates Pearson responses"""
def add_arguments(self, parser):
"""Configure command args"""
parser.add_argument('--ratio-success', dest='ratio', type=float, default=0.5)
parser.add_argument('--interval', dest='interval', type=int, default=5)
parser.add_argumen... | the_stack_v2_python_sparse | exams/management/commands/simulate_sftp_responses.py | johnfelipe/micromasters | train | 0 |
d8484937f0ac2a2d4dee24e631593bbb667d3973 | [
"self.temp_dir = tempfile.mkdtemp()\nself.binfiles = []\nself.to_delete = []\nself.nf = nf\nself.ni = ni\nself.output_fn = output_fn\nself.progress = progress\nself.interval = interval\nself.nsentences = 0",
"self.binfiles.append(fn)\nself.to_delete.append(fn)\nif self.progress:\n if self.nsentences % self.int... | <|body_start_0|>
self.temp_dir = tempfile.mkdtemp()
self.binfiles = []
self.to_delete = []
self.nf = nf
self.ni = ni
self.output_fn = output_fn
self.progress = progress
self.interval = interval
self.nsentences = 0
<|end_body_0|>
<|body_start_1|>
... | Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. TODO(ajit): Rearrange histlib.enco... | PFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PFile:
"""Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. T... | stack_v2_sparse_classes_75kplus_train_003951 | 4,954 | no_license | [
{
"docstring": "Initialize a .pfile. Args: nf: Number of floats ni: Number of ints output_fn: Name of the .pfile to create progess: If true, print an status messages on number of sentences written to sys.stdout. interval: Number of calls to add_sentence between status messages.",
"name": "__init__",
"si... | 3 | stack_v2_sparse_classes_30k_train_007491 | Implement the Python class `PFile` described below.
Class description:
Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this c... | Implement the Python class `PFile` described below.
Class description:
Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this c... | 36d9b7b6f864ee93220c960065f8c7e216c5009c | <|skeleton|>
class PFile:
"""Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. T... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PFile:
"""Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. TODO(ajit): Re... | the_stack_v2_python_sparse | sourceCodes/python/util/file.py | melodi-lab/SGM | train | 1 |
717d6dff01bbe2f64276a47f9ad5a0d553be90a8 | [
"count = 0\nfor i in range(len(time)):\n for j in range(i + 1, len(time)):\n if not (time[i] + time[j]) % 60:\n count += 1\nreturn count",
"data = {}\nfor t in time:\n t = t % 60\n data[t] = data.get(t, 0) + 1\ncount = 0\nzero = data.get(0)\nif zero and zero > 1:\n count += zero * (z... | <|body_start_0|>
count = 0
for i in range(len(time)):
for j in range(i + 1, len(time)):
if not (time[i] + time[j]) % 60:
count += 1
return count
<|end_body_0|>
<|body_start_1|>
data = {}
for t in time:
t = t % 60
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _numPairsDivisibleBy60(self, time):
""":type time: List[int] :rtype: int"""
<|body_0|>
def numPairsDivisibleBy60(self, time):
""":type time: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
count = 0
for i ... | stack_v2_sparse_classes_75kplus_train_003952 | 2,099 | permissive | [
{
"docstring": ":type time: List[int] :rtype: int",
"name": "_numPairsDivisibleBy60",
"signature": "def _numPairsDivisibleBy60(self, time)"
},
{
"docstring": ":type time: List[int] :rtype: int",
"name": "numPairsDivisibleBy60",
"signature": "def numPairsDivisibleBy60(self, time)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _numPairsDivisibleBy60(self, time): :type time: List[int] :rtype: int
- def numPairsDivisibleBy60(self, time): :type time: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _numPairsDivisibleBy60(self, time): :type time: List[int] :rtype: int
- def numPairsDivisibleBy60(self, time): :type time: List[int] :rtype: int
<|skeleton|>
class Solution:... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _numPairsDivisibleBy60(self, time):
""":type time: List[int] :rtype: int"""
<|body_0|>
def numPairsDivisibleBy60(self, time):
""":type time: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _numPairsDivisibleBy60(self, time):
""":type time: List[int] :rtype: int"""
count = 0
for i in range(len(time)):
for j in range(i + 1, len(time)):
if not (time[i] + time[j]) % 60:
count += 1
return count
def num... | the_stack_v2_python_sparse | 1010.pairs-of-songs-with-total-durations-divisible-by-60.py | windard/leeeeee | train | 0 | |
79642d78bdfc4b8895089edb0cd6edcda84ff165 | [
"key = '2b7e151628aed2a6abf7158809cf4f3c'\niv = '000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f'\npt = '6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51\\n 30c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710'\nkey, iv, pt = (a2b_p(key), a2b_p(iv), a2b_p... | <|body_start_0|>
key = '2b7e151628aed2a6abf7158809cf4f3c'
iv = '000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f'
pt = '6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51\n 30c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710'
key... | CBC test with Rijndael | CBC_Rijndael_Test | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CBC_Rijndael_Test:
"""CBC test with Rijndael"""
def testCBC_Rijndael_256(self):
"""Rijndael CBC 256"""
<|body_0|>
def testCBC_Rijndael_variable_data(self):
"""Rijndael CBC 256"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
key = '2b7e151628aed2... | stack_v2_sparse_classes_75kplus_train_003953 | 5,430 | permissive | [
{
"docstring": "Rijndael CBC 256",
"name": "testCBC_Rijndael_256",
"signature": "def testCBC_Rijndael_256(self)"
},
{
"docstring": "Rijndael CBC 256",
"name": "testCBC_Rijndael_variable_data",
"signature": "def testCBC_Rijndael_variable_data(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009605 | Implement the Python class `CBC_Rijndael_Test` described below.
Class description:
CBC test with Rijndael
Method signatures and docstrings:
- def testCBC_Rijndael_256(self): Rijndael CBC 256
- def testCBC_Rijndael_variable_data(self): Rijndael CBC 256 | Implement the Python class `CBC_Rijndael_Test` described below.
Class description:
CBC test with Rijndael
Method signatures and docstrings:
- def testCBC_Rijndael_256(self): Rijndael CBC 256
- def testCBC_Rijndael_variable_data(self): Rijndael CBC 256
<|skeleton|>
class CBC_Rijndael_Test:
"""CBC test with Rijnda... | ed4d80d1e6f09634c12c0c3096e39667c6642b95 | <|skeleton|>
class CBC_Rijndael_Test:
"""CBC test with Rijndael"""
def testCBC_Rijndael_256(self):
"""Rijndael CBC 256"""
<|body_0|>
def testCBC_Rijndael_variable_data(self):
"""Rijndael CBC 256"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CBC_Rijndael_Test:
"""CBC test with Rijndael"""
def testCBC_Rijndael_256(self):
"""Rijndael CBC 256"""
key = '2b7e151628aed2a6abf7158809cf4f3c'
iv = '000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f'
pt = '6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb... | the_stack_v2_python_sparse | script.module.cryptolib/lib/cryptopy/cipher/cbc_test.py | gacj22/WizardGacj22 | train | 4 |
d9631b04a48de845c1965c996a9ec019e42d513b | [
"pre_head = ListNode(-1)\nprev = pre_head\nwhile l1 and l2:\n if l1.val <= l2.val:\n prev.next = l1\n l1 = l1.next\n else:\n prev.next = l2\n l2 = l2.next\n prev = prev.next\nprev.next = l1 if l1 else l2\nreturn pre_head.next",
"if not l1:\n return l2\nelif not l2:\n ret... | <|body_start_0|>
pre_head = ListNode(-1)
prev = pre_head
while l1 and l2:
if l1.val <= l2.val:
prev.next = l1
l1 = l1.next
else:
prev.next = l2
l2 = l2.next
prev = prev.next
prev.next = l1... | LinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedList:
def merge_(self, l1: 'ListNode', l2: 'ListNode'):
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:"""
<|body_0|>
def merge(self, l1: 'ListNode', l2: 'ListNode'):
"""Approach: Recursion Time Complexity: O(M... | stack_v2_sparse_classes_75kplus_train_003954 | 1,190 | no_license | [
{
"docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:",
"name": "merge_",
"signature": "def merge_(self, l1: 'ListNode', l2: 'ListNode')"
},
{
"docstring": "Approach: Recursion Time Complexity: O(M + N) Space Complexity: O(N) :param l1: :... | 2 | stack_v2_sparse_classes_30k_train_018594 | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def merge_(self, l1: 'ListNode', l2: 'ListNode'): Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:
- def merge(self, l1: 'ListN... | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def merge_(self, l1: 'ListNode', l2: 'ListNode'): Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:
- def merge(self, l1: 'ListN... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class LinkedList:
def merge_(self, l1: 'ListNode', l2: 'ListNode'):
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:"""
<|body_0|>
def merge(self, l1: 'ListNode', l2: 'ListNode'):
"""Approach: Recursion Time Complexity: O(M... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinkedList:
def merge_(self, l1: 'ListNode', l2: 'ListNode'):
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:"""
pre_head = ListNode(-1)
prev = pre_head
while l1 and l2:
if l1.val <= l2.val:
prev.nex... | the_stack_v2_python_sparse | amazon/linked_list/merge_two_sorted_list.py | Shiv2157k/leet_code | train | 1 | |
0691ca625104eadc9d5882844e113b71fa163488 | [
"self.missing_generated = False\nself.missing_remote = False\nself.conffile_name = conffile_name\nself.diff_lines = []\nif not os.path.exists(generated_file_name):\n self.missing_generated = True\nif not os.path.exists(remote_file_name):\n self.missing_remote = True\nif not self.missing_generated and (not sel... | <|body_start_0|>
self.missing_generated = False
self.missing_remote = False
self.conffile_name = conffile_name
self.diff_lines = []
if not os.path.exists(generated_file_name):
self.missing_generated = True
if not os.path.exists(remote_file_name):
s... | Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file. | ConfFileDiff | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a r... | stack_v2_sparse_classes_75kplus_train_003955 | 11,154 | permissive | [
{
"docstring": "Compute whether the conffile with the given name has changed given a remote and generate file copy.",
"name": "__init__",
"signature": "def __init__(self, remote_file_name, generated_file_name, conffile_name)"
},
{
"docstring": "Print the diff using pretty colors. If confab is us... | 3 | stack_v2_sparse_classes_30k_test_002647 | Implement the Python class `ConfFileDiff` described below.
Class description:
Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file.
Method signatures and docstrings:
- def __init__(self, remote_file_name, generated_file_name, conffile_name): Compute wheth... | Implement the Python class `ConfFileDiff` described below.
Class description:
Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file.
Method signatures and docstrings:
- def __init__(self, remote_file_name, generated_file_name, conffile_name): Compute wheth... | b66d900b8286085fc9346b14eb6baa7e9fc3fcfe | <|skeleton|>
class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a remote and gen... | the_stack_v2_python_sparse | confab/conffiles.py | disko/confab | train | 0 |
1cc55762659acd6d08d73f179fcb41ad4ae806f4 | [
"configuration = g.user.get_api().get_configuration(configuration)\nzone = generate_zone_fqdn(zone, configuration.get_view(view))\nhost_records = zone.get_children_of_type(zone.HostRecord)\nresult = [host.to_json() for host in host_records]\nreturn jsonify(result)",
"data = host_parser.parse_args()\nconfiguration... | <|body_start_0|>
configuration = g.user.get_api().get_configuration(configuration)
zone = generate_zone_fqdn(zone, configuration.get_view(view))
host_records = zone.get_children_of_type(zone.HostRecord)
result = [host.to_json() for host in host_records]
return jsonify(result)
<|e... | HostRecordCollection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostRecordCollection:
def get(self, configuration, view, zone=None):
"""Get all host records belonging to default or provided Configuration and View plus Zone hierarchy."""
<|body_0|>
def post(self, configuration, view, zone=None):
"""Create a host record belonging t... | stack_v2_sparse_classes_75kplus_train_003956 | 33,507 | permissive | [
{
"docstring": "Get all host records belonging to default or provided Configuration and View plus Zone hierarchy.",
"name": "get",
"signature": "def get(self, configuration, view, zone=None)"
},
{
"docstring": "Create a host record belonging to default or provided Configuration and View plus Zon... | 2 | stack_v2_sparse_classes_30k_train_041809 | Implement the Python class `HostRecordCollection` described below.
Class description:
Implement the HostRecordCollection class.
Method signatures and docstrings:
- def get(self, configuration, view, zone=None): Get all host records belonging to default or provided Configuration and View plus Zone hierarchy.
- def pos... | Implement the Python class `HostRecordCollection` described below.
Class description:
Implement the HostRecordCollection class.
Method signatures and docstrings:
- def get(self, configuration, view, zone=None): Get all host records belonging to default or provided Configuration and View plus Zone hierarchy.
- def pos... | 60b36434e689c3ef852ab388ca2aae370e70c62d | <|skeleton|>
class HostRecordCollection:
def get(self, configuration, view, zone=None):
"""Get all host records belonging to default or provided Configuration and View plus Zone hierarchy."""
<|body_0|>
def post(self, configuration, view, zone=None):
"""Create a host record belonging t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HostRecordCollection:
def get(self, configuration, view, zone=None):
"""Get all host records belonging to default or provided Configuration and View plus Zone hierarchy."""
configuration = g.user.get_api().get_configuration(configuration)
zone = generate_zone_fqdn(zone, configuration.g... | the_stack_v2_python_sparse | Community/rest_api/dns_page.py | bluecatlabs/gateway-workflows | train | 45 | |
1093bfb704374e2ba67e09c797a77129d22a98f2 | [
"super(AttendCompareAggregateBlock, self).__init__()\nself.compression_factor = compression_factor\nself.num_images = args.num_images\nself.attend_module = AttendModule(args, inplanes, compression_factor)\nself.compare_module = CompareModule(args, inplanes, self.num_images)\nself.aggregate_module = AggregateModule(... | <|body_start_0|>
super(AttendCompareAggregateBlock, self).__init__()
self.compression_factor = compression_factor
self.num_images = args.num_images
self.attend_module = AttendModule(args, inplanes, compression_factor)
self.compare_module = CompareModule(args, inplanes, self.num_i... | Attend Compare Aggregate block. | AttendCompareAggregateBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttendCompareAggregateBlock:
"""Attend Compare Aggregate block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (... | stack_v2_sparse_classes_75kplus_train_003957 | 8,762 | permissive | [
{
"docstring": "Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of channels) of the output. downsample(nn.Module): When not none, used to downsample output to planes. compression_factor(int): The compression factor to use when perfo... | 2 | stack_v2_sparse_classes_30k_train_006969 | Implement the Python class `AttendCompareAggregateBlock` described below.
Class description:
Attend Compare Aggregate block.
Method signatures and docstrings:
- def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the ACABlock. Arguments: inplanes(int): The depth (n... | Implement the Python class `AttendCompareAggregateBlock` described below.
Class description:
Attend Compare Aggregate block.
Method signatures and docstrings:
- def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the ACABlock. Arguments: inplanes(int): The depth (n... | 12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054 | <|skeleton|>
class AttendCompareAggregateBlock:
"""Attend Compare Aggregate block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttendCompareAggregateBlock:
"""Attend Compare Aggregate block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of cha... | the_stack_v2_python_sparse | onconet/models/blocks/attend_compare_agg_block.py | yala/Mirai | train | 66 |
42410afe32690036d5cf0124bf2b888b150031b9 | [
"auth = secrets.token_hex(64)\nself.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, max_retries=max_retries, eager=eager, address=bind, forever_mode=True, redirect_failures=redirect_failures)\nlauncher_args = '' if launcher_args is None else ' '.join(launcher_args)\ncli... | <|body_start_0|>
auth = secrets.token_hex(64)
self.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, max_retries=max_retries, eager=eager, address=bind, forever_mode=True, redirect_failures=redirect_failures)
launcher_args = '' if launcher_args is None... | Run server with autoscaling remote clients via external launcher. | AutoScalingCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutoScalingCluster:
"""Run server with autoscaling remote clients via external launcher."""
def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, bind: Tuple... | stack_v2_sparse_classes_75kplus_train_003958 | 18,159 | permissive | [
{
"docstring": "Initialize server and autoscaler.",
"name": "__init__",
"signature": "def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, bind: Tuple[str, int]=('0.0.0... | 3 | stack_v2_sparse_classes_30k_train_013455 | Implement the Python class `AutoScalingCluster` described below.
Class description:
Run server with autoscaling remote clients via external launcher.
Method signatures and docstrings:
- def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int... | Implement the Python class `AutoScalingCluster` described below.
Class description:
Run server with autoscaling remote clients via external launcher.
Method signatures and docstrings:
- def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int... | e142376249e0fe3de624790600f3c5e99022e047 | <|skeleton|>
class AutoScalingCluster:
"""Run server with autoscaling remote clients via external launcher."""
def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, bind: Tuple... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AutoScalingCluster:
"""Run server with autoscaling remote clients via external launcher."""
def __init__(self: AutoScalingCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, bind: Tuple[str, int]=('... | the_stack_v2_python_sparse | src/hypershell/cluster/remote.py | glentner/hyper-shell | train | 20 |
8a5aa16e11180522bc54f1399ea63cb3bcef207a | [
"if expr.is_number:\n return AskImaginaryHandler._number(expr, assumptions)\nreturn test_closed_group(expr, assumptions, Q.antihermitian)",
"if expr.is_number:\n return AskImaginaryHandler._number(expr, assumptions)\nnccount = 0\nresult = False\nfor arg in expr.args:\n if ask(Q.antihermitian(arg), assump... | <|body_start_0|>
if expr.is_number:
return AskImaginaryHandler._number(expr, assumptions)
return test_closed_group(expr, assumptions, Q.antihermitian)
<|end_body_0|>
<|body_start_1|>
if expr.is_number:
return AskImaginaryHandler._number(expr, assumptions)
nccount... | Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian | AskAntiHermitianHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + ... | stack_v2_sparse_classes_75kplus_train_003959 | 21,918 | permissive | [
{
"docstring": "Antihermitian + Antihermitian -> Antihermitian Antihermitian + !Antihermitian -> !Antihermitian",
"name": "Add",
"signature": "def Add(expr, assumptions)"
},
{
"docstring": "As long as there is at most only one noncommutative term: Hermitian*Hermitian -> !Antihermitian Hermitian*... | 3 | stack_v2_sparse_classes_30k_train_012623 | Implement the Python class `AskAntiHermitianHandler` described below.
Class description:
Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian
Method signatures and docstrings:
- def Add(expr, assumptions): Antihe... | Implement the Python class `AskAntiHermitianHandler` described below.
Class description:
Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian
Method signatures and docstrings:
- def Add(expr, assumptions): Antihe... | 1ad7ec05fb1e3676ac879585296c513c3ee50ef9 | <|skeleton|>
class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + !Antihermitia... | the_stack_v2_python_sparse | Library/lib/python3.7/site-packages/sympy/assumptions/handlers/sets.py | holzschu/Carnets | train | 541 |
9560df8d682e74236f2be5d7fe56ba6b9721ef22 | [
"self.shipping_addr = shipping_addr\nif not shipping_addr:\n self.name = '{} (rated after address entered)'.format(self.name)",
"if not self.shipping_addr or not basket.all_lines():\n return prices.Price(currency=basket.currency, excl_tax=D(0), incl_tax=D(0))\nups_settings = models.UPSSettings.get_settings(... | <|body_start_0|>
self.shipping_addr = shipping_addr
if not shipping_addr:
self.name = '{} (rated after address entered)'.format(self.name)
<|end_body_0|>
<|body_start_1|>
if not self.shipping_addr or not basket.all_lines():
return prices.Price(currency=basket.currency, e... | Provide a method of standard UPS ground shipping | DomesticShipping | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomesticShipping:
"""Provide a method of standard UPS ground shipping"""
def __init__(self, shipping_addr=None):
"""Quickly init the default box, and save the shipping address"""
<|body_0|>
def calculate(self, basket):
"""Get a rate for this package from UPS"""
... | stack_v2_sparse_classes_75kplus_train_003960 | 3,718 | no_license | [
{
"docstring": "Quickly init the default box, and save the shipping address",
"name": "__init__",
"signature": "def __init__(self, shipping_addr=None)"
},
{
"docstring": "Get a rate for this package from UPS",
"name": "calculate",
"signature": "def calculate(self, basket)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000698 | Implement the Python class `DomesticShipping` described below.
Class description:
Provide a method of standard UPS ground shipping
Method signatures and docstrings:
- def __init__(self, shipping_addr=None): Quickly init the default box, and save the shipping address
- def calculate(self, basket): Get a rate for this ... | Implement the Python class `DomesticShipping` described below.
Class description:
Provide a method of standard UPS ground shipping
Method signatures and docstrings:
- def __init__(self, shipping_addr=None): Quickly init the default box, and save the shipping address
- def calculate(self, basket): Get a rate for this ... | f7bf3c61407da53d2c2d0142790dce4ccb94ee33 | <|skeleton|>
class DomesticShipping:
"""Provide a method of standard UPS ground shipping"""
def __init__(self, shipping_addr=None):
"""Quickly init the default box, and save the shipping address"""
<|body_0|>
def calculate(self, basket):
"""Get a rate for this package from UPS"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DomesticShipping:
"""Provide a method of standard UPS ground shipping"""
def __init__(self, shipping_addr=None):
"""Quickly init the default box, and save the shipping address"""
self.shipping_addr = shipping_addr
if not shipping_addr:
self.name = '{} (rated after addr... | the_stack_v2_python_sparse | cart/shipping/methods.py | lo-windigo/duxdekes.com | train | 0 |
1d4357228742ad1466ad66fd061220eb76c5d59d | [
"readonly_fields = super(TincHostInline, self).get_readonly_fields(request, obj=obj)\nif obj and obj.tinc.pubkey and ('pubkey' not in readonly_fields):\n return ('pubkey',) + readonly_fields\nreturn readonly_fields",
"if obj and obj.mgmt_net.backend == 'tinc' and (obj.tinc.pubkey is None) and (request.method =... | <|body_start_0|>
readonly_fields = super(TincHostInline, self).get_readonly_fields(request, obj=obj)
if obj and obj.tinc.pubkey and ('pubkey' not in readonly_fields):
return ('pubkey',) + readonly_fields
return readonly_fields
<|end_body_0|>
<|body_start_1|>
if obj and obj.m... | TincHostInline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TincHostInline:
def get_readonly_fields(self, request, obj=None):
"""pubkey as readonly if exists"""
<|body_0|>
def get_formset(self, request, obj=None, **kwargs):
"""Warn user if the tinc host is not fully configured"""
<|body_1|>
def get_fieldsets(self... | stack_v2_sparse_classes_75kplus_train_003961 | 6,808 | no_license | [
{
"docstring": "pubkey as readonly if exists",
"name": "get_readonly_fields",
"signature": "def get_readonly_fields(self, request, obj=None)"
},
{
"docstring": "Warn user if the tinc host is not fully configured",
"name": "get_formset",
"signature": "def get_formset(self, request, obj=No... | 3 | stack_v2_sparse_classes_30k_train_021484 | Implement the Python class `TincHostInline` described below.
Class description:
Implement the TincHostInline class.
Method signatures and docstrings:
- def get_readonly_fields(self, request, obj=None): pubkey as readonly if exists
- def get_formset(self, request, obj=None, **kwargs): Warn user if the tinc host is not... | Implement the Python class `TincHostInline` described below.
Class description:
Implement the TincHostInline class.
Method signatures and docstrings:
- def get_readonly_fields(self, request, obj=None): pubkey as readonly if exists
- def get_formset(self, request, obj=None, **kwargs): Warn user if the tinc host is not... | dd798dc9bd3321b17007ff131e7b1288a2cd3c36 | <|skeleton|>
class TincHostInline:
def get_readonly_fields(self, request, obj=None):
"""pubkey as readonly if exists"""
<|body_0|>
def get_formset(self, request, obj=None, **kwargs):
"""Warn user if the tinc host is not fully configured"""
<|body_1|>
def get_fieldsets(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TincHostInline:
def get_readonly_fields(self, request, obj=None):
"""pubkey as readonly if exists"""
readonly_fields = super(TincHostInline, self).get_readonly_fields(request, obj=obj)
if obj and obj.tinc.pubkey and ('pubkey' not in readonly_fields):
return ('pubkey',) + re... | the_stack_v2_python_sparse | controller/apps/tinc/admin.py | m00dy/vct-controller | train | 2 | |
e09ddcf91f8cfb690dff0e8f1f0eca9b907a23d3 | [
"self.cfg = cfg\nif stage == 0:\n self.encoder_cfg = self.cfg.MODEL.FIRST_STAGE.REGRESSION_METHOD\nelif stage == 1:\n self.encoder_cfg = self.cfg.MODEL.SECOND_STAGE.REGRESSION_METHOD\nelse:\n raise Exception('Not Implementation Error')\nself.regression_method = self.encoder_cfg.TYPE\nself.encoder_dict = {'... | <|body_start_0|>
self.cfg = cfg
if stage == 0:
self.encoder_cfg = self.cfg.MODEL.FIRST_STAGE.REGRESSION_METHOD
elif stage == 1:
self.encoder_cfg = self.cfg.MODEL.SECOND_STAGE.REGRESSION_METHOD
else:
raise Exception('Not Implementation Error')
s... | EncoderDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderDecoder:
def __init__(self, cfg, stage):
"""stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]"""
<|body_0|>
def encode(self, center_xyz, assigned_gt_boxes, batch_anchors_3d):
"""center_xyz: [bs, points_num... | stack_v2_sparse_classes_75kplus_train_003962 | 4,504 | no_license | [
{
"docstring": "stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]",
"name": "__init__",
"signature": "def __init__(self, cfg, stage)"
},
{
"docstring": "center_xyz: [bs, points_num, 3], points location assigned_gt_boxes: [bs, points_num, cls... | 3 | stack_v2_sparse_classes_30k_train_049500 | Implement the Python class `EncoderDecoder` described below.
Class description:
Implement the EncoderDecoder class.
Method signatures and docstrings:
- def __init__(self, cfg, stage): stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]
- def encode(self, center_xyz... | Implement the Python class `EncoderDecoder` described below.
Class description:
Implement the EncoderDecoder class.
Method signatures and docstrings:
- def __init__(self, cfg, stage): stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]
- def encode(self, center_xyz... | 1a78e8902292dc563c1f200ad1df2faaa24d5a01 | <|skeleton|>
class EncoderDecoder:
def __init__(self, cfg, stage):
"""stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]"""
<|body_0|>
def encode(self, center_xyz, assigned_gt_boxes, batch_anchors_3d):
"""center_xyz: [bs, points_num... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EncoderDecoder:
def __init__(self, cfg, stage):
"""stage: 0/1, first stage / second stage For anchors sent to EncoderDecoder, all have shape as [bs, -1, 7]"""
self.cfg = cfg
if stage == 0:
self.encoder_cfg = self.cfg.MODEL.FIRST_STAGE.REGRESSION_METHOD
elif stage ==... | the_stack_v2_python_sparse | builder/encoder_builder.py | zhufeng888/3DSSD_torch | train | 2 | |
325c32215a9def40e1776540593a190e8eb8ae57 | [
"color = self.color\nif color is not None:\n glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)\n glEnable(GL_COLOR_MATERIAL)\n glColorPointer(3, GL_FLOAT, 0, color)\n glEnableClientState(GL_COLOR_ARRAY)\n return 1\nelse:\n return 0",
"normal = self.normal\nif normal is not None:\n glNormalPointe... | <|body_start_0|>
color = self.color
if color is not None:
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)
glEnable(GL_COLOR_MATERIAL)
glColorPointer(3, GL_FLOAT, 0, color)
glEnableClientState(GL_COLOR_ARRAY)
return 1
else:
re... | Substitutes as object to hold vbo values | Holder | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Holder:
"""Substitutes as object to hold vbo values"""
def _enableColors(self, node):
"""Enable the colour array if possible"""
<|body_0|>
def _enableNormals(self, node):
"""Enable the normal array if possible"""
<|body_1|>
def _enableTextures(self, ... | stack_v2_sparse_classes_75kplus_train_003963 | 12,165 | permissive | [
{
"docstring": "Enable the colour array if possible",
"name": "_enableColors",
"signature": "def _enableColors(self, node)"
},
{
"docstring": "Enable the normal array if possible",
"name": "_enableNormals",
"signature": "def _enableNormals(self, node)"
},
{
"docstring": "Enable t... | 4 | stack_v2_sparse_classes_30k_train_047529 | Implement the Python class `Holder` described below.
Class description:
Substitutes as object to hold vbo values
Method signatures and docstrings:
- def _enableColors(self, node): Enable the colour array if possible
- def _enableNormals(self, node): Enable the normal array if possible
- def _enableTextures(self, node... | Implement the Python class `Holder` described below.
Class description:
Substitutes as object to hold vbo values
Method signatures and docstrings:
- def _enableColors(self, node): Enable the colour array if possible
- def _enableNormals(self, node): Enable the normal array if possible
- def _enableTextures(self, node... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class Holder:
"""Substitutes as object to hold vbo values"""
def _enableColors(self, node):
"""Enable the colour array if possible"""
<|body_0|>
def _enableNormals(self, node):
"""Enable the normal array if possible"""
<|body_1|>
def _enableTextures(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Holder:
"""Substitutes as object to hold vbo values"""
def _enableColors(self, node):
"""Enable the colour array if possible"""
color = self.color
if color is not None:
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)
glEnable(GL_COLOR_MATERIAL)
g... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/indexedpolygons.py | alexus37/AugmentedRealityChess | train | 1 |
ae15c9a0dc1ab1c8c72b2b91c65eab3e0bb32eac | [
"params = ParamsParser(request.JSON)\npassword = params.str('password', desc='密码', min_length=MIN_PASSWORD_LENGTH, max_length=MAX_PASSWORD_LENGTH)\nusername = params.str('username', desc='用户名', max_length=MAX_USERNAME_LENGTH)\naccounts = Account.objects.filter_cache(username=username)\nif len(accounts) == 0 or not ... | <|body_start_0|>
params = ParamsParser(request.JSON)
password = params.str('password', desc='密码', min_length=MIN_PASSWORD_LENGTH, max_length=MAX_PASSWORD_LENGTH)
username = params.str('username', desc='用户名', max_length=MAX_USERNAME_LENGTH)
accounts = Account.objects.filter_cache(username... | AccountLoginView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountLoginView:
def post(self, request):
"""登录 :param request: :return:"""
<|body_0|>
def get(self, request):
"""检查是否登录 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
params = ParamsParser(request.JSON)
password =... | stack_v2_sparse_classes_75kplus_train_003964 | 2,013 | no_license | [
{
"docstring": "登录 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "检查是否登录 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001299 | Implement the Python class `AccountLoginView` described below.
Class description:
Implement the AccountLoginView class.
Method signatures and docstrings:
- def post(self, request): 登录 :param request: :return:
- def get(self, request): 检查是否登录 :param request: :return: | Implement the Python class `AccountLoginView` described below.
Class description:
Implement the AccountLoginView class.
Method signatures and docstrings:
- def post(self, request): 登录 :param request: :return:
- def get(self, request): 检查是否登录 :param request: :return:
<|skeleton|>
class AccountLoginView:
def post... | 7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b | <|skeleton|>
class AccountLoginView:
def post(self, request):
"""登录 :param request: :return:"""
<|body_0|>
def get(self, request):
"""检查是否登录 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountLoginView:
def post(self, request):
"""登录 :param request: :return:"""
params = ParamsParser(request.JSON)
password = params.str('password', desc='密码', min_length=MIN_PASSWORD_LENGTH, max_length=MAX_PASSWORD_LENGTH)
username = params.str('username', desc='用户名', max_length... | the_stack_v2_python_sparse | FireHydrant/server/account/views/login.py | shoogoome/FireHydrant | train | 4 | |
c72910de0f5cf5a9acc34a992751c48cebd79329 | [
"if package is None:\n package = Package.from_resource_ids()\nself.package = package\nmd = self.package.to_sql()\nsqlite_path = Path(base_dir) / f'{db_name}.sqlite'\nif not sqlite_path.exists():\n raise RuntimeError(f'{sqlite_path} not initialized! Run `alembic upgrade head`.')\nsuper().__init__(base_dir, db_... | <|body_start_0|>
if package is None:
package = Package.from_resource_ids()
self.package = package
md = self.package.to_sql()
sqlite_path = Path(base_dir) / f'{db_name}.sqlite'
if not sqlite_path.exists():
raise RuntimeError(f'{sqlite_path} not initialized!... | IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class. | PudlSQLiteIOManager | [
"CC-BY-4.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PudlSQLiteIOManager:
"""IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class."""
def __init__(self, base_dir: str, db_name: str, packa... | stack_v2_sparse_classes_75kplus_train_003965 | 31,261 | permissive | [
{
"docstring": "Initialize PudlSQLiteIOManager. Args: base_dir: base directory where all the step outputs which use this object manager will be stored in. db_name: the name of sqlite database. package: Package object that contains collections of :class:`pudl.metadata.classes.Resources` objects and methods for v... | 4 | stack_v2_sparse_classes_30k_train_033796 | Implement the Python class `PudlSQLiteIOManager` described below.
Class description:
IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.
Method signatures and... | Implement the Python class `PudlSQLiteIOManager` described below.
Class description:
IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.
Method signatures and... | 6afae8aade053408f23ac4332d5cbb438ab72dc6 | <|skeleton|>
class PudlSQLiteIOManager:
"""IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class."""
def __init__(self, base_dir: str, db_name: str, packa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PudlSQLiteIOManager:
"""IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class."""
def __init__(self, base_dir: str, db_name: str, package: Package |... | the_stack_v2_python_sparse | src/pudl/io_managers.py | catalyst-cooperative/pudl | train | 382 |
cc14ee3aae6d52e2fb5beea2eaa6cad27856dcb8 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DelegatedAdminServiceManagementDetail()",
"from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'serviceManagementUrl': lambda n: setattr(self, 'service_management_url', n.get_str_value())... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return DelegatedAdminServiceManagementDetail()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .entity import Entity
fields: Dict[str, Callable[[Any], None]] = {'service... | DelegatedAdminServiceManagementDetail | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DelegatedAdminServiceManagementDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminServiceManagementDetail:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d... | stack_v2_sparse_classes_75kplus_train_003966 | 2,388 | 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: DelegatedAdminServiceManagementDetail",
"name": "create_from_discriminator_value",
"signature": "def create_... | 3 | stack_v2_sparse_classes_30k_val_000099 | Implement the Python class `DelegatedAdminServiceManagementDetail` described below.
Class description:
Implement the DelegatedAdminServiceManagementDetail class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminServiceManagementDetail: Crea... | Implement the Python class `DelegatedAdminServiceManagementDetail` described below.
Class description:
Implement the DelegatedAdminServiceManagementDetail class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminServiceManagementDetail: Crea... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DelegatedAdminServiceManagementDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminServiceManagementDetail:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DelegatedAdminServiceManagementDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminServiceManagementDetail:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | the_stack_v2_python_sparse | msgraph/generated/models/delegated_admin_service_management_detail.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
37d91390669a14c6f245955cddd5b48539f25b5f | [
"self.base_widget = base_widget\nself.tab_base_widget = tab_base_widget\nself.project = project\nself.xml_root = self.project.find(manager_node_path)\nif self.xml_root is None:\n raise LookupError('The given manager node \"%s\" is not in the project XML' % manager_node_path)\nself.tab_widgets = []\nself.xml_cont... | <|body_start_0|>
self.base_widget = base_widget
self.tab_base_widget = tab_base_widget
self.project = project
self.xml_root = self.project.find(manager_node_path)
if self.xml_root is None:
raise LookupError('The given manager node "%s" is not in the project XML' % man... | Handler for a group of UI elements with a XMLController as the center piece | AbstractManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbstractManager:
"""Handler for a group of UI elements with a XMLController as the center piece"""
def __init__(self, base_widget, tab_base_widget, project, manager_node_path):
"""@param base_widget (QWidget): Widget to place XmlController in @param tab_base_widget (QTabWidget): TabW... | stack_v2_sparse_classes_75kplus_train_003967 | 2,465 | no_license | [
{
"docstring": "@param base_widget (QWidget): Widget to place XmlController in @param tab_base_widget (QTabWidget): TabWidget to place gui elements (tabs) @param project (OpusProject): currently opened project @param manager_node_path (String): name of the top level node to manage",
"name": "__init__",
... | 4 | stack_v2_sparse_classes_30k_test_001481 | Implement the Python class `AbstractManager` described below.
Class description:
Handler for a group of UI elements with a XMLController as the center piece
Method signatures and docstrings:
- def __init__(self, base_widget, tab_base_widget, project, manager_node_path): @param base_widget (QWidget): Widget to place X... | Implement the Python class `AbstractManager` described below.
Class description:
Handler for a group of UI elements with a XMLController as the center piece
Method signatures and docstrings:
- def __init__(self, base_widget, tab_base_widget, project, manager_node_path): @param base_widget (QWidget): Widget to place X... | c392d15b35aa1d47bbc185ed76314f8e6dd9f92f | <|skeleton|>
class AbstractManager:
"""Handler for a group of UI elements with a XMLController as the center piece"""
def __init__(self, base_widget, tab_base_widget, project, manager_node_path):
"""@param base_widget (QWidget): Widget to place XmlController in @param tab_base_widget (QTabWidget): TabW... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AbstractManager:
"""Handler for a group of UI elements with a XMLController as the center piece"""
def __init__(self, base_widget, tab_base_widget, project, manager_node_path):
"""@param base_widget (QWidget): Widget to place XmlController in @param tab_base_widget (QTabWidget): TabWidget to plac... | the_stack_v2_python_sparse | opus_gui/abstract_manager/abstract_manager.py | psrc/urbansim | train | 4 |
14ad22109e6900f3000c99d61cd321b5641e31a6 | [
"GL.glViewport(0, 0, self.width, self.height)\nGL.glClearColor(0.0, 1.0, 0.0, 0.0)\nself.start = time.time()\nself.nframes = 0",
"GL.glClear(GL.GL_COLOR_BUFFER_BIT)\ntm = time.time() - self.start\nself.nframes += 1\nprint('fps', self.nframes / tm, end='\\r')"
] | <|body_start_0|>
GL.glViewport(0, 0, self.width, self.height)
GL.glClearColor(0.0, 1.0, 0.0, 0.0)
self.start = time.time()
self.nframes = 0
<|end_body_0|>
<|body_start_1|>
GL.glClear(GL.GL_COLOR_BUFFER_BIT)
tm = time.time() - self.start
self.nframes += 1
... | AppOgl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppOgl:
def initgl(self):
"""Initalize gl states when the frame is created"""
<|body_0|>
def redraw(self):
"""Render a single frame"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
GL.glViewport(0, 0, self.width, self.height)
GL.glClearColor(... | stack_v2_sparse_classes_75kplus_train_003968 | 797 | no_license | [
{
"docstring": "Initalize gl states when the frame is created",
"name": "initgl",
"signature": "def initgl(self)"
},
{
"docstring": "Render a single frame",
"name": "redraw",
"signature": "def redraw(self)"
}
] | 2 | null | Implement the Python class `AppOgl` described below.
Class description:
Implement the AppOgl class.
Method signatures and docstrings:
- def initgl(self): Initalize gl states when the frame is created
- def redraw(self): Render a single frame | Implement the Python class `AppOgl` described below.
Class description:
Implement the AppOgl class.
Method signatures and docstrings:
- def initgl(self): Initalize gl states when the frame is created
- def redraw(self): Render a single frame
<|skeleton|>
class AppOgl:
def initgl(self):
"""Initalize gl s... | 302826b345b965e8b1fc10a2251dba9061940118 | <|skeleton|>
class AppOgl:
def initgl(self):
"""Initalize gl states when the frame is created"""
<|body_0|>
def redraw(self):
"""Render a single frame"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppOgl:
def initgl(self):
"""Initalize gl states when the frame is created"""
GL.glViewport(0, 0, self.width, self.height)
GL.glClearColor(0.0, 1.0, 0.0, 0.0)
self.start = time.time()
self.nframes = 0
def redraw(self):
"""Render a single frame"""
GL... | the_stack_v2_python_sparse | interfaces/pyopengl/tk.py | dansgithubuser/playground | train | 0 | |
53510848269c9f1f2d9c631f9de8e5cf99e962ac | [
"super(UploaderThread, self).__init__(parent, **kwargs)\nself._snapshot = snapshot\nself._output = {'urls': dict()}",
"self._log.write('<h1>Beginning Uploads...</h1>')\nprojectData = FlexProjectData(**self._snapshot)\nfor pid, active in self._snapshot['platforms'].iteritems():\n if not active or pid in self._s... | <|body_start_0|>
super(UploaderThread, self).__init__(parent, **kwargs)
self._snapshot = snapshot
self._output = {'urls': dict()}
<|end_body_0|>
<|body_start_1|>
self._log.write('<h1>Beginning Uploads...</h1>')
projectData = FlexProjectData(**self._snapshot)
for pid, act... | A class for... | UploaderThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
<|body_0|>
def _runImpl(self):
"""Doc..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(UploaderThread, s... | stack_v2_sparse_classes_75kplus_train_003969 | 2,791 | no_license | [
{
"docstring": "Creates a new instance of UploaderThread.",
"name": "__init__",
"signature": "def __init__(self, parent, snapshot, **kwargs)"
},
{
"docstring": "Doc...",
"name": "_runImpl",
"signature": "def _runImpl(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012215 | Implement the Python class `UploaderThread` described below.
Class description:
A class for...
Method signatures and docstrings:
- def __init__(self, parent, snapshot, **kwargs): Creates a new instance of UploaderThread.
- def _runImpl(self): Doc... | Implement the Python class `UploaderThread` described below.
Class description:
A class for...
Method signatures and docstrings:
- def __init__(self, parent, snapshot, **kwargs): Creates a new instance of UploaderThread.
- def _runImpl(self): Doc...
<|skeleton|>
class UploaderThread:
"""A class for..."""
de... | 36ffb0fd1ef2e86c1b67feb61fd744f508b13c74 | <|skeleton|>
class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
<|body_0|>
def _runImpl(self):
"""Doc..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
super(UploaderThread, self).__init__(parent, **kwargs)
self._snapshot = snapshot
self._output = {'urls': dict()}
def _runImpl(self):
... | the_stack_v2_python_sparse | src/CompilerDeck/deploy/UploaderThread.py | sernst/CompilerDeck | train | 0 |
a4ce71473f933576fa7bb3e7ed22ec97f6f1e2c0 | [
"parser.add_argument('-d', '--delete', action='store_true', help='delete the selected tags')\nparser.add_argument('tags', nargs='*', metavar='ID or NAME', help='select the tag with ID or NAME and list info')\nreturn parser",
"if parsed_args.tags:\n tags = self.get_objects(parsed_args.tags)\nelse:\n tags = s... | <|body_start_0|>
parser.add_argument('-d', '--delete', action='store_true', help='delete the selected tags')
parser.add_argument('tags', nargs='*', metavar='ID or NAME', help='select the tag with ID or NAME and list info')
return parser
<|end_body_0|>
<|body_start_1|>
if parsed_args.tag... | list all tags | TagsCommand | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagsCommand:
"""list all tags"""
def extend_parser(self, parser):
"""Add more arguments to parser."""
<|body_0|>
def take_action(self, parsed_args):
"""Process CLI call."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
parser.add_argument('-d', '... | stack_v2_sparse_classes_75kplus_train_003970 | 1,116 | permissive | [
{
"docstring": "Add more arguments to parser.",
"name": "extend_parser",
"signature": "def extend_parser(self, parser)"
},
{
"docstring": "Process CLI call.",
"name": "take_action",
"signature": "def take_action(self, parsed_args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013391 | Implement the Python class `TagsCommand` described below.
Class description:
list all tags
Method signatures and docstrings:
- def extend_parser(self, parser): Add more arguments to parser.
- def take_action(self, parsed_args): Process CLI call. | Implement the Python class `TagsCommand` described below.
Class description:
list all tags
Method signatures and docstrings:
- def extend_parser(self, parser): Add more arguments to parser.
- def take_action(self, parsed_args): Process CLI call.
<|skeleton|>
class TagsCommand:
"""list all tags"""
def extend... | 2664d0c70d3d682ad931b885b4965447b156c280 | <|skeleton|>
class TagsCommand:
"""list all tags"""
def extend_parser(self, parser):
"""Add more arguments to parser."""
<|body_0|>
def take_action(self, parsed_args):
"""Process CLI call."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TagsCommand:
"""list all tags"""
def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument('-d', '--delete', action='store_true', help='delete the selected tags')
parser.add_argument('tags', nargs='*', metavar='ID or NAME', help='select the tag with ... | the_stack_v2_python_sparse | termius/handlers/tag.py | termius/termius-cli | train | 262 |
0a240e53b16d65c16f32b32c5902f72e3d92fa95 | [
"self.url = url\nself.api_key = api_key\nsuper(HostedGraphiteReporter, self).__init__(*args, **kwargs)",
"metrics = self.get_metrics()\nif metrics:\n try:\n request = urllib.Request(self.url, metrics)\n request.add_header('Authorization', 'Basic {}'.format(base64.encodestring(self.api_key).strip(... | <|body_start_0|>
self.url = url
self.api_key = api_key
super(HostedGraphiteReporter, self).__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
metrics = self.get_metrics()
if metrics:
try:
request = urllib.Request(self.url, metrics)
... | Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service. | HostedGraphiteReporter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostedGraphiteReporter:
"""Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service."""
def __init__(self, api_key, url='https://hostedgraphite.com/api/v1/sink', *args, **kwargs):
"""Create a Metrics Reporter T... | stack_v2_sparse_classes_75kplus_train_003971 | 3,147 | permissive | [
{
"docstring": "Create a Metrics Reporter To override this method, please make sure to call the superclass *after* your methods. Ie. def __init__(self, mystuff, stuff2=None, *args, **kwargs): # do my stuff... super(MyClass, self).__init__(*args, **kwargs) :param api_key: The Hosted Graphite API key :type api_ke... | 3 | stack_v2_sparse_classes_30k_train_048824 | Implement the Python class `HostedGraphiteReporter` described below.
Class description:
Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service.
Method signatures and docstrings:
- def __init__(self, api_key, url='https://hostedgraphite.com/ap... | Implement the Python class `HostedGraphiteReporter` described below.
Class description:
Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service.
Method signatures and docstrings:
- def __init__(self, api_key, url='https://hostedgraphite.com/ap... | 337aecccda1dcd160bb080a01946ac9edbd449d0 | <|skeleton|>
class HostedGraphiteReporter:
"""Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service."""
def __init__(self, api_key, url='https://hostedgraphite.com/api/v1/sink', *args, **kwargs):
"""Create a Metrics Reporter T... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HostedGraphiteReporter:
"""Hosted Graphite Metrics Reporter class If you have a hosted graphite service, you can log the OGM metrics to your graphite service."""
def __init__(self, api_key, url='https://hostedgraphite.com/api/v1/sink', *args, **kwargs):
"""Create a Metrics Reporter To override th... | the_stack_v2_python_sparse | mogwai/metrics/graphite.py | ZEROFAIL/mogwai | train | 10 |
21bc04b65f9d76d593083e051f39dbbafd8eefee | [
"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... | Missing associated documentation comment in .proto file. | AgentProfileServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgentProfileServiceServicer:
"""Missing associated documentation comment in .proto file."""
def createAgent(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def updateAgent(self, request, context):
"""Missing asso... | stack_v2_sparse_classes_75kplus_train_003972 | 8,348 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "createAgent",
"signature": "def createAgent(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "updateAgent",
"signature": "def updateAgent(self... | 4 | stack_v2_sparse_classes_30k_train_044765 | Implement the Python class `AgentProfileServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def createAgent(self, request, context): Missing associated documentation comment in .proto file.
- def updateAgent(self, request, c... | Implement the Python class `AgentProfileServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def createAgent(self, request, context): Missing associated documentation comment in .proto file.
- def updateAgent(self, request, c... | dc1ea0b58f92429ec8e7b54a8f23525abe024ba9 | <|skeleton|>
class AgentProfileServiceServicer:
"""Missing associated documentation comment in .proto file."""
def createAgent(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def updateAgent(self, request, context):
"""Missing asso... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AgentProfileServiceServicer:
"""Missing associated documentation comment in .proto file."""
def createAgent(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not imple... | the_stack_v2_python_sparse | custos-client-sdks/custos-python-sdk/build/lib/custos/server/core/AgentProfileService_pb2_grpc.py | apache/airavata-custos | train | 12 |
6fd1dbbaca8dc84007b0cecde498aff826d53f26 | [
"if torch.cuda.is_available():\n device = torch.device('cuda')\nelse:\n device = torch.device('cpu')\ntor_zero = torch.Tensor([0.0]).to(device).double()\nalpha = ApproxNDCG_OP.DEFAULT_ALPHA\nbatch_pred_diffs = torch.unsqueeze(input, dim=2) - torch.unsqueeze(input, dim=1)\nbatch_hat_pis = tor_get_approximated_... | <|body_start_0|>
if torch.cuda.is_available():
device = torch.device('cuda')
else:
device = torch.device('cpu')
tor_zero = torch.Tensor([0.0]).to(device).double()
alpha = ApproxNDCG_OP.DEFAULT_ALPHA
batch_pred_diffs = torch.unsqueeze(input, dim=2) - torch.... | ApproxNDCG_OP | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApproxNDCG_OP:
def forward(ctx, input, batch_std_labels):
"""In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ct... | stack_v2_sparse_classes_75kplus_train_003973 | 12,276 | permissive | [
{
"docstring": "In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context object that can be used to stash information for backw... | 2 | stack_v2_sparse_classes_30k_test_002794 | Implement the Python class `ApproxNDCG_OP` described below.
Class description:
Implement the ApproxNDCG_OP class.
Method signatures and docstrings:
- def forward(ctx, input, batch_std_labels): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the out... | Implement the Python class `ApproxNDCG_OP` described below.
Class description:
Implement the ApproxNDCG_OP class.
Method signatures and docstrings:
- def forward(ctx, input, batch_std_labels): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the out... | 4d56d5174c7ce4b15157d112083eb92e57288b04 | <|skeleton|>
class ApproxNDCG_OP:
def forward(ctx, input, batch_std_labels):
"""In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ct... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApproxNDCG_OP:
def forward(ctx, input, batch_std_labels):
"""In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context... | the_stack_v2_python_sparse | MultiDCP/models/loss_utils.py | qiaoliuhub/MultiDCP | train | 3 | |
d98a75f5bcd631506e8987df995b6d525c712b3f | [
"self.mlp = mlp\nself.eta = kwargs.pop('eta', 0.1)\nself.gamma = kwargs.pop('gamma', 0.9)\nself.v_w_list = [np.zeros(w.shape) for w in mlp.weights_list]\nself.v_b_list = [np.zeros(b.shape) for b in mlp.biases_list]",
"future_weights_list = [w - self.gamma * v_w for w, v_w in zip(self.mlp.weights_list, self.v_w_li... | <|body_start_0|>
self.mlp = mlp
self.eta = kwargs.pop('eta', 0.1)
self.gamma = kwargs.pop('gamma', 0.9)
self.v_w_list = [np.zeros(w.shape) for w in mlp.weights_list]
self.v_b_list = [np.zeros(b.shape) for b in mlp.biases_list]
<|end_body_0|>
<|body_start_1|>
future_weigh... | Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP weights v_b_list : np.a... | Nesterov | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Nesterov:
"""Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector... | stack_v2_sparse_classes_75kplus_train_003974 | 20,458 | permissive | [
{
"docstring": "__init__ method for the Nesterov class Sets up hyperparameters for the Nesterov class Parameters ---------- mlp : MLP Multilayer Perceptron object to be trained **kwargs : Parameters used by the Nesterov method (eta, gamma)",
"name": "__init__",
"signature": "def __init__(self, mlp, **kw... | 2 | null | Implement the Python class `Nesterov` described below.
Class description:
Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and b... | Implement the Python class `Nesterov` described below.
Class description:
Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and b... | 3761ff4f2a68137ac196e75c8651260cb8c79e69 | <|skeleton|>
class Nesterov:
"""Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Nesterov:
"""Class implementing Nesterov accelerated gradient optimization Attributes ---------- mlp : MLP Multilayer Perceptron object to be trained eta : float Parameter used to update weights and biases gamma : float Parameter used to update weights and biases v_w_list : np.array Update vector for the MLP ... | the_stack_v2_python_sparse | pr3/mlpOptimizer.py | zentonllo/gcom | train | 1 |
8a115ccf13bd67b3e06c8f0ba3f3655bd126e2c6 | [
"cf = Config('..\\\\DataLayer\\\\ShopTestData.ini', 'test_new_product_category_1')\nts = NewCommodityClassification(driver, 10)\nts.new_product_category('厨具')",
"cf = Config('..\\\\DataLayer\\\\ShopTestData.ini', 'test_new_product_category_1')\nts = NewCommodityClassification(driver, 10)\nts.modify_commodity_clas... | <|body_start_0|>
cf = Config('..\\DataLayer\\ShopTestData.ini', 'test_new_product_category_1')
ts = NewCommodityClassification(driver, 10)
ts.new_product_category('厨具')
<|end_body_0|>
<|body_start_1|>
cf = Config('..\\DataLayer\\ShopTestData.ini', 'test_new_product_category_1')
... | TestCommoditylassification | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCommoditylassification:
def test_new_product_category_1(self, driver):
"""正常新增"""
<|body_0|>
def test_modify_commodity_classification_1(self, driver):
"""正常修改"""
<|body_1|>
def test_delete_product_category(self, driver):
"""正常删除"""
<|... | stack_v2_sparse_classes_75kplus_train_003975 | 1,122 | no_license | [
{
"docstring": "正常新增",
"name": "test_new_product_category_1",
"signature": "def test_new_product_category_1(self, driver)"
},
{
"docstring": "正常修改",
"name": "test_modify_commodity_classification_1",
"signature": "def test_modify_commodity_classification_1(self, driver)"
},
{
"doc... | 3 | null | Implement the Python class `TestCommoditylassification` described below.
Class description:
Implement the TestCommoditylassification class.
Method signatures and docstrings:
- def test_new_product_category_1(self, driver): 正常新增
- def test_modify_commodity_classification_1(self, driver): 正常修改
- def test_delete_product... | Implement the Python class `TestCommoditylassification` described below.
Class description:
Implement the TestCommoditylassification class.
Method signatures and docstrings:
- def test_new_product_category_1(self, driver): 正常新增
- def test_modify_commodity_classification_1(self, driver): 正常修改
- def test_delete_product... | 39d95ceeb3374fa795feac04a0725ff07abc95dc | <|skeleton|>
class TestCommoditylassification:
def test_new_product_category_1(self, driver):
"""正常新增"""
<|body_0|>
def test_modify_commodity_classification_1(self, driver):
"""正常修改"""
<|body_1|>
def test_delete_product_category(self, driver):
"""正常删除"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCommoditylassification:
def test_new_product_category_1(self, driver):
"""正常新增"""
cf = Config('..\\DataLayer\\ShopTestData.ini', 'test_new_product_category_1')
ts = NewCommodityClassification(driver, 10)
ts.new_product_category('厨具')
def test_modify_commodity_classific... | the_stack_v2_python_sparse | BusinessLayer/test_shop.py | 20191019/ui_pytest | train | 0 | |
ec2da4c1ec345ad4df639119778cf15691716454 | [
"hours = [0, 1, 2, 3, 9, 10, 11, 12, 13, 14]\nruns = browser_timeframe.get_list_of_consecutive_sequences(hours)\nself.assertEqual(len(runs), 2)\nfirst_run = runs[0]\nself.assertEqual(first_run[0], 0)\nself.assertEqual(first_run[1], 3)\nsecond_run = runs[1]\nself.assertEqual(second_run[0], 9)\nself.assertEqual(secon... | <|body_start_0|>
hours = [0, 1, 2, 3, 9, 10, 11, 12, 13, 14]
runs = browser_timeframe.get_list_of_consecutive_sequences(hours)
self.assertEqual(len(runs), 2)
first_run = runs[0]
self.assertEqual(first_run[0], 0)
self.assertEqual(first_run[1], 3)
second_run = runs[... | Tests the functionality of the analyzer. | TestBrowserTimeframePlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBrowserTimeframePlugin:
"""Tests the functionality of the analyzer."""
def test_get_list_of_consecutive_sequences(self):
"""Test the get_list_of_consecutive_sequences function."""
<|body_0|>
def test_fix_gap_in_list(self):
"""Test the fix_gap_in_list function... | stack_v2_sparse_classes_75kplus_train_003976 | 2,035 | permissive | [
{
"docstring": "Test the get_list_of_consecutive_sequences function.",
"name": "test_get_list_of_consecutive_sequences",
"signature": "def test_get_list_of_consecutive_sequences(self)"
},
{
"docstring": "Test the fix_gap_in_list function.",
"name": "test_fix_gap_in_list",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_029786 | Implement the Python class `TestBrowserTimeframePlugin` described below.
Class description:
Tests the functionality of the analyzer.
Method signatures and docstrings:
- def test_get_list_of_consecutive_sequences(self): Test the get_list_of_consecutive_sequences function.
- def test_fix_gap_in_list(self): Test the fix... | Implement the Python class `TestBrowserTimeframePlugin` described below.
Class description:
Tests the functionality of the analyzer.
Method signatures and docstrings:
- def test_get_list_of_consecutive_sequences(self): Test the get_list_of_consecutive_sequences function.
- def test_fix_gap_in_list(self): Test the fix... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class TestBrowserTimeframePlugin:
"""Tests the functionality of the analyzer."""
def test_get_list_of_consecutive_sequences(self):
"""Test the get_list_of_consecutive_sequences function."""
<|body_0|>
def test_fix_gap_in_list(self):
"""Test the fix_gap_in_list function... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestBrowserTimeframePlugin:
"""Tests the functionality of the analyzer."""
def test_get_list_of_consecutive_sequences(self):
"""Test the get_list_of_consecutive_sequences function."""
hours = [0, 1, 2, 3, 9, 10, 11, 12, 13, 14]
runs = browser_timeframe.get_list_of_consecutive_sequ... | the_stack_v2_python_sparse | timesketch/lib/analyzers/browser_timeframe_test.py | google/timesketch | train | 2,263 |
90364b49f2b4115d23875c4aecca3b539dfc039e | [
"self.logger.info('Setting up query for %s' % pdb)\nmatches = session.query(mod.UnitIncomplete).filter(mod.UnitIncomplete.pdb_id == pdb)\nself.logger.info('Found %d results in the query' % len([m for m in matches]))\nreturn matches",
"self.logger.info('Loading %s.cif' % pdb)\ncif = self.cif(pdb)\nself.logger.info... | <|body_start_0|>
self.logger.info('Setting up query for %s' % pdb)
matches = session.query(mod.UnitIncomplete).filter(mod.UnitIncomplete.pdb_id == pdb)
self.logger.info('Found %d results in the query' % len([m for m in matches]))
return matches
<|end_body_0|>
<|body_start_1|>
se... | Loader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Loader:
def query(self, session, pdb):
"""Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for."""
<|body_0|>
def missing_keys(self, pdb):
"""Determine the unit ids in a file that are missing/unobse... | stack_v2_sparse_classes_75kplus_train_003977 | 4,059 | no_license | [
{
"docstring": "Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for.",
"name": "query",
"signature": "def query(self, session, pdb)"
},
{
"docstring": "Determine the unit ids in a file that are missing/unobserved. This parses ... | 3 | stack_v2_sparse_classes_30k_train_047838 | Implement the Python class `Loader` described below.
Class description:
Implement the Loader class.
Method signatures and docstrings:
- def query(self, session, pdb): Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for.
- def missing_keys(self, pdb... | Implement the Python class `Loader` described below.
Class description:
Implement the Loader class.
Method signatures and docstrings:
- def query(self, session, pdb): Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for.
- def missing_keys(self, pdb... | 1982e10a56885e56d79aac69365b9ff78c0e3d92 | <|skeleton|>
class Loader:
def query(self, session, pdb):
"""Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for."""
<|body_0|>
def missing_keys(self, pdb):
"""Determine the unit ids in a file that are missing/unobse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Loader:
def query(self, session, pdb):
"""Build a query to Parameters ---------- session : pymotifs.core.Session The session to use. pdb : str The pdb to query for."""
self.logger.info('Setting up query for %s' % pdb)
matches = session.query(mod.UnitIncomplete).filter(mod.UnitIncomplet... | the_stack_v2_python_sparse | pymotifs/units/incomplete.py | BGSU-RNA/RNA-3D-Hub-core | train | 3 | |
1a89821dfb9c81a24c2a14bbe5c1ab3db20ab1d9 | [
"app_label, model_name = get_app_label_and_model_name(self.data.model)\nmodel = get_model(app_label, model_name)\nqueryset = model._default_manager.all()\nfield_kwargs = {'label': self.data.label, 'help_text': self.data.help_text, 'initial': self.data.initial, 'required': self.data.required, 'queryset': queryset, '... | <|body_start_0|>
app_label, model_name = get_app_label_and_model_name(self.data.model)
model = get_model(app_label, model_name)
queryset = model._default_manager.all()
field_kwargs = {'label': self.data.label, 'help_text': self.data.help_text, 'initial': self.data.initial, 'required': se... | Select multiple MPTT model object field plugin. | SelectMultipleMPTTModelObjectsInputPlugin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelectMultipleMPTTModelObjectsInputPlugin:
"""Select multiple MPTT model object field plugin."""
def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs):
"""Get form field instances."""
<|body_0|>
def submit_plugin_form_data... | stack_v2_sparse_classes_75kplus_train_003978 | 3,976 | permissive | [
{
"docstring": "Get form field instances.",
"name": "get_form_field_instances",
"signature": "def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs)"
},
{
"docstring": "Submit plugin form data/process. :param fobi.models.FormEntry form_entry: Insta... | 2 | stack_v2_sparse_classes_30k_train_039397 | Implement the Python class `SelectMultipleMPTTModelObjectsInputPlugin` described below.
Class description:
Select multiple MPTT model object field plugin.
Method signatures and docstrings:
- def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): Get form field instance... | Implement the Python class `SelectMultipleMPTTModelObjectsInputPlugin` described below.
Class description:
Select multiple MPTT model object field plugin.
Method signatures and docstrings:
- def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): Get form field instance... | 4f6ca37bc600dcba3f74400d299826882d53b7d2 | <|skeleton|>
class SelectMultipleMPTTModelObjectsInputPlugin:
"""Select multiple MPTT model object field plugin."""
def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs):
"""Get form field instances."""
<|body_0|>
def submit_plugin_form_data... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SelectMultipleMPTTModelObjectsInputPlugin:
"""Select multiple MPTT model object field plugin."""
def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs):
"""Get form field instances."""
app_label, model_name = get_app_label_and_model_name(sel... | the_stack_v2_python_sparse | events/contrib/plugins/form_elements/fields/select_multiple_mptt_model_objects/base.py | mansonul/events | train | 0 |
cdb65ec3c26d8d63ee094fffed589e87f77cf32d | [
"self.open(base_url + '/logout')\nself.open(base_url + '/login')\nself.type('#email', test_user.email)\nself.type('#password', test_user.password)\nself.click('input[type=\"submit\"]')\nself.assert_element('#sell_form')\nself.assert_element(\"#sell_form form div label[for='name']\")\nself.type('#sell_form form div ... | <|body_start_0|>
self.open(base_url + '/logout')
self.open(base_url + '/login')
self.type('#email', test_user.email)
self.type('#password', test_user.password)
self.click('input[type="submit"]')
self.assert_element('#sell_form')
self.assert_element("#sell_form for... | FrontendSellR4 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrontendSellR4:
def test_sellNameAlphanumeric(self, *_):
"""This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name"""
<|body_0|>
def test_sellNameFirstSpace(self, *_):
"""This function tests that the user cannot submit a... | stack_v2_sparse_classes_75kplus_train_003979 | 6,250 | permissive | [
{
"docstring": "This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name",
"name": "test_sellNameAlphanumeric",
"signature": "def test_sellNameAlphanumeric(self, *_)"
},
{
"docstring": "This function tests that the user cannot submit a ticket with a s... | 3 | stack_v2_sparse_classes_30k_test_001378 | Implement the Python class `FrontendSellR4` described below.
Class description:
Implement the FrontendSellR4 class.
Method signatures and docstrings:
- def test_sellNameAlphanumeric(self, *_): This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name
- def test_sellNameFirs... | Implement the Python class `FrontendSellR4` described below.
Class description:
Implement the FrontendSellR4 class.
Method signatures and docstrings:
- def test_sellNameAlphanumeric(self, *_): This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name
- def test_sellNameFirs... | 582e00a4c16016e545fedcbb14a745d125db94e0 | <|skeleton|>
class FrontendSellR4:
def test_sellNameAlphanumeric(self, *_):
"""This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name"""
<|body_0|>
def test_sellNameFirstSpace(self, *_):
"""This function tests that the user cannot submit a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FrontendSellR4:
def test_sellNameAlphanumeric(self, *_):
"""This function tests that the user cannot submit a ticket with non-alphanumeric characters in the name"""
self.open(base_url + '/logout')
self.open(base_url + '/login')
self.type('#email', test_user.email)
self.... | the_stack_v2_python_sparse | qa327_test/frontend/sell/test_R4_1.py | GraemeBadley/QA-Project | train | 0 | |
daabebaa2e8d2388b8b6c0dd3515181f6e0cb8d8 | [
"if index == len(digits):\n res.append(s)\n return\nletterMap = [' ', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']\nchars = letterMap[int(digits[index])]\nfor i in range(len(chars)):\n self.formCombinations(digits, index + 1, s + chars[i], res)\nreturn",
"if digits == '':\n return []\... | <|body_start_0|>
if index == len(digits):
res.append(s)
return
letterMap = [' ', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
chars = letterMap[int(digits[index])]
for i in range(len(chars)):
self.formCombinations(digits, index + 1, s ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def formCombinations(self, digits, index, s, res):
""":type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void"""
<|body_0|>
def letterCombinations(self, digits):
""":type digits: str :rtype: List[s... | stack_v2_sparse_classes_75kplus_train_003980 | 1,224 | no_license | [
{
"docstring": ":type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void",
"name": "formCombinations",
"signature": "def formCombinations(self, digits, index, s, res)"
},
{
"docstring": ":type digits: str :rtype: List[str]",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_045725 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def formCombinations(self, digits, index, s, res): :type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void
- def lette... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def formCombinations(self, digits, index, s, res): :type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void
- def lette... | f8b35179b980e55f61bbcd2631fa3a9bf30c40ec | <|skeleton|>
class Solution:
def formCombinations(self, digits, index, s, res):
""":type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void"""
<|body_0|>
def letterCombinations(self, digits):
""":type digits: str :rtype: List[s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def formCombinations(self, digits, index, s, res):
""":type digits: str :type index: int :type s: str, this contains one combination from digits[0..index-1] :rtype: void"""
if index == len(digits):
res.append(s)
return
letterMap = [' ', '', 'abc', 'def... | the_stack_v2_python_sparse | Python Solutions/017 Letter Combinations of a Phone Number.py | Sue9/Leetcode | train | 0 | |
cc22f75d4e0322cdcdb4adaabfc03fe6919c7c46 | [
"costs.sort(key=lambda x: abs(x[0] - x[1]), reverse=True)\nab_cst = [0, 0]\nab_cnt = [0, 0]\nfor i, (a, b) in enumerate(costs):\n if abs(ab_cnt[0] - ab_cnt[1]) == len(costs) - i:\n if ab_cnt[0] < ab_cnt[1]:\n ab_cnt[0] += 1\n ab_cst[0] += a\n else:\n ab_cnt[1] += 1\... | <|body_start_0|>
costs.sort(key=lambda x: abs(x[0] - x[1]), reverse=True)
ab_cst = [0, 0]
ab_cnt = [0, 0]
for i, (a, b) in enumerate(costs):
if abs(ab_cnt[0] - ab_cnt[1]) == len(costs) - i:
if ab_cnt[0] < ab_cnt[1]:
ab_cnt[0] += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
"""Sort by gap in descending order and assign each with the largest gap first"""
<|body_0|>
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
"""Simply sort by cost_a - cost_b and assign ea... | stack_v2_sparse_classes_75kplus_train_003981 | 2,963 | no_license | [
{
"docstring": "Sort by gap in descending order and assign each with the largest gap first",
"name": "twoCitySchedCost",
"signature": "def twoCitySchedCost(self, costs: List[List[int]]) -> int"
},
{
"docstring": "Simply sort by cost_a - cost_b and assign early half to go a and the others to B",
... | 2 | stack_v2_sparse_classes_30k_train_053931 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoCitySchedCost(self, costs: List[List[int]]) -> int: Sort by gap in descending order and assign each with the largest gap first
- def twoCitySchedCost(self, costs: List[Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoCitySchedCost(self, costs: List[List[int]]) -> int: Sort by gap in descending order and assign each with the largest gap first
- def twoCitySchedCost(self, costs: List[Lis... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
"""Sort by gap in descending order and assign each with the largest gap first"""
<|body_0|>
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
"""Simply sort by cost_a - cost_b and assign ea... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
"""Sort by gap in descending order and assign each with the largest gap first"""
costs.sort(key=lambda x: abs(x[0] - x[1]), reverse=True)
ab_cst = [0, 0]
ab_cnt = [0, 0]
for i, (a, b) in enumerate(cost... | the_stack_v2_python_sparse | leetcode/solved/1095_Two_City_Scheduling/solution.py | sungminoh/algorithms | train | 0 | |
25ae66d1004e35847c8cbd04ff54a8a08b4932b0 | [
"if head is None:\n return True\nif root is None:\n return False\nreturn self.find_path(head, root) or self.isSubPath(head, root.left) or self.isSubPath(head, root.right)",
"if head is None:\n return True\nif root is None:\n return False\nif head.val == root.val:\n return self.find_path(head.next, ... | <|body_start_0|>
if head is None:
return True
if root is None:
return False
return self.find_path(head, root) or self.isSubPath(head, root.left) or self.isSubPath(head, root.right)
<|end_body_0|>
<|body_start_1|>
if head is None:
return True
i... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSubPath(self, head, root):
""":type head: ListNode :type root: TreeNode :rtype: bool"""
<|body_0|>
def find_path(self, head, root):
"""find a path from given root and head of the linked list"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003982 | 1,625 | permissive | [
{
"docstring": ":type head: ListNode :type root: TreeNode :rtype: bool",
"name": "isSubPath",
"signature": "def isSubPath(self, head, root)"
},
{
"docstring": "find a path from given root and head of the linked list",
"name": "find_path",
"signature": "def find_path(self, head, root)"
... | 2 | stack_v2_sparse_classes_30k_train_012058 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubPath(self, head, root): :type head: ListNode :type root: TreeNode :rtype: bool
- def find_path(self, head, root): find a path from given root and head of the linked list | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubPath(self, head, root): :type head: ListNode :type root: TreeNode :rtype: bool
- def find_path(self, head, root): find a path from given root and head of the linked list... | 547c200b627c774535bc22880b16d5390183aeba | <|skeleton|>
class Solution:
def isSubPath(self, head, root):
""":type head: ListNode :type root: TreeNode :rtype: bool"""
<|body_0|>
def find_path(self, head, root):
"""find a path from given root and head of the linked list"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isSubPath(self, head, root):
""":type head: ListNode :type root: TreeNode :rtype: bool"""
if head is None:
return True
if root is None:
return False
return self.find_path(head, root) or self.isSubPath(head, root.left) or self.isSubPath(head... | the_stack_v2_python_sparse | medium/1367_linked_list_in_binary_tree.py | Sukhrobjon/leetcode | train | 0 | |
63513da0fcc69ef9f9993647554ce4781db8bd43 | [
"where = 'location=\"%s\"' % self.city_code\nif self.woeid:\n where = 'woeid=\"%s\"' % self.woeid\nq = requests.get('http://query.yahooapis.com/v1/public/yql?q=' + 'select * from weather.forecast ' + 'where {where} and u=\"{units}\"&format=json'.format(where=where, units=self.units.lower()[0]), timeout=self.requ... | <|body_start_0|>
where = 'location="%s"' % self.city_code
if self.woeid:
where = 'woeid="%s"' % self.woeid
q = requests.get('http://query.yahooapis.com/v1/public/yql?q=' + 'select * from weather.forecast ' + 'where {where} and u="{units}"&format=json'.format(where=where, units=self.u... | Py3status | [
"WTFPL",
"EPL-2.0",
"BSD-3-Clause",
"GPL-3.0-only",
"BSD-2-Clause",
"GPL-1.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Py3status:
def _get_forecast(self):
"""Ask Yahoo! Weather. for a forecast"""
<|body_0|>
def _get_icon(self, forecast):
"""Return an unicode icon based on the forecast code and text See: http://developer.yahoo.com/weather/#codes"""
<|body_1|>
def weather_... | stack_v2_sparse_classes_75kplus_train_003983 | 5,411 | permissive | [
{
"docstring": "Ask Yahoo! Weather. for a forecast",
"name": "_get_forecast",
"signature": "def _get_forecast(self)"
},
{
"docstring": "Return an unicode icon based on the forecast code and text See: http://developer.yahoo.com/weather/#codes",
"name": "_get_icon",
"signature": "def _get_... | 3 | null | Implement the Python class `Py3status` described below.
Class description:
Implement the Py3status class.
Method signatures and docstrings:
- def _get_forecast(self): Ask Yahoo! Weather. for a forecast
- def _get_icon(self, forecast): Return an unicode icon based on the forecast code and text See: http://developer.ya... | Implement the Python class `Py3status` described below.
Class description:
Implement the Py3status class.
Method signatures and docstrings:
- def _get_forecast(self): Ask Yahoo! Weather. for a forecast
- def _get_icon(self, forecast): Return an unicode icon based on the forecast code and text See: http://developer.ya... | a762517505ed8e3ecb6bc35edc5cc70d49f44ffd | <|skeleton|>
class Py3status:
def _get_forecast(self):
"""Ask Yahoo! Weather. for a forecast"""
<|body_0|>
def _get_icon(self, forecast):
"""Return an unicode icon based on the forecast code and text See: http://developer.yahoo.com/weather/#codes"""
<|body_1|>
def weather_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Py3status:
def _get_forecast(self):
"""Ask Yahoo! Weather. for a forecast"""
where = 'location="%s"' % self.city_code
if self.woeid:
where = 'woeid="%s"' % self.woeid
q = requests.get('http://query.yahooapis.com/v1/public/yql?q=' + 'select * from weather.forecast ' ... | the_stack_v2_python_sparse | py3status/modules/weather_yahoo.py | nan0tube/py3status | train | 0 | |
09d55d889d1ea3164d490b7625a9c8f7b11b777b | [
"if not l1:\n return l2\nif not l2:\n return l1\nif l1.val > l2.val:\n l2.next = self.mergeTwoLists_2(l1, l2.next)\n return l2\nelse:\n l1.next = self.mergeTwoLists_2(l1.next, l2)\n return l1",
"res = ListNode(0)\np = res\nif not l1:\n return l2\nif not l2:\n return l1\nwhile l1 and l2:\n ... | <|body_start_0|>
if not l1:
return l2
if not l2:
return l1
if l1.val > l2.val:
l2.next = self.mergeTwoLists_2(l1, l2.next)
return l2
else:
l1.next = self.mergeTwoLists_2(l1.next, l2)
return l1
<|end_body_0|>
<|body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists_2(self, l1, l2):
"""* 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。"""
<|body_0|>
def mergeTwoLists_1(self, l1, l2):
"""* 迭代 时间复杂度 o(n+m) 空间复杂度 o(1)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003984 | 1,214 | no_license | [
{
"docstring": "* 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。",
"name": "mergeTwoLists_2",
"signature": "def mergeTwoLists_2(self, l1, l2)"
},
{
"docstring": "* 迭代 时间复杂度 o(n+m) 空间复杂度 o(1)",
"name": "mergeTwoLists_1",
"signature": "def mergeTwoLists_1(self, l1... | 2 | stack_v2_sparse_classes_30k_train_027167 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists_2(self, l1, l2): * 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。
- def mergeTwoLists_1(self, l1, l2): * 迭代 时间复杂度 o(n+m) 空间复杂度 o(1) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists_2(self, l1, l2): * 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。
- def mergeTwoLists_1(self, l1, l2): * 迭代 时间复杂度 o(n+m) 空间复杂度 o(1)
<... | ebf9503d4bc6d4335c463aa2b4622dd7df55fb87 | <|skeleton|>
class Solution:
def mergeTwoLists_2(self, l1, l2):
"""* 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。"""
<|body_0|>
def mergeTwoLists_1(self, l1, l2):
"""* 迭代 时间复杂度 o(n+m) 空间复杂度 o(1)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeTwoLists_2(self, l1, l2):
"""* 递归 时间复杂度 o(n+m) 空间复杂度 o(n+m) 每个元素都一定已经被遍历过了,所以 n + m 个栈帧会消耗 O(n + m)的空间。"""
if not l1:
return l2
if not l2:
return l1
if l1.val > l2.val:
l2.next = self.mergeTwoLists_2(l1, l2.next)
... | the_stack_v2_python_sparse | recursion/21_merge_two_sorted_lists.py | huuu97/LeetCode | train | 0 | |
7bc8fcefad5c9c7badac3ce46a01619c4ce35c25 | [
"if year < _Persian.START_YEAR or year > _Persian.END_YEAR:\n return None\nday = 21\nif year % 4 == 1 and year >= 2029 or (year % 4 == 2 and year >= 2062) or (year % 4 == 3 and year >= 2095) or (year % 4 == 0 and 1996 <= year <= 2096):\n day = 20\nelif year % 4 == 2 and year <= 1926 or (year % 4 == 3 and year... | <|body_start_0|>
if year < _Persian.START_YEAR or year > _Persian.END_YEAR:
return None
day = 21
if year % 4 == 1 and year >= 2029 or (year % 4 == 2 and year >= 2062) or (year % 4 == 3 and year >= 2095) or (year % 4 == 0 and 1996 <= year <= 2096):
day = 20
elif ye... | Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar | _Persian | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_003985 | 1,855 | permissive | [
{
"docstring": "Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year.",
"name": "new_year_date",
"signature": "def new_year_date(self, year: int) -> Optional[date]"
},
{
"docstring": "Return Gregorian date of Persian day and month in a given Gregorian year.",
"na... | 2 | stack_v2_sparse_classes_30k_train_029963 | Implement the Python class `_Persian` described below.
Class description:
Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar
Method signatures and docstrings:
- def new_year_date(self, year: int) -> Optional[date]: Return Gregorian date of Persian new year (1 Farvar... | Implement the Python class `_Persian` described below.
Class description:
Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar
Method signatures and docstrings:
- def new_year_date(self, year: int) -> Optional[date]: Return Gregorian date of Persian new year (1 Farvar... | f8c90952bf409703d0af5d89a202e21a90e2317f | <|skeleton|>
class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
if year < _Persian.START_YE... | the_stack_v2_python_sparse | holidays/calendars/persian.py | dr-prodigy/python-holidays | train | 919 |
c5211d5bbbf89f0dc44fe1f2cc21316a8e0de9ed | [
"self.datatype = datatype\nself.datarange = datarange\nself.num = num\nself.strlen = strlen\nself.dict = {int: tuple, float: tuple, str: str}",
"@wraps(func)\ndef wrapper(*args, **kwargs):\n data = self.generate(self.datatype, self.datarange, self.num, self.strlen)\n return func(data, *args, **kwargs)\nretu... | <|body_start_0|>
self.datatype = datatype
self.datarange = datarange
self.num = num
self.strlen = strlen
self.dict = {int: tuple, float: tuple, str: str}
<|end_body_0|>
<|body_start_1|>
@wraps(func)
def wrapper(*args, **kwargs):
data = self.generate(s... | This class is a decorated class | Random_gener | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Random_gener:
"""This class is a decorated class"""
def __init__(self, datatype, datarange, num, strlen=8):
"""To initialize this class, you need to enter the data type, data range, number of data, data length (note that the default length is 8) Areas for improvement: self.dict = {in... | stack_v2_sparse_classes_75kplus_train_003986 | 4,385 | no_license | [
{
"docstring": "To initialize this class, you need to enter the data type, data range, number of data, data length (note that the default length is 8) Areas for improvement: self.dict = {int: tuple, float: tuple, str: str}",
"name": "__init__",
"signature": "def __init__(self, datatype, datarange, num, ... | 5 | null | Implement the Python class `Random_gener` described below.
Class description:
This class is a decorated class
Method signatures and docstrings:
- def __init__(self, datatype, datarange, num, strlen=8): To initialize this class, you need to enter the data type, data range, number of data, data length (note that the de... | Implement the Python class `Random_gener` described below.
Class description:
This class is a decorated class
Method signatures and docstrings:
- def __init__(self, datatype, datarange, num, strlen=8): To initialize this class, you need to enter the data type, data range, number of data, data length (note that the de... | 661dba7ea846859056fd6ee7a310d352ca178e98 | <|skeleton|>
class Random_gener:
"""This class is a decorated class"""
def __init__(self, datatype, datarange, num, strlen=8):
"""To initialize this class, you need to enter the data type, data range, number of data, data length (note that the default length is 8) Areas for improvement: self.dict = {in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Random_gener:
"""This class is a decorated class"""
def __init__(self, datatype, datarange, num, strlen=8):
"""To initialize this class, you need to enter the data type, data range, number of data, data length (note that the default length is 8) Areas for improvement: self.dict = {int: tuple, flo... | the_stack_v2_python_sparse | 彭智焓 2018010275/second_homework/Random_gener.py | wanghan79/2020_Python | train | 4 |
2419fa8b38b5a23b0d19f36a07865e8b6cf8e8ae | [
"self.config = config\nself.level = level\nself.__clf_name = clf_name",
"reader = pd.read_csv(self.config.path_predict + level + '/' + name + '.csv', iterator=False, delimiter=',')\nd = {}\nfor i in range(len(reader['uid'])):\n d[reader['uid'][i]] = np.log10(reader['score'][i])\nreturn d",
"level = self.leve... | <|body_start_0|>
self.config = config
self.level = level
self.__clf_name = clf_name
<|end_body_0|>
<|body_start_1|>
reader = pd.read_csv(self.config.path_predict + level + '/' + name + '.csv', iterator=False, delimiter=',')
d = {}
for i in range(len(reader['uid'])):
... | :class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level | Load_predict_data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Load_predict_data:
""":class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level"""
def __init__(self, config, level, clf_name):
""":type config: Config :type level: str which level of result to read :type clf_name: List[... | stack_v2_sparse_classes_75kplus_train_003987 | 2,756 | no_license | [
{
"docstring": ":type config: Config :type level: str which level of result to read :type clf_name: List[str] name of classifiers on the last level",
"name": "__init__",
"signature": "def __init__(self, config, level, clf_name)"
},
{
"docstring": ":type level: str, which leval of data to read :t... | 3 | stack_v2_sparse_classes_30k_train_017336 | Implement the Python class `Load_predict_data` described below.
Class description:
:class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level
Method signatures and docstrings:
- def __init__(self, config, level, clf_name): :type config: Config :type level... | Implement the Python class `Load_predict_data` described below.
Class description:
:class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level
Method signatures and docstrings:
- def __init__(self, config, level, clf_name): :type config: Config :type level... | 5c5ee9bd76a5c78ac39f872a918661477505134a | <|skeleton|>
class Load_predict_data:
""":class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level"""
def __init__(self, config, level, clf_name):
""":type config: Config :type level: str which level of result to read :type clf_name: List[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Load_predict_data:
""":class Load_predict_data read the prediction result of No.2-n level, use the prediction result as features for next level"""
def __init__(self, config, level, clf_name):
""":type config: Config :type level: str which level of result to read :type clf_name: List[str] name of ... | the_stack_v2_python_sparse | rong360/load_predict_data_local_verfify.py | PengInGitHub/Machine_Learning_Challenge_Rong360_Creidt_Risk_Management | train | 1 |
f38885de8f80316c19ea19c280e0f44c4239aeaa | [
"self.tag = ''\nself.attributes = Attributes()\nself.content = ''\nself.elements = []",
"output = []\nfor e in self.elements:\n if e.tag == tag:\n output.append(e)\nreturn output",
"elem = Data()\nelem.tag = tag\nself.elements.append(elem)\nreturn elem",
"result = Data()\nif 'tag' in data:\n resu... | <|body_start_0|>
self.tag = ''
self.attributes = Attributes()
self.content = ''
self.elements = []
<|end_body_0|>
<|body_start_1|>
output = []
for e in self.elements:
if e.tag == tag:
output.append(e)
return output
<|end_body_1|>
<|bo... | This the XML data class used in SUAVE. Assumptions: None Source: N/A | Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
<|body_0|>
def get_elements(self, tag):
"""Ge... | stack_v2_sparse_classes_75kplus_train_003988 | 4,826 | no_license | [
{
"docstring": "Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A",
"name": "__defaults__",
"signature": "def __defaults__(self)"
},
{
"docstring": "Gets elements with a given tag. Assumptions: None Source: N/A Inputs: tag - used to check ... | 5 | stack_v2_sparse_classes_30k_train_021663 | Implement the Python class `Data` described below.
Class description:
This the XML data class used in SUAVE. Assumptions: None Source: N/A
Method signatures and docstrings:
- def __defaults__(self): Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A
- def get_el... | Implement the Python class `Data` described below.
Class description:
This the XML data class used in SUAVE. Assumptions: None Source: N/A
Method signatures and docstrings:
- def __defaults__(self): Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A
- def get_el... | 0ef6f56a373cedc0cfb2ba30e6f6901da6cbe861 | <|skeleton|>
class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
<|body_0|>
def get_elements(self, tag):
"""Ge... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
self.tag = ''
self.attributes = Attributes()
self.conte... | the_stack_v2_python_sparse | A22DSE/Models/SUAVE/SUAVE/Input_Output/XML/Data.py | dsegroup22/A22CERES | train | 1 |
ab99cddba425a3374d3ffd2ccc0136f45df5b99d | [
"self.copy_recovery = copy_recovery\nself.datastore_entity = datastore_entity\nself.power_state_config = power_state_config\nself.rename_restored_object_param = rename_restored_object_param\nself.resource_entity = resource_entity\nself.restored_objects_network_config = restored_objects_network_config\nself.use_smb_... | <|body_start_0|>
self.copy_recovery = copy_recovery
self.datastore_entity = datastore_entity
self.power_state_config = power_state_config
self.rename_restored_object_param = rename_restored_object_param
self.resource_entity = resource_entity
self.restored_objects_network_... | Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is being restored to its original pare... | RestoreHyperVVMParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreHyperVVMParams:
"""Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional... | stack_v2_sparse_classes_75kplus_train_003989 | 6,574 | permissive | [
{
"docstring": "Constructor for the RestoreHyperVVMParams class",
"name": "__init__",
"signature": "def __init__(self, copy_recovery=None, datastore_entity=None, power_state_config=None, rename_restored_object_param=None, resource_entity=None, restored_objects_network_config=None, use_smb_service=None, ... | 2 | stack_v2_sparse_classes_30k_train_034635 | Implement the Python class `RestoreHyperVVMParams` described below.
Class description:
Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should... | Implement the Python class `RestoreHyperVVMParams` described below.
Class description:
Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreHyperVVMParams:
"""Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestoreHyperVVMParams:
"""Implementation of the 'RestoreHyperVVMParams' model. TODO: type description here. Attributes: copy_recovery (bool): Whether to perform copy recovery. datastore_entity (EntityProto): A datastore entity where the object's files should be restored to. This field is optional if object is... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_hyperv_vm_params.py | cohesity/management-sdk-python | train | 24 |
59fcb5108d5e142fe1aa1b66a1749dd64766d828 | [
"super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.bias = bias\nself.dropout = dropout\nself.pad_type = pad_type\nself.kernel_size = kernel_size\nself.dilation = dilation\nself.stride = stride\nself.activation_fn = pt.ops.mappings.ACTIVATION_FN_MAP[activation_fn]()\nif norm ... | <|body_start_0|>
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.bias = bias
self.dropout = dropout
self.pad_type = pad_type
self.kernel_size = kernel_size
self.dilation = dilation
self.stride = stride
... | simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published | Conv1d | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv1d:
"""simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published"""
def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilation=1, stride=1, bias=True, norm=None, activation_fn='relu'):
... | stack_v2_sparse_classes_75kplus_train_003990 | 6,500 | permissive | [
{
"docstring": "Args: in_channels: out_channels: kernel_size: dilation: stride: bias: dropout: norm: activation_fn:",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilation=1, stride=1, bias=True, norm=None, activatio... | 3 | stack_v2_sparse_classes_30k_test_001709 | Implement the Python class `Conv1d` described below.
Class description:
simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilati... | Implement the Python class `Conv1d` described below.
Class description:
simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilati... | 93e18f41447a6833372bf912d49bc60fc441279a | <|skeleton|>
class Conv1d:
"""simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published"""
def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilation=1, stride=1, bias=True, norm=None, activation_fn='relu'):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Conv1d:
"""simplified version of padertorch.contrib.je.modules.Conv1d #ToDo: replace with JE version when published"""
def __init__(self, in_channels, out_channels, kernel_size, dropout=0.0, pad_type='both', groups=1, dilation=1, stride=1, bias=True, norm=None, activation_fn='relu'):
"""Args: in_... | the_stack_v2_python_sparse | padertorch/modules/convnet.py | fgnt/padertorch | train | 82 |
8508401f2bafcffaaafe0a85eeeab3600d7e9610 | [
"print('ApiCommentsReplies . GET . 1')\ndynamodb = boto3.resource('dynamodb', region_name='us-east-1')\ntable = dynamodb.Table('COMMENTS_REPLIES')\nreply_set_id = request.GET.get('reply_set_id')\ntemp_array = reply_set_id.split('-')\npublisher_id = temp_array[0]\nprint('ApiCommentsReplies . GET . 2')\ntry:\n res... | <|body_start_0|>
print('ApiCommentsReplies . GET . 1')
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table = dynamodb.Table('COMMENTS_REPLIES')
reply_set_id = request.GET.get('reply_set_id')
temp_array = reply_set_id.split('-')
publisher_id = temp_array[0... | COMMENTS REPLIES API View | ApiCommentsReplies | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiCommentsReplies:
"""COMMENTS REPLIES API View"""
def get(self, request, format=None):
"""Return Comment Thread For Comment ID"""
<|body_0|>
def post(self, request, format=None):
"""PUBLISH COMMENT"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003991 | 23,214 | no_license | [
{
"docstring": "Return Comment Thread For Comment ID",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "PUBLISH COMMENT",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005093 | Implement the Python class `ApiCommentsReplies` described below.
Class description:
COMMENTS REPLIES API View
Method signatures and docstrings:
- def get(self, request, format=None): Return Comment Thread For Comment ID
- def post(self, request, format=None): PUBLISH COMMENT | Implement the Python class `ApiCommentsReplies` described below.
Class description:
COMMENTS REPLIES API View
Method signatures and docstrings:
- def get(self, request, format=None): Return Comment Thread For Comment ID
- def post(self, request, format=None): PUBLISH COMMENT
<|skeleton|>
class ApiCommentsReplies:
... | fc1de65cf3420e06c6e3b6ba0d00bc29ffde6fbe | <|skeleton|>
class ApiCommentsReplies:
"""COMMENTS REPLIES API View"""
def get(self, request, format=None):
"""Return Comment Thread For Comment ID"""
<|body_0|>
def post(self, request, format=None):
"""PUBLISH COMMENT"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiCommentsReplies:
"""COMMENTS REPLIES API View"""
def get(self, request, format=None):
"""Return Comment Thread For Comment ID"""
print('ApiCommentsReplies . GET . 1')
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table = dynamodb.Table('COMMENTS_REPLIES... | the_stack_v2_python_sparse | papr_be/api/api_comments/views_api_comments.py | jebudas/papr_be-1 | train | 0 |
292bd0f39c2a94a44c41485f612990063010cafb | [
"if self.journal.current_turn_number % 2 != 0:\n return self.player_1\nreturn self.player_2",
"if self.journal.current_turn_number > 4:\n board = self.journal.current_board\n teams = board.get_middle_teams()\n if not teams:\n self.play_state = enums.PlayState.COMPLETE\n self.winner = Non... | <|body_start_0|>
if self.journal.current_turn_number % 2 != 0:
return self.player_1
return self.player_2
<|end_body_0|>
<|body_start_1|>
if self.journal.current_turn_number > 4:
board = self.journal.current_board
teams = board.get_middle_teams()
i... | The state of a Supercheckers game. | GameState | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameState:
"""The state of a Supercheckers game."""
def current_player(self) -> players.Player:
"""Get the current player based off of the current turn number. :return: a Player"""
<|body_0|>
def update_play_state(self) -> None:
"""Update the play_state enum base... | stack_v2_sparse_classes_75kplus_train_003992 | 3,544 | permissive | [
{
"docstring": "Get the current player based off of the current turn number. :return: a Player",
"name": "current_player",
"signature": "def current_player(self) -> players.Player"
},
{
"docstring": "Update the play_state enum based on the state of the game.",
"name": "update_play_state",
... | 2 | stack_v2_sparse_classes_30k_train_049451 | Implement the Python class `GameState` described below.
Class description:
The state of a Supercheckers game.
Method signatures and docstrings:
- def current_player(self) -> players.Player: Get the current player based off of the current turn number. :return: a Player
- def update_play_state(self) -> None: Update the... | Implement the Python class `GameState` described below.
Class description:
The state of a Supercheckers game.
Method signatures and docstrings:
- def current_player(self) -> players.Player: Get the current player based off of the current turn number. :return: a Player
- def update_play_state(self) -> None: Update the... | 220c271913cedfd5a816b8a2d220e92591c3d936 | <|skeleton|>
class GameState:
"""The state of a Supercheckers game."""
def current_player(self) -> players.Player:
"""Get the current player based off of the current turn number. :return: a Player"""
<|body_0|>
def update_play_state(self) -> None:
"""Update the play_state enum base... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameState:
"""The state of a Supercheckers game."""
def current_player(self) -> players.Player:
"""Get the current player based off of the current turn number. :return: a Player"""
if self.journal.current_turn_number % 2 != 0:
return self.player_1
return self.player_2
... | the_stack_v2_python_sparse | supercheckers/games.py | vegaslon/supercheckers-python | train | 0 |
7043d681700cdfb78990120fe1f8982a6cd1e016 | [
"if model._meta.app_label == 'rolodex':\n return 'rolodex_db'\nreturn 'default'",
"if model._meta.app_label == 'rolodex':\n return 'rolodex_db'\nreturn 'default'",
"if obj1._meta.app_label == obj2._meta.app_label:\n return True\nreturn None",
"if app_label == 'rolodex':\n return db == 'rolodex_db'... | <|body_start_0|>
if model._meta.app_label == 'rolodex':
return 'rolodex_db'
return 'default'
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'rolodex':
return 'rolodex_db'
return 'default'
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_lab... | A router to control all database operations on models in the auth application. | Router | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Router:
"""A router to control all database operations on models in the auth application."""
def db_for_read(self, model, **hints):
"""Attempts to read auth models go to rolodex."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Attempts to write rolodex m... | stack_v2_sparse_classes_75kplus_train_003993 | 1,155 | permissive | [
{
"docstring": "Attempts to read auth models go to rolodex.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attempts to write rolodex models go to rolodex.",
"name": "db_for_write",
"signature": "def db_for_write(self, model, **hints)"
}... | 4 | stack_v2_sparse_classes_30k_train_052451 | Implement the Python class `Router` described below.
Class description:
A router to control all database operations on models in the auth application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read auth models go to rolodex.
- def db_for_write(self, model, **hints): Attemp... | Implement the Python class `Router` described below.
Class description:
A router to control all database operations on models in the auth application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read auth models go to rolodex.
- def db_for_write(self, model, **hints): Attemp... | b9bea16979f1f2edb15e0fb249a5b6fc5ef15270 | <|skeleton|>
class Router:
"""A router to control all database operations on models in the auth application."""
def db_for_read(self, model, **hints):
"""Attempts to read auth models go to rolodex."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Attempts to write rolodex m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Router:
"""A router to control all database operations on models in the auth application."""
def db_for_read(self, model, **hints):
"""Attempts to read auth models go to rolodex."""
if model._meta.app_label == 'rolodex':
return 'rolodex_db'
return 'default'
def db... | the_stack_v2_python_sparse | django_example/router.py | CCBG/django-rolodex | train | 0 |
967e522cddcdf970208656dbc00c05ecafcffdce | [
"self.dp = []\nfor i in xrange(len(matrix)):\n self.dp.append([0])\n for n in matrix[i]:\n self.dp[i].append(self.dp[i][-1] + n)",
"res = 0\nfor i in xrange(row1, row2 + 1):\n res += self.dp[i][col2 + 1] - self.dp[i][col1]\nreturn res"
] | <|body_start_0|>
self.dp = []
for i in xrange(len(matrix)):
self.dp.append([0])
for n in matrix[i]:
self.dp[i].append(self.dp[i][-1] + n)
<|end_body_0|>
<|body_start_1|>
res = 0
for i in xrange(row1, row2 + 1):
res += self.dp[i][col2 +... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_75kplus_train_003994 | 1,712 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp... | 2 | stack_v2_sparse_classes_30k_train_049575 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | b4da922c4e8406c486760639b71e3ec50283ca43 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
self.dp = []
for i in xrange(len(matrix)):
self.dp.append([0])
for n in matrix[i]:
self.dp[i].append(self.dp[i][-1] + n)
def sumR... | the_stack_v2_python_sparse | old_session/session_1/_304/_304_range_sum_query_2D.py | YJL33/LeetCode | train | 3 | |
88d5991c97626355b1ed549915a34bf8198cbaab | [
"self.maxheap = []\nself.maxsize = 0\nself.minheap = []\nself.minsize = 0\nself.size = 0",
"if not self.size:\n heapq.heappush(self.maxheap, (-num, self.maxsize))\n self.maxsize = 1\n self.size = 1\n return\nif num <= -self.maxheap[0][0]:\n heapq.heappush(self.maxheap, (-num, self.maxsize))\n se... | <|body_start_0|>
self.maxheap = []
self.maxsize = 0
self.minheap = []
self.minsize = 0
self.size = 0
<|end_body_0|>
<|body_start_1|>
if not self.size:
heapq.heappush(self.maxheap, (-num, self.maxsize))
self.maxsize = 1
self.size = 1
... | MedianFinder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_003995 | 2,913 | no_license | [
{
"docstring": "initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type num: int :rtype: void",
"name": "addNum",
"signature": "def addNum(self, num)"
},
{
"docstring": ":rtype: float",
"name": "findMedian",
"s... | 3 | stack_v2_sparse_classes_30k_train_021187 | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float
<|skeleton|>
class Me... | 786e1597b18cf5f16df0a3d7dfa0b80c1435de4d | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
self.maxheap = []
self.maxsize = 0
self.minheap = []
self.minsize = 0
self.size = 0
def addNum(self, num):
""":type num: int :rtype: void"""
if not self.size:
... | the_stack_v2_python_sparse | No_295_Find_Median_from_Data_Stream.py | georgewashingturd/leetcode | train | 0 | |
dce9bab653d331efdb7f3babd0564a446a3255c7 | [
"super().__init__(capacity)\nself.n_steps = n_steps\nself.gamma = gamma\nself.history = deque(maxlen=self.n_steps)\nself.exp_history_queue = deque()",
"self.update_history_queue(exp)\nwhile self.exp_history_queue:\n experiences = self.exp_history_queue.popleft()\n last_exp_state, tail_experiences = self.spl... | <|body_start_0|>
super().__init__(capacity)
self.n_steps = n_steps
self.gamma = gamma
self.history = deque(maxlen=self.n_steps)
self.exp_history_queue = deque()
<|end_body_0|>
<|body_start_1|>
self.update_history_queue(exp)
while self.exp_history_queue:
... | N Step Replay Buffer. | MultiStepBuffer | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiStepBuffer:
"""N Step Replay Buffer."""
def __init__(self, capacity: int, n_steps: int=1, gamma: float=0.99) -> None:
"""Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps used for calculating discounted reward/experience gamma: ... | stack_v2_sparse_classes_75kplus_train_003996 | 10,953 | permissive | [
{
"docstring": "Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps used for calculating discounted reward/experience gamma: discount factor when calculating n_step discounted reward of the experience being stored in buffer",
"name": "__init__",
"signatur... | 5 | stack_v2_sparse_classes_30k_train_022704 | Implement the Python class `MultiStepBuffer` described below.
Class description:
N Step Replay Buffer.
Method signatures and docstrings:
- def __init__(self, capacity: int, n_steps: int=1, gamma: float=0.99) -> None: Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps ... | Implement the Python class `MultiStepBuffer` described below.
Class description:
N Step Replay Buffer.
Method signatures and docstrings:
- def __init__(self, capacity: int, n_steps: int=1, gamma: float=0.99) -> None: Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps ... | bdf311369b236c1e3d0336c7ed4ba249854f8606 | <|skeleton|>
class MultiStepBuffer:
"""N Step Replay Buffer."""
def __init__(self, capacity: int, n_steps: int=1, gamma: float=0.99) -> None:
"""Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps used for calculating discounted reward/experience gamma: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiStepBuffer:
"""N Step Replay Buffer."""
def __init__(self, capacity: int, n_steps: int=1, gamma: float=0.99) -> None:
"""Args: capacity: max number of experiences that will be stored in the buffer n_steps: number of steps used for calculating discounted reward/experience gamma: discount fact... | the_stack_v2_python_sparse | src/pl_bolts/models/rl/common/memory.py | Lightning-Universe/lightning-bolts | train | 76 |
0101cb4e170a8d168a24134fee231c0d44274d44 | [
"try:\n self.network_driver.apply_qos_on_port(qos_policy_id, amp_data[constants.VRRP_PORT_ID])\nexcept Exception:\n if not is_revert:\n raise\n LOG.warning('Failed to undo qos policy %(qos_id)s on vrrp port: %(port)s from amphorae: %(amp)s', {'qos_id': request_qos_id, 'port': amp_data[constants.VRRP... | <|body_start_0|>
try:
self.network_driver.apply_qos_on_port(qos_policy_id, amp_data[constants.VRRP_PORT_ID])
except Exception:
if not is_revert:
raise
LOG.warning('Failed to undo qos policy %(qos_id)s on vrrp port: %(port)s from amphorae: %(amp)s', {'q... | Apply Quality of Services to the VIP | ApplyQosAmphora | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplyQosAmphora:
"""Apply Quality of Services to the VIP"""
def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None):
"""Call network driver to apply QoS Policy on the vrrp ports."""
<|body_0|>
def execute(self, loadb... | stack_v2_sparse_classes_75kplus_train_003997 | 44,034 | permissive | [
{
"docstring": "Call network driver to apply QoS Policy on the vrrp ports.",
"name": "_apply_qos_on_vrrp_port",
"signature": "def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None)"
},
{
"docstring": "Apply qos policy on the vrrp ports whic... | 3 | stack_v2_sparse_classes_30k_train_006449 | Implement the Python class `ApplyQosAmphora` described below.
Class description:
Apply Quality of Services to the VIP
Method signatures and docstrings:
- def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None): Call network driver to apply QoS Policy on the vrrp ... | Implement the Python class `ApplyQosAmphora` described below.
Class description:
Apply Quality of Services to the VIP
Method signatures and docstrings:
- def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None): Call network driver to apply QoS Policy on the vrrp ... | 0426285a41464a5015494584f109eed35a0d44db | <|skeleton|>
class ApplyQosAmphora:
"""Apply Quality of Services to the VIP"""
def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None):
"""Call network driver to apply QoS Policy on the vrrp ports."""
<|body_0|>
def execute(self, loadb... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApplyQosAmphora:
"""Apply Quality of Services to the VIP"""
def _apply_qos_on_vrrp_port(self, loadbalancer, amp_data, qos_policy_id, is_revert=False, request_qos_id=None):
"""Call network driver to apply QoS Policy on the vrrp ports."""
try:
self.network_driver.apply_qos_on_po... | the_stack_v2_python_sparse | octavia/controller/worker/v2/tasks/network_tasks.py | openstack/octavia | train | 147 |
53c74e937fa9d39ce722aa19722214074ff54a8a | [
"n = len(matrix)\nfor i in range(n >> 1):\n size = n - (i << 1)\n tmp = matrix[i][i:i + size]\n for j in range(size):\n matrix[i][i + size - 1 - j] = matrix[i + j][i]\n for j in range(size):\n matrix[i + j][i] = matrix[n - 1 - i][i + j]\n for j in range(size):\n matrix[n - 1 - i]... | <|body_start_0|>
n = len(matrix)
for i in range(n >> 1):
size = n - (i << 1)
tmp = matrix[i][i:i + size]
for j in range(size):
matrix[i][i + size - 1 - j] = matrix[i + j][i]
for j in range(size):
matrix[i + j][i] = matrix[n ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate1(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p... | stack_v2_sparse_classes_75kplus_train_003998 | 2,222 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "rotate1",
"signature": "def rotate1(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",... | 2 | stack_v2_sparse_classes_30k_train_027252 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate1(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate(self, matrix): :type matrix: List[List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate1(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate(self, matrix): :type matrix: List[List[... | 4a1747b6497305f3821612d9c358a6795b1690da | <|skeleton|>
class Solution:
def rotate1(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotate1(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
n = len(matrix)
for i in range(n >> 1):
size = n - (i << 1)
tmp = matrix[i][i:i + size]
for j in range(size)... | the_stack_v2_python_sparse | Matrix/q048_rotate_image.py | sevenhe716/LeetCode | train | 0 | |
4211e47e5d84f2f86018686a325dc62e4fb52e08 | [
"global DCHECKER\nself.groups = 0\nself.dictgroups = []\ncheckdict = CHECK_DICT_OBRACKET.search(istring)\nif checkdict:\n if not DCHECKER:\n import alt_hunspell\n DCHECKER = alt_hunspell.Hunspell()\n brcheck = OPEN_BRACKET.search(istring, 0)\n i = 0\n while brcheck:\n start = brchec... | <|body_start_0|>
global DCHECKER
self.groups = 0
self.dictgroups = []
checkdict = CHECK_DICT_OBRACKET.search(istring)
if checkdict:
if not DCHECKER:
import alt_hunspell
DCHECKER = alt_hunspell.Hunspell()
brcheck = OPEN_BRACK... | Matching part of P2P rule. | Condition | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Condition:
"""Matching part of P2P rule."""
def __init__(self, istring, flags):
"""Create an instance of P2P condition."""
<|body_0|>
def finditer(self, iline):
"""Return all possible matches of condition of given rule."""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_75kplus_train_003999 | 17,033 | permissive | [
{
"docstring": "Create an instance of P2P condition.",
"name": "__init__",
"signature": "def __init__(self, istring, flags)"
},
{
"docstring": "Return all possible matches of condition of given rule.",
"name": "finditer",
"signature": "def finditer(self, iline)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002093 | Implement the Python class `Condition` described below.
Class description:
Matching part of P2P rule.
Method signatures and docstrings:
- def __init__(self, istring, flags): Create an instance of P2P condition.
- def finditer(self, iline): Return all possible matches of condition of given rule. | Implement the Python class `Condition` described below.
Class description:
Matching part of P2P rule.
Method signatures and docstrings:
- def __init__(self, istring, flags): Create an instance of P2P condition.
- def finditer(self, iline): Return all possible matches of condition of given rule.
<|skeleton|>
class Co... | ac645fb41260b86491b17fbc50e5ea3300dc28b7 | <|skeleton|>
class Condition:
"""Matching part of P2P rule."""
def __init__(self, istring, flags):
"""Create an instance of P2P condition."""
<|body_0|>
def finditer(self, iline):
"""Return all possible matches of condition of given rule."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Condition:
"""Matching part of P2P rule."""
def __init__(self, istring, flags):
"""Create an instance of P2P condition."""
global DCHECKER
self.groups = 0
self.dictgroups = []
checkdict = CHECK_DICT_OBRACKET.search(istring)
if checkdict:
if not ... | the_stack_v2_python_sparse | scripts/lib/python/ld/p2p.py | WladimirSidorenko/TextNormalization | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.