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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63df90b11e81f0faaa5dd2c997a4ed77dda763bc | [
"C = Course.objects.getCourseById(request)\nCC = CourseCurriculum(course=C, unit=request['unit'], description=request['description'])\nCC.save()\nreturn CC",
"C = Course.objects.get(courseId=request['courseId'])\nCC = CourseCurriculum.objects.get(course=C, unit=request['unit'])\nCC.description = request['descript... | <|body_start_0|>
C = Course.objects.getCourseById(request)
CC = CourseCurriculum(course=C, unit=request['unit'], description=request['description'])
CC.save()
return CC
<|end_body_0|>
<|body_start_1|>
C = Course.objects.get(courseId=request['courseId'])
CC = CourseCurric... | CourseCurriculumManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CourseCurriculumManager:
def addCourseCurriculum(self, request):
"""add course curriculum"""
<|body_0|>
def editCourseCurriculum(self, request):
"""edit course curriculum"""
<|body_1|>
def deleteCourseCurriculum(self, request):
"""delete course c... | stack_v2_sparse_classes_75kplus_train_007600 | 1,849 | permissive | [
{
"docstring": "add course curriculum",
"name": "addCourseCurriculum",
"signature": "def addCourseCurriculum(self, request)"
},
{
"docstring": "edit course curriculum",
"name": "editCourseCurriculum",
"signature": "def editCourseCurriculum(self, request)"
},
{
"docstring": "delet... | 5 | null | Implement the Python class `CourseCurriculumManager` described below.
Class description:
Implement the CourseCurriculumManager class.
Method signatures and docstrings:
- def addCourseCurriculum(self, request): add course curriculum
- def editCourseCurriculum(self, request): edit course curriculum
- def deleteCourseCu... | Implement the Python class `CourseCurriculumManager` described below.
Class description:
Implement the CourseCurriculumManager class.
Method signatures and docstrings:
- def addCourseCurriculum(self, request): add course curriculum
- def editCourseCurriculum(self, request): edit course curriculum
- def deleteCourseCu... | 9673bf8b6094560f0e5cb60efb536139deaa965e | <|skeleton|>
class CourseCurriculumManager:
def addCourseCurriculum(self, request):
"""add course curriculum"""
<|body_0|>
def editCourseCurriculum(self, request):
"""edit course curriculum"""
<|body_1|>
def deleteCourseCurriculum(self, request):
"""delete course c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CourseCurriculumManager:
def addCourseCurriculum(self, request):
"""add course curriculum"""
C = Course.objects.getCourseById(request)
CC = CourseCurriculum(course=C, unit=request['unit'], description=request['description'])
CC.save()
return CC
def editCourseCurric... | the_stack_v2_python_sparse | Course/models/CourseCurriculum.py | IEEEDTU/CMS | train | 5 | |
a7396c38f95384dbc91cb48cc47cc766e8be42da | [
"self.poke_attacker = copy(poke_attacker)\nself.poke_defender = copy(poke_defender)\nself.move = move\nself.dmg = 0\nself.has_pp = move.can_use()\nif not self.has_pp:\n self.missed_attack = False\nelse:\n self.missed_attack = not with_prob_of(move.accuracy()) or self.poke_defender.is_fainted()\n if not sel... | <|body_start_0|>
self.poke_attacker = copy(poke_attacker)
self.poke_defender = copy(poke_defender)
self.move = move
self.dmg = 0
self.has_pp = move.can_use()
if not self.has_pp:
self.missed_attack = False
else:
self.missed_attack = not with... | Attack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attack:
def __init__(self, poke_attacker, poke_defender, move):
"""Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that receives the attack. move (class:'Move'): The Move that the 'poke_attacker' uses in the attack. A... | stack_v2_sparse_classes_75kplus_train_007601 | 3,252 | no_license | [
{
"docstring": "Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that receives the attack. move (class:'Move'): The Move that the 'poke_attacker' uses in the attack. Action: Create and execute the attack and save relevant information about it... | 2 | stack_v2_sparse_classes_30k_train_013193 | Implement the Python class `Attack` described below.
Class description:
Implement the Attack class.
Method signatures and docstrings:
- def __init__(self, poke_attacker, poke_defender, move): Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that re... | Implement the Python class `Attack` described below.
Class description:
Implement the Attack class.
Method signatures and docstrings:
- def __init__(self, poke_attacker, poke_defender, move): Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that re... | aa9defc6387788fc57d50dfdff7e4c43e8a1c358 | <|skeleton|>
class Attack:
def __init__(self, poke_attacker, poke_defender, move):
"""Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that receives the attack. move (class:'Move'): The Move that the 'poke_attacker' uses in the attack. A... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Attack:
def __init__(self, poke_attacker, poke_defender, move):
"""Args: poke_attacker (class:'Pokemon'): The Pokémon that makes the attack. poke_defender (class:'Pokemon'): The Pokémon that receives the attack. move (class:'Move'): The Move that the 'poke_attacker' uses in the attack. Action: Create ... | the_stack_v2_python_sparse | Game/engine/attack.py | dieguigram/Pokemon-Python | train | 0 | |
23f9b4e3852b7231d792d7b9dad0cb6b52ccd98e | [
"self.machines = []\ncluster_infra = f'{ASSETS_DIR}/manifests/cluster-infrastructure-02-config.yml'\nwith open(cluster_infra) as f:\n self.cluster_infra = yaml.load(f, Loader=yaml.FullLoader)",
"self.assertIn('loadBalancer', self.cluster_infra['status']['platformStatus']['openstack'])\nloadBalancer = self.clus... | <|body_start_0|>
self.machines = []
cluster_infra = f'{ASSETS_DIR}/manifests/cluster-infrastructure-02-config.yml'
with open(cluster_infra) as f:
self.cluster_infra = yaml.load(f, Loader=yaml.FullLoader)
<|end_body_0|>
<|body_start_1|>
self.assertIn('loadBalancer', self.clus... | ManagedLoadBalancer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManagedLoadBalancer:
def setUp(self):
"""Parse the Cluster Infrastructure object into a Python data structure."""
<|body_0|>
def test_cluster_infra_object(self):
"""Assert that the Cluster infrastructure object contains the LoadBalancer configuration."""
<|bo... | stack_v2_sparse_classes_75kplus_train_007602 | 1,248 | permissive | [
{
"docstring": "Parse the Cluster Infrastructure object into a Python data structure.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Assert that the Cluster infrastructure object contains the LoadBalancer configuration.",
"name": "test_cluster_infra_object",
"signat... | 2 | stack_v2_sparse_classes_30k_train_030787 | Implement the Python class `ManagedLoadBalancer` described below.
Class description:
Implement the ManagedLoadBalancer class.
Method signatures and docstrings:
- def setUp(self): Parse the Cluster Infrastructure object into a Python data structure.
- def test_cluster_infra_object(self): Assert that the Cluster infras... | Implement the Python class `ManagedLoadBalancer` described below.
Class description:
Implement the ManagedLoadBalancer class.
Method signatures and docstrings:
- def setUp(self): Parse the Cluster Infrastructure object into a Python data structure.
- def test_cluster_infra_object(self): Assert that the Cluster infras... | d7f39ed4836c9f57ada762ec393943ba1b5ce451 | <|skeleton|>
class ManagedLoadBalancer:
def setUp(self):
"""Parse the Cluster Infrastructure object into a Python data structure."""
<|body_0|>
def test_cluster_infra_object(self):
"""Assert that the Cluster infrastructure object contains the LoadBalancer configuration."""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ManagedLoadBalancer:
def setUp(self):
"""Parse the Cluster Infrastructure object into a Python data structure."""
self.machines = []
cluster_infra = f'{ASSETS_DIR}/manifests/cluster-infrastructure-02-config.yml'
with open(cluster_infra) as f:
self.cluster_infra = ya... | the_stack_v2_python_sparse | scripts/openstack/manifest-tests/lb-managed/test_cluster-infra.py | openshift/installer | train | 1,541 | |
654903d1365dc7f97bfbe014e96c70493e0cf09f | [
"if not matrix or not path or rows < 1 or (cols < 1):\n return False\nvisited = [0] * (rows * cols)\npathLength = 0\nfor i in range(rows):\n for j in range(cols):\n if self.hasPathCore(matrix, rows, cols, i, j, path, pathLength, visited):\n return True\nreturn False",
"if len(path) == path... | <|body_start_0|>
if not matrix or not path or rows < 1 or (cols < 1):
return False
visited = [0] * (rows * cols)
pathLength = 0
for i in range(rows):
for j in range(cols):
if self.hasPathCore(matrix, rows, cols, i, j, path, pathLength, visited):
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPath(self, matrix, rows, cols, path):
""":param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径"""
<|body_0|>
def hasPathCore(self, matrix, rows, cols, i, j, path, pathLength, visited):
"""以格子 (i,j) 开始找路径 path 中的字符 path[path... | stack_v2_sparse_classes_75kplus_train_007603 | 2,879 | permissive | [
{
"docstring": ":param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径",
"name": "hasPath",
"signature": "def hasPath(self, matrix, rows, cols, path)"
},
{
"docstring": "以格子 (i,j) 开始找路径 path 中的字符 path[pathLength], 若未找到说明以 (i, j)为起点是找不到路径的,直接退出,以下一个格子为起点找。 若找到了路径中的第一个字符,... | 2 | stack_v2_sparse_classes_30k_train_006149 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPath(self, matrix, rows, cols, path): :param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径
- def hasPathCore(self, matrix, rows, cols, i, j, pa... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPath(self, matrix, rows, cols, path): :param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径
- def hasPathCore(self, matrix, rows, cols, i, j, pa... | 889d8fa489f1f2719c5a0dafd3ae51df7b4bf978 | <|skeleton|>
class Solution:
def hasPath(self, matrix, rows, cols, path):
""":param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径"""
<|body_0|>
def hasPathCore(self, matrix, rows, cols, i, j, path, pathLength, visited):
"""以格子 (i,j) 开始找路径 path 中的字符 path[path... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hasPath(self, matrix, rows, cols, path):
""":param matrix: 一个一维数组(题目中的二维矩阵) :param rows: 行 :param cols: 列 :param path: 要找的路径"""
if not matrix or not path or rows < 1 or (cols < 1):
return False
visited = [0] * (rows * cols)
pathLength = 0
for i... | the_stack_v2_python_sparse | 剑指offer/12-矩阵中的路径/12 hasPath.py | jinbooooom/coding-for-algorithms | train | 14 | |
6dbbb0165a3e7b4a8f5c1900e13b0dda93327c4f | [
"super(Cont_RDB, self).__init__()\nself.InChan = InChannel\nself.OutChan = OutChannel\nself.G = growRate\nself.C = nConvLayers\nif self.InChan != self.G:\n self.InConv = ops.Conv2d(self.InChan, self.G, 1, padding=0, stride=1)\nif self.OutChan != self.G and self.OutChan != self.InChan:\n self.OutConv = ops.Con... | <|body_start_0|>
super(Cont_RDB, self).__init__()
self.InChan = InChannel
self.OutChan = OutChannel
self.G = growRate
self.C = nConvLayers
if self.InChan != self.G:
self.InConv = ops.Conv2d(self.InChan, self.G, 1, padding=0, stride=1)
if self.OutChan !... | Contextual residual dense block. | Cont_RDB | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cont_RDB:
"""Contextual residual dense block."""
def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3):
"""Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param gro... | stack_v2_sparse_classes_75kplus_train_007604 | 14,306 | permissive | [
{
"docstring": "Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth rate of block :type growRate: int :param nConvLayers: the number of convlution layer :type nConvLayers: int :param kSize: ker... | 2 | stack_v2_sparse_classes_30k_train_025625 | Implement the Python class `Cont_RDB` described below.
Class description:
Contextual residual dense block.
Method signatures and docstrings:
- def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: ... | Implement the Python class `Cont_RDB` described below.
Class description:
Contextual residual dense block.
Method signatures and docstrings:
- def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: ... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class Cont_RDB:
"""Contextual residual dense block."""
def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3):
"""Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param gro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Cont_RDB:
"""Contextual residual dense block."""
def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3):
"""Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth... | the_stack_v2_python_sparse | zeus/networks/erdb_esr.py | huawei-noah/xingtian | train | 308 |
8f9c390c5648cab114bb016c6e322e21d6bbc6b8 | [
"user = UserModel.objects.create_user(username='saimer')\nself.assertEqual(user.email, '')\nself.assertEqual(user.username, 'saimer')\nself.assertFalse(user.has_usable_password())",
"self.test_user_creation()\nwith self.assertRaisesMessage(IntegrityError, 'UNIQUE constraint failed: auths_user.username'):\n Use... | <|body_start_0|>
user = UserModel.objects.create_user(username='saimer')
self.assertEqual(user.email, '')
self.assertEqual(user.username, 'saimer')
self.assertFalse(user.has_usable_password())
<|end_body_0|>
<|body_start_1|>
self.test_user_creation()
with self.assertRais... | Test case to create user. | UserCreationTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserCreationTestCase:
"""Test case to create user."""
def test_user_creation(self):
"""Testing to create a user. Expected result: - User created successfully"""
<|body_0|>
def test_user_recreate(self):
"""Testing to re-create same user. Expected result: - Raise e... | stack_v2_sparse_classes_75kplus_train_007605 | 1,526 | no_license | [
{
"docstring": "Testing to create a user. Expected result: - User created successfully",
"name": "test_user_creation",
"signature": "def test_user_creation(self)"
},
{
"docstring": "Testing to re-create same user. Expected result: - Raise exception IntegrityError",
"name": "test_user_recreat... | 3 | stack_v2_sparse_classes_30k_train_020176 | Implement the Python class `UserCreationTestCase` described below.
Class description:
Test case to create user.
Method signatures and docstrings:
- def test_user_creation(self): Testing to create a user. Expected result: - User created successfully
- def test_user_recreate(self): Testing to re-create same user. Expec... | Implement the Python class `UserCreationTestCase` described below.
Class description:
Test case to create user.
Method signatures and docstrings:
- def test_user_creation(self): Testing to create a user. Expected result: - User created successfully
- def test_user_recreate(self): Testing to re-create same user. Expec... | 7312cf04599fbc3575764b8d14fa88353a6d0baa | <|skeleton|>
class UserCreationTestCase:
"""Test case to create user."""
def test_user_creation(self):
"""Testing to create a user. Expected result: - User created successfully"""
<|body_0|>
def test_user_recreate(self):
"""Testing to re-create same user. Expected result: - Raise e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserCreationTestCase:
"""Test case to create user."""
def test_user_creation(self):
"""Testing to create a user. Expected result: - User created successfully"""
user = UserModel.objects.create_user(username='saimer')
self.assertEqual(user.email, '')
self.assertEqual(user.u... | the_stack_v2_python_sparse | src/auths/tests.py | saimer/core | train | 0 |
119116554190346cc09b8a920d32915a28fc52f2 | [
"OutputPanelHandler.hide_panel()\noutput = ''\nworkspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name())))\nif not workspace_file:\n return None\ncmd = [path.join(PKG_FOLDER, 'external', 'bazel-compilation-database', 'generate.sh')]\noutput = Tools.run_command(cmd, cwd=workspace_fi... | <|body_start_0|>
OutputPanelHandler.hide_panel()
output = ''
workspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name())))
if not workspace_file:
return None
cmd = [path.join(PKG_FOLDER, 'external', 'bazel-compilation-database', 'generate.... | Collection of methods to generate a compilation database. | Bazel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bazel:
"""Collection of methods to generate a compilation database."""
def generate_compdb(view):
"""Generate the compilation database."""
<|body_0|>
def compdb_generated(future):
"""Generate a compilation database."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_75kplus_train_007606 | 1,614 | permissive | [
{
"docstring": "Generate the compilation database.",
"name": "generate_compdb",
"signature": "def generate_compdb(view)"
},
{
"docstring": "Generate a compilation database.",
"name": "compdb_generated",
"signature": "def compdb_generated(future)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016732 | Implement the Python class `Bazel` described below.
Class description:
Collection of methods to generate a compilation database.
Method signatures and docstrings:
- def generate_compdb(view): Generate the compilation database.
- def compdb_generated(future): Generate a compilation database. | Implement the Python class `Bazel` described below.
Class description:
Collection of methods to generate a compilation database.
Method signatures and docstrings:
- def generate_compdb(view): Generate the compilation database.
- def compdb_generated(future): Generate a compilation database.
<|skeleton|>
class Bazel:... | c2e8913052f4c9f11433f0a421fbbc4b78699fd6 | <|skeleton|>
class Bazel:
"""Collection of methods to generate a compilation database."""
def generate_compdb(view):
"""Generate the compilation database."""
<|body_0|>
def compdb_generated(future):
"""Generate a compilation database."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bazel:
"""Collection of methods to generate a compilation database."""
def generate_compdb(view):
"""Generate the compilation database."""
OutputPanelHandler.hide_panel()
output = ''
workspace_file = File.search('WORKSPACE', TreeSearchScope(path.dirname(view.file_name())))... | the_stack_v2_python_sparse | plugin/flags_sources/bazel.py | niosus/EasyClangComplete | train | 677 |
feada690bdbf32241921ed938f937eaaa5ed25ee | [
"assert isinstance(converter, Converter), 'Invalid converter %s' % converter\nassert isinstance(baseTimeZone, tzinfo), 'Invalid base time zone %s' % baseTimeZone\nassert isinstance(timeZoneStr, tzinfo), 'Invalid time zone %s' % timeZoneStr\nassert isinstance(timeZoneVal, tzinfo), 'Invalid time zone %s' % timeZoneVa... | <|body_start_0|>
assert isinstance(converter, Converter), 'Invalid converter %s' % converter
assert isinstance(baseTimeZone, tzinfo), 'Invalid base time zone %s' % baseTimeZone
assert isinstance(timeZoneStr, tzinfo), 'Invalid time zone %s' % timeZoneStr
assert isinstance(timeZoneVal, tzi... | Provides the converter time zone support. | ConverterTimeZone | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConverterTimeZone:
"""Provides the converter time zone support."""
def __init__(self, converter, baseTimeZone, timeZoneStr, timeZoneVal):
"""Construct the GMT converter. @param converter: Converter The wrapped converter. @param baseTimeZone: tzinfo The time zone of the dates to be co... | stack_v2_sparse_classes_75kplus_train_007607 | 5,482 | no_license | [
{
"docstring": "Construct the GMT converter. @param converter: Converter The wrapped converter. @param baseTimeZone: tzinfo The time zone of the dates to be converted. @param timeZoneStr: tzinfo The time zone to convert to string values. @param timeZoneVal: tzinfo The time zone to convert the string values.",
... | 3 | stack_v2_sparse_classes_30k_train_023042 | Implement the Python class `ConverterTimeZone` described below.
Class description:
Provides the converter time zone support.
Method signatures and docstrings:
- def __init__(self, converter, baseTimeZone, timeZoneStr, timeZoneVal): Construct the GMT converter. @param converter: Converter The wrapped converter. @param... | Implement the Python class `ConverterTimeZone` described below.
Class description:
Provides the converter time zone support.
Method signatures and docstrings:
- def __init__(self, converter, baseTimeZone, timeZoneStr, timeZoneVal): Construct the GMT converter. @param converter: Converter The wrapped converter. @param... | e0b3466b34d31548996d57be4a9dac134d904380 | <|skeleton|>
class ConverterTimeZone:
"""Provides the converter time zone support."""
def __init__(self, converter, baseTimeZone, timeZoneStr, timeZoneVal):
"""Construct the GMT converter. @param converter: Converter The wrapped converter. @param baseTimeZone: tzinfo The time zone of the dates to be co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConverterTimeZone:
"""Provides the converter time zone support."""
def __init__(self, converter, baseTimeZone, timeZoneStr, timeZoneVal):
"""Construct the GMT converter. @param converter: Converter The wrapped converter. @param baseTimeZone: tzinfo The time zone of the dates to be converted. @par... | the_stack_v2_python_sparse | components/ally-core-http/ally/core/http/impl/processor/time_zone.py | cristidomsa/Ally-Py | train | 0 |
69eddc9f826d9d9d9986e1403a2fce0ce99958b3 | [
"super().__init__(freq)\nself._radius = radius\nself._property_list['model'] = 'DiscModel'\nself._property_list['radius'] = self._radius",
"if source.get('transceiver').get_channel_freq() != destination.get('transceiver').get_channel_freq():\n return False\nfrom_loc = source.get('location')\nto_loc = destinati... | <|body_start_0|>
super().__init__(freq)
self._radius = radius
self._property_list['model'] = 'DiscModel'
self._property_list['radius'] = self._radius
<|end_body_0|>
<|body_start_1|>
if source.get('transceiver').get_channel_freq() != destination.get('transceiver').get_channel_fre... | This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting source. The signal will be delivered by the channel to the transceivers within th... | DiscModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscModel:
"""This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting source. The signal will be delivered by the ... | stack_v2_sparse_classes_75kplus_train_007608 | 11,017 | no_license | [
{
"docstring": "This is the constructor. Parameters ---------- freq : float The frequency of this channel. radius : float The transmission radius.",
"name": "__init__",
"signature": "def __init__(self, freq, radius: float)"
},
{
"docstring": "This method tests if a node can reach another when tr... | 4 | stack_v2_sparse_classes_30k_val_000583 | Implement the Python class `DiscModel` described below.
Class description:
This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting sourc... | Implement the Python class `DiscModel` described below.
Class description:
This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting sourc... | c9b8b0f5f4f57ae6506c80956e48bad3ac9457ad | <|skeleton|>
class DiscModel:
"""This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting source. The signal will be delivered by the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiscModel:
"""This is a subclass of BaseChannel implementing a disc model for a wireless channel radiation. For this channel model, when there is a transmission, the signal will propagate within a disc with the origin of the disc being the transmitting source. The signal will be delivered by the channel to th... | the_stack_v2_python_sparse | comm/channel.py | xiaogaogaoxiao/Machine-Learning-Algorithm-for-Vehicular-Communication-Networks | train | 1 |
7d6883ce5e61050c4058093ce1791a37cebdd981 | [
"assert self.normalized_request is not None\nsearch_cursor = self.normalized_request.get('cursor')\nlanguage_code = self.normalized_request.get('language_code')\nif opportunity_type == constants.OPPORTUNITY_TYPE_SKILL:\n skill_opportunities, next_cursor, more = self._get_skill_opportunities_with_corresponding_to... | <|body_start_0|>
assert self.normalized_request is not None
search_cursor = self.normalized_request.get('cursor')
language_code = self.normalized_request.get('language_code')
if opportunity_type == constants.OPPORTUNITY_TYPE_SKILL:
skill_opportunities, next_cursor, more = sel... | Provides data for opportunities available in different categories. | ContributionOpportunitiesHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContributionOpportunitiesHandler:
"""Provides data for opportunities available in different categories."""
def get(self, opportunity_type: str) -> None:
"""Handles GET requests."""
<|body_0|>
def _get_skill_opportunities_with_corresponding_topic_name(self, cursor: Option... | stack_v2_sparse_classes_75kplus_train_007609 | 43,264 | permissive | [
{
"docstring": "Handles GET requests.",
"name": "get",
"signature": "def get(self, opportunity_type: str) -> None"
},
{
"docstring": "Returns a list of skill opportunities available for questions with a corresponding topic name. Args: cursor: str or None. If provided, the list of returned entiti... | 3 | null | Implement the Python class `ContributionOpportunitiesHandler` described below.
Class description:
Provides data for opportunities available in different categories.
Method signatures and docstrings:
- def get(self, opportunity_type: str) -> None: Handles GET requests.
- def _get_skill_opportunities_with_corresponding... | Implement the Python class `ContributionOpportunitiesHandler` described below.
Class description:
Provides data for opportunities available in different categories.
Method signatures and docstrings:
- def get(self, opportunity_type: str) -> None: Handles GET requests.
- def _get_skill_opportunities_with_corresponding... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class ContributionOpportunitiesHandler:
"""Provides data for opportunities available in different categories."""
def get(self, opportunity_type: str) -> None:
"""Handles GET requests."""
<|body_0|>
def _get_skill_opportunities_with_corresponding_topic_name(self, cursor: Option... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContributionOpportunitiesHandler:
"""Provides data for opportunities available in different categories."""
def get(self, opportunity_type: str) -> None:
"""Handles GET requests."""
assert self.normalized_request is not None
search_cursor = self.normalized_request.get('cursor')
... | the_stack_v2_python_sparse | core/controllers/contributor_dashboard.py | oppia/oppia | train | 6,172 |
fa6949e1b87fd23c469e0ab92f31e23fc0f6bf43 | [
"layer_db = LayerDatabase(model)\nuse_cuda = False\npruner = SpatialSvdPruner()\ncost_calculator = SpatialSvdCostCalculator()\ncomp_ratio_rounding_algo = RankRounder(params.multiplicity, cost_calculator)\nif params.mode == SpatialSvdParameters.Mode.auto:\n greedy_params = params.mode_params.greedy_params\n co... | <|body_start_0|>
layer_db = LayerDatabase(model)
use_cuda = False
pruner = SpatialSvdPruner()
cost_calculator = SpatialSvdCostCalculator()
comp_ratio_rounding_algo = RankRounder(params.multiplicity, cost_calculator)
if params.mode == SpatialSvdParameters.Mode.auto:
... | Factory to construct various aimet model compression classes based on a scheme | CompressionFactory | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServe... | stack_v2_sparse_classes_75kplus_train_007610 | 7,032 | permissive | [
{
"docstring": "Factory method to construct SpatialSvdCompressionAlgo :param model: Keras model to compress :param eval_callback: Evaluation callback for the model :param eval_iterations: Evaluation iterations :param cost_metric: Cost metric (mac or memory) :param params: Spatial SVD compression parameters :par... | 2 | stack_v2_sparse_classes_30k_train_040922 | Implement the Python class `CompressionFactory` described below.
Class description:
Factory to construct various aimet model compression classes based on a scheme
Method signatures and docstrings:
- def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric:... | Implement the Python class `CompressionFactory` described below.
Class description:
Factory to construct various aimet model compression classes based on a scheme
Method signatures and docstrings:
- def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric:... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServerSession=None... | the_stack_v2_python_sparse | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/compression_factory.py | quic/aimet | train | 1,676 |
b32b9bb6ae144e053048dc688108b08bdb28b91e | [
"self.request = request\nself.futures = {}\nsuper(StationsLoader, self).__init__()",
"self.setPriority(QtCore.QThread.LowestPriority)\nself.clearFutures()\nself.futures = {}\ninventory = None\nLOGGER.info('Making %d station requests' % len(self.request.sub_requests))\nwith concurrent.futures.ThreadPoolExecutor(5)... | <|body_start_0|>
self.request = request
self.futures = {}
super(StationsLoader, self).__init__()
<|end_body_0|>
<|body_start_1|>
self.setPriority(QtCore.QThread.LowestPriority)
self.clearFutures()
self.futures = {}
inventory = None
LOGGER.info('Making %d ... | Thread to handle station requests | StationsLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StationsLoader:
"""Thread to handle station requests"""
def __init__(self, request):
"""Initialization."""
<|body_0|>
def run(self):
"""Make a webservice request for events using the passed in options."""
<|body_1|>
def clearFutures(self):
""... | stack_v2_sparse_classes_75kplus_train_007611 | 7,532 | no_license | [
{
"docstring": "Initialization.",
"name": "__init__",
"signature": "def __init__(self, request)"
},
{
"docstring": "Make a webservice request for events using the passed in options.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Cancel any outstanding tasks",
... | 4 | stack_v2_sparse_classes_30k_train_052918 | Implement the Python class `StationsLoader` described below.
Class description:
Thread to handle station requests
Method signatures and docstrings:
- def __init__(self, request): Initialization.
- def run(self): Make a webservice request for events using the passed in options.
- def clearFutures(self): Cancel any out... | Implement the Python class `StationsLoader` described below.
Class description:
Thread to handle station requests
Method signatures and docstrings:
- def __init__(self, request): Initialization.
- def run(self): Make a webservice request for events using the passed in options.
- def clearFutures(self): Cancel any out... | 1a1faf5daabfc697172e72856e3fa089df038673 | <|skeleton|>
class StationsLoader:
"""Thread to handle station requests"""
def __init__(self, request):
"""Initialization."""
<|body_0|>
def run(self):
"""Make a webservice request for events using the passed in options."""
<|body_1|>
def clearFutures(self):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StationsLoader:
"""Thread to handle station requests"""
def __init__(self, request):
"""Initialization."""
self.request = request
self.futures = {}
super(StationsLoader, self).__init__()
def run(self):
"""Make a webservice request for events using the passed i... | the_stack_v2_python_sparse | venv/Lib/site-packages/pyweed/stations_handler.py | wenyali/Decoding_code | train | 0 |
6d5ed1d2eb359dbfbee3cac333e9e97acd6e0ad6 | [
"if 'colored' in kwargs:\n self.colored = kwargs['colored']\n del kwargs['colored']\nelse:\n self.colored = False\nkwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT\nBaseLTOLabel.__init__(self, *args, **kwargs)",
"BaseLTOLabel.drawOn(self, canvas, x, y)\ncanvas.saveState()\ncanvas.setLineWidth(... | <|body_start_0|>
if 'colored' in kwargs:
self.colored = kwargs['colored']
del kwargs['colored']
else:
self.colored = False
kwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT
BaseLTOLabel.__init__(self, *args, **kwargs)
<|end_body_0|>
<|body_s... | A class for LTO labels with rectangular blocks around the tape identifier. | VerticalLTOLabel | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
<|body_0|>
def drawOn(self, canvas, x, y):
... | stack_v2_sparse_classes_75kplus_train_007612 | 7,377 | permissive | [
{
"docstring": "Initializes the label. colored : boolean to determine if blocks have to be colorized.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Draws some blocks around the identifier's characters.",
"name": "drawOn",
"signature": "def dr... | 2 | stack_v2_sparse_classes_30k_train_018060 | Implement the Python class `VerticalLTOLabel` described below.
Class description:
A class for LTO labels with rectangular blocks around the tape identifier.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized.
- ... | Implement the Python class `VerticalLTOLabel` described below.
Class description:
A class for LTO labels with rectangular blocks around the tape identifier.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized.
- ... | c28aa50e2d6d3451b47e114094a86c03c87d4c50 | <|skeleton|>
class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
<|body_0|>
def drawOn(self, canvas, x, y):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
if 'colored' in kwargs:
self.colored = kwargs['co... | the_stack_v2_python_sparse | src/reportlab/graphics/barcode/lto.py | MrBitBucket/reportlab-mirror | train | 64 |
2e15561c381df2c7cea833256eea7e0e80a66a3a | [
"print('Writing tokens into %s file: ' % filename)\nwith open(filename, 'w') as f:\n for word, idx in tok2idx.iteritems():\n if idx != len(tok2idx) - 1:\n f.write('{} {}\\n'.format(word, idx))\n else:\n f.write('{} {}'.format(word, idx))\nprint('\\t- Done: {} tokens.'.format(l... | <|body_start_0|>
print('Writing tokens into %s file: ' % filename)
with open(filename, 'w') as f:
for word, idx in tok2idx.iteritems():
if idx != len(tok2idx) - 1:
f.write('{} {}\n'.format(word, idx))
else:
f.write('{} {... | RWfile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RWfile:
def write_vocab(tok2idx, filename):
"""Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per line"""
<|body_0|>
def load_vocab(filename):
"""Loads vocab from a file Arg... | stack_v2_sparse_classes_75kplus_train_007613 | 9,000 | no_license | [
{
"docstring": "Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per line",
"name": "write_vocab",
"signature": "def write_vocab(tok2idx, filename)"
},
{
"docstring": "Loads vocab from a file Args: filena... | 2 | stack_v2_sparse_classes_30k_train_011589 | Implement the Python class `RWfile` described below.
Class description:
Implement the RWfile class.
Method signatures and docstrings:
- def write_vocab(tok2idx, filename): Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per l... | Implement the Python class `RWfile` described below.
Class description:
Implement the RWfile class.
Method signatures and docstrings:
- def write_vocab(tok2idx, filename): Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per l... | b798e7b1286e043c5685aa8375022ee50f91024a | <|skeleton|>
class RWfile:
def write_vocab(tok2idx, filename):
"""Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per line"""
<|body_0|>
def load_vocab(filename):
"""Loads vocab from a file Arg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RWfile:
def write_vocab(tok2idx, filename):
"""Writes a vocab to a file Writes one word per line. Args: vocab: iterable that yields word filename: path to vocab file Returns: write a word per line"""
print('Writing tokens into %s file: ' % filename)
with open(filename, 'w') as f:
... | the_stack_v2_python_sparse | utils/other_utils.py | duytinvo/sequence_labeller | train | 3 | |
33b9cdb7c8a8d0a9f5cd248d4b7582b140825625 | [
"num_heads, head_size = (2, 2)\nfrom_seq_length = 4\nbatch_size = 3\ninit_decode_length = 0\ncache = _create_cache(batch_size, init_decode_length, num_heads, head_size)\nlayer = attention.CachedAttention(num_heads=num_heads, key_dim=head_size)\nfrom_data = tf.zeros((batch_size, from_seq_length, 8), dtype=np.float32... | <|body_start_0|>
num_heads, head_size = (2, 2)
from_seq_length = 4
batch_size = 3
init_decode_length = 0
cache = _create_cache(batch_size, init_decode_length, num_heads, head_size)
layer = attention.CachedAttention(num_heads=num_heads, key_dim=head_size)
from_data... | CachedAttentionTest | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CachedAttentionTest:
def test_masked_attention(self):
"""Test with a mask tensor."""
<|body_0|>
def test_padded_decode(self):
"""Test with a mask tensor."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
num_heads, head_size = (2, 2)
from_seq_... | stack_v2_sparse_classes_75kplus_train_007614 | 3,761 | permissive | [
{
"docstring": "Test with a mask tensor.",
"name": "test_masked_attention",
"signature": "def test_masked_attention(self)"
},
{
"docstring": "Test with a mask tensor.",
"name": "test_padded_decode",
"signature": "def test_padded_decode(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028944 | Implement the Python class `CachedAttentionTest` described below.
Class description:
Implement the CachedAttentionTest class.
Method signatures and docstrings:
- def test_masked_attention(self): Test with a mask tensor.
- def test_padded_decode(self): Test with a mask tensor. | Implement the Python class `CachedAttentionTest` described below.
Class description:
Implement the CachedAttentionTest class.
Method signatures and docstrings:
- def test_masked_attention(self): Test with a mask tensor.
- def test_padded_decode(self): Test with a mask tensor.
<|skeleton|>
class CachedAttentionTest:
... | 6fc53292b1d3ce3c0340ce724c2c11c77e663d27 | <|skeleton|>
class CachedAttentionTest:
def test_masked_attention(self):
"""Test with a mask tensor."""
<|body_0|>
def test_padded_decode(self):
"""Test with a mask tensor."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CachedAttentionTest:
def test_masked_attention(self):
"""Test with a mask tensor."""
num_heads, head_size = (2, 2)
from_seq_length = 4
batch_size = 3
init_decode_length = 0
cache = _create_cache(batch_size, init_decode_length, num_heads, head_size)
layer... | the_stack_v2_python_sparse | models/official/nlp/modeling/layers/attention_test.py | aboerzel/German_License_Plate_Recognition | train | 34 | |
dfb979ef90a48724fb6f3da0bc9407c0a17a6422 | [
"if xResolution < 1:\n raise NameError('The horizontal resolution must be larger or equal to one.')\nif yResolution < 1:\n raise NameError('The vertical resolution must be larger or equal to one.')\nif s <= 0:\n raise NameError('s must be positive')\nself.hres = xResolution\nself.vres = yResolution\nself.o... | <|body_start_0|>
if xResolution < 1:
raise NameError('The horizontal resolution must be larger or equal to one.')
if yResolution < 1:
raise NameError('The vertical resolution must be larger or equal to one.')
if s <= 0:
raise NameError('s must be positive')
... | A simple camera without a perspective projection. | OrthographicCamera | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrthographicCamera:
"""A simple camera without a perspective projection."""
def __init__(self, xResolution, yResolution, origin, lookat, s):
"""Construct a simple camera with all rays in the same direction, but different starting points."""
<|body_0|>
def generateRay(sel... | stack_v2_sparse_classes_75kplus_train_007615 | 1,404 | no_license | [
{
"docstring": "Construct a simple camera with all rays in the same direction, but different starting points.",
"name": "__init__",
"signature": "def __init__(self, xResolution, yResolution, origin, lookat, s)"
},
{
"docstring": "Generate Rays from the center of the corresponding pixel according... | 2 | stack_v2_sparse_classes_30k_train_005134 | Implement the Python class `OrthographicCamera` described below.
Class description:
A simple camera without a perspective projection.
Method signatures and docstrings:
- def __init__(self, xResolution, yResolution, origin, lookat, s): Construct a simple camera with all rays in the same direction, but different starti... | Implement the Python class `OrthographicCamera` described below.
Class description:
A simple camera without a perspective projection.
Method signatures and docstrings:
- def __init__(self, xResolution, yResolution, origin, lookat, s): Construct a simple camera with all rays in the same direction, but different starti... | 525a6fdc94d46a5a657ca46156d357fbae8ad71e | <|skeleton|>
class OrthographicCamera:
"""A simple camera without a perspective projection."""
def __init__(self, xResolution, yResolution, origin, lookat, s):
"""Construct a simple camera with all rays in the same direction, but different starting points."""
<|body_0|>
def generateRay(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrthographicCamera:
"""A simple camera without a perspective projection."""
def __init__(self, xResolution, yResolution, origin, lookat, s):
"""Construct a simple camera with all rays in the same direction, but different starting points."""
if xResolution < 1:
raise NameError(... | the_stack_v2_python_sparse | src/camera/OrthographicCamera.py | v0lta/pyTrace | train | 0 |
5c6228068a20f786ffaee9f6aeb3f1bbd70ea185 | [
"assert use_annotation in ['label', 'skeleton']\nself.use_rgbd = use_rgbd\nimage_sets = os.path.join(dataset_dir, 'image_sets/')\nimage_dir = os.path.join(dataset_dir, 'data/')\nclasses_dict = load_id_classes_dict(os.path.join(image_sets, 'classes.txt'))\nif class_ids is None:\n class_ids = sorted(classes_dict.k... | <|body_start_0|>
assert use_annotation in ['label', 'skeleton']
self.use_rgbd = use_rgbd
image_sets = os.path.join(dataset_dir, 'image_sets/')
image_dir = os.path.join(dataset_dir, 'data/')
classes_dict = load_id_classes_dict(os.path.join(image_sets, 'classes.txt'))
if cl... | YCBVDataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YCBVDataset:
def load_ycbv(self, dataset_dir, subset, class_ids=None, use_annotation='label', use_rgbd=False):
"""Load a subset of the COCO dataset. dataset_dir: The root directory of the COCO dataset. subset: What to load (train, val, minival, valminusminival) class_ids: If provided, on... | stack_v2_sparse_classes_75kplus_train_007616 | 39,452 | no_license | [
{
"docstring": "Load a subset of the COCO dataset. dataset_dir: The root directory of the COCO dataset. subset: What to load (train, val, minival, valminusminival) class_ids: If provided, only loads images that have the given classes. use_synthetic: If True uses the synthetic data in the data_syn folder (exclus... | 4 | stack_v2_sparse_classes_30k_train_014703 | Implement the Python class `YCBVDataset` described below.
Class description:
Implement the YCBVDataset class.
Method signatures and docstrings:
- def load_ycbv(self, dataset_dir, subset, class_ids=None, use_annotation='label', use_rgbd=False): Load a subset of the COCO dataset. dataset_dir: The root directory of the ... | Implement the Python class `YCBVDataset` described below.
Class description:
Implement the YCBVDataset class.
Method signatures and docstrings:
- def load_ycbv(self, dataset_dir, subset, class_ids=None, use_annotation='label', use_rgbd=False): Load a subset of the COCO dataset. dataset_dir: The root directory of the ... | 39dd270f7474084bd3143d6256daec62fe26a5ea | <|skeleton|>
class YCBVDataset:
def load_ycbv(self, dataset_dir, subset, class_ids=None, use_annotation='label', use_rgbd=False):
"""Load a subset of the COCO dataset. dataset_dir: The root directory of the COCO dataset. subset: What to load (train, val, minival, valminusminival) class_ids: If provided, on... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class YCBVDataset:
def load_ycbv(self, dataset_dir, subset, class_ids=None, use_annotation='label', use_rgbd=False):
"""Load a subset of the COCO dataset. dataset_dir: The root directory of the COCO dataset. subset: What to load (train, val, minival, valminusminival) class_ids: If provided, only loads image... | the_stack_v2_python_sparse | samples/YCB_Video/YCB_Video.py | chpohl/Mask_RCNN | train | 0 | |
6c771564414db03c60f123468b4281684dd358c2 | [
"self.tileset = None\nself.dim = 0\nself.size = None\nself.tsize = None\nself.tiles = []",
"self.tileset = Image.open(fname)\nself.dim = dim\nself.size = self.tileset.size\nself.tsize = (self.size[0] // self.dim, self.size[1] // dim)\nself.tiles = []\ntop, bottom = (0, self.dim)\nfor y in range(self.tsize[1]):\n ... | <|body_start_0|>
self.tileset = None
self.dim = 0
self.size = None
self.tsize = None
self.tiles = []
<|end_body_0|>
<|body_start_1|>
self.tileset = Image.open(fname)
self.dim = dim
self.size = self.tileset.size
self.tsize = (self.size[0] // self.d... | TileSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
<|body_0|>
def load_tileset(self, fname, dim):
"""open the passed file and assume square dim tiles"""
<|bod... | stack_v2_sparse_classes_75kplus_train_007617 | 13,292 | no_license | [
{
"docstring": "tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "open the passed file and assume square dim tiles",
"name": "load_tileset",
"sign... | 3 | stack_v2_sparse_classes_30k_train_017452 | Implement the Python class `TileSet` described below.
Class description:
Implement the TileSet class.
Method signatures and docstrings:
- def __init__(self): tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down
- def load_tileset(self, fname, dim): open ... | Implement the Python class `TileSet` described below.
Class description:
Implement the TileSet class.
Method signatures and docstrings:
- def __init__(self): tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down
- def load_tileset(self, fname, dim): open ... | efaf89cac9474fe278865aa13593597e037688cc | <|skeleton|>
class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
<|body_0|>
def load_tileset(self, fname, dim):
"""open the passed file and assume square dim tiles"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
self.tileset = None
self.dim = 0
self.size = None
self.tsize = None
self.tiles = []
def load_tileset(self... | the_stack_v2_python_sparse | Paths/main.py | Feenix33/PyGameG | train | 0 | |
7730af6fc733fdf98d564d81dd57ed7cb5d0231b | [
"super(WorkLogThread, self).__init__(parent)\nself.sig = sig\nself.repository = repository\nself.parent = parent",
"message = 'Journal de travail'\nrestTructuredText = message + os.linesep\nrestTructuredText += '=' * len(message) + os.linesep * 2\nfor commit in self.repository.get_commits():\n com = commit.com... | <|body_start_0|>
super(WorkLogThread, self).__init__(parent)
self.sig = sig
self.repository = repository
self.parent = parent
<|end_body_0|>
<|body_start_1|>
message = 'Journal de travail'
restTructuredText = message + os.linesep
restTructuredText += '=' * len(me... | Thread used to write work log from repository. | WorkLogThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkLogThread:
"""Thread used to write work log from repository."""
def __init__(self, parent, repository=None, sig=None):
"""Init thread."""
<|body_0|>
def run(self):
"""Run thread."""
<|body_1|>
def format_message_for_rst(self, message):
""... | stack_v2_sparse_classes_75kplus_train_007618 | 11,571 | permissive | [
{
"docstring": "Init thread.",
"name": "__init__",
"signature": "def __init__(self, parent, repository=None, sig=None)"
},
{
"docstring": "Run thread.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Format message for a nice rst print.",
"name": "format_messa... | 3 | stack_v2_sparse_classes_30k_val_002129 | Implement the Python class `WorkLogThread` described below.
Class description:
Thread used to write work log from repository.
Method signatures and docstrings:
- def __init__(self, parent, repository=None, sig=None): Init thread.
- def run(self): Run thread.
- def format_message_for_rst(self, message): Format message... | Implement the Python class `WorkLogThread` described below.
Class description:
Thread used to write work log from repository.
Method signatures and docstrings:
- def __init__(self, parent, repository=None, sig=None): Init thread.
- def run(self): Run thread.
- def format_message_for_rst(self, message): Format message... | 93dd7abb03d27cf3490d8b2514365260d67ab15b | <|skeleton|>
class WorkLogThread:
"""Thread used to write work log from repository."""
def __init__(self, parent, repository=None, sig=None):
"""Init thread."""
<|body_0|>
def run(self):
"""Run thread."""
<|body_1|>
def format_message_for_rst(self, message):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkLogThread:
"""Thread used to write work log from repository."""
def __init__(self, parent, repository=None, sig=None):
"""Init thread."""
super(WorkLogThread, self).__init__(parent)
self.sig = sig
self.repository = repository
self.parent = parent
def run(s... | the_stack_v2_python_sparse | Work_Log_Generator/work_log.py | hastagAB/Awesome-Python-Scripts | train | 1,757 |
9657ad66cc2346c3209b516edf30743f24a4e513 | [
"today_str = pendulum.today('UTC').format('YYYY-MM-DD')\ninfo = self.inner_compute_last_repair_info(today_str)\nlast_repair_info = info['last_repair_info']\ninfo_cache = info['info_cache']\nfor record in self:\n if record.id in last_repair_info:\n record.last_mile_repair_date = last_repair_info[record.id]... | <|body_start_0|>
today_str = pendulum.today('UTC').format('YYYY-MM-DD')
info = self.inner_compute_last_repair_info(today_str)
last_repair_info = info['last_repair_info']
info_cache = info['info_cache']
for record in self:
if record.id in last_repair_info:
... | 车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段 | TrainDev | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
<|body_0|>
def inner_compute_last_repair_info(self, date_str):
"""计算最终的修程信息 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
today_... | stack_v2_sparse_classes_75kplus_train_007619 | 2,455 | no_license | [
{
"docstring": "计算上次里程修信息 :return:",
"name": "_compute_last_repair_info",
"signature": "def _compute_last_repair_info(self)"
},
{
"docstring": "计算最终的修程信息 :return:",
"name": "inner_compute_last_repair_info",
"signature": "def inner_compute_last_repair_info(self, date_str)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052813 | Implement the Python class `TrainDev` described below.
Class description:
车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段
Method signatures and docstrings:
- def _compute_last_repair_info(self): 计算上次里程修信息 :return:
- def inner_compute_last_repair_info(self, date_str): 计算最终的修程信息 :return: | Implement the Python class `TrainDev` described below.
Class description:
车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段
Method signatures and docstrings:
- def _compute_last_repair_info(self): 计算上次里程修信息 :return:
- def inner_compute_last_repair_info(self, date_str): 计算最终的修程信息 :return:
<|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设... | 13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9 | <|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
<|body_0|>
def inner_compute_last_repair_info(self, date_str):
"""计算最终的修程信息 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
today_str = pendulum.today('UTC').format('YYYY-MM-DD')
info = self.inner_compute_last_repair_info(today_str)
last_repair_info = info['last_repair_info']
info_c... | the_stack_v2_python_sparse | mdias_addons/metro_park_base_data_10/models/train_dev.py | rezaghanimi/main_mdias | train | 0 |
143758b7a4c3091ebe280a532eb9e012acd08437 | [
"super().__init__()\nself.extends: Sequence[Union[str, Dict[str, Any]]] = ''\nself.css: Optional[Union[Dict[str, Any], Combine]] = None",
"new_obj = self.__class__(self)\nnew_obj.extends = extends\nnew_obj.css = css\nreturn new_obj"
] | <|body_start_0|>
super().__init__()
self.extends: Sequence[Union[str, Dict[str, Any]]] = ''
self.css: Optional[Union[Dict[str, Any], Combine]] = None
<|end_body_0|>
<|body_start_1|>
new_obj = self.__class__(self)
new_obj.extends = extends
new_obj.css = css
return... | ``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level or above), or directly a dict. Se... | Extend | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Extend:
"""``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level... | stack_v2_sparse_classes_75kplus_train_007620 | 44,402 | permissive | [
{
"docstring": "Init the var and its attributes. For the parameters, see ``str``.",
"name": "__init__",
"signature": "def __init__(self, _str_: str) -> None"
},
{
"docstring": "Allow to have a css key defined multiple times. Parameters ---------- extends : Tuple[Union[str, Dict[str, Any]]] The l... | 2 | stack_v2_sparse_classes_30k_train_010948 | Implement the Python class `Extend` described below.
Class description:
``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting wit... | Implement the Python class `Extend` described below.
Class description:
``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting wit... | adeff652784f0d814835fd16a8cacab09f426922 | <|skeleton|>
class Extend:
"""``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Extend:
"""``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level or above), o... | the_stack_v2_python_sparse | src/mixt/contrib/css/vars.py | twidi/mixt | train | 37 |
169f9778cdecdd24c3cc2d349b3a4aae55cae8ff | [
"self.tree = Element('GEDI')\ndl_document = SubElement(self.tree, 'DL_DOCUMENT')\nuser = SubElement(self.tree, 'USER')\nuser.attrib['name'] = user_name\nuser.attrib['date'] = str(date)\ndl_document.attrib['src'] = image_name\ndl_document.attrib['docTag'] = 'xml'\ndl_document.attrib['width'] = str(width)\ndl_documen... | <|body_start_0|>
self.tree = Element('GEDI')
dl_document = SubElement(self.tree, 'DL_DOCUMENT')
user = SubElement(self.tree, 'USER')
user.attrib['name'] = user_name
user.attrib['date'] = str(date)
dl_document.attrib['src'] = image_name
dl_document.attrib['docTag']... | XMLTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
<|body_0|>
def add_mask(self, name, type='PlanteInteret'):
"""Adds a detection. ID p... | stack_v2_sparse_classes_75kplus_train_007621 | 1,657 | no_license | [
{
"docstring": "Instantiates a XML Tree representation to hold object detection results.",
"name": "__init__",
"signature": "def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today())"
},
{
"docstring": "Adds a detection. ID points to a PNG mask representing th... | 3 | stack_v2_sparse_classes_30k_train_002421 | Implement the Python class `XMLTree` described below.
Class description:
Implement the XMLTree class.
Method signatures and docstrings:
- def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()): Instantiates a XML Tree representation to hold object detection results.
- def add_ma... | Implement the Python class `XMLTree` described below.
Class description:
Implement the XMLTree class.
Method signatures and docstrings:
- def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()): Instantiates a XML Tree representation to hold object detection results.
- def add_ma... | 361ca212cb236027a69acb2e3988506da5f286ea | <|skeleton|>
class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
<|body_0|>
def add_mask(self, name, type='PlanteInteret'):
"""Adds a detection. ID p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
self.tree = Element('GEDI')
dl_document = SubElement(self.tree, 'DL_DOCUMENT')
user = SubElemen... | the_stack_v2_python_sparse | my_xml_toolbox.py | laclouis5/Utilities | train | 1 | |
cfda1f8b8f637c9fce7b5d3fe588fe20316fd1de | [
"BlissWidget.__init__(self, *args)\nself.mach_info_hwobj = None\nself.graphics_initialized = None\nself.disc_label = None\nself.disc_value_label = None\nself.value_label_list = []\nself.addProperty('diskThreshold', 'float', 200, comment='Disk threshold')\nself.addProperty('maxPlotPoints', 'integer', 100, comment='M... | <|body_start_0|>
BlissWidget.__init__(self, *args)
self.mach_info_hwobj = None
self.graphics_initialized = None
self.disc_label = None
self.disc_value_label = None
self.value_label_list = []
self.addProperty('diskThreshold', 'float', 200, comment='Disk threshold')... | Descript. : | Qt4_MachineInfoBrick | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Qt4_MachineInfoBrick:
"""Descript. :"""
def __init__(self, *args):
"""Descript. :"""
<|body_0|>
def propertyChanged(self, property_name, old_value, new_value):
"""Descript. : Args. : Return. :"""
<|body_1|>
def set_value(self, values_list):
"... | stack_v2_sparse_classes_75kplus_train_007622 | 10,123 | no_license | [
{
"docstring": "Descript. :",
"name": "__init__",
"signature": "def __init__(self, *args)"
},
{
"docstring": "Descript. : Args. : Return. :",
"name": "propertyChanged",
"signature": "def propertyChanged(self, property_name, old_value, new_value)"
},
{
"docstring": "Descript. : Ar... | 6 | stack_v2_sparse_classes_30k_train_036037 | Implement the Python class `Qt4_MachineInfoBrick` described below.
Class description:
Descript. :
Method signatures and docstrings:
- def __init__(self, *args): Descript. :
- def propertyChanged(self, property_name, old_value, new_value): Descript. : Args. : Return. :
- def set_value(self, values_list): Descript. : A... | Implement the Python class `Qt4_MachineInfoBrick` described below.
Class description:
Descript. :
Method signatures and docstrings:
- def __init__(self, *args): Descript. :
- def propertyChanged(self, property_name, old_value, new_value): Descript. : Args. : Return. :
- def set_value(self, values_list): Descript. : A... | 1579c87687bc96298ac7559743af9665b316749c | <|skeleton|>
class Qt4_MachineInfoBrick:
"""Descript. :"""
def __init__(self, *args):
"""Descript. :"""
<|body_0|>
def propertyChanged(self, property_name, old_value, new_value):
"""Descript. : Args. : Return. :"""
<|body_1|>
def set_value(self, values_list):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Qt4_MachineInfoBrick:
"""Descript. :"""
def __init__(self, *args):
"""Descript. :"""
BlissWidget.__init__(self, *args)
self.mach_info_hwobj = None
self.graphics_initialized = None
self.disc_label = None
self.disc_value_label = None
self.value_label_... | the_stack_v2_python_sparse | Bricks/Qt4_MachineInfoBrick.py | jlmuir/mxcube | train | 0 |
96be437b242dfe48977008a9770755fb83548c87 | [
"self.win = grid.win\nself.grid = grid\nself.row = row\nself.col = col\nself.value = value\nul, lr = grid.tile_corners(row, col)\nbackground = graphics.Rectangle(ul, lr)\nbackground.setFill(RAMP[value])\nbackground.setOutline(TILE_OUTLINE_NEW)\nself.background = background\ncx = (ul.getX() + lr.getX()) / 2.0\ncy = ... | <|body_start_0|>
self.win = grid.win
self.grid = grid
self.row = row
self.col = col
self.value = value
ul, lr = grid.tile_corners(row, col)
background = graphics.Rectangle(ul, lr)
background.setFill(RAMP[value])
background.setOutline(TILE_OUTLINE_N... | A tile is the thing with a number that slides around the grid | Tile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tile:
"""A tile is the thing with a number that slides around the grid"""
def __init__(self, grid, row, col, value=2):
"""Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle and text within it. The background rectangle has a visibl... | stack_v2_sparse_classes_75kplus_train_007623 | 7,288 | no_license | [
{
"docstring": "Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle and text within it. The background rectangle has a visible outline until the first time it moves.",
"name": "__init__",
"signature": "def __init__(self, grid, row, col, value=2)"
},... | 3 | stack_v2_sparse_classes_30k_train_025958 | Implement the Python class `Tile` described below.
Class description:
A tile is the thing with a number that slides around the grid
Method signatures and docstrings:
- def __init__(self, grid, row, col, value=2): Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle ... | Implement the Python class `Tile` described below.
Class description:
A tile is the thing with a number that slides around the grid
Method signatures and docstrings:
- def __init__(self, grid, row, col, value=2): Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle ... | 559f81086bd3495348aa605da66117cb0fbc7277 | <|skeleton|>
class Tile:
"""A tile is the thing with a number that slides around the grid"""
def __init__(self, grid, row, col, value=2):
"""Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle and text within it. The background rectangle has a visibl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tile:
"""A tile is the thing with a number that slides around the grid"""
def __init__(self, grid, row, col, value=2):
"""Display the tile on the grid. Internally there are actually two graphics objects: A background rectangle and text within it. The background rectangle has a visible outline unt... | the_stack_v2_python_sparse | CIS 211 - CS II/Proj 3 - FiveTwelve-master/view.py | noahtigner/UO-ComputerScience-DataScience | train | 3 |
7b19223f4405f6e23b5a3de48027ec9fb9de5fab | [
"height_len = len(height)\nmax_water = 0\nfor i in range(height_len - 1):\n j = i + 1\n while j < height_len:\n lower_border = height[i] if height[i] < height[j] else height[j]\n water = lower_border * (j - i)\n max_water = max(water, max_water)\n j += 1\nreturn max_water",
"heig... | <|body_start_0|>
height_len = len(height)
max_water = 0
for i in range(height_len - 1):
j = i + 1
while j < height_len:
lower_border = height[i] if height[i] < height[j] else height[j]
water = lower_border * (j - i)
max_wate... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea_brute_force(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea_select_only_biggest_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
def maxArea_select_2_pointer(self, height):
... | stack_v2_sparse_classes_75kplus_train_007624 | 2,556 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea_brute_force",
"signature": "def maxArea_brute_force(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea_select_only_biggest_TLE",
"signature": "def maxArea_select_only_biggest_TLE(... | 3 | stack_v2_sparse_classes_30k_train_048930 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea_brute_force(self, height): :type height: List[int] :rtype: int
- def maxArea_select_only_biggest_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea_... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea_brute_force(self, height): :type height: List[int] :rtype: int
- def maxArea_select_only_biggest_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea_... | 83e5dea02e99e512d2b34dac05dabebfdb66ef2a | <|skeleton|>
class Solution:
def maxArea_brute_force(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea_select_only_biggest_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
def maxArea_select_2_pointer(self, height):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxArea_brute_force(self, height):
""":type height: List[int] :rtype: int"""
height_len = len(height)
max_water = 0
for i in range(height_len - 1):
j = i + 1
while j < height_len:
lower_border = height[i] if height[i] < heig... | the_stack_v2_python_sparse | unclassified/11_maxArea.py | wscheng/LeetCode | train | 0 | |
ecaba847d707d8f5895fdf57a4bf7a53c4923d46 | [
"farmer_user_auth = validated_data.pop('farmer_user_auth', None)\nif not farmer_user_auth:\n msg = 'Please Provide the User Authentication Information'\n raise ValidationError(msg)\nauth_password = farmer_user_auth.pop('password', None)\n_ = farmer_user_auth.pop('username', None)\nif not auth_password:\n m... | <|body_start_0|>
farmer_user_auth = validated_data.pop('farmer_user_auth', None)
if not farmer_user_auth:
msg = 'Please Provide the User Authentication Information'
raise ValidationError(msg)
auth_password = farmer_user_auth.pop('password', None)
_ = farmer_user_a... | This the serializer for the model : Farmer | FarmerSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FarmerSerializer:
"""This the serializer for the model : Farmer"""
def create(self, validated_data):
"""This will create the instance for many to many field"""
<|body_0|>
def upadate(self, instance, validated_data):
"""This is the update or put haeader for the fi... | stack_v2_sparse_classes_75kplus_train_007625 | 9,987 | no_license | [
{
"docstring": "This will create the instance for many to many field",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "This is the update or put haeader for the file",
"name": "upadate",
"signature": "def upadate(self, instance, validated_data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050402 | Implement the Python class `FarmerSerializer` described below.
Class description:
This the serializer for the model : Farmer
Method signatures and docstrings:
- def create(self, validated_data): This will create the instance for many to many field
- def upadate(self, instance, validated_data): This is the update or p... | Implement the Python class `FarmerSerializer` described below.
Class description:
This the serializer for the model : Farmer
Method signatures and docstrings:
- def create(self, validated_data): This will create the instance for many to many field
- def upadate(self, instance, validated_data): This is the update or p... | 8182f2274216016a15a2a98ea5a31d7e05222ed5 | <|skeleton|>
class FarmerSerializer:
"""This the serializer for the model : Farmer"""
def create(self, validated_data):
"""This will create the instance for many to many field"""
<|body_0|>
def upadate(self, instance, validated_data):
"""This is the update or put haeader for the fi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FarmerSerializer:
"""This the serializer for the model : Farmer"""
def create(self, validated_data):
"""This will create the instance for many to many field"""
farmer_user_auth = validated_data.pop('farmer_user_auth', None)
if not farmer_user_auth:
msg = 'Please Provid... | the_stack_v2_python_sparse | Account/api/serializer.py | SIBU99/serverCVKM | train | 0 |
57c565b8016d446e7c477007a03cfd2e2e13dbb1 | [
"slug = self.kwargs['slug']\narticle = self.util.check_article(slug)\ncomment = request.data\ncomment.update({'article': article.id})\nserializer = self.serializer_class(data=comment)\nserializer.is_valid(raise_exception=True)\nserializer.save(author=request.user)\nreturn Response({'message': 'Comment Successfully ... | <|body_start_0|>
slug = self.kwargs['slug']
article = self.util.check_article(slug)
comment = request.data
comment.update({'article': article.id})
serializer = self.serializer_class(data=comment)
serializer.is_valid(raise_exception=True)
serializer.save(author=req... | CreateCommentAPiView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateCommentAPiView:
def post(self, request, *args, **kwargs):
"""This method creates a comment on an article"""
<|body_0|>
def get(self, *args, **kwargs):
"""This method gets all comments for an article"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_007626 | 7,485 | permissive | [
{
"docstring": "This method creates a comment on an article",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "This method gets all comments for an article",
"name": "get",
"signature": "def get(self, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `CreateCommentAPiView` described below.
Class description:
Implement the CreateCommentAPiView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): This method creates a comment on an article
- def get(self, *args, **kwargs): This method gets all comments for ... | Implement the Python class `CreateCommentAPiView` described below.
Class description:
Implement the CreateCommentAPiView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): This method creates a comment on an article
- def get(self, *args, **kwargs): This method gets all comments for ... | cc84c18f7c222bc69cf4a263a1c2296b6d335c8b | <|skeleton|>
class CreateCommentAPiView:
def post(self, request, *args, **kwargs):
"""This method creates a comment on an article"""
<|body_0|>
def get(self, *args, **kwargs):
"""This method gets all comments for an article"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateCommentAPiView:
def post(self, request, *args, **kwargs):
"""This method creates a comment on an article"""
slug = self.kwargs['slug']
article = self.util.check_article(slug)
comment = request.data
comment.update({'article': article.id})
serializer = self.... | the_stack_v2_python_sparse | authors/apps/comments/views.py | andela/Ah-backend-guardians | train | 0 | |
a9feae6f37a759eeb6f33b95ea92c7aa66d8432c | [
"self.url = '/ydtp-backend-service/api/web_hand_over_duty'\ndata = {'user_id': handUser, 'password': pwd}\nre = self.post(url=self.zby_api, data=data, headers=form_headers)\nreturn re.text",
"self.url = '/ydtp-backend-service/api/offduty'\nre = self.post(url=self.zby_api, headers=form_headers)\nreturn re.text",
... | <|body_start_0|>
self.url = '/ydtp-backend-service/api/web_hand_over_duty'
data = {'user_id': handUser, 'password': pwd}
re = self.post(url=self.zby_api, data=data, headers=form_headers)
return re.text
<|end_body_0|>
<|body_start_1|>
self.url = '/ydtp-backend-service/api/offduty... | 个人中心 | PersonalInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonalInfo:
"""个人中心"""
def webHandOverDuty(self, handUser, pwd):
"""交接班"""
<|body_0|>
def offduty(self):
"""退出登录"""
<|body_1|>
def dutyInfo(self):
"""个人信息"""
<|body_2|>
def __shiftRecords(self):
"""收费汇总列表"""
<|b... | stack_v2_sparse_classes_75kplus_train_007627 | 1,626 | no_license | [
{
"docstring": "交接班",
"name": "webHandOverDuty",
"signature": "def webHandOverDuty(self, handUser, pwd)"
},
{
"docstring": "退出登录",
"name": "offduty",
"signature": "def offduty(self)"
},
{
"docstring": "个人信息",
"name": "dutyInfo",
"signature": "def dutyInfo(self)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_050813 | Implement the Python class `PersonalInfo` described below.
Class description:
个人中心
Method signatures and docstrings:
- def webHandOverDuty(self, handUser, pwd): 交接班
- def offduty(self): 退出登录
- def dutyInfo(self): 个人信息
- def __shiftRecords(self): 收费汇总列表
- def shiftMoneys(self): 查看收费流水清单 | Implement the Python class `PersonalInfo` described below.
Class description:
个人中心
Method signatures and docstrings:
- def webHandOverDuty(self, handUser, pwd): 交接班
- def offduty(self): 退出登录
- def dutyInfo(self): 个人信息
- def __shiftRecords(self): 收费汇总列表
- def shiftMoneys(self): 查看收费流水清单
<|skeleton|>
class PersonalInf... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class PersonalInfo:
"""个人中心"""
def webHandOverDuty(self, handUser, pwd):
"""交接班"""
<|body_0|>
def offduty(self):
"""退出登录"""
<|body_1|>
def dutyInfo(self):
"""个人信息"""
<|body_2|>
def __shiftRecords(self):
"""收费汇总列表"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PersonalInfo:
"""个人中心"""
def webHandOverDuty(self, handUser, pwd):
"""交接班"""
self.url = '/ydtp-backend-service/api/web_hand_over_duty'
data = {'user_id': handUser, 'password': pwd}
re = self.post(url=self.zby_api, data=data, headers=form_headers)
return re.text
... | the_stack_v2_python_sparse | Api/sentry_service/personalInfo.py | oyebino/pomp_api | train | 1 |
cb77b2c12385b0c3047b976f597aab68b35dc388 | [
"from users.models import Token\nvalidate_email(email)\nuser = self.model(username=username, email=self.normalize_email(email), is_active=True)\nuser.set_password(password)\nif commit:\n user.save(using=self._db)\n Token.objects.create(user=user)\nreturn user",
"from users.models import Token\nuser = self.c... | <|body_start_0|>
from users.models import Token
validate_email(email)
user = self.model(username=username, email=self.normalize_email(email), is_active=True)
user.set_password(password)
if commit:
user.save(using=self._db)
Token.objects.create(user=user)
... | User_manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User_manager:
def create_user(self, username, email, password, commit=True):
"""Crea un usuario sin privilegios especiales"""
<|body_0|>
def create_superuser(self, username, email, password):
"""Crea un superusuario"""
<|body_1|>
def create_user_test(sel... | stack_v2_sparse_classes_75kplus_train_007628 | 1,695 | no_license | [
{
"docstring": "Crea un usuario sin privilegios especiales",
"name": "create_user",
"signature": "def create_user(self, username, email, password, commit=True)"
},
{
"docstring": "Crea un superusuario",
"name": "create_superuser",
"signature": "def create_superuser(self, username, email,... | 4 | stack_v2_sparse_classes_30k_train_029342 | Implement the Python class `User_manager` described below.
Class description:
Implement the User_manager class.
Method signatures and docstrings:
- def create_user(self, username, email, password, commit=True): Crea un usuario sin privilegios especiales
- def create_superuser(self, username, email, password): Crea un... | Implement the Python class `User_manager` described below.
Class description:
Implement the User_manager class.
Method signatures and docstrings:
- def create_user(self, username, email, password, commit=True): Crea un usuario sin privilegios especiales
- def create_superuser(self, username, email, password): Crea un... | 74458df2f1fda8b8549abe17a4fdc0bd208f460e | <|skeleton|>
class User_manager:
def create_user(self, username, email, password, commit=True):
"""Crea un usuario sin privilegios especiales"""
<|body_0|>
def create_superuser(self, username, email, password):
"""Crea un superusuario"""
<|body_1|>
def create_user_test(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class User_manager:
def create_user(self, username, email, password, commit=True):
"""Crea un usuario sin privilegios especiales"""
from users.models import Token
validate_email(email)
user = self.model(username=username, email=self.normalize_email(email), is_active=True)
use... | the_stack_v2_python_sparse | users/managers.py | dem4ply/yacatecuhtli | train | 0 | |
de62896e2c20de25c8a6502ce5ccb7cf989c0070 | [
"self.space = space if space else SparkSpace(context=self.engine.context)\nself.space.connect()\ntitle = u'{} - {}'.format(self.space.configured_title(), _(u'Audited content'))\nself.space.bond(title=title)\nself.context = Context()\nself.mouth = Queue()\nself.speaker = speaker if speaker else Speaker(engine=self.e... | <|body_start_0|>
self.space = space if space else SparkSpace(context=self.engine.context)
self.space.connect()
title = u'{} - {}'.format(self.space.configured_title(), _(u'Audited content'))
self.space.bond(title=title)
self.context = Context()
self.mouth = Queue()
... | Replicates messages to a secondary space | SpaceUpdater | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpaceUpdater:
"""Replicates messages to a secondary space"""
def on_init(self, space=None, speaker=None, **kwargs):
"""Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space :param speaker: the speaker instance to use (optional) :... | stack_v2_sparse_classes_75kplus_train_007629 | 3,870 | permissive | [
{
"docstring": "Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space :param speaker: the speaker instance to use (optional) :type speaker: Speaker Parameters are provided mainly for test injection.",
"name": "on_init",
"signature": "def on_init(sel... | 3 | stack_v2_sparse_classes_30k_test_000752 | Implement the Python class `SpaceUpdater` described below.
Class description:
Replicates messages to a secondary space
Method signatures and docstrings:
- def on_init(self, space=None, speaker=None, **kwargs): Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space... | Implement the Python class `SpaceUpdater` described below.
Class description:
Replicates messages to a secondary space
Method signatures and docstrings:
- def on_init(self, space=None, speaker=None, **kwargs): Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space... | daf64fbab4085d1591bf9a1aecd06b4fc615d132 | <|skeleton|>
class SpaceUpdater:
"""Replicates messages to a secondary space"""
def on_init(self, space=None, speaker=None, **kwargs):
"""Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space :param speaker: the speaker instance to use (optional) :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpaceUpdater:
"""Replicates messages to a secondary space"""
def on_init(self, space=None, speaker=None, **kwargs):
"""Replicates messages to a secondary space :param space: the target space to use (optional) :type space: Space :param speaker: the speaker instance to use (optional) :type speaker:... | the_stack_v2_python_sparse | shellbot/updaters/space.py | romainkotarba/shellbot | train | 0 |
be2c19e990346b660d3038c9cbb5752bf96c498c | [
"self.width = 0\nself.height = 0\nself.size = 0\nself.crop = False\nif isinstance(options, dict):\n self.setFromSetting(options)\nelse:\n self.parse(options)",
"try:\n options = string.split('x')\n self.width = int(options[0])\n self.height = int(options[1])\n self.size = max(self.width, self.he... | <|body_start_0|>
self.width = 0
self.height = 0
self.size = 0
self.crop = False
if isinstance(options, dict):
self.setFromSetting(options)
else:
self.parse(options)
<|end_body_0|>
<|body_start_1|>
try:
options = string.split('x... | Options for resize such as width, height, max size - max of width/height, crop - need or not. | ResizeOptions | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResizeOptions:
"""Options for resize such as width, height, max size - max of width/height, crop - need or not."""
def __init__(self, options):
"""Get sting with options or settings dict"""
<|body_0|>
def parse(self, string):
"""Do parsing. Executed in object ini... | stack_v2_sparse_classes_75kplus_train_007630 | 4,500 | permissive | [
{
"docstring": "Get sting with options or settings dict",
"name": "__init__",
"signature": "def __init__(self, options)"
},
{
"docstring": "Do parsing. Executed in object init.",
"name": "parse",
"signature": "def parse(self, string)"
},
{
"docstring": "Set values from settings.L... | 4 | null | Implement the Python class `ResizeOptions` described below.
Class description:
Options for resize such as width, height, max size - max of width/height, crop - need or not.
Method signatures and docstrings:
- def __init__(self, options): Get sting with options or settings dict
- def parse(self, string): Do parsing. E... | Implement the Python class `ResizeOptions` described below.
Class description:
Options for resize such as width, height, max size - max of width/height, crop - need or not.
Method signatures and docstrings:
- def __init__(self, options): Get sting with options or settings dict
- def parse(self, string): Do parsing. E... | 9d0908251b94f5a3bde418a780ecb43db274d6d8 | <|skeleton|>
class ResizeOptions:
"""Options for resize such as width, height, max size - max of width/height, crop - need or not."""
def __init__(self, options):
"""Get sting with options or settings dict"""
<|body_0|>
def parse(self, string):
"""Do parsing. Executed in object ini... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResizeOptions:
"""Options for resize such as width, height, max size - max of width/height, crop - need or not."""
def __init__(self, options):
"""Get sting with options or settings dict"""
self.width = 0
self.height = 0
self.size = 0
self.crop = False
if i... | the_stack_v2_python_sparse | limited/lviewer/utils.py | b7w/limited-fm | train | 0 |
7024ebf9f75940fdd27ee55f36921a0b488fa1c4 | [
"Serializable._init(self, locals())\nsuper().__init__(min_rollouts=min_rollouts, min_steps=min_steps)\nself.env = env\nself.policy = policy\nself.show_progress_bar = show_progress_bar\nif mp.get_start_method(allow_none=True) != 'spawn':\n mp.set_start_method('spawn', force=True)\nself.pool = SamplerPool(num_work... | <|body_start_0|>
Serializable._init(self, locals())
super().__init__(min_rollouts=min_rollouts, min_steps=min_steps)
self.env = env
self.policy = policy
self.show_progress_bar = show_progress_bar
if mp.get_start_method(allow_none=True) != 'spawn':
mp.set_start... | Class for sampling from multiple environments in parallel | ParallelRolloutSampler | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParallelRolloutSampler:
"""Class for sampling from multiple environments in parallel"""
def __init__(self, env, policy, num_workers: int, *, min_rollouts: int=None, min_steps: int=None, show_progress_bar: bool=True, seed: int=NO_SEED_PASSED):
"""Constructor :param env: environment to... | stack_v2_sparse_classes_75kplus_train_007631 | 13,009 | permissive | [
{
"docstring": "Constructor :param env: environment to sample from :param policy: policy to act in the environment (can also be an exploration strategy) :param num_workers: number of parallel samplers :param min_rollouts: minimum number of complete rollouts to sample :param min_steps: minimum total number of st... | 3 | stack_v2_sparse_classes_30k_train_043847 | Implement the Python class `ParallelRolloutSampler` described below.
Class description:
Class for sampling from multiple environments in parallel
Method signatures and docstrings:
- def __init__(self, env, policy, num_workers: int, *, min_rollouts: int=None, min_steps: int=None, show_progress_bar: bool=True, seed: in... | Implement the Python class `ParallelRolloutSampler` described below.
Class description:
Class for sampling from multiple environments in parallel
Method signatures and docstrings:
- def __init__(self, env, policy, num_workers: int, *, min_rollouts: int=None, min_steps: int=None, show_progress_bar: bool=True, seed: in... | d7e9cd191ccb318d5f1e580babc2fc38b5b3675a | <|skeleton|>
class ParallelRolloutSampler:
"""Class for sampling from multiple environments in parallel"""
def __init__(self, env, policy, num_workers: int, *, min_rollouts: int=None, min_steps: int=None, show_progress_bar: bool=True, seed: int=NO_SEED_PASSED):
"""Constructor :param env: environment to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParallelRolloutSampler:
"""Class for sampling from multiple environments in parallel"""
def __init__(self, env, policy, num_workers: int, *, min_rollouts: int=None, min_steps: int=None, show_progress_bar: bool=True, seed: int=NO_SEED_PASSED):
"""Constructor :param env: environment to sample from ... | the_stack_v2_python_sparse | Pyrado/pyrado/sampling/parallel_rollout_sampler.py | 1abner1/SimuRLacra | train | 0 |
261fd45ecdb37050a243e3238972b7f8041ea71d | [
"dummy = ListNode(0)\ndummy.next = head\npre = dummy\ntail = dummy\nwhile True:\n count = k\n while count and tail:\n count -= 1\n tail = tail.next\n if not tail:\n break\n head = pre.next\n while pre.next != tail:\n cur = pre.next\n pre.next = cur.next\n cur... | <|body_start_0|>
dummy = ListNode(0)
dummy.next = head
pre = dummy
tail = dummy
while True:
count = k
while count and tail:
count -= 1
tail = tail.next
if not tail:
break
head = pre.ne... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode:
"""KEY: 1. 尾插法"""
<|body_0|>
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
"""2. 转换成节点列表,会消耗 O(N) 的空间"""
<|body_1|>
def reverseKGroup_2(self, head: ListNode, k: int) ... | stack_v2_sparse_classes_75kplus_train_007632 | 3,346 | no_license | [
{
"docstring": "KEY: 1. 尾插法",
"name": "reverseKGroup_1",
"signature": "def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode"
},
{
"docstring": "2. 转换成节点列表,会消耗 O(N) 的空间",
"name": "reverseKGroup",
"signature": "def reverseKGroup(self, head: ListNode, k: int) -> ListNode"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_019228 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode: KEY: 1. 尾插法
- def reverseKGroup(self, head: ListNode, k: int) -> ListNode: 2. 转换成节点列表,会消耗 O(N) 的空间
- def reverseKGr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode: KEY: 1. 尾插法
- def reverseKGroup(self, head: ListNode, k: int) -> ListNode: 2. 转换成节点列表,会消耗 O(N) 的空间
- def reverseKGr... | 4732fb80710a08a715c3e7080c394f5298b8326d | <|skeleton|>
class Solution:
def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode:
"""KEY: 1. 尾插法"""
<|body_0|>
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
"""2. 转换成节点列表,会消耗 O(N) 的空间"""
<|body_1|>
def reverseKGroup_2(self, head: ListNode, k: int) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseKGroup_1(self, head: ListNode, k: int) -> ListNode:
"""KEY: 1. 尾插法"""
dummy = ListNode(0)
dummy.next = head
pre = dummy
tail = dummy
while True:
count = k
while count and tail:
count -= 1
... | the_stack_v2_python_sparse | 02-linkedlist/25.k-个一组翻转链表.py | xiaoruijiang/algorithm | train | 0 | |
d0642507d38de59877e3b9bba1e5cdf3f7a9367d | [
"primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat\nphysical_interfaces = []\nfor interface in interfaces:\n if 'interface_id' not in interface:\n raise CreateEngineFailed('Interface definitions must contain the interface_id field. Failed to create engine: %s' % name)\n if... | <|body_start_0|>
primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat
physical_interfaces = []
for interface in interfaces:
if 'interface_id' not in interface:
raise CreateEngineFailed('Interface definitions must contain the interface_id fie... | Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface` | FirewallCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
... | stack_v2_sparse_classes_75kplus_train_007633 | 39,353 | permissive | [
{
"docstring": ":param dict snmp: SNMP dict should have keys `snmp_agent` str defining name of SNMPAgent, `snmp_interface` which is a list of interface IDs, and optionally `snmp_location` which is a string with the SNMP location name.",
"name": "create_bulk",
"signature": "def create_bulk(cls, name, int... | 2 | stack_v2_sparse_classes_30k_train_041624 | Implement the Python class `FirewallCluster` described below.
Class description:
Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac... | Implement the Python class `FirewallCluster` described below.
Class description:
Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac... | 54386c8a710727cc1acf69334a57b155d2f5408c | <|skeleton|>
class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
def create_b... | the_stack_v2_python_sparse | smc/core/engines.py | gabstopper/smc-python | train | 31 |
3a84272fe4e3811304cd3228dcbc799fd0b72702 | [
"code = request.query_params.get('code')\nif not code:\n return Response({'errors': '缺少code值'}, status=400)\nnext = '/'\nweiboauth = OAuthWeibo(client_id=settings.WEIBO_CLIENT_ID, client_secret=settings.WEIBO_CLIENT_SECRET, redirect_uri=settings.WEIBO_REDIRECT_URI, state=next)\nweibotoken = weiboauth.get_access_... | <|body_start_0|>
code = request.query_params.get('code')
if not code:
return Response({'errors': '缺少code值'}, status=400)
next = '/'
weiboauth = OAuthWeibo(client_id=settings.WEIBO_CLIENT_ID, client_secret=settings.WEIBO_CLIENT_SECRET, redirect_uri=settings.WEIBO_REDIRECT_URI,... | 验证微博登录 | WeiboOauthView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeiboOauthView:
"""验证微博登录"""
def get(self, request):
"""第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:"""
<|body_0|>
def post(self, request):
"""微博用户未绑定,绑定微博用户 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_007634 | 7,252 | permissive | [
{
"docstring": "第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "微博用户未绑定,绑定微博用户 :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002531 | Implement the Python class `WeiboOauthView` described below.
Class description:
验证微博登录
Method signatures and docstrings:
- def get(self, request): 第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:
- def post(self, request): 微博用户未绑定,绑定微博用户 :return: | Implement the Python class `WeiboOauthView` described below.
Class description:
验证微博登录
Method signatures and docstrings:
- def get(self, request): 第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:
- def post(self, request): 微博用户未绑定,绑定微博用户 :return:
<|skeleton|>
class WeiboOauthV... | cec3be71376fb94dc38553360253b70e88855594 | <|skeleton|>
class WeiboOauthView:
"""验证微博登录"""
def get(self, request):
"""第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:"""
<|body_0|>
def post(self, request):
"""微博用户未绑定,绑定微博用户 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeiboOauthView:
"""验证微博登录"""
def get(self, request):
"""第三方登录检查 oauth/sina/user/ ?code=0e67548e9e075577630cc983ff79fa6a :param request: :return:"""
code = request.query_params.get('code')
if not code:
return Response({'errors': '缺少code值'}, status=400)
next = '/... | the_stack_v2_python_sparse | note/meiduo34/mall/apps/oauth/views.py | gaosong666/taobao | train | 0 |
7a8d8347967bbf83a59207141c208a9d5bcbab33 | [
"l, r = (0, len(s) - 1)\nwhile l < r:\n while l < r and (not s[l].isalnum()):\n l += 1\n while l < r and (not s[r].isalnum()):\n r -= 1\n if s[l].lower() != s[r].lower():\n return False\n l += 1\n r -= 1\nreturn True",
"tmp = []\nfor c in s:\n if c.isalnum():\n tmp.ap... | <|body_start_0|>
l, r = (0, len(s) - 1)
while l < r:
while l < r and (not s[l].isalnum()):
l += 1
while l < r and (not s[r].isalnum()):
r -= 1
if s[l].lower() != s[r].lower():
return False
l += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l, r = (0, len(s) - 1)
while l < r:
while l ... | stack_v2_sparse_classes_75kplus_train_007635 | 895 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome2",
"signature": "def isPalindrome2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016968 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome2(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome2(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isPalindrome(self, s):
... | 31b2b4dc1e5c3b1c53b333fe30b98ed04b0bdacc | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
l, r = (0, len(s) - 1)
while l < r:
while l < r and (not s[l].isalnum()):
l += 1
while l < r and (not s[r].isalnum()):
r -= 1
if s[l].lower() != s[r]... | the_stack_v2_python_sparse | prob125_valid_palindrome.py | Hu-Wenchao/leetcode | train | 0 | |
65b704efc328ba5b51694224f41feb67c4e67e1a | [
"for i in range(len(nums)):\n t = target - nums[i]\n if t in nums and nums.index(t) != i:\n print([nums.index(t), i])\n return [nums.index(t), i]",
"d = {}\nfor i in range(len(nums)):\n t = target - nums[i]\n if t in d:\n print([d[t], i])\n return [d[t], i]\n d[nums[i]] ... | <|body_start_0|>
for i in range(len(nums)):
t = target - nums[i]
if t in nums and nums.index(t) != i:
print([nums.index(t), i])
return [nums.index(t), i]
<|end_body_0|>
<|body_start_1|>
d = {}
for i in range(len(nums)):
t = tar... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_0|>
def twosum_2(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_007636 | 1,213 | no_license | [
{
"docstring": ":type nums:list[int] :type target:int :rtype:list[int]",
"name": "twosum",
"signature": "def twosum(self, nums, target)"
},
{
"docstring": ":type nums:list[int] :type target:int :rtype:list[int]",
"name": "twosum_2",
"signature": "def twosum_2(self, nums, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053021 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
- def twosum_2(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
- def twosum_2(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
... | 4f2802d4773eddd2a2e06e61c51463056886b730 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_0|>
def twosum_2(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
for i in range(len(nums)):
t = target - nums[i]
if t in nums and nums.index(t) != i:
print([nums.index(t), i])
return [nums.index(t), i... | the_stack_v2_python_sparse | leetcode/9_twosum.py | Yara7L/python_algorithm | train | 0 | |
d2ebcd1db5a97e0d6b5f975d96d71b12d9fbcfa5 | [
"if root == None:\n return []\nself.result = []\n\ndef dfs(root):\n if root.left:\n dfs(root.left)\n if root.right:\n dfs(root.right)\n self.result.append(root.val)\ndfs(root)\nreturn self.result",
"if not root:\n return []\nstack = [root]\nres = []\nwhile stack:\n node = stack.pop... | <|body_start_0|>
if root == None:
return []
self.result = []
def dfs(root):
if root.left:
dfs(root.left)
if root.right:
dfs(root.right)
self.result.append(root.val)
dfs(root)
return self.result
<|end... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
<|body_0|>
def postorderTraversal_1(self, root):
""":type root: TreeNode :rtype: List[int] 35ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root =... | stack_v2_sparse_classes_75kplus_train_007637 | 1,509 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int] 32ms",
"name": "postorderTraversal",
"signature": "def postorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int] 35ms",
"name": "postorderTraversal_1",
"signature": "def postorderTraversal_1(self, root... | 2 | stack_v2_sparse_classes_30k_train_027765 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 32ms
- def postorderTraversal_1(self, root): :type root: TreeNode :rtype: List[int] 35ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 32ms
- def postorderTraversal_1(self, root): :type root: TreeNode :rtype: List[int] 35ms
<|skeleton|>
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
<|body_0|>
def postorderTraversal_1(self, root):
""":type root: TreeNode :rtype: List[int] 35ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
if root == None:
return []
self.result = []
def dfs(root):
if root.left:
dfs(root.left)
if root.right:
dfs(root.r... | the_stack_v2_python_sparse | BinaryTreePostorderTraversal_HARD_145.py | 953250587/leetcode-python | train | 2 | |
8848485f64fe45a228b309280e6f28c046356aec | [
"self.table = DBFetcher(dot_t_system_dir, 'db', 'admin').fetch()\nself.ssid_hash = None\nself.password_hash = None\nself.private_key = None\nself.get_keys()",
"ssid_hash = hashlib.sha256(ssid.encode()).hexdigest()\npassword_hash = hashlib.sha256(password.encode()).hexdigest()\npublic_key = hashlib.sha256((ssid + ... | <|body_start_0|>
self.table = DBFetcher(dot_t_system_dir, 'db', 'admin').fetch()
self.ssid_hash = None
self.password_hash = None
self.private_key = None
self.get_keys()
<|end_body_0|>
<|body_start_1|>
ssid_hash = hashlib.sha256(ssid.encode()).hexdigest()
password... | Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys. | Administrator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Administrator:
"""Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys."""
def __init__(self):
... | stack_v2_sparse_classes_75kplus_train_007638 | 4,830 | permissive | [
{
"docstring": "Initialization method of :class:`t_system.administration.Administrator` class.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "The high-level method to change keys of secret entry point for root authorized. 2 key(ssid and password) authentication uses s... | 5 | stack_v2_sparse_classes_30k_test_002260 | Implement the Python class `Administrator` described below.
Class description:
Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry key... | Implement the Python class `Administrator` described below.
Class description:
Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry key... | a9d63fbbdc208c578d6a6153bf2ba13142b3c7a5 | <|skeleton|>
class Administrator:
"""Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys."""
def __init__(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Administrator:
"""Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys."""
def __init__(self):
"""Initializa... | the_stack_v2_python_sparse | t_system/administration.py | ahmetishakoglu/T_System | train | 0 |
c9d2db1a07d73476617fc4fe8780e518a7a341b7 | [
"super().__init__(**kwargs)\nself.__iteration_number = kwargs['iteration_number']\nself.__employee_bees = [EmployeeBee(**kwargs, bit_generator=self._random) for _ in range(kwargs['bees'])]\nself.__onlooker_bees = [OnlookerBee(**kwargs, bit_generator=self._random) for _ in range(kwargs['bees'])]\nself._visualizer = ... | <|body_start_0|>
super().__init__(**kwargs)
self.__iteration_number = kwargs['iteration_number']
self.__employee_bees = [EmployeeBee(**kwargs, bit_generator=self._random) for _ in range(kwargs['bees'])]
self.__onlooker_bees = [OnlookerBee(**kwargs, bit_generator=self._random) for _ in ra... | Artificial Bee Colony Problem | ABCProblem | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ABCProblem:
"""Artificial Bee Colony Problem"""
def __init__(self, **kwargs):
"""Initializes a new instance of the ABCProblem class."""
<|body_0|>
def solve(self):
"""Solve the ABC problem"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().... | stack_v2_sparse_classes_75kplus_train_007639 | 3,116 | permissive | [
{
"docstring": "Initializes a new instance of the ABCProblem class.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Solve the ABC problem",
"name": "solve",
"signature": "def solve(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030709 | Implement the Python class `ABCProblem` described below.
Class description:
Artificial Bee Colony Problem
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes a new instance of the ABCProblem class.
- def solve(self): Solve the ABC problem | Implement the Python class `ABCProblem` described below.
Class description:
Artificial Bee Colony Problem
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes a new instance of the ABCProblem class.
- def solve(self): Solve the ABC problem
<|skeleton|>
class ABCProblem:
"""Artificial Bee... | 044b10be5694359900495403cc9f0e84d38a9e88 | <|skeleton|>
class ABCProblem:
"""Artificial Bee Colony Problem"""
def __init__(self, **kwargs):
"""Initializes a new instance of the ABCProblem class."""
<|body_0|>
def solve(self):
"""Solve the ABC problem"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ABCProblem:
"""Artificial Bee Colony Problem"""
def __init__(self, **kwargs):
"""Initializes a new instance of the ABCProblem class."""
super().__init__(**kwargs)
self.__iteration_number = kwargs['iteration_number']
self.__employee_bees = [EmployeeBee(**kwargs, bit_generat... | the_stack_v2_python_sparse | swarmlib/abc/abc_problem.py | huizhi-li/swarmlib | train | 0 |
2831b14864f7e4d4b5911f1ddb1f9e8d66bfbf7d | [
"self.grismname = os.path.basename(dummyImages.griname)\nif dummyImages.dirname != None:\n self.dirname = os.path.basename(dummyImages.dirname)\nelse:\n self.dirname = None\nself.configfile = configfile\nself.iolname = simobjects\nself.model_spectra = model_spectra\nself.model_images = model_images\nself.lamb... | <|body_start_0|>
self.grismname = os.path.basename(dummyImages.griname)
if dummyImages.dirname != None:
self.dirname = os.path.basename(dummyImages.dirname)
else:
self.dirname = None
self.configfile = configfile
self.iolname = simobjects
self.model... | Class to create a dispersed image | DispImator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DispImator:
"""Class to create a dispersed image"""
def __init__(self, dummyImages, configfile, simobjects, lambda_psf=None, model_spectra=None, model_images=None):
"""Initializer for the class @param dummyImages: dummy image structure @type dummyImages: DummyImages() @param configfi... | stack_v2_sparse_classes_75kplus_train_007640 | 15,945 | permissive | [
{
"docstring": "Initializer for the class @param dummyImages: dummy image structure @type dummyImages: DummyImages() @param configfile: name of the aXe configuration file @type configfile: string @param simobjects: name of the model object table @type simobjects: string @param lambda_psf: reference wavelength f... | 3 | stack_v2_sparse_classes_30k_train_034899 | Implement the Python class `DispImator` described below.
Class description:
Class to create a dispersed image
Method signatures and docstrings:
- def __init__(self, dummyImages, configfile, simobjects, lambda_psf=None, model_spectra=None, model_images=None): Initializer for the class @param dummyImages: dummy image s... | Implement the Python class `DispImator` described below.
Class description:
Class to create a dispersed image
Method signatures and docstrings:
- def __init__(self, dummyImages, configfile, simobjects, lambda_psf=None, model_spectra=None, model_images=None): Initializer for the class @param dummyImages: dummy image s... | 043c173fd5497c18c2b1bfe8bcff65180bca3996 | <|skeleton|>
class DispImator:
"""Class to create a dispersed image"""
def __init__(self, dummyImages, configfile, simobjects, lambda_psf=None, model_spectra=None, model_images=None):
"""Initializer for the class @param dummyImages: dummy image structure @type dummyImages: DummyImages() @param configfi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DispImator:
"""Class to create a dispersed image"""
def __init__(self, dummyImages, configfile, simobjects, lambda_psf=None, model_spectra=None, model_images=None):
"""Initializer for the class @param dummyImages: dummy image structure @type dummyImages: DummyImages() @param configfile: name of t... | the_stack_v2_python_sparse | stsdas/pkg/analysis/slitless/axe/axesrc/axecommands.py | spacetelescope/stsdas_stripped | train | 1 |
cdb7745db8068ff0e14335a4721625874e9bcb32 | [
"self.user = UserFactory()\nself.post = PostFactory()\nself.view = ReactionCreate()\nself.view.kwargs = {'pk': self.post.id}\nself.request = MagicMock()\nself.request.user = self.user\nself.view.request = self.request",
"reaction = Reaction.LIKE\nself.request.method = 'POST'\nself.request.POST = {'description': r... | <|body_start_0|>
self.user = UserFactory()
self.post = PostFactory()
self.view = ReactionCreate()
self.view.kwargs = {'pk': self.post.id}
self.request = MagicMock()
self.request.user = self.user
self.view.request = self.request
<|end_body_0|>
<|body_start_1|>
... | ReactionTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReactionTestCase:
def setUp(self):
"""Create new post, user and ReactionView."""
<|body_0|>
def test_reaction_add(self):
"""Test reaction creates"""
<|body_1|>
def test_reaction_single(self):
"""Test user can react only once by one emote"""
... | stack_v2_sparse_classes_75kplus_train_007641 | 1,575 | no_license | [
{
"docstring": "Create new post, user and ReactionView.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test reaction creates",
"name": "test_reaction_add",
"signature": "def test_reaction_add(self)"
},
{
"docstring": "Test user can react only once by one emo... | 3 | stack_v2_sparse_classes_30k_train_005769 | Implement the Python class `ReactionTestCase` described below.
Class description:
Implement the ReactionTestCase class.
Method signatures and docstrings:
- def setUp(self): Create new post, user and ReactionView.
- def test_reaction_add(self): Test reaction creates
- def test_reaction_single(self): Test user can reac... | Implement the Python class `ReactionTestCase` described below.
Class description:
Implement the ReactionTestCase class.
Method signatures and docstrings:
- def setUp(self): Create new post, user and ReactionView.
- def test_reaction_add(self): Test reaction creates
- def test_reaction_single(self): Test user can reac... | 4089c3f084d7460f64517158eefb54b3b93a01e8 | <|skeleton|>
class ReactionTestCase:
def setUp(self):
"""Create new post, user and ReactionView."""
<|body_0|>
def test_reaction_add(self):
"""Test reaction creates"""
<|body_1|>
def test_reaction_single(self):
"""Test user can react only once by one emote"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReactionTestCase:
def setUp(self):
"""Create new post, user and ReactionView."""
self.user = UserFactory()
self.post = PostFactory()
self.view = ReactionCreate()
self.view.kwargs = {'pk': self.post.id}
self.request = MagicMock()
self.request.user = self.... | the_stack_v2_python_sparse | apps/reactions/tests.py | maxwell912/social-app | train | 0 | |
4d5be2f9031339bfd610484fc9c82cb3bbf73440 | [
"kwargs = super().get_form_kwargs()\ntry:\n kwargs.update({'totp_secret': self.request.session['totp_secret']})\nexcept KeyError:\n raise Http404\nreturn kwargs",
"user = models.User.objects.get(pk=self.request.session.pop('user_pk'))\nself.request.session.pop('totp_secret')\ntoken = default_token_generator... | <|body_start_0|>
kwargs = super().get_form_kwargs()
try:
kwargs.update({'totp_secret': self.request.session['totp_secret']})
except KeyError:
raise Http404
return kwargs
<|end_body_0|>
<|body_start_1|>
user = models.User.objects.get(pk=self.request.sessio... | View to verify a code received by SMS. | VerifySMSCodeView | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerifySMSCodeView:
"""View to verify a code received by SMS."""
def get_form_kwargs(self):
"""Include totp secret in kwargs."""
<|body_0|>
def form_valid(self, form):
"""Redirect to reset password form."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_007642 | 9,442 | permissive | [
{
"docstring": "Include totp secret in kwargs.",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Redirect to reset password form.",
"name": "form_valid",
"signature": "def form_valid(self, form)"
}
] | 2 | stack_v2_sparse_classes_30k_train_038893 | Implement the Python class `VerifySMSCodeView` described below.
Class description:
View to verify a code received by SMS.
Method signatures and docstrings:
- def get_form_kwargs(self): Include totp secret in kwargs.
- def form_valid(self, form): Redirect to reset password form. | Implement the Python class `VerifySMSCodeView` described below.
Class description:
View to verify a code received by SMS.
Method signatures and docstrings:
- def get_form_kwargs(self): Include totp secret in kwargs.
- def form_valid(self, form): Redirect to reset password form.
<|skeleton|>
class VerifySMSCodeView:
... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class VerifySMSCodeView:
"""View to verify a code received by SMS."""
def get_form_kwargs(self):
"""Include totp secret in kwargs."""
<|body_0|>
def form_valid(self, form):
"""Redirect to reset password form."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VerifySMSCodeView:
"""View to verify a code received by SMS."""
def get_form_kwargs(self):
"""Include totp secret in kwargs."""
kwargs = super().get_form_kwargs()
try:
kwargs.update({'totp_secret': self.request.session['totp_secret']})
except KeyError:
... | the_stack_v2_python_sparse | modoboa/core/views/auth.py | modoboa/modoboa | train | 2,201 |
c9333dc702fecf6553cfbd72718c15dbced185c7 | [
"call_command('update_index')\nfor k in settings.HAYSTACK_CONNECTIONS:\n self.assertTrue(call('core', k) in m.call_args_list)",
"call_command('update_index', verbosity=0, using=['eng', 'fra'])\nm.assert_any_call('core', 'eng')\nm.assert_any_call('core', 'fra')\nself.assertTrue(call('core', 'default') not in m.... | <|body_start_0|>
call_command('update_index')
for k in settings.HAYSTACK_CONNECTIONS:
self.assertTrue(call('core', k) in m.call_args_list)
<|end_body_0|>
<|body_start_1|>
call_command('update_index', verbosity=0, using=['eng', 'fra'])
m.assert_any_call('core', 'eng')
... | CoreManagementCommandsTestCase | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoreManagementCommandsTestCase:
def test_update_index_default_using(self, m):
"""update_index uses default index when --using is not present"""
<|body_0|>
def test_update_index_using(self, m):
"""update_index only applies to indexes specified with --using"""
... | stack_v2_sparse_classes_75kplus_train_007643 | 3,152 | permissive | [
{
"docstring": "update_index uses default index when --using is not present",
"name": "test_update_index_default_using",
"signature": "def test_update_index_default_using(self, m)"
},
{
"docstring": "update_index only applies to indexes specified with --using",
"name": "test_update_index_usi... | 6 | null | Implement the Python class `CoreManagementCommandsTestCase` described below.
Class description:
Implement the CoreManagementCommandsTestCase class.
Method signatures and docstrings:
- def test_update_index_default_using(self, m): update_index uses default index when --using is not present
- def test_update_index_usin... | Implement the Python class `CoreManagementCommandsTestCase` described below.
Class description:
Implement the CoreManagementCommandsTestCase class.
Method signatures and docstrings:
- def test_update_index_default_using(self, m): update_index uses default index when --using is not present
- def test_update_index_usin... | 5d74280724ff6c6ac1b2d3a7c86b382e512ecf4d | <|skeleton|>
class CoreManagementCommandsTestCase:
def test_update_index_default_using(self, m):
"""update_index uses default index when --using is not present"""
<|body_0|>
def test_update_index_using(self, m):
"""update_index only applies to indexes specified with --using"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CoreManagementCommandsTestCase:
def test_update_index_default_using(self, m):
"""update_index uses default index when --using is not present"""
call_command('update_index')
for k in settings.HAYSTACK_CONNECTIONS:
self.assertTrue(call('core', k) in m.call_args_list)
def... | the_stack_v2_python_sparse | mud/django-haystack-2.3.2/test_haystack/test_management_commands.py | Nik0las1984/mud-obj | train | 2 | |
b3b4446140f490e733ab9273e5bb7bb8974feb54 | [
"n = len(nums)\nif n < 2:\n return False\ntotal = sum(nums)\nif total % 2 == 1:\n return False\nm = total / 2\nmaxNumber = max(nums)\nif maxNumber > m and maxNumber + m > total:\n return False\ndp = [[0] * (m + 1) for _ in range(n)]\nif nums[0] <= m:\n dp[0][nums[0]] = 1\nfor i in range(1, n):\n for ... | <|body_start_0|>
n = len(nums)
if n < 2:
return False
total = sum(nums)
if total % 2 == 1:
return False
m = total / 2
maxNumber = max(nums)
if maxNumber > m and maxNumber + m > total:
return False
dp = [[0] * (m + 1) for... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
... | stack_v2_sparse_classes_75kplus_train_007644 | 3,218 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition",
"signature": "def canPartition(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition",
"signature": "def canPartition(self, nums)"
},
{
"docstring": ":type nums: List... | 3 | stack_v2_sparse_classes_30k_train_042547 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition(self, nums): :type nums: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition(self, nums): :type nums: Li... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
n = len(nums)
if n < 2:
return False
total = sum(nums)
if total % 2 == 1:
return False
m = total / 2
maxNumber = max(nums)
if maxNumber > m a... | the_stack_v2_python_sparse | 0416_Partition_Equal_Subset_Sum.py | bingli8802/leetcode | train | 0 | |
6eddc1f8b34ed09b120a52b0ca10df67a71cedcf | [
"Pattern.__init__(self, pattern)\nself.markdown = md\nself.get_hl_settings = False",
"if not self.get_hl_settings:\n self.get_hl_settings = True\n self.style_plain_text = self.config['style_plain_text']\n config = hl.get_hl_settings(self.markdown)\n css_class = self.config['css_class']\n self.css_c... | <|body_start_0|>
Pattern.__init__(self, pattern)
self.markdown = md
self.get_hl_settings = False
<|end_body_0|>
<|body_start_1|>
if not self.get_hl_settings:
self.get_hl_settings = True
self.style_plain_text = self.config['style_plain_text']
config = ... | Handle the inline code patterns. | InlineHilitePattern | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, md):
"""Initialize."""
<|body_0|>
def get_settings(self):
"""Check for CodeHilite extension and gather its settings."""
<|body_1|>
def highlight_code(self, langua... | stack_v2_sparse_classes_75kplus_train_007645 | 4,604 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, pattern, md)"
},
{
"docstring": "Check for CodeHilite extension and gather its settings.",
"name": "get_settings",
"signature": "def get_settings(self)"
},
{
"docstring": "Syntax highlight the inli... | 4 | stack_v2_sparse_classes_30k_train_001348 | Implement the Python class `InlineHilitePattern` described below.
Class description:
Handle the inline code patterns.
Method signatures and docstrings:
- def __init__(self, pattern, md): Initialize.
- def get_settings(self): Check for CodeHilite extension and gather its settings.
- def highlight_code(self, language, ... | Implement the Python class `InlineHilitePattern` described below.
Class description:
Handle the inline code patterns.
Method signatures and docstrings:
- def __init__(self, pattern, md): Initialize.
- def get_settings(self): Check for CodeHilite extension and gather its settings.
- def highlight_code(self, language, ... | 0e7796a61d4391ba51e3a9e21d3cdcd64a0ba8a4 | <|skeleton|>
class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, md):
"""Initialize."""
<|body_0|>
def get_settings(self):
"""Check for CodeHilite extension and gather its settings."""
<|body_1|>
def highlight_code(self, langua... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, md):
"""Initialize."""
Pattern.__init__(self, pattern)
self.markdown = md
self.get_hl_settings = False
def get_settings(self):
"""Check for CodeHilite extension and gather ... | the_stack_v2_python_sparse | thirdparty/pymdownx/inlinehilite.py | cxsjclassroom/webserver | train | 5 |
5f22af9a5bdcbd5cdec51e744c1f7117ba3c64b3 | [
"slower = head\nfaster = head\nwhile faster and faster.next:\n slower = slower.next\n faster = faster.next.next\n if faster == slower:\n return True\nreturn False",
"listSet = set()\nwhile head:\n if head == None:\n return False\n elif head in listSet:\n return True\n else:\... | <|body_start_0|>
slower = head
faster = head
while faster and faster.next:
slower = slower.next
faster = faster.next.next
if faster == slower:
return True
return False
<|end_body_0|>
<|body_start_1|>
listSet = set()
whi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
slower = head
faster = head
while ... | stack_v2_sparse_classes_75kplus_train_007646 | 1,012 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle1",
"signature": "def hasCycle1(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017559 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle1(self, head): :type head: ListNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle1(self, head): :type head: ListNode :rtype: bool
<|skeleton|>
class Solution:
def hasCycle(self, h... | 639f4686308522d59cd8b818247d70ce57dc5c10 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
slower = head
faster = head
while faster and faster.next:
slower = slower.next
faster = faster.next.next
if faster == slower:
return True
retu... | the_stack_v2_python_sparse | src/141. Linked List Cycle.py | YoungXueya/LeetcodeSolution | train | 0 | |
f0bdc18bbdc65c9e968d24215b8e50bef2352cc7 | [
"super(Conv1dSubsampling2, self).__init__()\nself.conv = torch.nn.Sequential(torch.nn.Conv1d(idim, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv1d(odim, odim, 3, 2), torch.nn.ReLU())\nself.out = torch.nn.Sequential(torch.nn.Linear(odim, odim), pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate)... | <|body_start_0|>
super(Conv1dSubsampling2, self).__init__()
self.conv = torch.nn.Sequential(torch.nn.Conv1d(idim, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv1d(odim, odim, 3, 2), torch.nn.ReLU())
self.out = torch.nn.Sequential(torch.nn.Linear(odim, odim), pos_enc if pos_enc is not None else Posi... | Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. | Conv1dSubsampling2 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv1dSubsampling2:
"""Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
... | stack_v2_sparse_classes_75kplus_train_007647 | 14,351 | permissive | [
{
"docstring": "Construct an Conv1dSubsampling2 object.",
"name": "__init__",
"signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)"
},
{
"docstring": "Subsample x. Args: x (torch.Tensor): Input tensor (#batch, time, idim). x_mask (torch.Tensor): Input mask (#batch, 1, time). ... | 3 | stack_v2_sparse_classes_30k_test_001494 | Implement the Python class `Conv1dSubsampling2` described below.
Class description:
Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Method signatures and docstr... | Implement the Python class `Conv1dSubsampling2` described below.
Class description:
Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Method signatures and docstr... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class Conv1dSubsampling2:
"""Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Conv1dSubsampling2:
"""Convolutional 1D subsampling (to 1/2 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
"""Co... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transformer/subsampling.py | espnet/espnet | train | 7,242 |
2a87983b567a571508f64824ea32e201e8d1f83a | [
"if model._meta.app_label in self.db_user_apps:\n return 'rbac_db'\nreturn None",
"if model._meta.app_label in self.db_user_apps:\n return 'rbac_db'\nreturn None",
"if app_label in self.db_user_apps:\n return db == 'rbac_db'\nreturn None"
] | <|body_start_0|>
if model._meta.app_label in self.db_user_apps:
return 'rbac_db'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label in self.db_user_apps:
return 'rbac_db'
return None
<|end_body_1|>
<|body_start_2|>
if app_label in self.... | A router to control all database operations on models in the auth application. | DatabaseRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseRouter:
"""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 default."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Attempts to write a... | stack_v2_sparse_classes_75kplus_train_007648 | 1,058 | no_license | [
{
"docstring": "Attempts to read auth models go to default.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attempts to write auth models go to default.",
"name": "db_for_write",
"signature": "def db_for_write(self, model, **hints)"
},
... | 3 | stack_v2_sparse_classes_30k_train_044969 | Implement the Python class `DatabaseRouter` 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 default.
- def db_for_write(self, model, **hints)... | Implement the Python class `DatabaseRouter` 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 default.
- def db_for_write(self, model, **hints)... | bb85b52598d68956bde8756c8321ade7b8479ba7 | <|skeleton|>
class DatabaseRouter:
"""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 default."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Attempts to write a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatabaseRouter:
"""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 default."""
if model._meta.app_label in self.db_user_apps:
return 'rbac_db'
return None
... | the_stack_v2_python_sparse | rbac_v1/rbac/db_router_setting.py | huiiiuh/huihuiproject | train | 0 |
a74f632e12e45b58bf73391fd8c77e3d57a86ad8 | [
"dp = [30001 for _ in range(101)]\nres = [0 for _ in range(len(T))]\nfor i in range(len(T) - 1, -1, -1):\n index = 30001\n for j in range(T[i] + 1, 101):\n if dp[j] < index:\n index = dp[j]\n if index < 30001:\n res[i] = index - i\n dp[T[i]] = i\nreturn res",
"stack = []\nres ... | <|body_start_0|>
dp = [30001 for _ in range(101)]
res = [0 for _ in range(len(T))]
for i in range(len(T) - 1, -1, -1):
index = 30001
for j in range(T[i] + 1, 101):
if dp[j] < index:
index = dp[j]
if index < 30001:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def dailyTemperatures(self, T):
""":type T: List[int] :rtype: List[int]"""
<|body_0|>
def dailyTemperatures(self, T):
""":type T: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [30001 for _ in range(101)]
... | stack_v2_sparse_classes_75kplus_train_007649 | 1,137 | no_license | [
{
"docstring": ":type T: List[int] :rtype: List[int]",
"name": "dailyTemperatures",
"signature": "def dailyTemperatures(self, T)"
},
{
"docstring": ":type T: List[int] :rtype: List[int]",
"name": "dailyTemperatures",
"signature": "def dailyTemperatures(self, T)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041086 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def dailyTemperatures(self, T): :type T: List[int] :rtype: List[int]
- def dailyTemperatures(self, T): :type T: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def dailyTemperatures(self, T): :type T: List[int] :rtype: List[int]
- def dailyTemperatures(self, T): :type T: List[int] :rtype: List[int]
<|skeleton|>
class Solution:
def... | 6d4cdfaca1e6720b16d6cb278520c1583b47826e | <|skeleton|>
class Solution:
def dailyTemperatures(self, T):
""":type T: List[int] :rtype: List[int]"""
<|body_0|>
def dailyTemperatures(self, T):
""":type T: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def dailyTemperatures(self, T):
""":type T: List[int] :rtype: List[int]"""
dp = [30001 for _ in range(101)]
res = [0 for _ in range(len(T))]
for i in range(len(T) - 1, -1, -1):
index = 30001
for j in range(T[i] + 1, 101):
if dp[... | the_stack_v2_python_sparse | leetcode/num739.py | formernest/leetcode | train | 0 | |
f5a75fe366980a0da82101a27ecbf99a82682f01 | [
"super(focal, self).__init__()\nself.alpha = alpha\nself.gamma = gamma\nself.logits = with_logits",
"if self.logits:\n CE_loss = F.binary_cross_entropy_with_logits(images, labels)\nelse:\n CE_loss = F.binary_cross_entropy(images, labels)\npt = torch.exp(-CE_loss)\nF_loss = self.alpha * (1 - pt) ** self.gamm... | <|body_start_0|>
super(focal, self).__init__()
self.alpha = alpha
self.gamma = gamma
self.logits = with_logits
<|end_body_0|>
<|body_start_1|>
if self.logits:
CE_loss = F.binary_cross_entropy_with_logits(images, labels)
else:
CE_loss = F.binary_cr... | Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/1708.02002. | focal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class focal:
"""Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/1708.02002."""
def __init__(self, alp... | stack_v2_sparse_classes_75kplus_train_007650 | 1,290 | no_license | [
{
"docstring": "Args: alpha (float): \"balance\" coefficient, gamma (float): \"focusing\" parameter (>=0), with_logits (bool): indicates if the sigmoid operation was applied at the end of a neural network's forward path.",
"name": "__init__",
"signature": "def __init__(self, alpha=0.5, gamma=2, with_log... | 2 | stack_v2_sparse_classes_30k_train_031717 | Implement the Python class `focal` described below.
Class description:
Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/170... | Implement the Python class `focal` described below.
Class description:
Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/170... | d9a27493d8770982e2c933bc1e4b1aa31d682f14 | <|skeleton|>
class focal:
"""Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/1708.02002."""
def __init__(self, alp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class focal:
"""Loss function for classification tasks with large data imbalance. Focal loss (FL) is define as: FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t), where p_t is a cross-entropy loss for binary classification. For more details, see https://arxiv.org/abs/1708.02002."""
def __init__(self, alpha=0.5, gamma... | the_stack_v2_python_sparse | DefectNet/loss.py | gduscher/AICrystallographer | train | 1 |
78dfcf4068c0b98ff80f67f17e9d8aaf502d424c | [
"self.food, self.food_idx = (food, 0)\nself.snake = deque([[0, 0]])\nself.size = (height, width)\nself.dirs = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}\nself.res = 0",
"pos = [self.snake[0][0] + self.dirs[direction][0], self.snake[0][1] + self.dirs[direction][1]]\nif pos[0] < 0 or pos[0] >= self.size... | <|body_start_0|>
self.food, self.food_idx = (food, 0)
self.snake = deque([[0, 0]])
self.size = (height, width)
self.dirs = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}
self.res = 0
<|end_body_0|>
<|body_start_1|>
pos = [self.snake[0][0] + self.dirs[direction][0... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: 'List[List[int]]'):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1],... | stack_v2_sparse_classes_75kplus_train_007651 | 3,226 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 3 | stack_v2_sparse_classes_30k_train_043493 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: 'List[List[int]]'): Initialize your data structure here. @param width - screen width @param height - screen height @param food... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: 'List[List[int]]'): Initialize your data structure here. @param width - screen width @param height - screen height @param food... | 4a1747b6497305f3821612d9c358a6795b1690da | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: 'List[List[int]]'):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1],... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnakeGame:
def __init__(self, width: int, height: int, food: 'List[List[int]]'):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is... | the_stack_v2_python_sparse | Queue/q353_design_snake_game.py | sevenhe716/LeetCode | train | 0 | |
f62098d359414a8df4399854e16ef6cc896f2563 | [
"_file_id: int = request.query_params.get('file_id')\n_no_trans: int = request.query_params.get('no_trans')\n_search_text: str = request.query_params.get('search_text')\n_queryset = self.get_queryset().filter(file_id=_file_id).order_by('fid')\n_queryset = ApiUtil.qs_tr_filter_and_order(_queryset, _no_trans, _search... | <|body_start_0|>
_file_id: int = request.query_params.get('file_id')
_no_trans: int = request.query_params.get('no_trans')
_search_text: str = request.query_params.get('search_text')
_queryset = self.get_queryset().filter(file_id=_file_id).order_by('fid')
_queryset = ApiUtil.qs_t... | FileMarksView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileMarksView:
def list(self, request, *args, **kwargs):
"""Translate with pagination"""
<|body_0|>
def create(self, request, *args, **kwargs):
"""Update translate and mark file to refresh copy when Celery run periodic update"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_007652 | 12,600 | no_license | [
{
"docstring": "Translate with pagination",
"name": "list",
"signature": "def list(self, request, *args, **kwargs)"
},
{
"docstring": "Update translate and mark file to refresh copy when Celery run periodic update",
"name": "create",
"signature": "def create(self, request, *args, **kwarg... | 2 | null | Implement the Python class `FileMarksView` described below.
Class description:
Implement the FileMarksView class.
Method signatures and docstrings:
- def list(self, request, *args, **kwargs): Translate with pagination
- def create(self, request, *args, **kwargs): Update translate and mark file to refresh copy when Ce... | Implement the Python class `FileMarksView` described below.
Class description:
Implement the FileMarksView class.
Method signatures and docstrings:
- def list(self, request, *args, **kwargs): Translate with pagination
- def create(self, request, *args, **kwargs): Update translate and mark file to refresh copy when Ce... | e56936a884f14f5451b2fd5b2ab16621b73bbe69 | <|skeleton|>
class FileMarksView:
def list(self, request, *args, **kwargs):
"""Translate with pagination"""
<|body_0|>
def create(self, request, *args, **kwargs):
"""Update translate and mark file to refresh copy when Celery run periodic update"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileMarksView:
def list(self, request, *args, **kwargs):
"""Translate with pagination"""
_file_id: int = request.query_params.get('file_id')
_no_trans: int = request.query_params.get('no_trans')
_search_text: str = request.query_params.get('search_text')
_queryset = sel... | the_stack_v2_python_sparse | back/core/views.py | meoook/Abyss-Translate | train | 0 | |
00036ff9a57b5d138ddfc72cf02545214758506e | [
"r, nr = (0, 0)\nfor i in range(len(nums)):\n tmp = nr\n nr = max(r, nr)\n r = tmp + nums[i]\nreturn max(r, nr)",
"def helper(start, stop):\n r, nr = (0, 0)\n for i in range(start, stop):\n tmp = nr\n nr = max(r, nr)\n r = tmp + nums[i]\n return max(r, nr)\nif len(nums) == 1... | <|body_start_0|>
r, nr = (0, 0)
for i in range(len(nums)):
tmp = nr
nr = max(r, nr)
r = tmp + nums[i]
return max(r, nr)
<|end_body_0|>
<|body_start_1|>
def helper(start, stop):
r, nr = (0, 0)
for i in range(start, stop):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob1(self, nums):
"""line :param nums: :return:"""
<|body_0|>
def rob2(self, nums):
"""circle :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r, nr = (0, 0)
for i in range(len(nums)):
... | stack_v2_sparse_classes_75kplus_train_007653 | 790 | no_license | [
{
"docstring": "line :param nums: :return:",
"name": "rob1",
"signature": "def rob1(self, nums)"
},
{
"docstring": "circle :type nums: List[int] :rtype: int",
"name": "rob2",
"signature": "def rob2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020541 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob1(self, nums): line :param nums: :return:
- def rob2(self, nums): circle :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob1(self, nums): line :param nums: :return:
- def rob2(self, nums): circle :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def rob1(self, nums):
... | e16702d2b3ec4e5054baad56f4320bc3b31676ad | <|skeleton|>
class Solution:
def rob1(self, nums):
"""line :param nums: :return:"""
<|body_0|>
def rob2(self, nums):
"""circle :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rob1(self, nums):
"""line :param nums: :return:"""
r, nr = (0, 0)
for i in range(len(nums)):
tmp = nr
nr = max(r, nr)
r = tmp + nums[i]
return max(r, nr)
def rob2(self, nums):
"""circle :type nums: List[int] :rtype:... | the_stack_v2_python_sparse | leetcode/medium/house_robber.py | SuperMartinYang/learning_algorithm | train | 0 | |
032cef86e10c43d8b85dd26658516506164c5ffb | [
"super(CreateIngest, self).__init__('create_ingest_jobs')\nself.create_ingest_type = None\nself.ingest_id = None\nself.scan_id = None\nself.strike_id = None",
"json_dict = {'create_ingest_type': self.create_ingest_type, 'ingest_id': self.ingest_id}\nif self.create_ingest_type == STRIKE_JOB_TYPE:\n json_dict['s... | <|body_start_0|>
super(CreateIngest, self).__init__('create_ingest_jobs')
self.create_ingest_type = None
self.ingest_id = None
self.scan_id = None
self.strike_id = None
<|end_body_0|>
<|body_start_1|>
json_dict = {'create_ingest_type': self.create_ingest_type, 'ingest_id... | Command message that creates the ingest job | CreateIngest | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateIngest:
"""Command message that creates the ingest job"""
def __init__(self):
"""Constructor"""
<|body_0|>
def to_json(self):
"""See :meth:`messaging.messages.message.CommandMessage.to_json`"""
<|body_1|>
def from_json(json_dict):
"""Se... | stack_v2_sparse_classes_75kplus_train_007654 | 5,186 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "See :meth:`messaging.messages.message.CommandMessage.to_json`",
"name": "to_json",
"signature": "def to_json(self)"
},
{
"docstring": "See :meth:`messaging.messages.message.Comm... | 4 | stack_v2_sparse_classes_30k_test_002572 | Implement the Python class `CreateIngest` described below.
Class description:
Command message that creates the ingest job
Method signatures and docstrings:
- def __init__(self): Constructor
- def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json`
- def from_json(json_dict): See :meth:`messag... | Implement the Python class `CreateIngest` described below.
Class description:
Command message that creates the ingest job
Method signatures and docstrings:
- def __init__(self): Constructor
- def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json`
- def from_json(json_dict): See :meth:`messag... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class CreateIngest:
"""Command message that creates the ingest job"""
def __init__(self):
"""Constructor"""
<|body_0|>
def to_json(self):
"""See :meth:`messaging.messages.message.CommandMessage.to_json`"""
<|body_1|>
def from_json(json_dict):
"""Se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateIngest:
"""Command message that creates the ingest job"""
def __init__(self):
"""Constructor"""
super(CreateIngest, self).__init__('create_ingest_jobs')
self.create_ingest_type = None
self.ingest_id = None
self.scan_id = None
self.strike_id = None
... | the_stack_v2_python_sparse | scale/ingest/messages/create_ingest_jobs.py | kfconsultant/scale | train | 0 |
88e0bbc2ce70beefd77e80e06cf4981790e42fdc | [
"if 'softmax_flag' in conf:\n raise Exception('Softmax argument is deprecated. Use activation')\nif 'activation' in conf:\n self.activation = conf['activation']\nelif 'output_activation' in conf:\n self.activation = conf['output_activation']\nelse:\n self.activation = 'softmax'\nsuper(StackedmasksRecons... | <|body_start_0|>
if 'softmax_flag' in conf:
raise Exception('Softmax argument is deprecated. Use activation')
if 'activation' in conf:
self.activation = conf['activation']
elif 'output_activation' in conf:
self.activation = conf['output_activation']
el... | the stacked masks reconstructor class a reconstructor using that uses stacked masks | StackedmasksReconstructor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StackedmasksReconstructor:
"""the stacked masks reconstructor class a reconstructor using that uses stacked masks"""
def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False):
"""StackedmasksReconstructor constructor Args: conf: the reconstructor co... | stack_v2_sparse_classes_75kplus_train_007655 | 4,155 | permissive | [
{
"docstring": "StackedmasksReconstructor constructor Args: conf: the reconstructor configuration as a dictionary evalconf: the evaluator configuration as a ConfigParser dataconf: the database configuration rec_dir: the directory where the reconstructions will be stored",
"name": "__init__",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_033575 | Implement the Python class `StackedmasksReconstructor` described below.
Class description:
the stacked masks reconstructor class a reconstructor using that uses stacked masks
Method signatures and docstrings:
- def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): StackedmasksR... | Implement the Python class `StackedmasksReconstructor` described below.
Class description:
the stacked masks reconstructor class a reconstructor using that uses stacked masks
Method signatures and docstrings:
- def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): StackedmasksR... | 5e862cbf846d45b8a317f87588533f3fde9f0726 | <|skeleton|>
class StackedmasksReconstructor:
"""the stacked masks reconstructor class a reconstructor using that uses stacked masks"""
def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False):
"""StackedmasksReconstructor constructor Args: conf: the reconstructor co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StackedmasksReconstructor:
"""the stacked masks reconstructor class a reconstructor using that uses stacked masks"""
def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False):
"""StackedmasksReconstructor constructor Args: conf: the reconstructor configuration a... | the_stack_v2_python_sparse | nabu/postprocessing/reconstructors/stackedmasks_reconstructor.py | JeroenZegers/Nabu-MSSS | train | 19 |
92dd2eb502fe98fcf18c6a12fa85b0f2603ac61f | [
"dd = np.array([[32, 64, 128], [16, -1, 1], [8, 4, 2]])\nself.rivmth_value = 0\npit_value = -1\nsuper(D8plus, self).__init__('d8', dd=dd, raster=d8, transform=transform, pit_value=pit_value, fill_value=fill_value, search_radius=1, **kwargs)",
"if row is None and col is None:\n return np.logical_or(self.r == se... | <|body_start_0|>
dd = np.array([[32, 64, 128], [16, -1, 1], [8, 4, 2]])
self.rivmth_value = 0
pit_value = -1
super(D8plus, self).__init__('d8', dd=dd, raster=d8, transform=transform, pit_value=pit_value, fill_value=fill_value, search_radius=1, **kwargs)
<|end_body_0|>
<|body_start_1|>
... | D8plus | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class D8plus:
def __init__(self, d8, transform, fill_value=-9, **kwargs):
"""initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth (0) and inland depression (-1) for more info on the ldd data format see: http://hydro.iis.u-tok... | stack_v2_sparse_classes_75kplus_train_007656 | 16,667 | permissive | [
{
"docstring": "initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth (0) and inland depression (-1) for more info on the ldd data format see: http://hydro.iis.u-tokyo.ac.jp/~yamadai/GlobalDir/",
"name": "__init__",
"signature": "def __... | 2 | stack_v2_sparse_classes_30k_train_033800 | Implement the Python class `D8plus` described below.
Class description:
Implement the D8plus class.
Method signatures and docstrings:
- def __init__(self, d8, transform, fill_value=-9, **kwargs): initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth ... | Implement the Python class `D8plus` described below.
Class description:
Implement the D8plus class.
Method signatures and docstrings:
- def __init__(self, d8, transform, fill_value=-9, **kwargs): initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth ... | f9d7960633be80e8e24d2f2563df367cc3f060c6 | <|skeleton|>
class D8plus:
def __init__(self, d8, transform, fill_value=-9, **kwargs):
"""initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth (0) and inland depression (-1) for more info on the ldd data format see: http://hydro.iis.u-tok... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class D8plus:
def __init__(self, d8, transform, fill_value=-9, **kwargs):
"""initialize drainage direction object based on hydroshseds d8 definition, extended with multiple pit values for rivermouth (0) and inland depression (-1) for more info on the ldd data format see: http://hydro.iis.u-tokyo.ac.jp/~yama... | the_stack_v2_python_sparse | src/1-prepare/cmftools/nb/dd_ops.py | Jiangchao3/compound_hotspots | train | 0 | |
7b26fd13b8522619abca2fc6d8b595cbd3e7d816 | [
"if parent_type == 'task':\n parent_id = RollupFactory.get_parent_id(request, parent_type, task_id)\n rollup_entity = Scope(request, parent_id, project_id)\nelif parent_type == 'project':\n rollup_entity = Project(request, project_id)\nreturn rollup_entity",
"db_store = request.getfixturevalue('tiny_db_s... | <|body_start_0|>
if parent_type == 'task':
parent_id = RollupFactory.get_parent_id(request, parent_type, task_id)
rollup_entity = Scope(request, parent_id, project_id)
elif parent_type == 'project':
rollup_entity = Project(request, project_id)
return rollup_en... | RollupFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RollupFactory:
def get_rollup_entity(request, parent_type, task_id, project_id):
"""This method is used to create the object based on the parent_type :param request: :param parent_type: :param task_id: :param project_id: :return:"""
<|body_0|>
def get_parent_id(request, pare... | stack_v2_sparse_classes_75kplus_train_007657 | 1,761 | no_license | [
{
"docstring": "This method is used to create the object based on the parent_type :param request: :param parent_type: :param task_id: :param project_id: :return:",
"name": "get_rollup_entity",
"signature": "def get_rollup_entity(request, parent_type, task_id, project_id)"
},
{
"docstring": "Get ... | 2 | stack_v2_sparse_classes_30k_val_000730 | Implement the Python class `RollupFactory` described below.
Class description:
Implement the RollupFactory class.
Method signatures and docstrings:
- def get_rollup_entity(request, parent_type, task_id, project_id): This method is used to create the object based on the parent_type :param request: :param parent_type: ... | Implement the Python class `RollupFactory` described below.
Class description:
Implement the RollupFactory class.
Method signatures and docstrings:
- def get_rollup_entity(request, parent_type, task_id, project_id): This method is used to create the object based on the parent_type :param request: :param parent_type: ... | ee6b7f7844079e94801c19a1dd80921e1741e58e | <|skeleton|>
class RollupFactory:
def get_rollup_entity(request, parent_type, task_id, project_id):
"""This method is used to create the object based on the parent_type :param request: :param parent_type: :param task_id: :param project_id: :return:"""
<|body_0|>
def get_parent_id(request, pare... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RollupFactory:
def get_rollup_entity(request, parent_type, task_id, project_id):
"""This method is used to create the object based on the parent_type :param request: :param parent_type: :param task_id: :param project_id: :return:"""
if parent_type == 'task':
parent_id = RollupFacto... | the_stack_v2_python_sparse | AST_GraphDB/study/autobots/entities/rollups/rollupfactory.py | git4rajesh/python-learnings | train | 0 | |
e336cb00e430531d6fa8ac14b154fab498aad6db | [
"self.log = log.Log().log_print()\nself.log.info('初始化Recorder类')\nself.str_fun_name = str_fun_name",
"if hasattr(self, self.str_fun_name):\n fun_obj = getattr(self, self.str_fun_name)\n return fun_obj(str_file_name, tuple_items, list_all)\nelse:\n self.log.info('没有记录方法')\n return {'status': 1, 'status... | <|body_start_0|>
self.log = log.Log().log_print()
self.log.info('初始化Recorder类')
self.str_fun_name = str_fun_name
<|end_body_0|>
<|body_start_1|>
if hasattr(self, self.str_fun_name):
fun_obj = getattr(self, self.str_fun_name)
return fun_obj(str_file_name, tuple_it... | 记录类 | Recorder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recorder:
"""记录类"""
def __init__(self, str_fun_name: str='record_csv'):
"""【初始化】"""
<|body_0|>
def __call__(self, str_file_name: str, tuple_items: tuple, list_all: list):
"""【回调函数】 str_file_name:文件名 tuple_items:字段 list_all:数据"""
<|body_1|>
def record... | stack_v2_sparse_classes_75kplus_train_007658 | 8,214 | no_license | [
{
"docstring": "【初始化】",
"name": "__init__",
"signature": "def __init__(self, str_fun_name: str='record_csv')"
},
{
"docstring": "【回调函数】 str_file_name:文件名 tuple_items:字段 list_all:数据",
"name": "__call__",
"signature": "def __call__(self, str_file_name: str, tuple_items: tuple, list_all: li... | 3 | null | Implement the Python class `Recorder` described below.
Class description:
记录类
Method signatures and docstrings:
- def __init__(self, str_fun_name: str='record_csv'): 【初始化】
- def __call__(self, str_file_name: str, tuple_items: tuple, list_all: list): 【回调函数】 str_file_name:文件名 tuple_items:字段 list_all:数据
- def record_csv... | Implement the Python class `Recorder` described below.
Class description:
记录类
Method signatures and docstrings:
- def __init__(self, str_fun_name: str='record_csv'): 【初始化】
- def __call__(self, str_file_name: str, tuple_items: tuple, list_all: list): 【回调函数】 str_file_name:文件名 tuple_items:字段 list_all:数据
- def record_csv... | bd7152899dcb04aa76ed9f65b36e6a8ccc0affd0 | <|skeleton|>
class Recorder:
"""记录类"""
def __init__(self, str_fun_name: str='record_csv'):
"""【初始化】"""
<|body_0|>
def __call__(self, str_file_name: str, tuple_items: tuple, list_all: list):
"""【回调函数】 str_file_name:文件名 tuple_items:字段 list_all:数据"""
<|body_1|>
def record... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Recorder:
"""记录类"""
def __init__(self, str_fun_name: str='record_csv'):
"""【初始化】"""
self.log = log.Log().log_print()
self.log.info('初始化Recorder类')
self.str_fun_name = str_fun_name
def __call__(self, str_file_name: str, tuple_items: tuple, list_all: list):
"""【... | the_stack_v2_python_sparse | part03/week03/crawler.py | tea8336/test | train | 0 |
f1c2ca9e9566d40fe18ede187fe45845112b78b3 | [
"self.decor_list = pygame.sprite.Group()\nself.platform_list = pygame.sprite.Group()\nself.enemy_list = pygame.sprite.Group()\nself.exit = pygame.sprite.Group()\nself.obstacles_list = pygame.sprite.Group()\nself.player = player\nself.start = []",
"self.decor_list.update()\nself.platform_list.update()\nself.obstac... | <|body_start_0|>
self.decor_list = pygame.sprite.Group()
self.platform_list = pygame.sprite.Group()
self.enemy_list = pygame.sprite.Group()
self.exit = pygame.sprite.Group()
self.obstacles_list = pygame.sprite.Group()
self.player = player
self.start = []
<|end_bod... | This is a generic super-class used to define a level. Create a child class for each level witj level-specific info. | Level | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Level:
"""This is a generic super-class used to define a level. Create a child class for each level witj level-specific info."""
def __init__(self, player):
"""Pass in a handle to player. Needed for when collide with player"""
<|body_0|>
def update(self, dt):
"""... | stack_v2_sparse_classes_75kplus_train_007659 | 6,769 | no_license | [
{
"docstring": "Pass in a handle to player. Needed for when collide with player",
"name": "__init__",
"signature": "def __init__(self, player)"
},
{
"docstring": "update everything on this level",
"name": "update",
"signature": "def update(self, dt)"
},
{
"docstring": "draw every... | 4 | stack_v2_sparse_classes_30k_train_012295 | Implement the Python class `Level` described below.
Class description:
This is a generic super-class used to define a level. Create a child class for each level witj level-specific info.
Method signatures and docstrings:
- def __init__(self, player): Pass in a handle to player. Needed for when collide with player
- d... | Implement the Python class `Level` described below.
Class description:
This is a generic super-class used to define a level. Create a child class for each level witj level-specific info.
Method signatures and docstrings:
- def __init__(self, player): Pass in a handle to player. Needed for when collide with player
- d... | a723a0bd26dc9b749a7913f41ff5fec0ceee8af0 | <|skeleton|>
class Level:
"""This is a generic super-class used to define a level. Create a child class for each level witj level-specific info."""
def __init__(self, player):
"""Pass in a handle to player. Needed for when collide with player"""
<|body_0|>
def update(self, dt):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Level:
"""This is a generic super-class used to define a level. Create a child class for each level witj level-specific info."""
def __init__(self, player):
"""Pass in a handle to player. Needed for when collide with player"""
self.decor_list = pygame.sprite.Group()
self.platform_... | the_stack_v2_python_sparse | levels.py | ApyMajul/dynamic-jump-game | train | 0 |
559dd9712697555b4f2cab101836dde80c9c6de8 | [
"dag = DAG()\ndag.Add(1, [2, 3, 4, 5])\ndag.Add(3, [4, 5])\ndag.Add(5, [])\ndag.Add(2, [3, 4, 5])\ndag.Add(4, [5])\nself.assertEqual(5, len(dag))\nl = list(dag)\nself.assertEqual(l, [5, 4, 3, 2, 1])",
"dag = DAG()\ndag.Add(1, [2, 3, 4, 5])\ndag.Add(3, [4, 5])\ndag.Add(5, [1])\ndag.Add(2, [3, 4, 5])\ndag.Add(4, [5... | <|body_start_0|>
dag = DAG()
dag.Add(1, [2, 3, 4, 5])
dag.Add(3, [4, 5])
dag.Add(5, [])
dag.Add(2, [3, 4, 5])
dag.Add(4, [5])
self.assertEqual(5, len(dag))
l = list(dag)
self.assertEqual(l, [5, 4, 3, 2, 1])
<|end_body_0|>
<|body_start_1|>
... | Test the DAG | TestDAG | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDAG:
"""Test the DAG"""
def testDAG(self):
"""Basic test - this should work"""
<|body_0|>
def testCircularDependency(self):
"""Circular dependency test, should fail"""
<|body_1|>
def testMissingDependency(self):
"""Missing dependency test... | stack_v2_sparse_classes_75kplus_train_007660 | 5,069 | no_license | [
{
"docstring": "Basic test - this should work",
"name": "testDAG",
"signature": "def testDAG(self)"
},
{
"docstring": "Circular dependency test, should fail",
"name": "testCircularDependency",
"signature": "def testCircularDependency(self)"
},
{
"docstring": "Missing dependency t... | 4 | stack_v2_sparse_classes_30k_test_002651 | Implement the Python class `TestDAG` described below.
Class description:
Test the DAG
Method signatures and docstrings:
- def testDAG(self): Basic test - this should work
- def testCircularDependency(self): Circular dependency test, should fail
- def testMissingDependency(self): Missing dependency test, should fail
-... | Implement the Python class `TestDAG` described below.
Class description:
Test the DAG
Method signatures and docstrings:
- def testDAG(self): Basic test - this should work
- def testCircularDependency(self): Circular dependency test, should fail
- def testMissingDependency(self): Missing dependency test, should fail
-... | c7389961bee3d8e5088c8c3c8c4bb7e273e4ec50 | <|skeleton|>
class TestDAG:
"""Test the DAG"""
def testDAG(self):
"""Basic test - this should work"""
<|body_0|>
def testCircularDependency(self):
"""Circular dependency test, should fail"""
<|body_1|>
def testMissingDependency(self):
"""Missing dependency test... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDAG:
"""Test the DAG"""
def testDAG(self):
"""Basic test - this should work"""
dag = DAG()
dag.Add(1, [2, 3, 4, 5])
dag.Add(3, [4, 5])
dag.Add(5, [])
dag.Add(2, [3, 4, 5])
dag.Add(4, [5])
self.assertEqual(5, len(dag))
l = list(da... | the_stack_v2_python_sparse | csbuild/_utils/dag.py | SleepingCatGames/csbuild2 | train | 1 |
1669ba68efc357eeef2ca2abcbf17646ebec81df | [
"super(Encoder, self).__init__()\nself.rnn_type = rnn_type\nrnn = getattr(nn, rnn_type)\nself.src_embedding = nn.Embedding(num_embeddings=vocab_size, embedding_dim=embedding_dim)\nself.encoder = rnn(input_size=embedding_dim, hidden_size=hidden_dim, num_layers=num_layers, batch_first=True, bidirectional=True)",
"i... | <|body_start_0|>
super(Encoder, self).__init__()
self.rnn_type = rnn_type
rnn = getattr(nn, rnn_type)
self.src_embedding = nn.Embedding(num_embeddings=vocab_size, embedding_dim=embedding_dim)
self.encoder = rnn(input_size=embedding_dim, hidden_size=hidden_dim, num_layers=num_laye... | GenSen Encoder. Original source in https://github.com/Maluuba/gensen | Encoder | [
"MIT",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""GenSen Encoder. Original source in https://github.com/Maluuba/gensen"""
def __init__(self, vocab_size, embedding_dim, hidden_dim, num_layers, rnn_type='GRU'):
"""Initialize all the parameters. Args: vocab_size (int): Size of the vocabulary. embedding_dim (int): the size o... | stack_v2_sparse_classes_75kplus_train_007661 | 14,854 | permissive | [
{
"docstring": "Initialize all the parameters. Args: vocab_size (int): Size of the vocabulary. embedding_dim (int): the size of each embedding vector hidden_dim (int): the size of each hidden vector num_layers (int): the number of layers. rnn_type (str): Type of RNN.",
"name": "__init__",
"signature": "... | 3 | null | Implement the Python class `Encoder` described below.
Class description:
GenSen Encoder. Original source in https://github.com/Maluuba/gensen
Method signatures and docstrings:
- def __init__(self, vocab_size, embedding_dim, hidden_dim, num_layers, rnn_type='GRU'): Initialize all the parameters. Args: vocab_size (int)... | Implement the Python class `Encoder` described below.
Class description:
GenSen Encoder. Original source in https://github.com/Maluuba/gensen
Method signatures and docstrings:
- def __init__(self, vocab_size, embedding_dim, hidden_dim, num_layers, rnn_type='GRU'): Initialize all the parameters. Args: vocab_size (int)... | f5c40c3199552f6824e1aa6db10905acc1bf6d60 | <|skeleton|>
class Encoder:
"""GenSen Encoder. Original source in https://github.com/Maluuba/gensen"""
def __init__(self, vocab_size, embedding_dim, hidden_dim, num_layers, rnn_type='GRU'):
"""Initialize all the parameters. Args: vocab_size (int): Size of the vocabulary. embedding_dim (int): the size o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""GenSen Encoder. Original source in https://github.com/Maluuba/gensen"""
def __init__(self, vocab_size, embedding_dim, hidden_dim, num_layers, rnn_type='GRU'):
"""Initialize all the parameters. Args: vocab_size (int): Size of the vocabulary. embedding_dim (int): the size of each embedd... | the_stack_v2_python_sparse | utils_nlp/models/gensen/gensen.py | pemukl/german-bertabs | train | 1 |
63e017a41e045edd766ceae9825f7a09498084b8 | [
"super().__init__()\nself.layer_norm1 = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads=num_heads, size=size, dropout=dropout)\nself.layer_norm2 = nn.LayerNorm(size, eps=1e-06)\nself.feed_forward = PositionwiseFeedForward(input_size=size, ff_size=ff_size, dropout=dropout)\nself.drop... | <|body_start_0|>
super().__init__()
self.layer_norm1 = nn.LayerNorm(size, eps=1e-06)
self.src_src_att = MultiHeadedAttention(num_heads=num_heads, size=size, dropout=dropout)
self.layer_norm2 = nn.LayerNorm(size, eps=1e-06)
self.feed_forward = PositionwiseFeedForward(input_size=si... | One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. | TransformerEncoderLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1):
"""A single Transformer layer."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_007662 | 4,681 | permissive | [
{
"docstring": "A single Transformer layer.",
"name": "__init__",
"signature": "def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1)"
},
{
"docstring": "Forward pass for a single transformer encoder layer. First applies layer norm, then self attention, then dropo... | 2 | stack_v2_sparse_classes_30k_train_015521 | Implement the Python class `TransformerEncoderLayer` described below.
Class description:
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
Method signatures and docstrings:
- def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ... | Implement the Python class `TransformerEncoderLayer` described below.
Class description:
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
Method signatures and docstrings:
- def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ... | b9d1cd1038a9e9d3ba378eb2d1efaefbdbfba800 | <|skeleton|>
class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1):
"""A single Transformer layer."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1):
"""A single Transformer layer."""
super().__init__()
self.l... | the_stack_v2_python_sparse | src/module/transformer_layer.py | wangqi1996/joeynmt_test | train | 0 |
09410fa5ab3f2856aa16a88991f8c8a377fe5668 | [
"response = self.client.get(reverse('team#record', args=['00FF']))\nself.assertEqual(response.status_code, 404)\nself.assertEqual(json.loads(response.content.decode('utf8')), {'status': 'unknown team', 'command': 'get_team_record', 'result': []})",
"Team.objects.create(name='Atreides', location='Arakis', score=42... | <|body_start_0|>
response = self.client.get(reverse('team#record', args=['00FF']))
self.assertEqual(response.status_code, 404)
self.assertEqual(json.loads(response.content.decode('utf8')), {'status': 'unknown team', 'command': 'get_team_record', 'result': []})
<|end_body_0|>
<|body_start_1|>
... | Test the team record view | TeamRecordViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamRecordViewTests:
"""Test the team record view"""
def test_no_team(self):
"""The view must return a 404 for all teams when no team is registered"""
<|body_0|>
def test_unknown_team(self):
"""The view must return a 404 when the team doesn't exist"""
<|b... | stack_v2_sparse_classes_75kplus_train_007663 | 25,854 | no_license | [
{
"docstring": "The view must return a 404 for all teams when no team is registered",
"name": "test_no_team",
"signature": "def test_no_team(self)"
},
{
"docstring": "The view must return a 404 when the team doesn't exist",
"name": "test_unknown_team",
"signature": "def test_unknown_team... | 4 | stack_v2_sparse_classes_30k_train_013998 | Implement the Python class `TeamRecordViewTests` described below.
Class description:
Test the team record view
Method signatures and docstrings:
- def test_no_team(self): The view must return a 404 for all teams when no team is registered
- def test_unknown_team(self): The view must return a 404 when the team doesn't... | Implement the Python class `TeamRecordViewTests` described below.
Class description:
Test the team record view
Method signatures and docstrings:
- def test_no_team(self): The view must return a 404 for all teams when no team is registered
- def test_unknown_team(self): The view must return a 404 when the team doesn't... | f30d97f5091bfc0f109a4f6db837a4dad677500e | <|skeleton|>
class TeamRecordViewTests:
"""Test the team record view"""
def test_no_team(self):
"""The view must return a 404 for all teams when no team is registered"""
<|body_0|>
def test_unknown_team(self):
"""The view must return a 404 when the team doesn't exist"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeamRecordViewTests:
"""Test the team record view"""
def test_no_team(self):
"""The view must return a 404 for all teams when no team is registered"""
response = self.client.get(reverse('team#record', args=['00FF']))
self.assertEqual(response.status_code, 404)
self.assertE... | the_stack_v2_python_sparse | serverside/Urbs/UrbsFrontend/tests.py | haum/24hc17 | train | 0 |
b519cdf899c66cc96a479da8e8bc0e79469a282c | [
"super(ContainerProjectHandle, self).__init__(viztrail=viztrail, datastore=datastore, filestore=filestore)\nself.container_api = container_api\nself.port = port\nself.container_id = container_id\nself.urls = ContainerApiUrlFactory(base_url=self.container_api)",
"url = self.urls.cancel_exec(task_id)\nr = requests.... | <|body_start_0|>
super(ContainerProjectHandle, self).__init__(viztrail=viztrail, datastore=datastore, filestore=filestore)
self.container_api = container_api
self.port = port
self.container_id = container_id
self.urls = ContainerApiUrlFactory(base_url=self.container_api)
<|end_bo... | Extend the default project handle with a reference to the base url of the project container API. | ContainerProjectHandle | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerProjectHandle:
"""Extend the default project handle with a reference to the base url of the project container API."""
def __init__(self, viztrail: ViztrailHandle, container_api: str, port: int, container_id: str, datastore: Datastore, filestore: Filestore):
"""Initialize the... | stack_v2_sparse_classes_75kplus_train_007664 | 12,932 | permissive | [
{
"docstring": "Initialize the project viztrail and the container API url. Parameters ---------- viztrail: vizier.viztrail.base.ViztrailHandle The viztrail handle for the project container_api: string Base url for the project container API port: int Local port of the container API container_id: string Unique co... | 3 | stack_v2_sparse_classes_30k_train_009968 | Implement the Python class `ContainerProjectHandle` described below.
Class description:
Extend the default project handle with a reference to the base url of the project container API.
Method signatures and docstrings:
- def __init__(self, viztrail: ViztrailHandle, container_api: str, port: int, container_id: str, da... | Implement the Python class `ContainerProjectHandle` described below.
Class description:
Extend the default project handle with a reference to the base url of the project container API.
Method signatures and docstrings:
- def __init__(self, viztrail: ViztrailHandle, container_api: str, port: int, container_id: str, da... | e99f43df3df80ad5647f57d805c339257336ac73 | <|skeleton|>
class ContainerProjectHandle:
"""Extend the default project handle with a reference to the base url of the project container API."""
def __init__(self, viztrail: ViztrailHandle, container_api: str, port: int, container_id: str, datastore: Datastore, filestore: Filestore):
"""Initialize the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContainerProjectHandle:
"""Extend the default project handle with a reference to the base url of the project container API."""
def __init__(self, viztrail: ViztrailHandle, container_api: str, port: int, container_id: str, datastore: Datastore, filestore: Filestore):
"""Initialize the project vizt... | the_stack_v2_python_sparse | vizier/engine/project/cache/container.py | VizierDB/web-api-async | train | 2 |
a3308a6ab9c783900787526e6fc3265236bd79d0 | [
"self.fluorescein_species = fluorescein.species[0]\nself.fluorescein_concentration = fluorescein.concentration[0]\nself.fluor_electrolyte_species = fluorescein.species[1]\nself.fluor_electrolyte_concentration = fluorescein.concentration[1]\nsuper(BpeIceoFluoroQuenchDataset, self).__init__(**kwargs)",
"if np.all(s... | <|body_start_0|>
self.fluorescein_species = fluorescein.species[0]
self.fluorescein_concentration = fluorescein.concentration[0]
self.fluor_electrolyte_species = fluorescein.species[1]
self.fluor_electrolyte_concentration = fluorescein.concentration[1]
super(BpeIceoFluoroQuenchDa... | Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate | BpeIceoFluoroQuenchDataset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BpeIceoFluoroQuenchDataset:
"""Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate"""
def __init__(self, fluorescein, test_collection, **kwargs):
"""Args: fl... | stack_v2_sparse_classes_75kplus_train_007665 | 1,789 | permissive | [
{
"docstring": "Args: fluorescein (material liquid class): class with material information on the fluorescein/electrolyte. NOTES: this material liquid class should contain a list for species and concentration: species (list): ['fluorescein species name', 'electrolyte species name'] concentration (list): [conc. ... | 2 | stack_v2_sparse_classes_30k_train_003634 | Implement the Python class `BpeIceoFluoroQuenchDataset` described below.
Class description:
Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate
Method signatures and docstrings:
- def __init_... | Implement the Python class `BpeIceoFluoroQuenchDataset` described below.
Class description:
Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate
Method signatures and docstrings:
- def __init_... | 21c96c1bb1ba2548c4d5bebb389eb66ff58f851d | <|skeleton|>
class BpeIceoFluoroQuenchDataset:
"""Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate"""
def __init__(self, fluorescein, test_collection, **kwargs):
"""Args: fl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BpeIceoFluoroQuenchDataset:
"""Base class for all standard datasets for BPE-ICEO experiments... that employ fluorescein quenching to observe the BPE charging/discharging dynamics and the Faradaic reaction rate"""
def __init__(self, fluorescein, test_collection, **kwargs):
"""Args: fluorescein (ma... | the_stack_v2_python_sparse | curlypiv/datasets/bpe_iceo_fluoroquench_dataset.py | sean-mackenzie/curlypiv | train | 0 |
1ca63ad43b40cf7cde85bc1e26fb8a38c12bc5aa | [
"if not persno:\n from cdb import auth\n persno = auth.persno\nif not Subscription.ByKeys(object_id, persno):\n fields = clss.MakeChangeControlAttributes()\n fields['channel_cdb_object_id'] = object_id\n fields['personalnummer'] = persno\n Subscription.Create(**fields)",
"if not persno:\n fro... | <|body_start_0|>
if not persno:
from cdb import auth
persno = auth.persno
if not Subscription.ByKeys(object_id, persno):
fields = clss.MakeChangeControlAttributes()
fields['channel_cdb_object_id'] = object_id
fields['personalnummer'] = persno
... | Subscription | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subscription:
def subscribeToChannel(clss, object_id, persno=''):
"""Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``None``. If not the entry will be generated."""
<|body_0|>
def unsubscribeFromChannel(clss... | stack_v2_sparse_classes_75kplus_train_007666 | 19,136 | no_license | [
{
"docstring": "Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``None``. If not the entry will be generated.",
"name": "subscribeToChannel",
"signature": "def subscribeToChannel(clss, object_id, persno='')"
},
{
"docstring": "Ch... | 3 | stack_v2_sparse_classes_30k_train_030106 | Implement the Python class `Subscription` described below.
Class description:
Implement the Subscription class.
Method signatures and docstrings:
- def subscribeToChannel(clss, object_id, persno=''): Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``N... | Implement the Python class `Subscription` described below.
Class description:
Implement the Subscription class.
Method signatures and docstrings:
- def subscribeToChannel(clss, object_id, persno=''): Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``N... | 6bc932c67bc8d93b873838ae6d9fb8d33c72234d | <|skeleton|>
class Subscription:
def subscribeToChannel(clss, object_id, persno=''):
"""Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``None``. If not the entry will be generated."""
<|body_0|>
def unsubscribeFromChannel(clss... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Subscription:
def subscribeToChannel(clss, object_id, persno=''):
"""Checks whether there is a subscription entry for the user identified by `persno` or the active user if `persno` is ``None``. If not the entry will be generated."""
if not persno:
from cdb import auth
p... | the_stack_v2_python_sparse | site-packages/cs.activitystream-15.3.1.4-py2.7.egg/cs/activitystream/objects.py | prachipainuly-rbei/devops-poc | train | 0 | |
9c0c3cb5a7fdd3bcaac58b9ab95a1e9bcb35406f | [
"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. | GCSSecretServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GCSSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getGCSSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createGCSSecret(self, request, context):
"""Missing as... | stack_v2_sparse_classes_75kplus_train_007667 | 7,947 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getGCSSecret",
"signature": "def getGCSSecret(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "createGCSSecret",
"signature": "def createGCSS... | 4 | stack_v2_sparse_classes_30k_train_015005 | Implement the Python class `GCSSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getGCSSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createGCSSecret(self, request,... | Implement the Python class `GCSSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getGCSSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createGCSSecret(self, request,... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class GCSSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getGCSSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createGCSSecret(self, request, context):
"""Missing as... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GCSSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getGCSSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not impleme... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/gcs/GCSSecretService_pb2_grpc.py | apache/airavata-mft | train | 23 |
f9c5d5379db4ae514ea1f2ae3e60001c51a6d01b | [
"self.kubeconfig = kubeconfig\nself.name = sname\nself.namespace = namespace\nself.secrets = secrets\nself.data = {}\nself.create_dict()",
"self.data['apiVersion'] = 'v1'\nself.data['kind'] = 'Secret'\nself.data['metadata'] = {}\nself.data['metadata']['name'] = self.name\nself.data['metadata']['namespace'] = self... | <|body_start_0|>
self.kubeconfig = kubeconfig
self.name = sname
self.namespace = namespace
self.secrets = secrets
self.data = {}
self.create_dict()
<|end_body_0|>
<|body_start_1|>
self.data['apiVersion'] = 'v1'
self.data['kind'] = 'Secret'
self.da... | Handle secret options | SecretConfig | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
<|body_0|>
def create_dict(self):
"""return a secret as a dict"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_007668 | 2,639 | permissive | [
{
"docstring": "constructor for handling secret options",
"name": "__init__",
"signature": "def __init__(self, sname, namespace, kubeconfig, secrets=None)"
},
{
"docstring": "return a secret as a dict",
"name": "create_dict",
"signature": "def create_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_039340 | Implement the Python class `SecretConfig` described below.
Class description:
Handle secret options
Method signatures and docstrings:
- def __init__(self, sname, namespace, kubeconfig, secrets=None): constructor for handling secret options
- def create_dict(self): return a secret as a dict | Implement the Python class `SecretConfig` described below.
Class description:
Handle secret options
Method signatures and docstrings:
- def __init__(self, sname, namespace, kubeconfig, secrets=None): constructor for handling secret options
- def create_dict(self): return a secret as a dict
<|skeleton|>
class SecretC... | e342f6659a4ef1a188ff403e2fc6b06ac6d119c7 | <|skeleton|>
class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
<|body_0|>
def create_dict(self):
"""return a secret as a dict"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
self.kubeconfig = kubeconfig
self.name = sname
self.namespace = namespace
self.secrets = secrets
self.dat... | the_stack_v2_python_sparse | ansible/roles/lib_openshift_3.2/build/lib/secret.py | openshift/openshift-tools | train | 170 |
184ca1af478e04eb96c464eb6a75c6e7e95120f0 | [
"response = 'Mensagem recebida'\npost = request.jsonrequest\nif post.get('message', False) and post.get('from', False):\n params_sms_id = {'body': post.get('message'), 'number': helpers.sanitize_mobile(post.get('from')), 'message_type': 'sms', 'message_id': post.get('id'), 'state': 'received', 'direction_type': ... | <|body_start_0|>
response = 'Mensagem recebida'
post = request.jsonrequest
if post.get('message', False) and post.get('from', False):
params_sms_id = {'body': post.get('message'), 'number': helpers.sanitize_mobile(post.get('from')), 'message_type': 'sms', 'message_id': post.get('id')... | SmsDEVWebhooks | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmsDEVWebhooks:
def smsdev_input(self, **post):
"""Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { "from": "5562988887777", // Número que enviou o retorno "id": "123456789", // ID do retorno "id_sent": "637849052", // ID da m... | stack_v2_sparse_classes_75kplus_train_007669 | 3,533 | no_license | [
{
"docstring": "Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { \"from\": \"5562988887777\", // Número que enviou o retorno \"id\": \"123456789\", // ID do retorno \"id_sent\": \"637849052\", // ID da mensagem enviada \"message\": \"Teste de retorno... | 2 | stack_v2_sparse_classes_30k_train_002516 | Implement the Python class `SmsDEVWebhooks` described below.
Class description:
Implement the SmsDEVWebhooks class.
Method signatures and docstrings:
- def smsdev_input(self, **post): Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { "from": "5562988887777"... | Implement the Python class `SmsDEVWebhooks` described below.
Class description:
Implement the SmsDEVWebhooks class.
Method signatures and docstrings:
- def smsdev_input(self, **post): Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { "from": "5562988887777"... | 68019d063765508e8de00466f2dd5909a9d0b304 | <|skeleton|>
class SmsDEVWebhooks:
def smsdev_input(self, **post):
"""Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { "from": "5562988887777", // Número que enviou o retorno "id": "123456789", // ID do retorno "id_sent": "637849052", // ID da m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SmsDEVWebhooks:
def smsdev_input(self, **post):
"""Webhoock para receber mensagens do SmsDev https://painel.smsdev.com.br/integracao/callback POST from smsdev: { "from": "5562988887777", // Número que enviou o retorno "id": "123456789", // ID do retorno "id_sent": "637849052", // ID da mensagem enviad... | the_stack_v2_python_sparse | sms_dev/controllers/sms_api_input.py | marcelsavegnago/social | train | 0 | |
7bbe54736cfa713b18a953dd3302500bf6faf161 | [
"n = len(nums)\nf, g = ([0] * n, [0] * n)\nf[0], g[0] = (nums[0], nums[0])\nfor i in range(1, n):\n f[i] = max(max(f[i - 1] * nums[i], g[i - 1] * nums[i]), nums[i])\n g[i] = min(min(f[i - 1] * nums[i], g[i - 1] * nums[i]), nums[i])\nreturn max(f)",
"m = 1\nres = nums[0]\nfor i in nums:\n m *= i\n if r... | <|body_start_0|>
n = len(nums)
f, g = ([0] * n, [0] * n)
f[0], g[0] = (nums[0], nums[0])
for i in range(1, n):
f[i] = max(max(f[i - 1] * nums[i], g[i - 1] * nums[i]), nums[i])
g[i] = min(min(f[i - 1] * nums[i], g[i - 1] * nums[i]), nums[i])
return max(f)
<... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProduct(self, nums):
"""动态规划 :param nums: :return:"""
<|body_0|>
def maxProduct2(self, nums):
"""暴力解法 求最大值,可以看成求被0拆分的各个子数组的最大值。 当一个数组中没有0存在,则分为两种情况: 1.负数为偶数个,则整个数组的各个值相乘为最大值; 2.负数为奇数个,则从左边开始,乘到最后一个负数停止有一个“最大值”,从右边也有一个“最大值”,比较,得出最大值。 :param nums: :ret... | stack_v2_sparse_classes_75kplus_train_007670 | 3,279 | no_license | [
{
"docstring": "动态规划 :param nums: :return:",
"name": "maxProduct",
"signature": "def maxProduct(self, nums)"
},
{
"docstring": "暴力解法 求最大值,可以看成求被0拆分的各个子数组的最大值。 当一个数组中没有0存在,则分为两种情况: 1.负数为偶数个,则整个数组的各个值相乘为最大值; 2.负数为奇数个,则从左边开始,乘到最后一个负数停止有一个“最大值”,从右边也有一个“最大值”,比较,得出最大值。 :param nums: :return:",
"nam... | 2 | stack_v2_sparse_classes_30k_train_051565 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, nums): 动态规划 :param nums: :return:
- def maxProduct2(self, nums): 暴力解法 求最大值,可以看成求被0拆分的各个子数组的最大值。 当一个数组中没有0存在,则分为两种情况: 1.负数为偶数个,则整个数组的各个值相乘为最大值; 2.负数为奇数个,则从左边开... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, nums): 动态规划 :param nums: :return:
- def maxProduct2(self, nums): 暴力解法 求最大值,可以看成求被0拆分的各个子数组的最大值。 当一个数组中没有0存在,则分为两种情况: 1.负数为偶数个,则整个数组的各个值相乘为最大值; 2.负数为奇数个,则从左边开... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def maxProduct(self, nums):
"""动态规划 :param nums: :return:"""
<|body_0|>
def maxProduct2(self, nums):
"""暴力解法 求最大值,可以看成求被0拆分的各个子数组的最大值。 当一个数组中没有0存在,则分为两种情况: 1.负数为偶数个,则整个数组的各个值相乘为最大值; 2.负数为奇数个,则从左边开始,乘到最后一个负数停止有一个“最大值”,从右边也有一个“最大值”,比较,得出最大值。 :param nums: :ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProduct(self, nums):
"""动态规划 :param nums: :return:"""
n = len(nums)
f, g = ([0] * n, [0] * n)
f[0], g[0] = (nums[0], nums[0])
for i in range(1, n):
f[i] = max(max(f[i - 1] * nums[i], g[i - 1] * nums[i]), nums[i])
g[i] = min(min(f... | the_stack_v2_python_sparse | 152_乘积最大子序列.py | lovehhf/LeetCode | train | 0 | |
494967e79f0a9fa3e6333dfe2d57f191ece3b6e5 | [
"AxisFormat.__init__(self, 'clustersnew')\nself._axes['energy'] = 0\nself._axes['eta'] = 1\nself._axes['phi'] = 2\nself._axes['vertexz'] = 3\nself._axes['mbtrigger'] = 4",
"newobj = AxisFormatClustersNew()\nnewobj._Deepcopy(self, memo)\nreturn newobj",
"newobj = AxisFormatClustersNew()\nnewobj._Copy(self)\nretu... | <|body_start_0|>
AxisFormat.__init__(self, 'clustersnew')
self._axes['energy'] = 0
self._axes['eta'] = 1
self._axes['phi'] = 2
self._axes['vertexz'] = 3
self._axes['mbtrigger'] = 4
<|end_body_0|>
<|body_start_1|>
newobj = AxisFormatClustersNew()
newobj._D... | Axis format for new cluster THnSparse | AxisFormatClustersNew | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AxisFormatClustersNew:
"""Axis format for new cluster THnSparse"""
def __init__(self):
"""Constructor"""
<|body_0|>
def __deepcopy__(self, memo):
"""Deep copy constructor"""
<|body_1|>
def __copy__(self, other):
"""Shallow copy constructor"""... | stack_v2_sparse_classes_75kplus_train_007671 | 5,256 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Deep copy constructor",
"name": "__deepcopy__",
"signature": "def __deepcopy__(self, memo)"
},
{
"docstring": "Shallow copy constructor",
"name": "__copy__",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_004356 | Implement the Python class `AxisFormatClustersNew` described below.
Class description:
Axis format for new cluster THnSparse
Method signatures and docstrings:
- def __init__(self): Constructor
- def __deepcopy__(self, memo): Deep copy constructor
- def __copy__(self, other): Shallow copy constructor | Implement the Python class `AxisFormatClustersNew` described below.
Class description:
Axis format for new cluster THnSparse
Method signatures and docstrings:
- def __init__(self): Constructor
- def __deepcopy__(self, memo): Deep copy constructor
- def __copy__(self, other): Shallow copy constructor
<|skeleton|>
cla... | 5df28b2b415e78e81273b0d9bf5c1b99feda3348 | <|skeleton|>
class AxisFormatClustersNew:
"""Axis format for new cluster THnSparse"""
def __init__(self):
"""Constructor"""
<|body_0|>
def __deepcopy__(self, memo):
"""Deep copy constructor"""
<|body_1|>
def __copy__(self, other):
"""Shallow copy constructor"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AxisFormatClustersNew:
"""Axis format for new cluster THnSparse"""
def __init__(self):
"""Constructor"""
AxisFormat.__init__(self, 'clustersnew')
self._axes['energy'] = 0
self._axes['eta'] = 1
self._axes['phi'] = 2
self._axes['vertexz'] = 3
self._ax... | the_stack_v2_python_sparse | PWGJE/EMCALJetTasks/Tracks/analysis/base/struct/ClusterTHnSparse.py | alisw/AliPhysics | train | 129 |
6efcd2c8a7668a08a17cf0debb51c9dc445bdf37 | [
"tempA = headA\ncountA = 1\ncountB = 1\ntempB = headB\nif tempA == None or tempB == None:\n return None\nwhile tempA:\n tempA = tempA.next\n countA += 1\nwhile tempB:\n tempB = tempB.next\n countB += 1\ndiff = countA - countB\ntempA = headA\ntempB = headB\nif diff < 0:\n diff = abs(diff)\n whil... | <|body_start_0|>
tempA = headA
countA = 1
countB = 1
tempB = headB
if tempA == None or tempB == None:
return None
while tempA:
tempA = tempA.next
countA += 1
while tempB:
tempB = tempB.next
countB += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode_better_approach(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_007672 | 1,870 | permissive | [
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA, headB)"
},
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode_better_approach",
"signature": "def ge... | 2 | stack_v2_sparse_classes_30k_train_009702 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode_better_approach(self, headA, headB): :type head1, head1: List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode_better_approach(self, headA, headB): :type head1, head1: List... | 0e4af391274e33a9bb9f999a9032b74d06fc878e | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode_better_approach(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
tempA = headA
countA = 1
countB = 1
tempB = headB
if tempA == None or tempB == None:
return None
while tempA:
tempA = tempA... | the_stack_v2_python_sparse | leetcode/link-list/intersect.py | Gaurav-Pande/DataStructures | train | 6 | |
9465ff91f06e42642b4fa5dcff5e9cde89d29a0b | [
"self.max_rank = max_rank\nself.problems = problems\nself.languages = languages\nself.results = results\nself.acc_result = acc_result",
"content = ''\nscore_tuple = [(score, userid) for userid, score in score_dict.items()]\nscore_tuple.sort()\nscore_tuple.reverse()\nfor score, userid in score_tuple:\n pr_statu... | <|body_start_0|>
self.max_rank = max_rank
self.problems = problems
self.languages = languages
self.results = results
self.acc_result = acc_result
<|end_body_0|>
<|body_start_1|>
content = ''
score_tuple = [(score, userid) for userid, score in score_dict.items()]
... | Generate rankings list Columns: teamname, pr. solved, score | RankingsGen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RankingsGen:
"""Generate rankings list Columns: teamname, pr. solved, score"""
def __init__(self, max_rank, problems, languages, results, acc_result):
"""@param max_rank: Last rank to be denerated @param problems: List of problems (@see profile/) @param languages: Dict of languages (... | stack_v2_sparse_classes_75kplus_train_007673 | 3,763 | no_license | [
{
"docstring": "@param max_rank: Last rank to be denerated @param problems: List of problems (@see profile/) @param languages: Dict of languages (@see profile/) @param results: List of Results (@see profile/) @param acc_result: Index of acc result",
"name": "__init__",
"signature": "def __init__(self, m... | 2 | stack_v2_sparse_classes_30k_train_014175 | Implement the Python class `RankingsGen` described below.
Class description:
Generate rankings list Columns: teamname, pr. solved, score
Method signatures and docstrings:
- def __init__(self, max_rank, problems, languages, results, acc_result): @param max_rank: Last rank to be denerated @param problems: List of probl... | Implement the Python class `RankingsGen` described below.
Class description:
Generate rankings list Columns: teamname, pr. solved, score
Method signatures and docstrings:
- def __init__(self, max_rank, problems, languages, results, acc_result): @param max_rank: Last rank to be denerated @param problems: List of probl... | f9b426ebb76eb7321da691a96db2aedb53c5265c | <|skeleton|>
class RankingsGen:
"""Generate rankings list Columns: teamname, pr. solved, score"""
def __init__(self, max_rank, problems, languages, results, acc_result):
"""@param max_rank: Last rank to be denerated @param problems: List of problems (@see profile/) @param languages: Dict of languages (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RankingsGen:
"""Generate rankings list Columns: teamname, pr. solved, score"""
def __init__(self, max_rank, problems, languages, results, acc_result):
"""@param max_rank: Last rank to be denerated @param problems: List of problems (@see profile/) @param languages: Dict of languages (@see profile/... | the_stack_v2_python_sparse | trunk/lib/codehack/server/scoregen.py | BackupTheBerlios/codehack-svn | train | 0 |
34001651f4c638af91830bc6d4e6c92a7c4e1fe6 | [
"self.lists = [v1, v2]\nself.num_lists = 2\nself.cur_row = None\nself.cur_col = None",
"if self.cur_row is None:\n for row in range(self.num_lists):\n if self.lists[row]:\n self.cur_row = row\n self.cur_col = 0\n break\n return self.lists[self.cur_row][0]\nfor row in ... | <|body_start_0|>
self.lists = [v1, v2]
self.num_lists = 2
self.cur_row = None
self.cur_col = None
<|end_body_0|>
<|body_start_1|>
if self.cur_row is None:
for row in range(self.num_lists):
if self.lists[row]:
self.cur_row = row
... | ZigzagIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus_train_007674 | 1,967 | no_license | [
{
"docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]",
"name": "__init__",
"signature": "def __init__(self, v1, v2)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name"... | 3 | stack_v2_sparse_classes_30k_train_011148 | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | 16468a4397430b24b685cab02570ff3f5849e86f | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
self.lists = [v1, v2]
self.num_lists = 2
self.cur_row = None
self.cur_col = None
def next(self):
""":rtype: int"""
if self... | the_stack_v2_python_sparse | zig-zag-iterator/s1.py | fingerroll/wip | train | 0 | |
c6f26f67e5c8e6a76a4c588d0b02f1922e4a5d5a | [
"super().__init__()\nself.hidden_channels = hidden_channels\nself.forget_bias = forget_bias\npadding = (kernel_size // 2, kernel_size // 2)\nkernel_size = (kernel_size, kernel_size)\nself.conv_d = nn.Conv2d(in_channels=hidden_channels, out_channels=hidden_channels * 4, kernel_size=kernel_size, padding=padding, stri... | <|body_start_0|>
super().__init__()
self.hidden_channels = hidden_channels
self.forget_bias = forget_bias
padding = (kernel_size // 2, kernel_size // 2)
kernel_size = (kernel_size, kernel_size)
self.conv_d = nn.Conv2d(in_channels=hidden_channels, out_channels=hidden_chann... | MIMS | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MIMS:
def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01):
""":param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量"""
<|body_0|>
def forward(self, d: Tensor, c: Tensor, s: Tensor) -> Tuple[Tensor, Tensor]... | stack_v2_sparse_classes_75kplus_train_007675 | 8,526 | permissive | [
{
"docstring": ":param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量",
"name": "__init__",
"signature": "def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01)"
},
{
"docstring": ":param d: 差分信息 :param c: 状态记忆Tensor :param s: MI... | 2 | stack_v2_sparse_classes_30k_train_027196 | Implement the Python class `MIMS` described below.
Class description:
Implement the MIMS class.
Method signatures and docstrings:
- def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01): :param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量
- def for... | Implement the Python class `MIMS` described below.
Class description:
Implement the MIMS class.
Method signatures and docstrings:
- def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01): :param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量
- def for... | d8079d6ceb3a41a06552bb3d88298327d0645d57 | <|skeleton|>
class MIMS:
def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01):
""":param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量"""
<|body_0|>
def forward(self, d: Tensor, c: Tensor, s: Tensor) -> Tuple[Tensor, Tensor]... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MIMS:
def __init__(self, hidden_channels: int, kernel_size: Union[int, tuple], forget_bias: float=0.01):
""":param hidden_channels: 通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量"""
super().__init__()
self.hidden_channels = hidden_channels
self.forget_bias = forget_bias
... | the_stack_v2_python_sparse | study/models/MIM/MIMBlock.py | hechentao/STudy | train | 0 | |
06d5efbdad2f7011677a139c1106724ea880645e | [
"self.actions = None\nupdated_dict = self.get_params_dict()\nif state_dict is not None:\n updated_dict.update(state_dict)\nsuper(StatesModel, self).__init__(state_dict=updated_dict, batch_size=batch_size, **kwargs)",
"params = {'actions': {'dtype': numpy.float32}}\nstate_dict = super(StatesModel, self).get_par... | <|body_start_0|>
self.actions = None
updated_dict = self.get_params_dict()
if state_dict is not None:
updated_dict.update(state_dict)
super(StatesModel, self).__init__(state_dict=updated_dict, batch_size=batch_size, **kwargs)
<|end_body_0|>
<|body_start_1|>
params = ... | Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`. | StatesModel | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatesModel:
"""Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`."""
def __init__(self, batch_size: int, state_dict: Optional[StateDict]=None, **kwargs):
"""Initialise a :class:`StatesM... | stack_v2_sparse_classes_75kplus_train_007676 | 27,459 | permissive | [
{
"docstring": "Initialise a :class:`StatesModel`. Args: batch_size: The number of items in the first dimension of the tensors. state_dict: Dictionary defining the attributes of the tensors. **kwargs: The name-tensor pairs can also be specified as kwargs.",
"name": "__init__",
"signature": "def __init__... | 2 | stack_v2_sparse_classes_30k_train_000628 | Implement the Python class `StatesModel` described below.
Class description:
Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`.
Method signatures and docstrings:
- def __init__(self, batch_size: int, state_dict: Optional... | Implement the Python class `StatesModel` described below.
Class description:
Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`.
Method signatures and docstrings:
- def __init__(self, batch_size: int, state_dict: Optional... | 5e69c50e5b220859d65406d803086406b50a8e78 | <|skeleton|>
class StatesModel:
"""Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`."""
def __init__(self, batch_size: int, state_dict: Optional[StateDict]=None, **kwargs):
"""Initialise a :class:`StatesM... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StatesModel:
"""Keeps track of the data structures used by the :class:`Model`. Attributes: actions: Represents the actions that will be sampled by a :class:`Model`."""
def __init__(self, batch_size: int, state_dict: Optional[StateDict]=None, **kwargs):
"""Initialise a :class:`StatesModel`. Args: ... | the_stack_v2_python_sparse | fragile/core/states.py | sergio-hcsoft/fragile-1 | train | 0 |
a5e9a1d33bf38d1c0b0390ddb21bdcc43d540f3a | [
"self.root = tk.Tk()\nself.root.withdraw()\nself.menu = tk.Menu(self.root)\nself._item_count = 0\nself._clicked_item = None\nself._active = False\nself.menu.bind('<Unmap>', lambda event: self.root.after_idle(self._dismiss_callback))",
"item_count = self._item_count\n\ndef click_callback():\n self._item_callbac... | <|body_start_0|>
self.root = tk.Tk()
self.root.withdraw()
self.menu = tk.Menu(self.root)
self._item_count = 0
self._clicked_item = None
self._active = False
self.menu.bind('<Unmap>', lambda event: self.root.after_idle(self._dismiss_callback))
<|end_body_0|>
<|bod... | The popup-menu. | PopupMenu | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PopupMenu:
"""The popup-menu."""
def __init__(self):
"""Initialize."""
<|body_0|>
def add_menuitem(self, menuitem, callback=None):
"""Add menu items."""
<|body_1|>
def _item_callback(self, which_item):
"""Menu item click callback."""
... | stack_v2_sparse_classes_75kplus_train_007677 | 2,162 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Add menu items.",
"name": "add_menuitem",
"signature": "def add_menuitem(self, menuitem, callback=None)"
},
{
"docstring": "Menu item click callback.",
"name": "_item_callba... | 5 | null | Implement the Python class `PopupMenu` described below.
Class description:
The popup-menu.
Method signatures and docstrings:
- def __init__(self): Initialize.
- def add_menuitem(self, menuitem, callback=None): Add menu items.
- def _item_callback(self, which_item): Menu item click callback.
- def _dismiss_callback(se... | Implement the Python class `PopupMenu` described below.
Class description:
The popup-menu.
Method signatures and docstrings:
- def __init__(self): Initialize.
- def add_menuitem(self, menuitem, callback=None): Add menu items.
- def _item_callback(self, which_item): Menu item click callback.
- def _dismiss_callback(se... | d0619dd7f2c05856bf0eb57b69732659dda824a9 | <|skeleton|>
class PopupMenu:
"""The popup-menu."""
def __init__(self):
"""Initialize."""
<|body_0|>
def add_menuitem(self, menuitem, callback=None):
"""Add menu items."""
<|body_1|>
def _item_callback(self, which_item):
"""Menu item click callback."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PopupMenu:
"""The popup-menu."""
def __init__(self):
"""Initialize."""
self.root = tk.Tk()
self.root.withdraw()
self.menu = tk.Menu(self.root)
self._item_count = 0
self._clicked_item = None
self._active = False
self.menu.bind('<Unmap>', lamb... | the_stack_v2_python_sparse | bumblebee/popup.py | mkwardakov/bumblebee-status | train | 1 |
8b4df5191bee1968669ef6c5ee63ce0d9fd1c76b | [
"\"\"\"\n if not root: return \"\"\n stack, out = [root], []\n while stack:\n cur = stack.pop()\n out.append(cur.val)\n for child in filter(None, [cur.right, cur.left]):\n stack += [child]\n\n print(out)\n return ' '.join(map(str, ou... | <|body_start_0|>
"""
if not root: return ""
stack, out = [root], []
while stack:
cur = stack.pop()
out.append(cur.val)
for child in filter(None, [cur.right, cur.left]):
stack += [c... | Codec | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
... | stack_v2_sparse_classes_75kplus_train_007678 | 4,562 | permissive | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_020571 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 4ea4c1579c28308455be4dfa02bd45ebd88b2d0a | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
"""
if not root: return ""
stack, out = [root], []
while stack:
cur = stack.pop()
out.append(cur.val)
... | the_stack_v2_python_sparse | src/trees/deserialize_serialize.py | way2arun/datastructures_algorithms | train | 1 | |
ca2dc9e687e9559d9107e191a8dd2bac447e16e5 | [
"super(Composition2x2, self).__init__(2 * single_w, 2 * single_h)\nself.empty = np.zeros((single_h, single_w, 3), dtype=np.uint8)\nself.single_w = single_w\nself.single_h = single_h\nself.tl = tl\nself.tr = tr\nself.bl = bl\nself.br = br",
"top_left = cv2.resize(self.tl(), (self.single_w, self.single_h)) if self.... | <|body_start_0|>
super(Composition2x2, self).__init__(2 * single_w, 2 * single_h)
self.empty = np.zeros((single_h, single_w, 3), dtype=np.uint8)
self.single_w = single_w
self.single_h = single_h
self.tl = tl
self.tr = tr
self.bl = bl
self.br = br
<|end_bod... | Composition2x2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Composition2x2:
def __init__(self, single_w, single_h, tl=None, tr=None, bl=None, br=None):
"""Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. :param single_h: Height of a step-frame. :param tl: Reference to the function which gets the frame to b... | stack_v2_sparse_classes_75kplus_train_007679 | 1,965 | no_license | [
{
"docstring": "Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. :param single_h: Height of a step-frame. :param tl: Reference to the function which gets the frame to be displayed on top left. :param tr: Reference to the function which gets the frame to be displayed on t... | 2 | stack_v2_sparse_classes_30k_train_025387 | Implement the Python class `Composition2x2` described below.
Class description:
Implement the Composition2x2 class.
Method signatures and docstrings:
- def __init__(self, single_w, single_h, tl=None, tr=None, bl=None, br=None): Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. ... | Implement the Python class `Composition2x2` described below.
Class description:
Implement the Composition2x2 class.
Method signatures and docstrings:
- def __init__(self, single_w, single_h, tl=None, tr=None, bl=None, br=None): Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. ... | 8316bcc43805ba3cdc196b68b14f921f81610337 | <|skeleton|>
class Composition2x2:
def __init__(self, single_w, single_h, tl=None, tr=None, bl=None, br=None):
"""Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. :param single_h: Height of a step-frame. :param tl: Reference to the function which gets the frame to b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Composition2x2:
def __init__(self, single_w, single_h, tl=None, tr=None, bl=None, br=None):
"""Initialize the step with all relevant attributes. :param single_w: Width of a step-frame. :param single_h: Height of a step-frame. :param tl: Reference to the function which gets the frame to be displayed on... | the_stack_v2_python_sparse | video/pipeline/compositions/composition_2x2.py | breitmuuufrosch/OpenCvPipeline | train | 0 | |
9a40e889b16d3c98174f5b764c8f5030660c9176 | [
"try:\n return lang.isalpha()\nexcept:\n return False",
"langs = set([l.lower().title() for l in langs if Language.is_language(l)])\nquery = alchemy_session.query(Language).filter(Language.name.in_(langs))\nlogging.debug(query)\nlang_instances = query.all()\nfor inst in lang_instances:\n langs.remove(ins... | <|body_start_0|>
try:
return lang.isalpha()
except:
return False
<|end_body_0|>
<|body_start_1|>
langs = set([l.lower().title() for l in langs if Language.is_language(l)])
query = alchemy_session.query(Language).filter(Language.name.in_(langs))
logging.de... | Language | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Language:
def is_language(lang):
"""checking language"""
<|body_0|>
def get_languages_from_db(langs, alchemy_session):
"""get SQLAlchemy isinstances from DB"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
return lang.isalpha()
... | stack_v2_sparse_classes_75kplus_train_007680 | 2,157 | no_license | [
{
"docstring": "checking language",
"name": "is_language",
"signature": "def is_language(lang)"
},
{
"docstring": "get SQLAlchemy isinstances from DB",
"name": "get_languages_from_db",
"signature": "def get_languages_from_db(langs, alchemy_session)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019130 | Implement the Python class `Language` described below.
Class description:
Implement the Language class.
Method signatures and docstrings:
- def is_language(lang): checking language
- def get_languages_from_db(langs, alchemy_session): get SQLAlchemy isinstances from DB | Implement the Python class `Language` described below.
Class description:
Implement the Language class.
Method signatures and docstrings:
- def is_language(lang): checking language
- def get_languages_from_db(langs, alchemy_session): get SQLAlchemy isinstances from DB
<|skeleton|>
class Language:
def is_languag... | 0eab54eb283e7434734b9fbeabd7d3ba249772af | <|skeleton|>
class Language:
def is_language(lang):
"""checking language"""
<|body_0|>
def get_languages_from_db(langs, alchemy_session):
"""get SQLAlchemy isinstances from DB"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Language:
def is_language(lang):
"""checking language"""
try:
return lang.isalpha()
except:
return False
def get_languages_from_db(langs, alchemy_session):
"""get SQLAlchemy isinstances from DB"""
langs = set([l.lower().title() for l in lang... | the_stack_v2_python_sparse | backend/main_app/models/language.py | zzzevaka/findchat | train | 0 | |
d84eec4b7091c760721fbbbb4231245e3701cdc5 | [
"info = {}\ninfo['temperature'] = self.get_cpu_temp()\ninfo['loadavg'] = self.get_load_avg()\ninfo['usage'] = self.get_cpu_usage()\nreturn info",
"usage = {}\ntry:\n fields = ('user', 'system', 'idle', 'nice', 'iowait', 'irq', 'softirq', 'steal')\n usage = {key: value for key, value in psutil.cpu_times()._a... | <|body_start_0|>
info = {}
info['temperature'] = self.get_cpu_temp()
info['loadavg'] = self.get_load_avg()
info['usage'] = self.get_cpu_usage()
return info
<|end_body_0|>
<|body_start_1|>
usage = {}
try:
fields = ('user', 'system', 'idle', 'nice', 'io... | Class for retrieving CPU info | CpuInfo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CpuInfo:
"""Class for retrieving CPU info"""
def get_cpu_info():
"""Return CPU temperature, load average and usage info as a dict"""
<|body_0|>
def get_cpu_usage():
"""Return dict with overall CPU usage"""
<|body_1|>
def get_cpu_load(interval=1):
... | stack_v2_sparse_classes_75kplus_train_007681 | 2,945 | permissive | [
{
"docstring": "Return CPU temperature, load average and usage info as a dict",
"name": "get_cpu_info",
"signature": "def get_cpu_info()"
},
{
"docstring": "Return dict with overall CPU usage",
"name": "get_cpu_usage",
"signature": "def get_cpu_usage()"
},
{
"docstring": "Return ... | 5 | stack_v2_sparse_classes_30k_train_033608 | Implement the Python class `CpuInfo` described below.
Class description:
Class for retrieving CPU info
Method signatures and docstrings:
- def get_cpu_info(): Return CPU temperature, load average and usage info as a dict
- def get_cpu_usage(): Return dict with overall CPU usage
- def get_cpu_load(interval=1): Return ... | Implement the Python class `CpuInfo` described below.
Class description:
Class for retrieving CPU info
Method signatures and docstrings:
- def get_cpu_info(): Return CPU temperature, load average and usage info as a dict
- def get_cpu_usage(): Return dict with overall CPU usage
- def get_cpu_load(interval=1): Return ... | 4fa4360d0c05dbbb65bd53cca0ca1014fcd45071 | <|skeleton|>
class CpuInfo:
"""Class for retrieving CPU info"""
def get_cpu_info():
"""Return CPU temperature, load average and usage info as a dict"""
<|body_0|>
def get_cpu_usage():
"""Return dict with overall CPU usage"""
<|body_1|>
def get_cpu_load(interval=1):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CpuInfo:
"""Class for retrieving CPU info"""
def get_cpu_info():
"""Return CPU temperature, load average and usage info as a dict"""
info = {}
info['temperature'] = self.get_cpu_temp()
info['loadavg'] = self.get_load_avg()
info['usage'] = self.get_cpu_usage()
... | the_stack_v2_python_sparse | myDevices/system/cpu.py | myDevicesIoT/Cayenne-Agent | train | 21 |
be500b472b856a6566e8dec8443376432589b3ac | [
"existing_relateduser_emails_set = set(self.model.objects.filter(period=period, user__useremail__email__in=emails).values_list('user__useremail__email', flat=True))\nall_relateduser_emails_set = set(emails)\nnew_relateduser_emails_set = all_relateduser_emails_set.difference(existing_relateduser_emails_set)\ncreated... | <|body_start_0|>
existing_relateduser_emails_set = set(self.model.objects.filter(period=period, user__useremail__email__in=emails).values_list('user__useremail__email', flat=True))
all_relateduser_emails_set = set(emails)
new_relateduser_emails_set = all_relateduser_emails_set.difference(existin... | Base class for the managers for related users. | AbstractRelatedUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbstractRelatedUserManager:
"""Base class for the managers for related users."""
def bulk_create_from_emails(self, period, emails):
"""Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Uses :meth:`devilry.devilry_account.models.UserManager.bulk... | stack_v2_sparse_classes_75kplus_train_007682 | 19,027 | permissive | [
{
"docstring": "Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Uses :meth:`devilry.devilry_account.models.UserManager.bulk_create_from_emails` to create any non-existing users. Raises: devilry_account.exceptions.IllegalOperationError: If the ``CRADMIN_LEGACY_USE_EMAIL_... | 2 | null | Implement the Python class `AbstractRelatedUserManager` described below.
Class description:
Base class for the managers for related users.
Method signatures and docstrings:
- def bulk_create_from_emails(self, period, emails): Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Us... | Implement the Python class `AbstractRelatedUserManager` described below.
Class description:
Base class for the managers for related users.
Method signatures and docstrings:
- def bulk_create_from_emails(self, period, emails): Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Us... | a3355fe78992466cfcae8b166128bf51ddbb26d0 | <|skeleton|>
class AbstractRelatedUserManager:
"""Base class for the managers for related users."""
def bulk_create_from_emails(self, period, emails):
"""Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Uses :meth:`devilry.devilry_account.models.UserManager.bulk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AbstractRelatedUserManager:
"""Base class for the managers for related users."""
def bulk_create_from_emails(self, period, emails):
"""Bulk create related student/examiner for all the emails in the given ``emails`` iterator. Uses :meth:`devilry.devilry_account.models.UserManager.bulk_create_from_... | the_stack_v2_python_sparse | devilry/apps/core/models/relateduser.py | devilry/devilry-django | train | 42 |
d86b04f8b7f7686f3a3e2ab85d54fe858cd4e882 | [
"if not matrix or not matrix[0]:\n return 0\nres = 0\nfor i in range(len(matrix)):\n heights = []\n for j in range(len(matrix[0])):\n cur = 0\n for k in range(i, len(matrix)):\n if matrix[k][j] == '0':\n break\n cur += 1\n heights.append(cur)\n r... | <|body_start_0|>
if not matrix or not matrix[0]:
return 0
res = 0
for i in range(len(matrix)):
heights = []
for j in range(len(matrix[0])):
cur = 0
for k in range(i, len(matrix)):
if matrix[k][j] == '0':
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not matrix o... | stack_v2_sparse_classes_75kplus_train_007683 | 1,659 | permissive | [
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "maximalRectangle",
"signature": "def maximalRectangle(self, matrix)"
},
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea",
"signature": "def largestRectangleArea(self, heights)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030620 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
<|skeleton|>
class ... | 5097f69bb0050d963c784d6bc0e88a7e871568ed | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
if not matrix or not matrix[0]:
return 0
res = 0
for i in range(len(matrix)):
heights = []
for j in range(len(matrix[0])):
cur = 0
... | the_stack_v2_python_sparse | 51-100/85.py | yshshadow/Leetcode | train | 0 | |
50fc075c8b03b337eda35200a954205dbf5df24a | [
"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!')"
] | <|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... | 定义算术服务 | ArithServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArithServicer:
"""定义算术服务"""
def XiangJia(self, request, context):
"""定义相加方法"""
<|body_0|>
def XiangJian(self, request, context):
"""定义相减方法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
co... | stack_v2_sparse_classes_75kplus_train_007684 | 3,524 | no_license | [
{
"docstring": "定义相加方法",
"name": "XiangJia",
"signature": "def XiangJia(self, request, context)"
},
{
"docstring": "定义相减方法",
"name": "XiangJian",
"signature": "def XiangJian(self, request, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017936 | Implement the Python class `ArithServicer` described below.
Class description:
定义算术服务
Method signatures and docstrings:
- def XiangJia(self, request, context): 定义相加方法
- def XiangJian(self, request, context): 定义相减方法 | Implement the Python class `ArithServicer` described below.
Class description:
定义算术服务
Method signatures and docstrings:
- def XiangJia(self, request, context): 定义相加方法
- def XiangJian(self, request, context): 定义相减方法
<|skeleton|>
class ArithServicer:
"""定义算术服务"""
def XiangJia(self, request, context):
... | c2389b6d9c47d9a1a2e63c8e0dc3fc132943b444 | <|skeleton|>
class ArithServicer:
"""定义算术服务"""
def XiangJia(self, request, context):
"""定义相加方法"""
<|body_0|>
def XiangJian(self, request, context):
"""定义相减方法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArithServicer:
"""定义算术服务"""
def XiangJia(self, request, context):
"""定义相加方法"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def XiangJian(self, request, context):
... | the_stack_v2_python_sparse | micro/proto/grpc/arith_pb2_grpc.py | jstang9527/buoy | train | 2 |
787a1b61ae0bc890ca0772ea5aed183e4cbe89aa | [
"self.folder = folder\nself.is_latin_required = is_latin_required\nif root:\n self.folder = os.path.join(root, self.folder)\nassert os.path.exists(os.path.join(self.folder, 'ImagesPart1'))\nassert os.path.exists(os.path.join(self.folder, 'ImagesPart2'))\nassert os.path.exists(os.path.join(self.folder, 'train_gt_... | <|body_start_0|>
self.folder = folder
self.is_latin_required = is_latin_required
if root:
self.folder = os.path.join(root, self.folder)
assert os.path.exists(os.path.join(self.folder, 'ImagesPart1'))
assert os.path.exists(os.path.join(self.folder, 'ImagesPart2'))
... | Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation. | ICDAR2019MLTDatasetConverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ICDAR2019MLTDatasetConverter:
"""Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation."""
def __init__(self, folder, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotat... | stack_v2_sparse_classes_75kplus_train_007685 | 25,441 | permissive | [
{
"docstring": "Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param is_latin_required: if it is True than images that do not contain latin text will be filtered out.",
"name": "__init__",
"signature": "def __init__(s... | 4 | stack_v2_sparse_classes_30k_train_012721 | Implement the Python class `ICDAR2019MLTDatasetConverter` described below.
Class description:
Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.
Method signatures and docstrings:
- def __init__(self, folder, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder ... | Implement the Python class `ICDAR2019MLTDatasetConverter` described below.
Class description:
Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation.
Method signatures and docstrings:
- def __init__(self, folder, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder ... | c553a56088f0055baba838b68c9299e19683227e | <|skeleton|>
class ICDAR2019MLTDatasetConverter:
"""Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation."""
def __init__(self, folder, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ICDAR2019MLTDatasetConverter:
"""Class for conversion of ICDAR2019 to TextOnlyCocoAnnotation."""
def __init__(self, folder, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param i... | the_stack_v2_python_sparse | pytorch_toolkit/text_spotting/text_spotting/datasets/datasets.py | DmitriySidnev/openvino_training_extensions | train | 0 |
ba81c2ab82cb20bdf7782a2888f55ba25ef4687b | [
"response = self.client.get('/blog/')\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No posts are available.')\nself.assertQuerysetEqual(response.context['posts'], [])",
"create_post(title='past post', days=-30)\nresponse = self.client.get('/blog/')\nself.assertQuerysetEqual(response... | <|body_start_0|>
response = self.client.get('/blog/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No posts are available.')
self.assertQuerysetEqual(response.context['posts'], [])
<|end_body_0|>
<|body_start_1|>
create_post(title='past post', days=... | EntryViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntryViewTests:
def test_list_view_with_no_posts(self):
"""If no posts exist, an appropriate message should be displayed."""
<|body_0|>
def test_list_view_with_a_past_post(self):
"""Posts with a published_date in the past should be displayed on the post_list page."""... | stack_v2_sparse_classes_75kplus_train_007686 | 3,467 | no_license | [
{
"docstring": "If no posts exist, an appropriate message should be displayed.",
"name": "test_list_view_with_no_posts",
"signature": "def test_list_view_with_no_posts(self)"
},
{
"docstring": "Posts with a published_date in the past should be displayed on the post_list page.",
"name": "test... | 5 | stack_v2_sparse_classes_30k_train_002249 | Implement the Python class `EntryViewTests` described below.
Class description:
Implement the EntryViewTests class.
Method signatures and docstrings:
- def test_list_view_with_no_posts(self): If no posts exist, an appropriate message should be displayed.
- def test_list_view_with_a_past_post(self): Posts with a publi... | Implement the Python class `EntryViewTests` described below.
Class description:
Implement the EntryViewTests class.
Method signatures and docstrings:
- def test_list_view_with_no_posts(self): If no posts exist, an appropriate message should be displayed.
- def test_list_view_with_a_past_post(self): Posts with a publi... | b95e0f30e9db9c1874cd8800935905f9eec5e87b | <|skeleton|>
class EntryViewTests:
def test_list_view_with_no_posts(self):
"""If no posts exist, an appropriate message should be displayed."""
<|body_0|>
def test_list_view_with_a_past_post(self):
"""Posts with a published_date in the past should be displayed on the post_list page."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EntryViewTests:
def test_list_view_with_no_posts(self):
"""If no posts exist, an appropriate message should be displayed."""
response = self.client.get('/blog/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No posts are available.')
self.as... | the_stack_v2_python_sparse | blog/tests.py | pablocesar87/merixstudio | train | 0 | |
c1e25a7e52d87108c05dbfaacf026c4d81595c16 | [
"self.p = p\nif graph is not None:\n if name is None:\n name = graph.name + '_sparsifier'\n edges_np = GraphSparsifier._sample_edges(sess, graph, p)\n Graph.__init__(self, sess, name, edges_np=edges_np, n=graph.n, is_sparse=is_sparse, writer=writer)\nelse:\n Graph.__init__(self, sess, name, n=n, ... | <|body_start_0|>
self.p = p
if graph is not None:
if name is None:
name = graph.name + '_sparsifier'
edges_np = GraphSparsifier._sample_edges(sess, graph, p)
Graph.__init__(self, sess, name, edges_np=edges_np, n=graph.n, is_sparse=is_sparse, writer=wri... | The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results. Attributes: sess (:obj:`tf.Session`): This attribute represents the session that ... | GraphSparsifier | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphSparsifier:
"""The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results. Attributes: sess (:obj:`tf.Session`): ... | stack_v2_sparse_classes_75kplus_train_007687 | 6,285 | permissive | [
{
"docstring": "Class Constructor of the GraphSparsfiier This method is called to construct a Graph object. This block of code initializes all the variables necessaries for this class to properly works. This class can be initialized using an edge list, that fill the graph at this moment, or can be construct it ... | 4 | null | Implement the Python class `GraphSparsifier` described below.
Class description:
The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results.... | Implement the Python class `GraphSparsifier` described below.
Class description:
The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results.... | 19ae968b3060275c631dc601757646abaf1f58a1 | <|skeleton|>
class GraphSparsifier:
"""The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results. Attributes: sess (:obj:`tf.Session`): ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GraphSparsifier:
"""The graph sparsifier class implemented in the top of TensorFlow. This class inherits the Graph class and modifies it functionality adding a level of randomness on edge additions and deletions, that improves the performance of the results. Attributes: sess (:obj:`tf.Session`): This attribut... | the_stack_v2_python_sparse | tfgraph/graph/graph_sparsifier.py | tfgraph/tfgraph | train | 4 |
620d38984194a84d9ac2cd73c7d2f32c46085dfb | [
"\"\"\"在__init__中定义的属性,称为静态属性\"\"\"\nself.screen_width = 1000\nself.screen_height = 600\nself.bg_color = (230, 230, 230)\nself.ship_limit = 2\nself.bullet_width = 300\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_max_num = 3\nself.alien_drop_speed = 30\nself.speed_scale = 1.1\nself.score_s... | <|body_start_0|>
"""在__init__中定义的属性,称为静态属性"""
self.screen_width = 1000
self.screen_height = 600
self.bg_color = (230, 230, 230)
self.ship_limit = 2
self.bullet_width = 300
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullet_max_num... | 保存游戏中的所有设置 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化 随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_007688 | 1,265 | no_license | [
{
"docstring": "初始化游戏设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化 随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度",
"name": "increase_speed",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_026957 | Implement the Python class `Settings` described below.
Class description:
保存游戏中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_settings(self): 初始化 随游戏进行而变化的设置
- def increase_speed(self): 提高速度 | Implement the Python class `Settings` described below.
Class description:
保存游戏中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_settings(self): 初始化 随游戏进行而变化的设置
- def increase_speed(self): 提高速度
<|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
... | 497c933217019046aca0d4258b174a13965348a7 | <|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化 随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
"""在__init__中定义的属性,称为静态属性"""
self.screen_width = 1000
self.screen_height = 600
self.bg_color = (230, 230, 230)
self.ship_limit = 2
self.bullet_width = 300
self.bullet_height = 15
... | the_stack_v2_python_sparse | python编程从入门到实践/alien_invasion/settings.py | tp-yan/PythonScript | train | 0 |
dfb5c084432480b859fe27303980fb2ce8487f79 | [
"self._provider = provider\nself._mutation_column = mutation_column\nself._is_plot = is_plot\nif self._provider is None:\n context = StudyContext(depvar=cn.RATE, mutation_column=mutation_column)\n provider = ModelDataProvider(context, constraints=constraints)\n provider.do()\nelse:\n self._mutation_colu... | <|body_start_0|>
self._provider = provider
self._mutation_column = mutation_column
self._is_plot = is_plot
if self._provider is None:
context = StudyContext(depvar=cn.RATE, mutation_column=mutation_column)
provider = ModelDataProvider(context, constraints=constrai... | Plot mutations with counts by isolates | MutationIsolatePlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MutationIsolatePlot:
"""Plot mutations with counts by isolates"""
def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True):
""":param str mutation_column: :param ModelDataProvider provider: :param bool is_plot:"""
<|body_0|>
def _mak... | stack_v2_sparse_classes_75kplus_train_007689 | 2,723 | permissive | [
{
"docstring": ":param str mutation_column: :param ModelDataProvider provider: :param bool is_plot:",
"name": "__init__",
"signature": "def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True)"
},
{
"docstring": ":param str species: :return pd.DataFrame: col... | 3 | null | Implement the Python class `MutationIsolatePlot` described below.
Class description:
Plot mutations with counts by isolates
Method signatures and docstrings:
- def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True): :param str mutation_column: :param ModelDataProvider provider:... | Implement the Python class `MutationIsolatePlot` described below.
Class description:
Plot mutations with counts by isolates
Method signatures and docstrings:
- def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True): :param str mutation_column: :param ModelDataProvider provider:... | 704435e66c58677bab24f27820458870092924e2 | <|skeleton|>
class MutationIsolatePlot:
"""Plot mutations with counts by isolates"""
def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True):
""":param str mutation_column: :param ModelDataProvider provider: :param bool is_plot:"""
<|body_0|>
def _mak... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MutationIsolatePlot:
"""Plot mutations with counts by isolates"""
def __init__(self, mutation_column=cn.GGENE_ID, provider=None, constraints=None, is_plot=True):
""":param str mutation_column: :param ModelDataProvider provider: :param bool is_plot:"""
self._provider = provider
sel... | the_stack_v2_python_sparse | microbepy/plot/mutation_isolate_plot.py | ScienceStacks/microbepy | train | 1 |
86b658ab90422c8aa09807ee7fc9959fcb3a5dcc | [
"if start_time and end_time and (start_time >= end_time):\n abort(400, **make_result(status=400, msg='创建开始时间大于创建结束时间'))\nif is_deleted < 0 or is_deleted > 1:\n abort(400, **make_result(status=400, msg='任务状态参数错误'))\nreturn Response(job_name=job_name, start_time=start_time, end_time=end_time, interface_id=inter... | <|body_start_0|>
if start_time and end_time and (start_time >= end_time):
abort(400, **make_result(status=400, msg='创建开始时间大于创建结束时间'))
if is_deleted < 0 or is_deleted > 1:
abort(400, **make_result(status=400, msg='任务状态参数错误'))
return Response(job_name=job_name, start_time=s... | JobVerify | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobVerify:
def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit):
"""获取任务列表"""
<|body_0|>
def verify_delete_job(job_id, user_id):
"""删除任务"""
<|body_1|>
def verify_get_job_id(job_id):
"""获取任务"""
<|b... | stack_v2_sparse_classes_75kplus_train_007690 | 3,824 | no_license | [
{
"docstring": "获取任务列表",
"name": "verify_get_job_list",
"signature": "def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit)"
},
{
"docstring": "删除任务",
"name": "verify_delete_job",
"signature": "def verify_delete_job(job_id, user_id)"
},
{
... | 6 | stack_v2_sparse_classes_30k_train_019950 | Implement the Python class `JobVerify` described below.
Class description:
Implement the JobVerify class.
Method signatures and docstrings:
- def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit): 获取任务列表
- def verify_delete_job(job_id, user_id): 删除任务
- def verify_get_job_id(jo... | Implement the Python class `JobVerify` described below.
Class description:
Implement the JobVerify class.
Method signatures and docstrings:
- def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit): 获取任务列表
- def verify_delete_job(job_id, user_id): 删除任务
- def verify_get_job_id(jo... | 0374684612a13af1e4d41dcd97ba8c80ecd89710 | <|skeleton|>
class JobVerify:
def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit):
"""获取任务列表"""
<|body_0|>
def verify_delete_job(job_id, user_id):
"""删除任务"""
<|body_1|>
def verify_get_job_id(job_id):
"""获取任务"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JobVerify:
def verify_get_job_list(job_name, start_time, end_time, interface_id, is_deleted, page, limit):
"""获取任务列表"""
if start_time and end_time and (start_time >= end_time):
abort(400, **make_result(status=400, msg='创建开始时间大于创建结束时间'))
if is_deleted < 0 or is_deleted > 1:
... | the_stack_v2_python_sparse | verify/job.py | ChanningWong/HCNDC-web | train | 0 | |
702f4042c4d792853a3e83ed5f06462d7dd2f444 | [
"n = len(values)\nif n == 1:\n return True\nF = [[[0 for _ in xrange(n)] for _ in xrange(n)] for _ in xrange(2)]\ns = [0 for _ in xrange(n + 1)]\nfor i in xrange(1, n + 1):\n s[i] = s[i - 1] + values[i - 1]\nfor i in xrange(n):\n for p in xrange(2):\n F[p][i][i] = values[i]\nfor i in xrange(n - 2, -... | <|body_start_0|>
n = len(values)
if n == 1:
return True
F = [[[0 for _ in xrange(n)] for _ in xrange(n)] for _ in xrange(2)]
s = [0 for _ in xrange(n + 1)]
for i in xrange(1, n + 1):
s[i] = s[i - 1] + values[i - 1]
for i in xrange(n):
f... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def firstWillWin_MLE(self, values):
"""DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i + sum - F_{i+1, j}^{1}, A_j + sum - F_{i, j-1}^{1} ) Sometimes assuming the opponent will carry ... | stack_v2_sparse_classes_75kplus_train_007691 | 4,485 | permissive | [
{
"docstring": "DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i + sum - F_{i+1, j}^{1}, A_j + sum - F_{i, j-1}^{1} ) Sometimes assuming the opponent will carry out the best strategy eliminate stochastic process Memory... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstWillWin_MLE(self, values): DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstWillWin_MLE(self, values): DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i... | 4629a3857b2c57418b86a3b3a7180ecb15e763e3 | <|skeleton|>
class Solution:
def firstWillWin_MLE(self, values):
"""DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i + sum - F_{i+1, j}^{1}, A_j + sum - F_{i, j-1}^{1} ) Sometimes assuming the opponent will carry ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def firstWillWin_MLE(self, values):
"""DP with Game theory Let F_{i, j}^{p} represents the max value he can get in sub-array A[i..j] for person p. DP formula: F_{i, j}^{0} = max(A_i + sum - F_{i+1, j}^{1}, A_j + sum - F_{i, j-1}^{1} ) Sometimes assuming the opponent will carry out the best s... | the_stack_v2_python_sparse | Coins in a Line III.py | RijuDasgupta9116/LintCode | train | 0 | |
77be81f485de3cc749b82d5d23332a6b7ee748df | [
"half = (target + 1) // 2\narr = []\nfor i in range(1, half):\n sum = 0\n for j in range(i, half + 1):\n sum += j\n if sum > target:\n break\n elif sum == target:\n subarr = [k for k in range(i, j + 1)]\n arr.append(subarr)\n break\nreturn arr",... | <|body_start_0|>
half = (target + 1) // 2
arr = []
for i in range(1, half):
sum = 0
for j in range(i, half + 1):
sum += j
if sum > target:
break
elif sum == target:
subarr = [k for k i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findContinuousSequence(self, target: int) -> List[List[int]]:
"""执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:"""
<|body_0|>
def findContinuousSequence2(self, target: int) -> List[List[int]]:
... | stack_v2_sparse_classes_75kplus_train_007692 | 4,844 | no_license | [
{
"docstring": "执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:",
"name": "findContinuousSequence",
"signature": "def findContinuousSequence(self, target: int) -> List[List[int]]"
},
{
"docstring": "执行用时 :164 ms, 在所有 Python3 提交中击败了69.... | 5 | stack_v2_sparse_classes_30k_train_018824 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findContinuousSequence(self, target: int) -> List[List[int]]: 执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:
- ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findContinuousSequence(self, target: int) -> List[List[int]]: 执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:
- ... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def findContinuousSequence(self, target: int) -> List[List[int]]:
"""执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:"""
<|body_0|>
def findContinuousSequence2(self, target: int) -> List[List[int]]:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findContinuousSequence(self, target: int) -> List[List[int]]:
"""执行用时 :432 ms, 在所有 Python3 提交中击败了27.47%的用户 内存消耗 :13.4 MB, 在所有 Python3 提交中击败了100.00%的用户 :param target: :return:"""
half = (target + 1) // 2
arr = []
for i in range(1, half):
sum = 0
... | the_stack_v2_python_sparse | LeetCode/1543. 和为s的连续正数序列.py | yiming1012/MyLeetCode | train | 2 | |
697296e524064e82a251c7e26e7ad5629104e8b0 | [
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('English')\nself.assertIn('English', my_survey.responses)",
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['english', 'spanish'... | <|body_start_0|>
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
self.assertIn('English', my_survey.responses)
<|end_body_0|>
<|body_start_1|>
question = 'What language did you first learn to spea... | Tests for the class AnonymousSurvey | TestAnonymousSurvey | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly"""
<|body_0|>
def test_store_three_responses(self):
"""Test that a single response is stored properly"""
... | stack_v2_sparse_classes_75kplus_train_007693 | 980 | no_license | [
{
"docstring": "Test that a single response is stored properly",
"name": "test_store_single_response",
"signature": "def test_store_single_response(self)"
},
{
"docstring": "Test that a single response is stored properly",
"name": "test_store_three_responses",
"signature": "def test_stor... | 2 | stack_v2_sparse_classes_30k_train_035636 | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Tests for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored properly
- def test_store_three_responses(self): Test that a single response is store... | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Tests for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored properly
- def test_store_three_responses(self): Test that a single response is store... | 81160304d8ef66ecde1bfd194261a5164cc934dd | <|skeleton|>
class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly"""
<|body_0|>
def test_store_three_responses(self):
"""Test that a single response is stored properly"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestAnonymousSurvey:
"""Tests for the class AnonymousSurvey"""
def test_store_single_response(self):
"""Test that a single response is stored properly"""
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response... | the_stack_v2_python_sparse | chapter_11/test_survey.py | Raihan9797/Python-Crash-Course | train | 0 |
44e916c13ac15c197b440172f5489d4191c970ba | [
"auth_org = self.obtain_auth_organization()\nargs = request.args\nq = g.session.query(db.Organization)\ng.session.commit()\nif 'name' in args:\n q = q.filter(db.Organization.name.like(args['name']))\nif 'country' in args:\n q = q.filter(db.Organization.country == args['country'])\nif 'collaboration_id' in arg... | <|body_start_0|>
auth_org = self.obtain_auth_organization()
args = request.args
q = g.session.query(db.Organization)
g.session.commit()
if 'name' in args:
q = q.filter(db.Organization.name.like(args['name']))
if 'country' in args:
q = q.filter(db.O... | Organizations | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Organizations:
def get(self):
"""Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Organization|Globa... | stack_v2_sparse_classes_75kplus_train_007694 | 17,265 | permissive | [
{
"docstring": "Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Organization|Global|View|❌|❌|View all organizations| |Organ... | 2 | stack_v2_sparse_classes_30k_train_052103 | Implement the Python class `Organizations` described below.
Class description:
Implement the Organizations class.
Method signatures and docstrings:
- def get(self): Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|... | Implement the Python class `Organizations` described below.
Class description:
Implement the Organizations class.
Method signatures and docstrings:
- def get(self): Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|... | b3ff6e91ac4caeaf31c12c20f73dfc61cfd9baca | <|skeleton|>
class Organizations:
def get(self):
"""Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Organization|Globa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Organizations:
def get(self):
"""Returns a list organizations --- description: >- Get a list of organizations based on filters and user permissions ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Organization|Global|View|❌|❌|Vie... | the_stack_v2_python_sparse | vantage6-server/vantage6/server/resource/organization.py | vantage6/vantage6 | train | 15 | |
eb4ed989f04dcdce30a03f0b2cce08868ac1a1de | [
"super(Inception5a, self).__init__()\nself.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)\nself.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=0), ConvBNLayer(num_channels=ch3x3... | <|body_start_0|>
super(Inception5a, self).__init__()
self.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)
self.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=... | Inception5a | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_75kplus_train_007695 | 23,805 | permissive | [
{
"docstring": "@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ... | 2 | stack_v2_sparse_classes_30k_train_037844 | Implement the Python class `Inception5a` described below.
Class description:
Implement the Inception5a class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c... | Implement the Python class `Inception5a` described below.
Class description:
Implement the Inception5a class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c... | 78ff3c3ab3906012a0f4a612251347632aa493a7 | <|skeleton|>
class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 co... | the_stack_v2_python_sparse | ECO/paddle2.0/model/ECO.py | thinkall/Contrib | train | 1 | |
1e14dd1633ab75d2cabcded22358affa219efde9 | [
"try:\n res = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT).replace('\\n', '')\nexcept subprocess.CalledProcessError as e:\n logger.error('Cmd ret code: {0}. Output: {1}'.format(e.returncode, e.output))\n return e.output\nreturn res",
"cmd = \"ip route | grep '{0}' | awk '{{print $3}... | <|body_start_0|>
try:
res = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT).replace('\n', '')
except subprocess.CalledProcessError as e:
logger.error('Cmd ret code: {0}. Output: {1}'.format(e.returncode, e.output))
return e.output
return res... | Interface for bridge management. | BridgeTool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BridgeTool:
"""Interface for bridge management."""
def call_cmd(cmd):
"""Call wrapper for command."""
<|body_0|>
def get_bridge_name(netmask):
"""Return bridge name by it's netmask."""
<|body_1|>
def check_bridge(bridge, interface):
"""Check ... | stack_v2_sparse_classes_75kplus_train_007696 | 11,453 | permissive | [
{
"docstring": "Call wrapper for command.",
"name": "call_cmd",
"signature": "def call_cmd(cmd)"
},
{
"docstring": "Return bridge name by it's netmask.",
"name": "get_bridge_name",
"signature": "def get_bridge_name(netmask)"
},
{
"docstring": "Check interface in bridge.",
"na... | 5 | stack_v2_sparse_classes_30k_train_041391 | Implement the Python class `BridgeTool` described below.
Class description:
Interface for bridge management.
Method signatures and docstrings:
- def call_cmd(cmd): Call wrapper for command.
- def get_bridge_name(netmask): Return bridge name by it's netmask.
- def check_bridge(bridge, interface): Check interface in br... | Implement the Python class `BridgeTool` described below.
Class description:
Interface for bridge management.
Method signatures and docstrings:
- def call_cmd(cmd): Call wrapper for command.
- def get_bridge_name(netmask): Return bridge name by it's netmask.
- def check_bridge(bridge, interface): Check interface in br... | ce8109b683d1b718cd9b8800a77233d3c1430795 | <|skeleton|>
class BridgeTool:
"""Interface for bridge management."""
def call_cmd(cmd):
"""Call wrapper for command."""
<|body_0|>
def get_bridge_name(netmask):
"""Return bridge name by it's netmask."""
<|body_1|>
def check_bridge(bridge, interface):
"""Check ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BridgeTool:
"""Interface for bridge management."""
def call_cmd(cmd):
"""Call wrapper for command."""
try:
res = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT).replace('\n', '')
except subprocess.CalledProcessError as e:
logger.error('Cm... | the_stack_v2_python_sparse | plugin_test/helpers/baremetal.py | zhujunhui/fuel-plugin-contrail | train | 0 |
d290b8c0a6b75428cc00106084e4e44e7af6af87 | [
"head = root\nwhile head:\n prev, cur, next_head = (None, head, None)\n while cur:\n if next_head is None:\n if cur.left:\n next_head = cur.left\n elif cur.right:\n next_head = cur.right\n if cur.left:\n if prev:\n pre... | <|body_start_0|>
head = root
while head:
prev, cur, next_head = (None, head, None)
while cur:
if next_head is None:
if cur.left:
next_head = cur.left
elif cur.right:
next_head ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def connect(self, root):
""":param root: a tree link node :return: nothing"""
<|body_0|>
def connect_level(self, root):
"""层次遍历 :param root: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = root
while head:
... | stack_v2_sparse_classes_75kplus_train_007697 | 2,816 | no_license | [
{
"docstring": ":param root: a tree link node :return: nothing",
"name": "connect",
"signature": "def connect(self, root)"
},
{
"docstring": "层次遍历 :param root: :return:",
"name": "connect_level",
"signature": "def connect_level(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000778 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def connect(self, root): :param root: a tree link node :return: nothing
- def connect_level(self, root): 层次遍历 :param root: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def connect(self, root): :param root: a tree link node :return: nothing
- def connect_level(self, root): 层次遍历 :param root: :return:
<|skeleton|>
class Solution:
def connect... | 215d513b3564a7a76db3d2b29e4acc341a68e8ee | <|skeleton|>
class Solution:
def connect(self, root):
""":param root: a tree link node :return: nothing"""
<|body_0|>
def connect_level(self, root):
"""层次遍历 :param root: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def connect(self, root):
""":param root: a tree link node :return: nothing"""
head = root
while head:
prev, cur, next_head = (None, head, None)
while cur:
if next_head is None:
if cur.left:
ne... | the_stack_v2_python_sparse | python/dfs/populating-next-right-pointers-ii.py | euxuoh/leetcode | train | 0 | |
9cbf39ce399de6fa40b2ca1408bde875c2e80a08 | [
"self.device = device\nself.alpha = alpha\nself.model = model.to(self.device)\nself.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad}\nself._means = {}\nself._precision_matrices = {}\nfor n, p in deepcopy(self.params).items():\n p.data.zero_()\n self._precision_matrices[n] = p.data.... | <|body_start_0|>
self.device = device
self.alpha = alpha
self.model = model.to(self.device)
self.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad}
self._means = {}
self._precision_matrices = {}
for n, p in deepcopy(self.params).items():
... | OnlineEWC | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnlineEWC:
def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5):
"""OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter"""
... | stack_v2_sparse_classes_75kplus_train_007698 | 3,611 | no_license | [
{
"docstring": "OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter",
"name": "__init__",
"signature": "def __init__(self, model: nn.Module, device='cuda:0... | 3 | stack_v2_sparse_classes_30k_train_045952 | Implement the Python class `OnlineEWC` described below.
Class description:
Implement the OnlineEWC class.
Method signatures and docstrings:
- def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (stri... | Implement the Python class `OnlineEWC` described below.
Class description:
Implement the OnlineEWC class.
Method signatures and docstrings:
- def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (stri... | f1f9e9f4f85c7eb076e3c15e2390c9d612adabdf | <|skeleton|>
class OnlineEWC:
def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5):
"""OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OnlineEWC:
def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5):
"""OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter"""
self.devic... | the_stack_v2_python_sparse | utils/ewc_utils/onlineEWC.py | lihr04/corel2m | train | 0 | |
2ba345d1c3284170689033f10270cc2198561ecd | [
"if db_field.name == 'user':\n kwargs['initial'] = request.user.id\nreturn db_field.formfield(**kwargs)",
"changelist = super().get_changelist_instance(request)\nuids = {instance.user_id for instance in changelist.result_list}\nelements = User.objects.filter(pk__in=uids).values_list('pk', 'username')\ncache.se... | <|body_start_0|>
if db_field.name == 'user':
kwargs['initial'] = request.user.id
return db_field.formfield(**kwargs)
<|end_body_0|>
<|body_start_1|>
changelist = super().get_changelist_instance(request)
uids = {instance.user_id for instance in changelist.result_list}
... | BaseModelAdmin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseModelAdmin:
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Prepopulate current user."""
<|body_0|>
def get_changelist_instance(self, request):
"""Get all related user usernames and send to the cache, we will use it later in __str__ method to ... | stack_v2_sparse_classes_75kplus_train_007699 | 4,958 | permissive | [
{
"docstring": "Prepopulate current user.",
"name": "formfield_for_foreignkey",
"signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)"
},
{
"docstring": "Get all related user usernames and send to the cache, we will use it later in __str__ method to improve performance. :... | 2 | null | Implement the Python class `BaseModelAdmin` described below.
Class description:
Implement the BaseModelAdmin class.
Method signatures and docstrings:
- def formfield_for_foreignkey(self, db_field, request, **kwargs): Prepopulate current user.
- def get_changelist_instance(self, request): Get all related user username... | Implement the Python class `BaseModelAdmin` described below.
Class description:
Implement the BaseModelAdmin class.
Method signatures and docstrings:
- def formfield_for_foreignkey(self, db_field, request, **kwargs): Prepopulate current user.
- def get_changelist_instance(self, request): Get all related user username... | 51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0 | <|skeleton|>
class BaseModelAdmin:
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Prepopulate current user."""
<|body_0|>
def get_changelist_instance(self, request):
"""Get all related user usernames and send to the cache, we will use it later in __str__ method to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseModelAdmin:
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Prepopulate current user."""
if db_field.name == 'user':
kwargs['initial'] = request.user.id
return db_field.formfield(**kwargs)
def get_changelist_instance(self, request):
"""G... | the_stack_v2_python_sparse | tool/admin.py | mikekeda/tools | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.