blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d2cc412e30fb8ab6432776ebfa83e70e630a5bec | [
"self.cv = cv\nself.age = 0\nself.particles = []",
"self.age += dt\nfor p in self.particles:\n p.update(dt)\nfor i in range(len(self.particles) - 1, -1, -1):\n if not self.particles[i].alive():\n del self.particles[i]"
] | <|body_start_0|>
self.cv = cv
self.age = 0
self.particles = []
<|end_body_0|>
<|body_start_1|>
self.age += dt
for p in self.particles:
p.update(dt)
for i in range(len(self.particles) - 1, -1, -1):
if not self.particles[i].alive():
... | Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes: cv (Tk.canvas): the canvas in which... | Fireworks | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fireworks:
"""Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes... | stack_v2_sparse_classes_36k_train_021300 | 16,427 | permissive | [
{
"docstring": "Init Fireworks objects. Args: cv (Tk.canvas): the canvas in which the particle is drawn.",
"name": "__init__",
"signature": "def __init__(self, cv=None)"
},
{
"docstring": "Update the fireworks' particles and remove dead ones. Args: dt (float): the time that has passed after the ... | 2 | stack_v2_sparse_classes_30k_train_020865 | Implement the Python class `Fireworks` described below.
Class description:
Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particl... | Implement the Python class `Fireworks` described below.
Class description:
Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particl... | c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8 | <|skeleton|>
class Fireworks:
"""Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fireworks:
"""Generic class for fireworks. The main "behavior" of a fireworks is specified via its update method. E.g., new particles can be emitted and added to the particle list. The Fireworks base class automatically updates all particles from the particle list in its update method. Attributes: cv (Tk.canv... | the_stack_v2_python_sparse | scripts/sheet9/9.2.py | LennartElbe/PythOnline | train | 0 |
166d34e0785e4f217d1c3c15adf4a022174196aa | [
"container = Container()\nsystem = CursorSystem(container)\ncursor = Entity(PositionComponent(1, 1), CursorComponent())\nfirst = Entity(PositionComponent(1, 1))\nsecond = Entity(PositionComponent(1, 1))\ncontainer.entities = [cursor, first, second]\nsystem.check_target()\nself.assertIs(container.target, first)",
... | <|body_start_0|>
container = Container()
system = CursorSystem(container)
cursor = Entity(PositionComponent(1, 1), CursorComponent())
first = Entity(PositionComponent(1, 1))
second = Entity(PositionComponent(1, 1))
container.entities = [cursor, first, second]
syst... | TestCursorSystem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCursorSystem:
def test_first(self):
"""Target the first coincident entity."""
<|body_0|>
def test_no_coincident(self):
"""Target nothing if there are no coincident entities."""
<|body_1|>
def test_stat_second(self):
"""Target the first coinci... | stack_v2_sparse_classes_36k_train_021301 | 2,604 | permissive | [
{
"docstring": "Target the first coincident entity.",
"name": "test_first",
"signature": "def test_first(self)"
},
{
"docstring": "Target nothing if there are no coincident entities.",
"name": "test_no_coincident",
"signature": "def test_no_coincident(self)"
},
{
"docstring": "Ta... | 4 | stack_v2_sparse_classes_30k_train_008431 | Implement the Python class `TestCursorSystem` described below.
Class description:
Implement the TestCursorSystem class.
Method signatures and docstrings:
- def test_first(self): Target the first coincident entity.
- def test_no_coincident(self): Target nothing if there are no coincident entities.
- def test_stat_seco... | Implement the Python class `TestCursorSystem` described below.
Class description:
Implement the TestCursorSystem class.
Method signatures and docstrings:
- def test_first(self): Target the first coincident entity.
- def test_no_coincident(self): Target nothing if there are no coincident entities.
- def test_stat_seco... | 4aba3322a8582a2d06ab0d4b67028738249669e9 | <|skeleton|>
class TestCursorSystem:
def test_first(self):
"""Target the first coincident entity."""
<|body_0|>
def test_no_coincident(self):
"""Target nothing if there are no coincident entities."""
<|body_1|>
def test_stat_second(self):
"""Target the first coinci... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCursorSystem:
def test_first(self):
"""Target the first coincident entity."""
container = Container()
system = CursorSystem(container)
cursor = Entity(PositionComponent(1, 1), CursorComponent())
first = Entity(PositionComponent(1, 1))
second = Entity(Positio... | the_stack_v2_python_sparse | src/ecs/systems/test_cursorsystem.py | joehowells/critical-keep | train | 1 | |
5885c8fa06047d5b38e48bf7e02aaeec5e59840e | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CalendarGroup()",
"from .calendar import Calendar\nfrom .entity import Entity\nfrom .calendar import Calendar\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'calendars': lambda n: setattr(self, 'calendars', n.... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return CalendarGroup()
<|end_body_0|>
<|body_start_1|>
from .calendar import Calendar
from .entity import Entity
from .calendar import Calendar
from .entity import Entity
... | CalendarGroup | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalendarGroup:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns... | stack_v2_sparse_classes_36k_train_021302 | 2,971 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: CalendarGroup",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | stack_v2_sparse_classes_30k_train_012590 | Implement the Python class `CalendarGroup` described below.
Class description:
Implement the CalendarGroup class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: Creates a new instance of the appropriate class based on discriminator value... | Implement the Python class `CalendarGroup` described below.
Class description:
Implement the CalendarGroup class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: Creates a new instance of the appropriate class based on discriminator value... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class CalendarGroup:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CalendarGroup:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: CalendarGrou... | the_stack_v2_python_sparse | msgraph/generated/models/calendar_group.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
ab17c9bb0f45f5dc7f54bd7bb1f11b91d348dbc8 | [
"if len(nums) == 1:\n return nums[0]\nreturn max(self.rob2(nums[0:len(nums) - 1]), self.rob2(nums[1:len(nums)]))",
"if not nums:\n return 0\nif len(nums) <= 2:\n return max(nums)\ndp = [0 for _ in range(len(nums))]\ndp[0], dp[1] = (nums[0], max(nums[0], nums[1]))\nmax_money = max(dp[0], dp[1])\nfor i in ... | <|body_start_0|>
if len(nums) == 1:
return nums[0]
return max(self.rob2(nums[0:len(nums) - 1]), self.rob2(nums[1:len(nums)]))
<|end_body_0|>
<|body_start_1|>
if not nums:
return 0
if len(nums) <= 2:
return max(nums)
dp = [0 for _ in range(len(... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rob2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(nums) == 1:
return nums[0]
return... | stack_v2_sparse_classes_36k_train_021303 | 1,102 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rob",
"signature": "def rob(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rob2",
"signature": "def rob2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009579 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def rob(self, nums):
"... | b06c58412c4ad3baac07b882aa6e8ff06c9906c3 | <|skeleton|>
class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rob2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) == 1:
return nums[0]
return max(self.rob2(nums[0:len(nums) - 1]), self.rob2(nums[1:len(nums)]))
def rob2(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums... | the_stack_v2_python_sparse | 动态规划/213.打家劫舍-ii.py | 634671436/leetcode | train | 1 | |
aba69b168578c59bd3d7e92a35ea66a1df145161 | [
"self.config = config\nself.input_x = tf.placeholder(tf.int32, [None, self.config.seq_length], name='input_x')\nself.input_y = tf.placeholder(tf.float32, [None, self.config.num_classes], name='input_y')\nself.keep_prob = tf.placeholder(tf.float32, name='keep_prob')\nself.cnn()",
"with tf.device('/gpu:0'):\n em... | <|body_start_0|>
self.config = config
self.input_x = tf.placeholder(tf.int32, [None, self.config.seq_length], name='input_x')
self.input_y = tf.placeholder(tf.float32, [None, self.config.num_classes], name='input_y')
self.keep_prob = tf.placeholder(tf.float32, name='keep_prob')
s... | TextCNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextCNN:
def __init__(self, config):
"""文本分类,CNN模型"""
<|body_0|>
def cnn(self):
"""CNN模型"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.config = config
self.input_x = tf.placeholder(tf.int32, [None, self.config.seq_length], name='input... | stack_v2_sparse_classes_36k_train_021304 | 2,877 | no_license | [
{
"docstring": "文本分类,CNN模型",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "CNN模型",
"name": "cnn",
"signature": "def cnn(self)"
}
] | 2 | null | Implement the Python class `TextCNN` described below.
Class description:
Implement the TextCNN class.
Method signatures and docstrings:
- def __init__(self, config): 文本分类,CNN模型
- def cnn(self): CNN模型 | Implement the Python class `TextCNN` described below.
Class description:
Implement the TextCNN class.
Method signatures and docstrings:
- def __init__(self, config): 文本分类,CNN模型
- def cnn(self): CNN模型
<|skeleton|>
class TextCNN:
def __init__(self, config):
"""文本分类,CNN模型"""
<|body_0|>
def cnn... | 648fa01a0f0be1ace4b4b233822ccd2107ab0897 | <|skeleton|>
class TextCNN:
def __init__(self, config):
"""文本分类,CNN模型"""
<|body_0|>
def cnn(self):
"""CNN模型"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextCNN:
def __init__(self, config):
"""文本分类,CNN模型"""
self.config = config
self.input_x = tf.placeholder(tf.int32, [None, self.config.seq_length], name='input_x')
self.input_y = tf.placeholder(tf.float32, [None, self.config.num_classes], name='input_y')
self.keep_prob =... | the_stack_v2_python_sparse | Leaning/#text_classification_rnn_cnn/cnn_model.py | LiaoBoWen/MyProject | train | 2 | |
e231b5e86acffc23ea9f76f27416facedbaa43cd | [
"super().__init__()\nself.variable_name = variable_name\nself.variable_type = variable_type",
"lam = self.variable_type.execute(session, context)\nif lam is None:\n msg = 'Type {} for variable {} has not been declared yet'.format(self.variable_type.name, self.variable_name)\n raise NormError(msg)\nfrom norm... | <|body_start_0|>
super().__init__()
self.variable_name = variable_name
self.variable_type = variable_type
<|end_body_0|>
<|body_start_1|>
lam = self.variable_type.execute(session, context)
if lam is None:
msg = 'Type {} for variable {} has not been declared yet'.form... | ArgumentDeclaration | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgumentDeclaration:
def __init__(self, variable_name, variable_type):
"""The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName :param variable_type: the type of the variable :type variable_type: TypeName"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k_train_021305 | 3,531 | permissive | [
{
"docstring": "The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName :param variable_type: the type of the variable :type variable_type: TypeName",
"name": "__init__",
"signature": "def __init__(self, variable_name, variable_type)"
},
{
"docst... | 2 | null | Implement the Python class `ArgumentDeclaration` described below.
Class description:
Implement the ArgumentDeclaration class.
Method signatures and docstrings:
- def __init__(self, variable_name, variable_type): The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName ... | Implement the Python class `ArgumentDeclaration` described below.
Class description:
Implement the ArgumentDeclaration class.
Method signatures and docstrings:
- def __init__(self, variable_name, variable_type): The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName ... | ff76e030d7cebdca51c72d5d7e789d90f0e1e565 | <|skeleton|>
class ArgumentDeclaration:
def __init__(self, variable_name, variable_type):
"""The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName :param variable_type: the type of the variable :type variable_type: TypeName"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArgumentDeclaration:
def __init__(self, variable_name, variable_type):
"""The argument declaration :param variable_name: the name of the variable :type variable_name: VariableName :param variable_type: the type of the variable :type variable_type: TypeName"""
super().__init__()
self.va... | the_stack_v2_python_sparse | norm/executable/declaration.py | xumiao/supernorm | train | 0 | |
3a69ad77b241eaaa79b376470f661d214ec7cd43 | [
"self.paperspace = paperspace\nself.color = color\nself.layer = layer\nself.lineType = lineType\nself.lineTypeScale = lineTypeScale\nself.lineWeight = lineWeight\nself.extrusion = extrusion\nself.elevation = elevation\nself.thickness = thickness\nself.parent = parent",
"if self.parent:\n parent = self.parent\n... | <|body_start_0|>
self.paperspace = paperspace
self.color = color
self.layer = layer
self.lineType = lineType
self.lineTypeScale = lineTypeScale
self.lineWeight = lineWeight
self.extrusion = extrusion
self.elevation = elevation
self.thickness = thic... | Base class for _common group codes for entities. | _Entity | [
"GPL-3.0-only",
"Font-exception-2.0",
"GPL-3.0-or-later",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain-disclaimer",
"Bitstream-Vera",
"LicenseRef-scancode-blender-2010",
"LGPL-2.1-or-later",
"GPL-2.0-or-lat... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Entity:
"""Base class for _common group codes for entities."""
def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, parent=None):
"""None values will be omitted."""
<|bo... | stack_v2_sparse_classes_36k_train_021306 | 30,058 | permissive | [
{
"docstring": "None values will be omitted.",
"name": "__init__",
"signature": "def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, parent=None)"
},
{
"docstring": "Return common group cod... | 2 | stack_v2_sparse_classes_30k_train_004212 | Implement the Python class `_Entity` described below.
Class description:
Base class for _common group codes for entities.
Method signatures and docstrings:
- def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, p... | Implement the Python class `_Entity` described below.
Class description:
Base class for _common group codes for entities.
Method signatures and docstrings:
- def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, p... | f7d23a489c2b4bcc3c1961ac955926484ff8b8d9 | <|skeleton|>
class _Entity:
"""Base class for _common group codes for entities."""
def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, parent=None):
"""None values will be omitted."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Entity:
"""Base class for _common group codes for entities."""
def __init__(self, paperspace=None, color=None, layer='0', lineType=None, lineTypeScale=None, lineWeight=None, extrusion=None, elevation=None, thickness=None, parent=None):
"""None values will be omitted."""
self.paperspace =... | the_stack_v2_python_sparse | engine/2.80/scripts/addons/io_export_dxf/model/dxfLibrary.py | byteinc/Phasor | train | 3 |
5f830f5602d4da0a1765d3ec9e9a2edde75c0d3c | [
"context = super(ModeratorView, self).get_context_data(**kwargs)\ngroup_id = self.kwargs.get('group')\nif group_id:\n context['group'] = get_object_or_404(Group, pk=group_id)\nreturn context",
"queryset = self.request.user.messages_to_moderate\ngroup = self.kwargs.get('group')\nif group:\n queryset = querys... | <|body_start_0|>
context = super(ModeratorView, self).get_context_data(**kwargs)
group_id = self.kwargs.get('group')
if group_id:
context['group'] = get_object_or_404(Group, pk=group_id)
return context
<|end_body_0|>
<|body_start_1|>
queryset = self.request.user.mess... | View that handles viewing messages to be moderated | ModeratorView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModeratorView:
"""View that handles viewing messages to be moderated"""
def get_context_data(self, **kwargs):
"""Add additional context to the moderation page"""
<|body_0|>
def get_queryset(self):
"""Get the queryset for the page"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_021307 | 6,036 | permissive | [
{
"docstring": "Add additional context to the moderation page",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Get the queryset for the page",
"name": "get_queryset",
"signature": "def get_queryset(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005060 | Implement the Python class `ModeratorView` described below.
Class description:
View that handles viewing messages to be moderated
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add additional context to the moderation page
- def get_queryset(self): Get the queryset for the page | Implement the Python class `ModeratorView` described below.
Class description:
View that handles viewing messages to be moderated
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add additional context to the moderation page
- def get_queryset(self): Get the queryset for the page
<|skeleton|... | a56c0f89df82694bf5db32a04d8b092974791972 | <|skeleton|>
class ModeratorView:
"""View that handles viewing messages to be moderated"""
def get_context_data(self, **kwargs):
"""Add additional context to the moderation page"""
<|body_0|>
def get_queryset(self):
"""Get the queryset for the page"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModeratorView:
"""View that handles viewing messages to be moderated"""
def get_context_data(self, **kwargs):
"""Add additional context to the moderation page"""
context = super(ModeratorView, self).get_context_data(**kwargs)
group_id = self.kwargs.get('group')
if group_id... | the_stack_v2_python_sparse | open_connect/moderation/views.py | ofa/connect | train | 66 |
03d7c011fb155d2e1bae4c82e59105195d733048 | [
"project_id = uuid.UUID(project_id)\nproject = self.service.projects[project_id]\nreturn project.services[uuid.UUID(app_id)] if app_id else project.services",
"project_id = uuid.UUID(args[0])\nproject = self.service.projects[project_id]\nservice_id = uuid.UUID(args[1]) if len(args) > 1 else None\nparams = kwargs[... | <|body_start_0|>
project_id = uuid.UUID(project_id)
project = self.service.projects[project_id]
return project.services[uuid.UUID(app_id)] if app_id else project.services
<|end_body_0|>
<|body_start_1|>
project_id = uuid.UUID(args[0])
project = self.service.projects[project_id]
... | Applications handler. | AppsHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppsHandler:
"""Applications handler."""
def get(self, project_id, app_id=None):
"""List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d3d9ada26/apps [ { "counters": {}, "name": "empower.apps.w... | stack_v2_sparse_classes_36k_train_021308 | 5,352 | permissive | [
{
"docstring": "List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d3d9ada26/apps [ { \"counters\": {}, \"name\": \"empower.apps.wifimobilitymanager.wifimobilitymanager\", \"params\": { \"every\": 2000, \"project_id\": \"... | 4 | stack_v2_sparse_classes_30k_train_009662 | Implement the Python class `AppsHandler` described below.
Class description:
Applications handler.
Method signatures and docstrings:
- def get(self, project_id, app_id=None): List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d... | Implement the Python class `AppsHandler` described below.
Class description:
Applications handler.
Method signatures and docstrings:
- def get(self, project_id, app_id=None): List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d... | 38eac8eebf57da4bec07518383ab65a5544445fe | <|skeleton|>
class AppsHandler:
"""Applications handler."""
def get(self, project_id, app_id=None):
"""List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d3d9ada26/apps [ { "counters": {}, "name": "empower.apps.w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppsHandler:
"""Applications handler."""
def get(self, project_id, app_id=None):
"""List the apps. Args: [0]: the project id (mandatory) [1]: the app id (optional) Example URLs: GET /api/v1/projects/52313ecb-9d00-4b7d-b873-b55d3d9ada26/apps [ { "counters": {}, "name": "empower.apps.wifimobilityma... | the_stack_v2_python_sparse | empower_core/projectsmanager/appshandler.py | 5g-empower/empower-core | train | 3 |
6f7b9a779abd8fe5f117f7610525cc19a0a63d52 | [
"super().__init__()\nself._initialize_arguments(args)\nself.temperature = args.temperature\nself.adj_type = args.adj_type\nif args.adj_type == 'fixed':\n self.adj_mx = adj_mx.to(device)\nelif args.adj_type == 'empty':\n self.adj_mx = torch.zeros(size=(args.num_nodes, args.num_nodes, args.num_relation_types), ... | <|body_start_0|>
super().__init__()
self._initialize_arguments(args)
self.temperature = args.temperature
self.adj_type = args.adj_type
if args.adj_type == 'fixed':
self.adj_mx = adj_mx.to(device)
elif args.adj_type == 'empty':
self.adj_mx = torch.z... | Implements the GATRNN model. | GATRNN | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GATRNN:
"""Implements the GATRNN model."""
def __init__(self, adj_mx, args):
"""Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentParser class, we only use model-related arguments here."""... | stack_v2_sparse_classes_36k_train_021309 | 13,550 | permissive | [
{
"docstring": "Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentParser class, we only use model-related arguments here.",
"name": "__init__",
"signature": "def __init__(self, adj_mx, args)"
},
{
"do... | 4 | stack_v2_sparse_classes_30k_train_014413 | Implement the Python class `GATRNN` described below.
Class description:
Implements the GATRNN model.
Method signatures and docstrings:
- def __init__(self, adj_mx, args): Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentP... | Implement the Python class `GATRNN` described below.
Class description:
Implements the GATRNN model.
Method signatures and docstrings:
- def __init__(self, adj_mx, args): Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentP... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class GATRNN:
"""Implements the GATRNN model."""
def __init__(self, adj_mx, args):
"""Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentParser class, we only use model-related arguments here."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GATRNN:
"""Implements the GATRNN model."""
def __init__(self, adj_mx, args):
"""Instantiates the GATRNN encoder model. Args: adj_mx: adjacency matrix, with shape (self.num_nodes, self.num_nodes). args: python argparse.ArgumentParser class, we only use model-related arguments here."""
supe... | the_stack_v2_python_sparse | editable_graph_temporal/model/gat_model.py | Jimmy-INL/google-research | train | 1 |
964ce6b6286bd348633483d5129a415d8a8980b4 | [
"self.max_length = 15\nself.max_length_char = '~'\nself.normalization = [('[A-ZÄÖÜ]', 'A'), ('[a-zäöüß]', 'a'), ('[0-9]', '9'), ('[\\\\.\\\\!\\\\?\\\\,\\\\;]', '.'), ('[\\\\(\\\\)\\\\[\\\\]\\\\{\\\\}]', '('), ('[^Aa9\\\\.\\\\(]', '#')]\nself.mappings = [('[A]{2,}', 'A+'), ('[a]{2,}', 'a+'), ('[\\\\.]{2,}', '.+'), (... | <|body_start_0|>
self.max_length = 15
self.max_length_char = '~'
self.normalization = [('[A-ZÄÖÜ]', 'A'), ('[a-zäöüß]', 'a'), ('[0-9]', '9'), ('[\\.\\!\\?\\,\\;]', '.'), ('[\\(\\)\\[\\]\\{\\}]', '('), ('[^Aa9\\.\\(]', '#')]
self.mappings = [('[A]{2,}', 'A+'), ('[a]{2,}', 'a+'), ('[\\.]{2... | Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9+ | WordPatternFeature | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordPatternFeature:
"""Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9+"""
def __init__(self):
"... | stack_v2_sparse_classes_36k_train_021310 | 34,618 | permissive | [
{
"docstring": "Instantiates a new object of this feature generator.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Converts a EntityWindow object into a list of lists of features, where features are strings. Args: window: The EntityWindow object (defined in datasets.... | 3 | stack_v2_sparse_classes_30k_train_015574 | Implement the Python class `WordPatternFeature` described below.
Class description:
Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9... | Implement the Python class `WordPatternFeature` described below.
Class description:
Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9... | 4ddeccdb197260ad478f6915a3771dce889339a3 | <|skeleton|>
class WordPatternFeature:
"""Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9+"""
def __init__(self):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordPatternFeature:
"""Generates a feature that describes the word pattern of a feature. A word pattern is a rough representation of the word, examples: original word | word pattern ---------------------------- John | Aa+ Washington | Aa+ DARPA | A+ 2055 | 9+"""
def __init__(self):
"""Instantiate... | the_stack_v2_python_sparse | preprocessing/feature_engineering/features.py | daivikswarup/WLP-Parser | train | 0 |
b8af26faeb4444367f05b43d3ffe9fba193942e1 | [
"obj = context.object\nif obj is None:\n return False\nreturn all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT'])",
"scene = context.scene\npg = scene.pdt_pg\nobj = bpy.context.view_layer.objects.active\nif obj is None:\n self.report({'ERROR'}, PDT_ERR_NO_ACT_OBJ)\n return {'FINISHED'}\nif obj.mode ... | <|body_start_0|>
obj = context.object
if obj is None:
return False
return all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT'])
<|end_body_0|>
<|body_start_1|>
scene = context.scene
pg = scene.pdt_pg
obj = bpy.context.view_layer.objects.active
if o... | Rotate Selected Vertices about Pivot Point in View Plane | PDT_OT_ViewPlaneRotate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PDT_OT_ViewPlaneRotate:
"""Rotate Selected Vertices about Pivot Point in View Plane"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
<|body_0|>
def execute(self, context):
"""Rotate Selected Vert... | stack_v2_sparse_classes_36k_train_021311 | 13,734 | permissive | [
{
"docstring": "Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.",
"name": "poll",
"signature": "def poll(cls, context)"
},
{
"docstring": "Rotate Selected Vertices about Pivot Point. Note: Rotates any selected vertices about the Pivot Point in View Oriented co... | 2 | stack_v2_sparse_classes_30k_train_009985 | Implement the Python class `PDT_OT_ViewPlaneRotate` described below.
Class description:
Rotate Selected Vertices about Pivot Point in View Plane
Method signatures and docstrings:
- def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.
- def execute(self, context):... | Implement the Python class `PDT_OT_ViewPlaneRotate` described below.
Class description:
Rotate Selected Vertices about Pivot Point in View Plane
Method signatures and docstrings:
- def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.
- def execute(self, context):... | 4d5c304878c1e0018d97c1b07bcaa3981632265a | <|skeleton|>
class PDT_OT_ViewPlaneRotate:
"""Rotate Selected Vertices about Pivot Point in View Plane"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
<|body_0|>
def execute(self, context):
"""Rotate Selected Vert... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PDT_OT_ViewPlaneRotate:
"""Rotate Selected Vertices about Pivot Point in View Plane"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
obj = context.object
if obj is None:
return False
return all... | the_stack_v2_python_sparse | src/bpy/3.6/scripts/addons/precision_drawing_tools/pdt_pivot_point.py | RnoB/3DVisualSwarm | train | 0 |
3f6c6bd6846c263b3dcb3012b51fa9feff31414e | [
"self.tobjects = tobjects\nself.find_nearest_neighbours = find_nearest_neighbours\nself.k = k\nself.smoothing_param = smoothing_param\nself.get_labels = get_labels\nself.kernel = kernel\nself.printer = printer\nself.neigh_events = range(k + 2)\nif neigh_events:\n self.neigh_events = neigh_events\nself.labels = s... | <|body_start_0|>
self.tobjects = tobjects
self.find_nearest_neighbours = find_nearest_neighbours
self.k = k
self.smoothing_param = smoothing_param
self.get_labels = get_labels
self.kernel = kernel
self.printer = printer
self.neigh_events = range(k + 2)
... | Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and a posteriori probabilities. | MlknnBasic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MlknnBasic:
"""Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and a posteriori probabilities."""
de... | stack_v2_sparse_classes_36k_train_021312 | 7,074 | no_license | [
{
"docstring": "Constructor. @type tobjects: list of training objects @param tobjects: used to calculate parameters (probabilities) and nearest neighbours amongst the training objects it returns; NOTE: if a user wants to manipulate, which codes to consider(e.g. higher or lower level) it is good to give a specif... | 5 | null | Implement the Python class `MlknnBasic` described below.
Class description:
Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and... | Implement the Python class `MlknnBasic` described below.
Class description:
Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and... | e38508de91f8a7bda3096c6f0a361734207357a5 | <|skeleton|>
class MlknnBasic:
"""Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and a posteriori probabilities."""
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MlknnBasic:
"""Naive Bayes with KNN as features. A classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. Processing of the whole dataset is being performed in order to calculate a priori and a posteriori probabilities."""
def __init__(se... | the_stack_v2_python_sparse | src/main/python/document_classification/mlknn/mlknn_basic.py | pszostek/research-python-backup | train | 0 |
0a988ab8be2eca97af790a6bc193eeee092c90ba | [
"m, n = (len(obstacleGrid), len(obstacleGrid[0]))\ndp = [[0 for _ in range(n)] for _ in range(m)]\ndp[0][0] = 0 if obstacleGrid[0][0] else 1\nfor i in range(m):\n for j in range(n):\n if obstacleGrid[i][j]:\n dp[i][j] = 0\n else:\n if i:\n dp[i][j] += dp[i - 1][... | <|body_start_0|>
m, n = (len(obstacleGrid), len(obstacleGrid[0]))
dp = [[0 for _ in range(n)] for _ in range(m)]
dp[0][0] = 0 if obstacleGrid[0][0] else 1
for i in range(m):
for j in range(n):
if obstacleGrid[i][j]:
dp[i][j] = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int:
"""典型DP"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid: List[List[int]]) -> int:
"""二维数组压缩成一维数组 dp[j] = dp[j] + dp[j - 1] new dp[j] = old dp[j] + dp[j-1] current cell... | stack_v2_sparse_classes_36k_train_021313 | 1,748 | no_license | [
{
"docstring": "典型DP",
"name": "uniquePathsWithObstacles1",
"signature": "def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int"
},
{
"docstring": "二维数组压缩成一维数组 dp[j] = dp[j] + dp[j - 1] new dp[j] = old dp[j] + dp[j-1] current cell = top cell + left cell",
"name": "uniqueP... | 2 | stack_v2_sparse_classes_30k_train_018600 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int: 典型DP
- def uniquePathsWithObstacles2(self, obstacleGrid: List[List[int]]) -> int: 二维数组压缩成一维数组 dp[j] = d... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int: 典型DP
- def uniquePathsWithObstacles2(self, obstacleGrid: List[List[int]]) -> int: 二维数组压缩成一维数组 dp[j] = d... | 2bbb1640589aab34f2bc42489283033cc11fb885 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int:
"""典型DP"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid: List[List[int]]) -> int:
"""二维数组压缩成一维数组 dp[j] = dp[j] + dp[j - 1] new dp[j] = old dp[j] + dp[j-1] current cell... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int:
"""典型DP"""
m, n = (len(obstacleGrid), len(obstacleGrid[0]))
dp = [[0 for _ in range(n)] for _ in range(m)]
dp[0][0] = 0 if obstacleGrid[0][0] else 1
for i in range(m):
for j... | the_stack_v2_python_sparse | 063_unique-paths-ii.py | helloocc/algorithm | train | 1 | |
19ffbdee98cad56139ba969957b225b6be743c8e | [
"self.preorder = _preorder\nself.inorder = _inorder\nreturn self.dfs(0, len(self.preorder) - 1, 0, len(self.inorder) - 1)",
"if pl > pr:\n return\nroot = TreeNode(self.preorder[pl])\nidx = self.inorder.index(self.preorder[pl])\nleft = self.dfs(pl + 1, pl + idx - il, il, idx - 1)\nright = self.dfs(pl + idx - il... | <|body_start_0|>
self.preorder = _preorder
self.inorder = _inorder
return self.dfs(0, len(self.preorder) - 1, 0, len(self.inorder) - 1)
<|end_body_0|>
<|body_start_1|>
if pl > pr:
return
root = TreeNode(self.preorder[pl])
idx = self.inorder.index(self.preorde... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def buildTree(self, _preorder, _inorder):
""":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode"""
<|body_0|>
def dfs(self, pl, pr, il, ir):
"""数组范围是闭区间 pl:前序遍历左边界 pr:前序遍历右边界 il:中序遍历左边界 ir:中序遍历右边界"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_021314 | 1,677 | no_license | [
{
"docstring": ":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode",
"name": "buildTree",
"signature": "def buildTree(self, _preorder, _inorder)"
},
{
"docstring": "数组范围是闭区间 pl:前序遍历左边界 pr:前序遍历右边界 il:中序遍历左边界 ir:中序遍历右边界",
"name": "dfs",
"signature": "def dfs(self, pl, pr, ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, _preorder, _inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode
- def dfs(self, pl, pr, il, ir): 数组范围是闭区间 pl:前序遍历左边界 pr:前序遍历右边界 il:中... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, _preorder, _inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode
- def dfs(self, pl, pr, il, ir): 数组范围是闭区间 pl:前序遍历左边界 pr:前序遍历右边界 il:中... | 967b0fbb40ae491b552bc3365a481e66324cb6f2 | <|skeleton|>
class Solution:
def buildTree(self, _preorder, _inorder):
""":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode"""
<|body_0|>
def dfs(self, pl, pr, il, ir):
"""数组范围是闭区间 pl:前序遍历左边界 pr:前序遍历右边界 il:中序遍历左边界 ir:中序遍历右边界"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def buildTree(self, _preorder, _inorder):
""":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode"""
self.preorder = _preorder
self.inorder = _inorder
return self.dfs(0, len(self.preorder) - 1, 0, len(self.inorder) - 1)
def dfs(self, pl, pr, il, ir... | the_stack_v2_python_sparse | jianzhi_offer/06_前序遍历和中序遍历构建二叉树.py | ryanatgz/data_structure_and_algorithm | train | 0 | |
ab73d6d10a8dac78f1221aa24f297f174f1e52d7 | [
"cls = super(PacketFactory, mcs).__new__(mcs, name, bases, attrs)\nif cls.__type__ is not None and cls.__type__ not in PacketFactory._PACKETS:\n PacketFactory._PACKETS[cls.__type__] = cls\nreturn cls",
"cls = PacketFactory._PACKETS[dct['type']]\nif type(cls) != mcs:\n cls = type(cls).get_class(dct, server)\... | <|body_start_0|>
cls = super(PacketFactory, mcs).__new__(mcs, name, bases, attrs)
if cls.__type__ is not None and cls.__type__ not in PacketFactory._PACKETS:
PacketFactory._PACKETS[cls.__type__] = cls
return cls
<|end_body_0|>
<|body_start_1|>
cls = PacketFactory._PACKETS[dc... | A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary. | PacketFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PacketFactory:
"""A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary."""
def __new__(mcs, name, bases, attrs):
"""Register a new packet class into the factory."""
<|body_0|>
def ge... | stack_v2_sparse_classes_36k_train_021315 | 15,461 | no_license | [
{
"docstring": "Register a new packet class into the factory.",
"name": "__new__",
"signature": "def __new__(mcs, name, bases, attrs)"
},
{
"docstring": "Instantiate the packet corresponding to the serialized dictionary. It will check if the packet type is registered, the deferred the request to... | 2 | stack_v2_sparse_classes_30k_train_010048 | Implement the Python class `PacketFactory` described below.
Class description:
A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.
Method signatures and docstrings:
- def __new__(mcs, name, bases, attrs): Register a new packet ... | Implement the Python class `PacketFactory` described below.
Class description:
A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary.
Method signatures and docstrings:
- def __new__(mcs, name, bases, attrs): Register a new packet ... | cd19e3168b4661312efdc80b5b7c006a70b8004b | <|skeleton|>
class PacketFactory:
"""A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary."""
def __new__(mcs, name, bases, attrs):
"""Register a new packet class into the factory."""
<|body_0|>
def ge... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PacketFactory:
"""A metaclass that is used to register new packet classes as they are being defined, and instantiate new packets from their name when necessary."""
def __new__(mcs, name, bases, attrs):
"""Register a new packet class into the factory."""
cls = super(PacketFactory, mcs).__n... | the_stack_v2_python_sparse | idarling/idarling/idarling/shared/packets.py | saidelike/IDArling-1 | train | 0 |
7cdf23278627b02ade640e880f7d7d53818f3bed | [
"self._fixed_length_left = fixed_length_left\nself._fixed_length_right = fixed_length_right\nself._pad_value = pad_value\nself._pad_mode = pad_mode",
"batch_size = len(x['id_left'])\npad_length_left = max(x['length_left'])\npad_length_right = max(x['length_right'])\nbin_size = len(x['match_histogram'][0][0])\nif ... | <|body_start_0|>
self._fixed_length_left = fixed_length_left
self._fixed_length_right = fixed_length_right
self._pad_value = pad_value
self._pad_mode = pad_mode
<|end_body_0|>
<|body_start_1|>
batch_size = len(x['id_left'])
pad_length_left = max(x['length_left'])
... | Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the value to fill text. :param pad_mode: String, `pre` or `post`: pad either befo... | DRMMPadding | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DRMMPadding:
"""Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the value to fill text. :param pad_mode: S... | stack_v2_sparse_classes_36k_train_021316 | 10,301 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self, fixed_length_left: int=None, fixed_length_right: int=None, pad_value: typing.Union[int, str]=0, pad_mode: str='pre')"
},
{
"docstring": "Padding. Pad `x['text_left']`, `x['text_right]` and `x['match_histogram']`.",
... | 2 | stack_v2_sparse_classes_30k_train_009542 | Implement the Python class `DRMMPadding` described below.
Class description:
Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the... | Implement the Python class `DRMMPadding` described below.
Class description:
Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the... | 4198ebce942f4afe7ddca6a96ab6f4464ade4518 | <|skeleton|>
class DRMMPadding:
"""Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the value to fill text. :param pad_mode: S... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DRMMPadding:
"""Pad data for DRMM Model. :param fixed_length_left: Integer. If set, `text_left` and `match_histogram` will be padded to this length. :param fixed_length_right: Integer. If set, `text_right` will be padded to this length. :param pad_value: the value to fill text. :param pad_mode: String, `pre` ... | the_stack_v2_python_sparse | poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/callbacks/padding.py | microsoft/ContextualSP | train | 332 |
ac2c663028da2b2c85c43146546642cad817c895 | [
"url = utils.urljoin(Cluster.base_path, self.id, 'actions', 'resize')\nheaders = {'Accept': ''}\nbody = {'node_count': node_count, 'nodes_to_remove': nodes_to_remove}\nresponse = session.post(url, json=body, headers=headers)\nexceptions.raise_from_response(response)\nreturn response['uuid']",
"url = utils.urljoin... | <|body_start_0|>
url = utils.urljoin(Cluster.base_path, self.id, 'actions', 'resize')
headers = {'Accept': ''}
body = {'node_count': node_count, 'nodes_to_remove': nodes_to_remove}
response = session.post(url, json=body, headers=headers)
exceptions.raise_from_response(response)
... | Cluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cluster:
def resize(self, session, *, node_count, nodes_to_remove=None):
"""Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default is 1. :param nodes_to_remove: The server ID list will be removed if downsizing the cluster. :re... | stack_v2_sparse_classes_36k_train_021317 | 8,130 | permissive | [
{
"docstring": "Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default is 1. :param nodes_to_remove: The server ID list will be removed if downsizing the cluster. :returns: The UUID of the resized cluster. :raises: :exc:`~openstack.exceptions.Resourc... | 2 | null | Implement the Python class `Cluster` described below.
Class description:
Implement the Cluster class.
Method signatures and docstrings:
- def resize(self, session, *, node_count, nodes_to_remove=None): Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default... | Implement the Python class `Cluster` described below.
Class description:
Implement the Cluster class.
Method signatures and docstrings:
- def resize(self, session, *, node_count, nodes_to_remove=None): Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default... | d474eb84c605c429bb9cccb166cabbdd1654d73c | <|skeleton|>
class Cluster:
def resize(self, session, *, node_count, nodes_to_remove=None):
"""Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default is 1. :param nodes_to_remove: The server ID list will be removed if downsizing the cluster. :re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cluster:
def resize(self, session, *, node_count, nodes_to_remove=None):
"""Resize the cluster. :param node_count: The number of servers that will serve as node in the bay/cluster. The default is 1. :param nodes_to_remove: The server ID list will be removed if downsizing the cluster. :returns: The UUI... | the_stack_v2_python_sparse | openstack/container_infrastructure_management/v1/cluster.py | openstack/openstacksdk | train | 124 | |
958f327f325a4471ae42158cdbe82f926c740162 | [
"if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\n self.n = int(n)\n self.p = float(p)\nelse:\n if type(data) != list:\n TypeError('data must be a list')\n if l... | <|body_start_0|>
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than 1')
self.n = int(n)
self.p = float(p)
else:
... | Binomial distribution | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""Binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”"""
<|body_0|>
def pmf(self, k):
"""Calcu... | stack_v2_sparse_classes_36k_train_021318 | 2,120 | no_license | [
{
"docstring": "data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Calculates the value of the PMF for a given... | 3 | null | Implement the Python class `Binomial` described below.
Class description:
Binomial distribution
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”
- de... | Implement the Python class `Binomial` described below.
Class description:
Binomial distribution
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”
- de... | 0b56aa0e92d65d4a5832cc994769834fbcfbe0ac | <|skeleton|>
class Binomial:
"""Binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”"""
<|body_0|>
def pmf(self, k):
"""Calcu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""Binomial distribution"""
def __init__(self, data=None, n=1, p=0.5):
"""data is a list of the data to be used to estimate the distribution n is the number of Bernoulli trials p is the probability of a “success”"""
if data is None:
if n <= 0:
raise V... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | ikki2530/holbertonschool-machine_learning | train | 0 |
51159822727d1eef0074618b80366d8c8ae8d915 | [
"super(ExamSheetSerializer, self).__init__(*args, **kwargs)\nusers = User.objects.filter(id=self.context['request'].user.id)\nself.fields['owner'].queryset = users",
"queryset = Question.objects.filter(sheet=obj)\nquestions = []\nfor q in queryset:\n questions.append(q.text)\nreturn questions"
] | <|body_start_0|>
super(ExamSheetSerializer, self).__init__(*args, **kwargs)
users = User.objects.filter(id=self.context['request'].user.id)
self.fields['owner'].queryset = users
<|end_body_0|>
<|body_start_1|>
queryset = Question.objects.filter(sheet=obj)
questions = []
... | ExamSheetSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExamSheetSerializer:
def __init__(self, *args, **kwargs):
"""Teacher can only add examsheet with himself as an owner"""
<|body_0|>
def get_questions(self, obj):
"""Simply returns all questions which belongs to this examsheet"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_021319 | 3,922 | no_license | [
{
"docstring": "Teacher can only add examsheet with himself as an owner",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Simply returns all questions which belongs to this examsheet",
"name": "get_questions",
"signature": "def get_questions(self... | 2 | stack_v2_sparse_classes_30k_train_012152 | Implement the Python class `ExamSheetSerializer` described below.
Class description:
Implement the ExamSheetSerializer class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Teacher can only add examsheet with himself as an owner
- def get_questions(self, obj): Simply returns all questions wh... | Implement the Python class `ExamSheetSerializer` described below.
Class description:
Implement the ExamSheetSerializer class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Teacher can only add examsheet with himself as an owner
- def get_questions(self, obj): Simply returns all questions wh... | 2651ac12078c7d5435d1fb23585bb275c974ce30 | <|skeleton|>
class ExamSheetSerializer:
def __init__(self, *args, **kwargs):
"""Teacher can only add examsheet with himself as an owner"""
<|body_0|>
def get_questions(self, obj):
"""Simply returns all questions which belongs to this examsheet"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExamSheetSerializer:
def __init__(self, *args, **kwargs):
"""Teacher can only add examsheet with himself as an owner"""
super(ExamSheetSerializer, self).__init__(*args, **kwargs)
users = User.objects.filter(id=self.context['request'].user.id)
self.fields['owner'].queryset = use... | the_stack_v2_python_sparse | ExamAPI/Sheets/serializers.py | mtyton/ExamSheetEvaluator-API | train | 0 | |
7264f7018531a0b39d2eefdcc4aec3aa42e1b040 | [
"super(AttentionEncoder, self).__init__()\nself.lookup = nn.Embedding(vocab_size, emb_size)\nif pretrained_emb is None:\n xavier_uniform(self.lookup.weight.data)\nelse:\n assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has incorrect size: {} instead of {}'.format(w_emb.size(), (... | <|body_start_0|>
super(AttentionEncoder, self).__init__()
self.lookup = nn.Embedding(vocab_size, emb_size)
if pretrained_emb is None:
xavier_uniform(self.lookup.weight.data)
else:
assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has i... | Segment encoder that produces segment vectors as the weighted average of word embeddings. | AttentionEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttentionEncoder:
"""Segment encoder that produces segment vectors as the weighted average of word embeddings."""
def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False):
"""Initializes the encoder using a [vocab_size x emb_size] embe... | stack_v2_sparse_classes_36k_train_021320 | 22,149 | permissive | [
{
"docstring": "Initializes the encoder using a [vocab_size x emb_size] embedding matrix. The encoder learns a matrix M, which may be initialized explicitely or randomly. Parameters: vocab_size (int): the vocabulary size emb_size (int): dimensionality of embeddings bias (bool): whether or not to use a bias vect... | 2 | stack_v2_sparse_classes_30k_train_007242 | Implement the Python class `AttentionEncoder` described below.
Class description:
Segment encoder that produces segment vectors as the weighted average of word embeddings.
Method signatures and docstrings:
- def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini... | Implement the Python class `AttentionEncoder` described below.
Class description:
Segment encoder that produces segment vectors as the weighted average of word embeddings.
Method signatures and docstrings:
- def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini... | 41452f447284491cf8ade8e09f3bc4e314ec64f7 | <|skeleton|>
class AttentionEncoder:
"""Segment encoder that produces segment vectors as the weighted average of word embeddings."""
def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False):
"""Initializes the encoder using a [vocab_size x emb_size] embe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttentionEncoder:
"""Segment encoder that produces segment vectors as the weighted average of word embeddings."""
def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False):
"""Initializes the encoder using a [vocab_size x emb_size] embedding matrix.... | the_stack_v2_python_sparse | iswd/model_library.py | gkaramanolakis/ISWD | train | 7 |
a8e1db8ad76b062f7529f92f2620afd0299c7bfd | [
"node2neighbors = {}\nfor node in graph:\n node2neighbors[node] = set(node.neighbors)\n\ndef cmp(a, b):\n if a in node2neighbors[b]:\n return 1\n if b in node2neighbors[a]:\n return -1\n return 0\ngraph.sort(cmp=cmp)\nreturn graph",
"pi = {}\nfor node in graph:\n pi[node] = set()\nfor... | <|body_start_0|>
node2neighbors = {}
for node in graph:
node2neighbors[node] = set(node.neighbors)
def cmp(a, b):
if a in node2neighbors[b]:
return 1
if b in node2neighbors[a]:
return -1
return 0
graph.sort(... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def topSort_error(self, graph):
""":param graph: :return: graph"""
<|body_0|>
def topSort_normal(self, graph):
"""Without dfs/bfs 1. get all the predecessors of each node 2. pop a node without a predecessors and add it to result list 3. update the predecess... | stack_v2_sparse_classes_36k_train_021321 | 2,948 | permissive | [
{
"docstring": ":param graph: :return: graph",
"name": "topSort_error",
"signature": "def topSort_error(self, graph)"
},
{
"docstring": "Without dfs/bfs 1. get all the predecessors of each node 2. pop a node without a predecessors and add it to result list 3. update the predecessors of each node... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def topSort_error(self, graph): :param graph: :return: graph
- def topSort_normal(self, graph): Without dfs/bfs 1. get all the predecessors of each node 2. pop a node without a p... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def topSort_error(self, graph): :param graph: :return: graph
- def topSort_normal(self, graph): Without dfs/bfs 1. get all the predecessors of each node 2. pop a node without a p... | 4629a3857b2c57418b86a3b3a7180ecb15e763e3 | <|skeleton|>
class Solution:
def topSort_error(self, graph):
""":param graph: :return: graph"""
<|body_0|>
def topSort_normal(self, graph):
"""Without dfs/bfs 1. get all the predecessors of each node 2. pop a node without a predecessors and add it to result list 3. update the predecess... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def topSort_error(self, graph):
""":param graph: :return: graph"""
node2neighbors = {}
for node in graph:
node2neighbors[node] = set(node.neighbors)
def cmp(a, b):
if a in node2neighbors[b]:
return 1
if b in node2ne... | the_stack_v2_python_sparse | Topological Sorting.py | RijuDasgupta9116/LintCode | train | 0 | |
ebf3cc3dd453c3b141b815afd099e23938d46c17 | [
"stack, node, last, depths = ([], root, None, {})\nprint(node.val, stack, last, depths)\nwhile stack or node:\n if node:\n print(node.val, stack, last, depths)\n stack.append(node)\n node = node.left\n else:\n node = stack[-1]\n if not node.right or last == node.right:\n ... | <|body_start_0|>
stack, node, last, depths = ([], root, None, {})
print(node.val, stack, last, depths)
while stack or node:
if node:
print(node.val, stack, last, depths)
stack.append(node)
node = node.left
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBalanced_iterative(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isBalanced_recursive(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stack, node, last, depths =... | stack_v2_sparse_classes_36k_train_021322 | 2,113 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isBalanced_iterative",
"signature": "def isBalanced_iterative(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isBalanced_recursive",
"signature": "def isBalanced_recursive(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009451 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced_iterative(self, root): :type root: TreeNode :rtype: bool
- def isBalanced_recursive(self, root): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced_iterative(self, root): :type root: TreeNode :rtype: bool
- def isBalanced_recursive(self, root): :type root: TreeNode :rtype: bool
<|skeleton|>
class Solution:
... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def isBalanced_iterative(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isBalanced_recursive(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isBalanced_iterative(self, root):
""":type root: TreeNode :rtype: bool"""
stack, node, last, depths = ([], root, None, {})
print(node.val, stack, last, depths)
while stack or node:
if node:
print(node.val, stack, last, depths)
... | the_stack_v2_python_sparse | 110_isBalance.py | jennyChing/leetCode | train | 2 | |
0ab0b0c37a84d9b350b48acb1b70954d5714ac12 | [
"for idx in POSSIBLE_INDEXES:\n try:\n soup = BeautifulSoup(open(os.path.join(self.docpath, idx)), 'lxml')\n break\n except IOError:\n pass\nelse:\n raise IOError(errno.ENOENT, 'Essential index file not found.')\nfor t in _parse_soup(soup):\n yield t",
"link = soup.find('a', {'cla... | <|body_start_0|>
for idx in POSSIBLE_INDEXES:
try:
soup = BeautifulSoup(open(os.path.join(self.docpath, idx)), 'lxml')
break
except IOError:
pass
else:
raise IOError(errno.ENOENT, 'Essential index file not found.')
... | Parser for Sphinx-based documenation: Python, Django, Pyramid... | SphinxParser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphinxParser:
"""Parser for Sphinx-based documenation: Python, Django, Pyramid..."""
def parse(self):
"""Parse sphinx docs at *path*. yield tuples of symbol name, type and path"""
<|body_0|>
def find_and_patch_entry(self, soup, entry):
"""Modify soup so dash can ... | stack_v2_sparse_classes_36k_train_021323 | 35,122 | no_license | [
{
"docstring": "Parse sphinx docs at *path*. yield tuples of symbol name, type and path",
"name": "parse",
"signature": "def parse(self)"
},
{
"docstring": "Modify soup so dash can generate TOCs on the fly.",
"name": "find_and_patch_entry",
"signature": "def find_and_patch_entry(self, so... | 2 | null | Implement the Python class `SphinxParser` described below.
Class description:
Parser for Sphinx-based documenation: Python, Django, Pyramid...
Method signatures and docstrings:
- def parse(self): Parse sphinx docs at *path*. yield tuples of symbol name, type and path
- def find_and_patch_entry(self, soup, entry): Mod... | Implement the Python class `SphinxParser` described below.
Class description:
Parser for Sphinx-based documenation: Python, Django, Pyramid...
Method signatures and docstrings:
- def parse(self): Parse sphinx docs at *path*. yield tuples of symbol name, type and path
- def find_and_patch_entry(self, soup, entry): Mod... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class SphinxParser:
"""Parser for Sphinx-based documenation: Python, Django, Pyramid..."""
def parse(self):
"""Parse sphinx docs at *path*. yield tuples of symbol name, type and path"""
<|body_0|>
def find_and_patch_entry(self, soup, entry):
"""Modify soup so dash can ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SphinxParser:
"""Parser for Sphinx-based documenation: Python, Django, Pyramid..."""
def parse(self):
"""Parse sphinx docs at *path*. yield tuples of symbol name, type and path"""
for idx in POSSIBLE_INDEXES:
try:
soup = BeautifulSoup(open(os.path.join(self.doc... | the_stack_v2_python_sparse | repoData/hynek-doc2dash/allPythonContent.py | aCoffeeYin/pyreco | train | 0 |
256e12fdc5af08aa2a20428f55cb186d1a4b991f | [
"self.bisnode_username = bisnode_username\nself.bisnode_password = bisnode_password\nself.include_pdf_reports = include_pdf_reports\nself.official_username = official_username\nself.official_password = official_password\nself.official_reason = official_reason\nself.official_system = official_system\nself.aml_nation... | <|body_start_0|>
self.bisnode_username = bisnode_username
self.bisnode_password = bisnode_password
self.include_pdf_reports = include_pdf_reports
self.official_username = official_username
self.official_password = official_password
self.official_reason = official_reason
... | Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string): TODO: type description here. official_username (string): TODO: type description he... | SpecialProperties | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecialProperties:
"""Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string): TODO: type description here. official... | stack_v2_sparse_classes_36k_train_021324 | 4,533 | permissive | [
{
"docstring": "Constructor for the SpecialProperties class",
"name": "__init__",
"signature": "def __init__(self, bisnode_username=None, bisnode_password=None, include_pdf_reports=None, official_username=None, official_password=None, official_reason=None, official_system=None, aml_nationality=None, aml... | 2 | null | Implement the Python class `SpecialProperties` described below.
Class description:
Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string)... | Implement the Python class `SpecialProperties` described below.
Class description:
Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string)... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class SpecialProperties:
"""Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string): TODO: type description here. official... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecialProperties:
"""Implementation of the 'SpecialProperties' model. TODO: type model description here. Attributes: bisnode_username (string): TODO: type description here. bisnode_password (string): TODO: type description here. include_pdf_reports (string): TODO: type description here. official_username (st... | the_stack_v2_python_sparse | idfy_rest_client/models/special_properties.py | dealflowteam/Idfy | train | 0 |
40156aeda5db65df5bac7d87240906e4c30c5f1b | [
"self.num_heads = num_heads\nself.block = block\nself.different_layout_per_head = different_layout_per_head\nself.num_layout_heads = num_heads if different_layout_per_head else 1",
"if seq_len % self.block != 0:\n raise ValueError(f'Sequence Length, {seq_len}, needs to be dividable by Block size {self.block}!'... | <|body_start_0|>
self.num_heads = num_heads
self.block = block
self.different_layout_per_head = different_layout_per_head
self.num_layout_heads = num_heads if different_layout_per_head else 1
<|end_body_0|>
<|body_start_1|>
if seq_len % self.block != 0:
raise ValueEr... | Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functionality. | SparsityConfig | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparsityConfig:
"""Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functionality."""
def __init__(self, num... | stack_v2_sparse_classes_36k_train_021325 | 42,463 | permissive | [
{
"docstring": "Initialize the Sparsity Pattern Config. For usage example please see, TODO DeepSpeed Sparse Transformer Tutorial Arguments: num_heads: required: an integer determining number of attention heads of the layer. block: optional: an integer determining the block size. Current implementation of sparse... | 3 | null | Implement the Python class `SparsityConfig` described below.
Class description:
Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functi... | Implement the Python class `SparsityConfig` described below.
Class description:
Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functi... | 55d9964c59c0c6e23158b5789a5c36c28939a7b0 | <|skeleton|>
class SparsityConfig:
"""Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functionality."""
def __init__(self, num... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SparsityConfig:
"""Abstract Configuration class to store `sparsity configuration of a self attention layer`. It contains shared property of different block-sparse sparsity patterns. However, each class needs to extend it based on required property and functionality."""
def __init__(self, num_heads, block... | the_stack_v2_python_sparse | deepspeed/ops/sparse_attention/sparsity_config.py | microsoft/DeepSpeed | train | 27,557 |
64afc0a3d40b5cfa056454125a537b828f83d3c2 | [
"if value == '':\n raise ValueError(\"value can't be an empty string\")\nreturn value",
"if not validate_isbn_digit(value):\n raise ValueError('value is not a valid ISBN')\nreturn value",
"if value < 1:\n raise ValueError(\"number of pages can't be 0 or less\")\nreturn value"
] | <|body_start_0|>
if value == '':
raise ValueError("value can't be an empty string")
return value
<|end_body_0|>
<|body_start_1|>
if not validate_isbn_digit(value):
raise ValueError('value is not a valid ISBN')
return value
<|end_body_1|>
<|body_start_2|>
... | Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos. | BookV2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookV2:
"""Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos."""
def validate_not_empty(cls, value: str, **kwargs) -> str:
"""Verifica se os campos informados não estão vazios."""
<|body_0|>
def validate_isbn(cls, val... | stack_v2_sparse_classes_36k_train_021326 | 2,791 | no_license | [
{
"docstring": "Verifica se os campos informados não estão vazios.",
"name": "validate_not_empty",
"signature": "def validate_not_empty(cls, value: str, **kwargs) -> str"
},
{
"docstring": "Verifica se o ISBN informado é válido.",
"name": "validate_isbn",
"signature": "def validate_isbn(... | 3 | stack_v2_sparse_classes_30k_train_001171 | Implement the Python class `BookV2` described below.
Class description:
Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.
Method signatures and docstrings:
- def validate_not_empty(cls, value: str, **kwargs) -> str: Verifica se os campos informados não estão vazi... | Implement the Python class `BookV2` described below.
Class description:
Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos.
Method signatures and docstrings:
- def validate_not_empty(cls, value: str, **kwargs) -> str: Verifica se os campos informados não estão vazi... | 11d8391f0db79331892884a391750810399a3c45 | <|skeleton|>
class BookV2:
"""Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos."""
def validate_not_empty(cls, value: str, **kwargs) -> str:
"""Verifica se os campos informados não estão vazios."""
<|body_0|>
def validate_isbn(cls, val... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BookV2:
"""Segunda versão da classe de livros contento todos os campos dos exemplos anteriores e mais alguns novos."""
def validate_not_empty(cls, value: str, **kwargs) -> str:
"""Verifica se os campos informados não estão vazios."""
if value == '':
raise ValueError("value can... | the_stack_v2_python_sparse | usando-o-pydantic/books/models.py | plainspooky/giovannireisnunes | train | 11 |
1be18f30372b9169ef9deb2d4ce604483a97b78f | [
"if nums == []:\n return None\nfirst = 0\nlast = len(nums) - 1\nwhile last - first > 1:\n mid = (first + last) // 2\n if nums[mid] > target:\n last = mid\n else:\n first = mid\nif nums[first] == target:\n return first\nelif nums[last] == target:\n return last\nelse:\n return None"... | <|body_start_0|>
if nums == []:
return None
first = 0
last = len(nums) - 1
while last - first > 1:
mid = (first + last) // 2
if nums[mid] > target:
last = mid
else:
first = mid
if nums[first] == targe... | Solution1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if... | stack_v2_sparse_classes_36k_train_021327 | 1,527 | no_license | [
{
"docstring": ":type nums: list :type target int",
"name": "binarysearch",
"signature": "def binarysearch(self, nums, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019478 | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def binarysearch(self, nums, target): :type nums: list :type target int
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def binarysearch(self, nums, target): :type nums: list :type target int
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
<|ske... | 9bd2d706f014ce84356ba38fc7801da0285a91d3 | <|skeleton|>
class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
if nums == []:
return None
first = 0
last = len(nums) - 1
while last - first > 1:
mid = (first + last) // 2
if nums[mid] > target:
... | the_stack_v2_python_sparse | leetcode/twoSum-167.py | pittcat/Algorithm_Practice | train | 0 | |
eb5a3d1ef291a7fb31526610ba6d5a92dc0d3f84 | [
"self.is_training = is_training\nself.root = root\nself.shuffle = shuffle\nself.drop_last = drop_last\nself.num_instances = num_instances\nself.instance_id = instance_id\nResnetMediaPipe.instance_count += 1\npipe_name = '{}:{}'.format(self.__class__.__name__, ResnetMediaPipe.instance_count)\npipe_name = str(pipe_na... | <|body_start_0|>
self.is_training = is_training
self.root = root
self.shuffle = shuffle
self.drop_last = drop_last
self.num_instances = num_instances
self.instance_id = instance_id
ResnetMediaPipe.instance_count += 1
pipe_name = '{}:{}'.format(self.__class... | Class defining resnet media pipe. | ResnetMediaPipe | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResnetMediaPipe:
"""Class defining resnet media pipe."""
def __init__(self, is_training=False, root=None, batch_size=1, shuffle=False, drop_last=True, queue_depth=1, num_instances=1, instance_id=0, device=None, seed=None):
""":params is_training: True if ResnetMediaPipe handles train... | stack_v2_sparse_classes_36k_train_021328 | 7,309 | permissive | [
{
"docstring": ":params is_training: True if ResnetMediaPipe handles training data, False in case of evaluation. :params root: path from which to load the images. :params batch_size: mediapipe output batch size. :params shuffle: whether images have to be shuffled. :params drop_last: whether to drop the last inc... | 2 | stack_v2_sparse_classes_30k_train_009020 | Implement the Python class `ResnetMediaPipe` described below.
Class description:
Class defining resnet media pipe.
Method signatures and docstrings:
- def __init__(self, is_training=False, root=None, batch_size=1, shuffle=False, drop_last=True, queue_depth=1, num_instances=1, instance_id=0, device=None, seed=None): :... | Implement the Python class `ResnetMediaPipe` described below.
Class description:
Class defining resnet media pipe.
Method signatures and docstrings:
- def __init__(self, is_training=False, root=None, batch_size=1, shuffle=False, drop_last=True, queue_depth=1, num_instances=1, instance_id=0, device=None, seed=None): :... | 3ca77c4a5fb62c60372e8a2839b1fccc3c4e4212 | <|skeleton|>
class ResnetMediaPipe:
"""Class defining resnet media pipe."""
def __init__(self, is_training=False, root=None, batch_size=1, shuffle=False, drop_last=True, queue_depth=1, num_instances=1, instance_id=0, device=None, seed=None):
""":params is_training: True if ResnetMediaPipe handles train... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResnetMediaPipe:
"""Class defining resnet media pipe."""
def __init__(self, is_training=False, root=None, batch_size=1, shuffle=False, drop_last=True, queue_depth=1, num_instances=1, instance_id=0, device=None, seed=None):
""":params is_training: True if ResnetMediaPipe handles training data, Fal... | the_stack_v2_python_sparse | PyTorch/computer_vision/classification/torchvision/resnet_media_pipe.py | HabanaAI/Model-References | train | 108 |
4becf18393dc157d266e77c022864c96567ad973 | [
"super(CenterLineAtYAxis, self).__init__(dim)\nself.output_size = output_size\nself.output_spacing = output_spacing",
"if self.dim == 2:\n return self.get_2d(**kwargs)\nelif self.dim == 3:\n return self.get_3d(**kwargs)",
"input_image = kwargs.get('image')\nline = kwargs.get('line')\noutput_size = kwargs.... | <|body_start_0|>
super(CenterLineAtYAxis, self).__init__(dim)
self.output_size = output_size
self.output_spacing = output_spacing
<|end_body_0|>
<|body_start_1|>
if self.dim == 2:
return self.get_2d(**kwargs)
elif self.dim == 3:
return self.get_3d(**kwarg... | A composite transformation that centers a given line at the y axis. Used in the bone generators. | CenterLineAtYAxis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CenterLineAtYAxis:
"""A composite transformation that centers a given line at the y axis. Used in the bone generators."""
def __init__(self, dim, output_size, output_spacing):
"""Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param outpu... | stack_v2_sparse_classes_36k_train_021329 | 7,141 | no_license | [
{
"docstring": "Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param output_spacing: The output image spacing in mm.",
"name": "__init__",
"signature": "def __init__(self, dim, output_size, output_spacing)"
},
{
"docstring": "Returns the sitk transf... | 4 | stack_v2_sparse_classes_30k_train_018619 | Implement the Python class `CenterLineAtYAxis` described below.
Class description:
A composite transformation that centers a given line at the y axis. Used in the bone generators.
Method signatures and docstrings:
- def __init__(self, dim, output_size, output_spacing): Initializer. :param dim: The dimension. :param o... | Implement the Python class `CenterLineAtYAxis` described below.
Class description:
A composite transformation that centers a given line at the y axis. Used in the bone generators.
Method signatures and docstrings:
- def __init__(self, dim, output_size, output_spacing): Initializer. :param dim: The dimension. :param o... | ef6cee91264ba1fe6b40d9823a07647b95bcc2c4 | <|skeleton|>
class CenterLineAtYAxis:
"""A composite transformation that centers a given line at the y axis. Used in the bone generators."""
def __init__(self, dim, output_size, output_spacing):
"""Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param outpu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CenterLineAtYAxis:
"""A composite transformation that centers a given line at the y axis. Used in the bone generators."""
def __init__(self, dim, output_size, output_spacing):
"""Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param output_spacing: Th... | the_stack_v2_python_sparse | transformations/spatial/center_line_at_y_axis.py | XiaoweiXu/MedicalDataAugmentationTool | train | 1 |
f2146900beb4e7321de69cf3268e089901f42a0b | [
"accumulation = 1\nfor i in range(len(nums)):\n accumulation *= nums[i]\nres = [0] * len(nums)\nfor i in range(len(nums)):\n res[i] = accumulation // nums[i]\nreturn res",
"p = 1\nn = len(nums)\noutput = []\nfor i in range(0, n):\n output.append(p)\n p = p * nums[i]\np = 1\nfor i in range(n - 1, -1, -... | <|body_start_0|>
accumulation = 1
for i in range(len(nums)):
accumulation *= nums[i]
res = [0] * len(nums)
for i in range(len(nums)):
res[i] = accumulation // nums[i]
return res
<|end_body_0|>
<|body_start_1|>
p = 1
n = len(nums)
o... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf2(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
accumulation = 1
... | stack_v2_sparse_classes_36k_train_021330 | 957 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf",
"signature": "def productExceptSelf(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf2",
"signature": "def productExceptSelf2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf2(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf2(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleton|>
class Solut... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf2(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
accumulation = 1
for i in range(len(nums)):
accumulation *= nums[i]
res = [0] * len(nums)
for i in range(len(nums)):
res[i] = accumulation // nums[i]
... | the_stack_v2_python_sparse | 238. Product of Array Except Self/product.py | Macielyoung/LeetCode | train | 1 | |
de1b565ab92f8b99e1e726f62cb4d87d2a621710 | [
"storage = get_storage()\nstorage.add_permission_to_role(role_id, permission_id)\nreturn ('', 204)",
"storage = get_storage()\nstorage.remove_permission_from_role(role_id, permission_id)\nreturn ('', 204)"
] | <|body_start_0|>
storage = get_storage()
storage.add_permission_to_role(role_id, permission_id)
return ('', 204)
<|end_body_0|>
<|body_start_1|>
storage = get_storage()
storage.remove_permission_from_role(role_id, permission_id)
return ('', 204)
<|end_body_1|>
| RolePermissionManagementView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RolePermissionManagementView:
def post(self, role_id, permission_id):
"""--- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Permissions responses: 204: description: Permission added to role successfully. 400: $ref: '#/components/responses/400-Ba... | stack_v2_sparse_classes_36k_train_021331 | 5,492 | permissive | [
{
"docstring": "--- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Permissions responses: 204: description: Permission added to role successfully. 400: $ref: '#/components/responses/400-BadRequest' 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/comp... | 2 | stack_v2_sparse_classes_30k_train_014757 | Implement the Python class `RolePermissionManagementView` described below.
Class description:
Implement the RolePermissionManagementView class.
Method signatures and docstrings:
- def post(self, role_id, permission_id): --- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Perm... | Implement the Python class `RolePermissionManagementView` described below.
Class description:
Implement the RolePermissionManagementView class.
Method signatures and docstrings:
- def post(self, role_id, permission_id): --- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Perm... | 280800c73eb7cfd49029462b352887e78f1ff91b | <|skeleton|>
class RolePermissionManagementView:
def post(self, role_id, permission_id):
"""--- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Permissions responses: 204: description: Permission added to role successfully. 400: $ref: '#/components/responses/400-Ba... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RolePermissionManagementView:
def post(self, role_id, permission_id):
"""--- summary: Add a permission to a role parameters: - role_id - permission_id tags: - Roles - Permissions responses: 204: description: Permission added to role successfully. 400: $ref: '#/components/responses/400-BadRequest' 401:... | the_stack_v2_python_sparse | sfa_api/roles.py | SolarArbiter/solarforecastarbiter-api | train | 9 | |
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab | [
"if not 0 < train_prop <= 1:\n raise ValueError(\"'train_prop' must be in (0, 1] (got {}).\".format(train_prop))\nself.train_prop = train_prop\nself._stat_func = stat_func\nself.loc_mean_fit = -1.0\nself.last_timestamp = -1\nself._fitted = False",
"self.last_timestamp = X[-1]\nlast_ind = int(np.ceil(y.size * s... | <|body_start_0|>
if not 0 < train_prop <= 1:
raise ValueError("'train_prop' must be in (0, 1] (got {}).".format(train_prop))
self.train_prop = train_prop
self._stat_func = stat_func
self.loc_mean_fit = -1.0
self.last_timestamp = -1
self._fitted = False
<|end_b... | Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps. | _TSLocalStat | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _TSLocalStat:
"""Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps."""
def __init__(self, stat_func: t.Ca... | stack_v2_sparse_classes_36k_train_021332 | 12,299 | permissive | [
{
"docstring": "Init a Local statistical forecasting model.",
"name": "__init__",
"signature": "def __init__(self, stat_func: t.Callable[[np.ndarray], float], train_prop: float)"
},
{
"docstring": "Fit a local statistical forecasting model.",
"name": "fit",
"signature": "def fit(self, X:... | 3 | stack_v2_sparse_classes_30k_train_010835 | Implement the Python class `_TSLocalStat` described below.
Class description:
Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.
Me... | Implement the Python class `_TSLocalStat` described below.
Class description:
Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.
Me... | 61cc1f63fa055c7466151cfefa7baff8df1702b7 | <|skeleton|>
class _TSLocalStat:
"""Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps."""
def __init__(self, stat_func: t.Ca... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _TSLocalStat:
"""Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps."""
def __init__(self, stat_func: t.Callable[[np.nd... | the_stack_v2_python_sparse | tspymfe/_models.py | FelSiq/ts-pymfe | train | 9 |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"try:\n if AuthorizationService.get_user_authorizations_for_entity(business_identifier):\n response, status = (AffiliationService.find_affiliation(org_id, business_identifier), http_status.HTTP_200_OK)\n else:\n response, status = ({'message': 'Not authorized to perform this action'}, http_statu... | <|body_start_0|>
try:
if AuthorizationService.get_user_authorizations_for_entity(business_identifier):
response, status = (AffiliationService.find_affiliation(org_id, business_identifier), http_status.HTTP_200_OK)
else:
response, status = ({'message': 'Not... | Resource for managing a single affiliation between an org and an entity. | OrgAffiliation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
<|body_0|>
def delete(org_id, business_identifier):
... | stack_v2_sparse_classes_36k_train_021333 | 30,185 | permissive | [
{
"docstring": "Get the affiliation by org id and business identifier with authorized user.",
"name": "get",
"signature": "def get(org_id, business_identifier)"
},
{
"docstring": "Delete an affiliation between an org and an entity.",
"name": "delete",
"signature": "def delete(org_id, bus... | 2 | stack_v2_sparse_classes_30k_train_014571 | Implement the Python class `OrgAffiliation` described below.
Class description:
Resource for managing a single affiliation between an org and an entity.
Method signatures and docstrings:
- def get(org_id, business_identifier): Get the affiliation by org id and business identifier with authorized user.
- def delete(or... | Implement the Python class `OrgAffiliation` described below.
Class description:
Resource for managing a single affiliation between an org and an entity.
Method signatures and docstrings:
- def get(org_id, business_identifier): Get the affiliation by org id and business identifier with authorized user.
- def delete(or... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
<|body_0|>
def delete(org_id, business_identifier):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
try:
if AuthorizationService.get_user_authorizations_for_entit... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
2703daf075f63938ea588500255a478ce402b097 | [
"active = self.actionAt(event.pos())\nif active and active.use_option:\n option = active.widget.option\n if option.is_hovered(event.globalPos()):\n option.clicked.emit()\nsuper(OptionalMenu, self).mouseReleaseEvent(event)",
"active = self.actionAt(event.pos())\nfor action in self.actions():\n acti... | <|body_start_0|>
active = self.actionAt(event.pos())
if active and active.use_option:
option = active.widget.option
if option.is_hovered(event.globalPos()):
option.clicked.emit()
super(OptionalMenu, self).mouseReleaseEvent(event)
<|end_body_0|>
<|body_sta... | A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidgets.QWidgetAction`. | OptionalMenu | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptionalMenu:
"""A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidgets.QWidgetAction`."""
def mouseRe... | stack_v2_sparse_classes_36k_train_021334 | 17,670 | permissive | [
{
"docstring": "Emit option clicked signal if mouse released on it",
"name": "mouseReleaseEvent",
"signature": "def mouseReleaseEvent(self, event)"
},
{
"docstring": "Add highlight to active action",
"name": "mouseMoveEvent",
"signature": "def mouseMoveEvent(self, event)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_009676 | Implement the Python class `OptionalMenu` described below.
Class description:
A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidg... | Implement the Python class `OptionalMenu` described below.
Class description:
A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidg... | 4a0545e5cbca5fee744af8798db7c4b98d6ded04 | <|skeleton|>
class OptionalMenu:
"""A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidgets.QWidgetAction`."""
def mouseRe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OptionalMenu:
"""A subclass of `QtWidgets.QMenu` to work with `OptionalAction` This menu has reimplemented `mouseReleaseEvent`, `mouseMoveEvent` and `leaveEvent` to provide better action hightlighting and triggering for actions that were instances of `QtWidgets.QWidgetAction`."""
def mouseReleaseEvent(se... | the_stack_v2_python_sparse | avalon/tools/widgets.py | MoonShineVFX/avalon-core | train | 0 |
9837782a410026253bc7524b3cab8b438f147d8f | [
"exchanges_list = []\nexchange_data = DegiroConfigHelper.DEGIRO_CONFIG['exchanges']\nfor exchange in exchange_data:\n if all((my_key in exchange for my_key in ['id', 'name', 'country', 'city', 'code', 'hiqAbbr'])):\n exchanges_list.append(Exchange(id=exchange['id'], name=exchange['name'], country=exchange... | <|body_start_0|>
exchanges_list = []
exchange_data = DegiroConfigHelper.DEGIRO_CONFIG['exchanges']
for exchange in exchange_data:
if all((my_key in exchange for my_key in ['id', 'name', 'country', 'city', 'code', 'hiqAbbr'])):
exchanges_list.append(Exchange(id=exchang... | Helper class for degiro config file | DegiroDataHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DegiroDataHelper:
"""Helper class for degiro config file"""
def exchange_to_object():
"""Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object"""
<|body_0|>
def stock_to_object(stock, index_sym, db_tool):
"""Transforms json stock ... | stack_v2_sparse_classes_36k_train_021335 | 4,676 | no_license | [
{
"docstring": "Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object",
"name": "exchange_to_object",
"signature": "def exchange_to_object()"
},
{
"docstring": "Transforms json stock data to sqlalchemy object :param stock: :param index_sym: :param db_tool :return... | 4 | stack_v2_sparse_classes_30k_train_011221 | Implement the Python class `DegiroDataHelper` described below.
Class description:
Helper class for degiro config file
Method signatures and docstrings:
- def exchange_to_object(): Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object
- def stock_to_object(stock, index_sym, db_tool): T... | Implement the Python class `DegiroDataHelper` described below.
Class description:
Helper class for degiro config file
Method signatures and docstrings:
- def exchange_to_object(): Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object
- def stock_to_object(stock, index_sym, db_tool): T... | a2b486d5941dbee01272c49e6e63e289edcf9966 | <|skeleton|>
class DegiroDataHelper:
"""Helper class for degiro config file"""
def exchange_to_object():
"""Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object"""
<|body_0|>
def stock_to_object(stock, index_sym, db_tool):
"""Transforms json stock ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DegiroDataHelper:
"""Helper class for degiro config file"""
def exchange_to_object():
"""Transforms json exchange data to sqlalchemy object :return: exchange sqlalchemy object"""
exchanges_list = []
exchange_data = DegiroConfigHelper.DEGIRO_CONFIG['exchanges']
for exchange... | the_stack_v2_python_sparse | autotrader/broker/degiro/degiro_data_helper.py | SlashGordon/autotrader | train | 1 |
90dd5d969a8567b7e2750ce1d1897e14dcd6ca93 | [
"size = len(nums)\nself.next = [0] * (size + 1)\nself.head = collections.defaultdict(int)\nfor i, n in enumerate(nums):\n self.next[i + 1] = self.head[n]\n self.head[n] = i + 1",
"cnt = 0\nidx = self.head[target]\nwhile idx > 0:\n cnt += 1\n idx = self.next[idx]\nc = int(random.random() * cnt)\nidx = ... | <|body_start_0|>
size = len(nums)
self.next = [0] * (size + 1)
self.head = collections.defaultdict(int)
for i, n in enumerate(nums):
self.next[i + 1] = self.head[n]
self.head[n] = i + 1
<|end_body_0|>
<|body_start_1|>
cnt = 0
idx = self.head[targe... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
size = len(nums)
self.next = [0] * (size ... | stack_v2_sparse_classes_36k_train_021336 | 4,817 | no_license | [
{
"docstring": ":type nums: List[int] :type numsSize: int",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type target: int :rtype: int",
"name": "pick",
"signature": "def pick(self, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int
<|skeleton|>
class Solution:
def __init__(self, ... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
size = len(nums)
self.next = [0] * (size + 1)
self.head = collections.defaultdict(int)
for i, n in enumerate(nums):
self.next[i + 1] = self.head[n]
self.head[n] =... | the_stack_v2_python_sparse | leetcode_python/Math/random-pick-index.py | yennanliu/CS_basics | train | 64 | |
7d35545b6372aec057a4a78c9d8a50f8c8eacd90 | [
"try:\n insertionSort([1, 2, 3])\nexcept:\n self.fail('Error while calling insertionSort')",
"items = StrictList([random.randint(0, 2 ** 30) for i in range(1024)])\ninsertionSort(items)\nif isIncreasing(items):\n raise unittest.SkipTest('Not implemented yet')\nself.assertTrue(isDecreasing(items), 'Items ... | <|body_start_0|>
try:
insertionSort([1, 2, 3])
except:
self.fail('Error while calling insertionSort')
<|end_body_0|>
<|body_start_1|>
items = StrictList([random.randint(0, 2 ** 30) for i in range(1024)])
insertionSort(items)
if isIncreasing(items):
... | TestProblem1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestProblem1:
def test_API(self):
"""P1: Sanity Test: Is insertionSort callable?"""
<|body_0|>
def test_sortRandomValues(self):
"""P1: Sorting a list of random values"""
<|body_1|>
def test_sortDecreasingValues(self):
"""P1: Sorting a list that i... | stack_v2_sparse_classes_36k_train_021337 | 11,207 | no_license | [
{
"docstring": "P1: Sanity Test: Is insertionSort callable?",
"name": "test_API",
"signature": "def test_API(self)"
},
{
"docstring": "P1: Sorting a list of random values",
"name": "test_sortRandomValues",
"signature": "def test_sortRandomValues(self)"
},
{
"docstring": "P1: Sort... | 3 | stack_v2_sparse_classes_30k_val_000116 | Implement the Python class `TestProblem1` described below.
Class description:
Implement the TestProblem1 class.
Method signatures and docstrings:
- def test_API(self): P1: Sanity Test: Is insertionSort callable?
- def test_sortRandomValues(self): P1: Sorting a list of random values
- def test_sortDecreasingValues(sel... | Implement the Python class `TestProblem1` described below.
Class description:
Implement the TestProblem1 class.
Method signatures and docstrings:
- def test_API(self): P1: Sanity Test: Is insertionSort callable?
- def test_sortRandomValues(self): P1: Sorting a list of random values
- def test_sortDecreasingValues(sel... | d4f32507a5f581ad8ee0ce84e6cd92daac0941d7 | <|skeleton|>
class TestProblem1:
def test_API(self):
"""P1: Sanity Test: Is insertionSort callable?"""
<|body_0|>
def test_sortRandomValues(self):
"""P1: Sorting a list of random values"""
<|body_1|>
def test_sortDecreasingValues(self):
"""P1: Sorting a list that i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestProblem1:
def test_API(self):
"""P1: Sanity Test: Is insertionSort callable?"""
try:
insertionSort([1, 2, 3])
except:
self.fail('Error while calling insertionSort')
def test_sortRandomValues(self):
"""P1: Sorting a list of random values"""
... | the_stack_v2_python_sparse | Homework5/hw5_test.py | pillowfication/ECS-32B | train | 1 | |
684710d8b3e5fda9ec855ba73efbd6443531772d | [
"super(ThreeVariable, self).__init__()\narray_cross_check(x_1, x_2)\narray_cross_check(x_1, x_3)\narray_cross_check(x_2, x_3)\nself.x_1 = x_1\nself.x_2 = x_2\nself.x_3 = x_3",
"r_ab = sp.stats.pearsonr(self.x_1, self.x_2)[0]\nr_ac = sp.stats.pearsonr(self.x_1, self.x_3)[0]\nr_bc = sp.stats.pearsonr(self.x_2, self... | <|body_start_0|>
super(ThreeVariable, self).__init__()
array_cross_check(x_1, x_2)
array_cross_check(x_1, x_3)
array_cross_check(x_2, x_3)
self.x_1 = x_1
self.x_2 = x_2
self.x_3 = x_3
<|end_body_0|>
<|body_start_1|>
r_ab = sp.stats.pearsonr(self.x_1, self... | Three partial correlation coefficient and t-test | ThreeVariable | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreeVariable:
"""Three partial correlation coefficient and t-test"""
def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None:
""":param x_1: array_like :param x_2: array_like :param x_3: array_like"""
<|body_0|>
def __call__(self):
"""Calcu... | stack_v2_sparse_classes_36k_train_021338 | 8,613 | no_license | [
{
"docstring": ":param x_1: array_like :param x_2: array_like :param x_3: array_like",
"name": "__init__",
"signature": "def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None"
},
{
"docstring": "Calculate three partial correlation coefficient. :return: class self",
"n... | 3 | null | Implement the Python class `ThreeVariable` described below.
Class description:
Three partial correlation coefficient and t-test
Method signatures and docstrings:
- def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None: :param x_1: array_like :param x_2: array_like :param x_3: array_like
- def ... | Implement the Python class `ThreeVariable` described below.
Class description:
Three partial correlation coefficient and t-test
Method signatures and docstrings:
- def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None: :param x_1: array_like :param x_2: array_like :param x_3: array_like
- def ... | 1c8d5fbf3676dc81e9f143e93ee2564359519b11 | <|skeleton|>
class ThreeVariable:
"""Three partial correlation coefficient and t-test"""
def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None:
""":param x_1: array_like :param x_2: array_like :param x_3: array_like"""
<|body_0|>
def __call__(self):
"""Calcu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ThreeVariable:
"""Three partial correlation coefficient and t-test"""
def __init__(self, x_1: array_like, x_2: array_like, x_3: array_like) -> None:
""":param x_1: array_like :param x_2: array_like :param x_3: array_like"""
super(ThreeVariable, self).__init__()
array_cross_check(x... | the_stack_v2_python_sparse | statistics/correlation.py | qliu0/PythonInAirSeaScience | train | 0 |
fcb9121f8fad0a07c4a2dc21c7f37a04eb7fcf04 | [
"self.lifetime = lifetime\nself.event = event\nself.executionTimer = executionTimer\nself.timer = executionTimer",
"if self.lifetime <= 0:\n return\nself.lifetime -= elapsedTime\nif self.executionTimer is not None:\n self.timer -= elapsedTime\n if self.timer <= 0.0:\n self.event()\n self.ti... | <|body_start_0|>
self.lifetime = lifetime
self.event = event
self.executionTimer = executionTimer
self.timer = executionTimer
<|end_body_0|>
<|body_start_1|>
if self.lifetime <= 0:
return
self.lifetime -= elapsedTime
if self.executionTimer is not None... | Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaessigen Intervallen aufgerufen werden, um sich zu aktualisieren und bei Bedarf ... | TimedEvent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimedEvent:
"""Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaessigen Intervallen aufgerufen werden, um... | stack_v2_sparse_classes_36k_train_021339 | 2,168 | no_license | [
{
"docstring": "Erstellt eine Instanz von TimedEvent. @param lifetime: Gueltigkeitsdauer des Events in Sekunden (float) @param event: auszufuehrende Funktion (function) @executionTimer: Ausfuehrungstimer, der das Zeitintervall zwischen Aktivierungen bestimmt (float) (default = None)",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_015015 | Implement the Python class `TimedEvent` described below.
Class description:
Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaes... | Implement the Python class `TimedEvent` described below.
Class description:
Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaes... | e32626ed0e7cc2ba93380e2a6d0dfb5e90c963ad | <|skeleton|>
class TimedEvent:
"""Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaessigen Intervallen aufgerufen werden, um... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimedEvent:
"""Definiert ein zeitlich gesteuertes Event fuer die VR-Umgebung. Ein TimedEvent ist ein Wrapper fuer eine festgelegte Funktion, die, mit zeitlicher Verzoegerung, ein- oder mehrfach ausgefuehrt werden kann. TimedEvent-Objekte muessen in regelmaessigen Intervallen aufgerufen werden, um sich zu aktu... | the_stack_v2_python_sparse | addons/SmartLiving2050/core/TimedEvent.py | AntonChalakov/VRPGruppe1 | train | 0 |
42e73af0a8a0595994a59e3400f84348ec0959e1 | [
"try:\n diagnosis: models.Diagnosis = models.Diagnosis.create_from_json(data=request.data, patient_profile=request.user.patient_profile)\nexcept custom_exceptions.DataNotProvided as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nserialized_diagnosis = serializ... | <|body_start_0|>
try:
diagnosis: models.Diagnosis = models.Diagnosis.create_from_json(data=request.data, patient_profile=request.user.patient_profile)
except custom_exceptions.DataNotProvided as e:
return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_... | Endpoints for Diagnosis objects. | DiagnosesEndpoint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiagnosesEndpoint:
"""Endpoints for Diagnosis objects."""
def post(self, request: Request) -> response.Response:
"""Adds a new diagnosis for the user."""
<|body_0|>
def put(self, request: Request) -> response.Response:
"""Updates an existing diagnosis."""
... | stack_v2_sparse_classes_36k_train_021340 | 14,860 | no_license | [
{
"docstring": "Adds a new diagnosis for the user.",
"name": "post",
"signature": "def post(self, request: Request) -> response.Response"
},
{
"docstring": "Updates an existing diagnosis.",
"name": "put",
"signature": "def put(self, request: Request) -> response.Response"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_val_000877 | Implement the Python class `DiagnosesEndpoint` described below.
Class description:
Endpoints for Diagnosis objects.
Method signatures and docstrings:
- def post(self, request: Request) -> response.Response: Adds a new diagnosis for the user.
- def put(self, request: Request) -> response.Response: Updates an existing ... | Implement the Python class `DiagnosesEndpoint` described below.
Class description:
Endpoints for Diagnosis objects.
Method signatures and docstrings:
- def post(self, request: Request) -> response.Response: Adds a new diagnosis for the user.
- def put(self, request: Request) -> response.Response: Updates an existing ... | b6d757895132b9b3c8c6682c11efadf993d5905b | <|skeleton|>
class DiagnosesEndpoint:
"""Endpoints for Diagnosis objects."""
def post(self, request: Request) -> response.Response:
"""Adds a new diagnosis for the user."""
<|body_0|>
def put(self, request: Request) -> response.Response:
"""Updates an existing diagnosis."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiagnosesEndpoint:
"""Endpoints for Diagnosis objects."""
def post(self, request: Request) -> response.Response:
"""Adds a new diagnosis for the user."""
try:
diagnosis: models.Diagnosis = models.Diagnosis.create_from_json(data=request.data, patient_profile=request.user.patien... | the_stack_v2_python_sparse | main/model_api.py | kalolad1/cosmos | train | 0 |
a7a535879f2b0b20c1c1aacf7032239e307114d7 | [
"self.module = None\nself.priority = priority\nself.permission = permission\nself.clanOnly = clanOnly\nself._class = classObj\nself._args = args\nself.className = classObj.__name__",
"if self.module is not None:\n raise ValueError('Object already initialized!')\nself.module = self._class(*self._args)"
] | <|body_start_0|>
self.module = None
self.priority = priority
self.permission = permission
self.clanOnly = clanOnly
self._class = classObj
self._args = args
self.className = classObj.__name__
<|end_body_0|>
<|body_start_1|>
if self.module is not None:
... | Container object for a module. Managers hold their modules in a list of ModuleEntries. | ModuleEntry | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModuleEntry:
"""Container object for a module. Managers hold their modules in a list of ModuleEntries."""
def __init__(self, classObj, priority, permission, clanOnly, *args):
"""Create a new ModuleEntry. The actual object is not created yet; here classObj is the class Type object and... | stack_v2_sparse_classes_36k_train_021341 | 1,714 | permissive | [
{
"docstring": "Create a new ModuleEntry. The actual object is not created yet; here classObj is the class Type object and *args holds the calling arguments. The class is only created once createInstance is called.",
"name": "__init__",
"signature": "def __init__(self, classObj, priority, permission, cl... | 2 | null | Implement the Python class `ModuleEntry` described below.
Class description:
Container object for a module. Managers hold their modules in a list of ModuleEntries.
Method signatures and docstrings:
- def __init__(self, classObj, priority, permission, clanOnly, *args): Create a new ModuleEntry. The actual object is no... | Implement the Python class `ModuleEntry` described below.
Class description:
Container object for a module. Managers hold their modules in a list of ModuleEntries.
Method signatures and docstrings:
- def __init__(self, classObj, priority, permission, clanOnly, *args): Create a new ModuleEntry. The actual object is no... | ea746010d544bd5ae68dad3613326cd09f9da09a | <|skeleton|>
class ModuleEntry:
"""Container object for a module. Managers hold their modules in a list of ModuleEntries."""
def __init__(self, classObj, priority, permission, clanOnly, *args):
"""Create a new ModuleEntry. The actual object is not created yet; here classObj is the class Type object and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModuleEntry:
"""Container object for a module. Managers hold their modules in a list of ModuleEntries."""
def __init__(self, classObj, priority, permission, clanOnly, *args):
"""Create a new ModuleEntry. The actual object is not created yet; here classObj is the class Type object and *args holds ... | the_stack_v2_python_sparse | cwbot/common/objectContainer.py | ijzer/cwbot-ndy | train | 0 |
3c131adc8bb9b2f648808ee0bf0d15d2235ac28a | [
"self.extrapolated = [list(zip(self.coordinates[0], self.coordinates[1])), list(zip(self.coordinates[-2], self.coordinates[-1]))]\nself.coordinates.insert(0, [2 * a - b for a, b in zip(self.coordinates[0], self.coordinates[1])])\nself.coordinates.append([2 * a - b for a, b in zip(self.coordinates[-1], self.coordina... | <|body_start_0|>
self.extrapolated = [list(zip(self.coordinates[0], self.coordinates[1])), list(zip(self.coordinates[-2], self.coordinates[-1]))]
self.coordinates.insert(0, [2 * a - b for a, b in zip(self.coordinates[0], self.coordinates[1])])
self.coordinates.append([2 * a - b for a, b in zip(s... | Interpolate with B-spline. | InterpolatorBSpline | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterpolatorBSpline:
"""Interpolate with B-spline."""
def adjust_endpoints(self) -> None:
"""Adjust endpoints such that they are clamped and can handle extrapolation."""
<|body_0|>
def setup(self) -> None:
"""Optional setup."""
<|body_1|>
def interpo... | stack_v2_sparse_classes_36k_train_021342 | 3,888 | permissive | [
{
"docstring": "Adjust endpoints such that they are clamped and can handle extrapolation.",
"name": "adjust_endpoints",
"signature": "def adjust_endpoints(self) -> None"
},
{
"docstring": "Optional setup.",
"name": "setup",
"signature": "def setup(self) -> None"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_010814 | Implement the Python class `InterpolatorBSpline` described below.
Class description:
Interpolate with B-spline.
Method signatures and docstrings:
- def adjust_endpoints(self) -> None: Adjust endpoints such that they are clamped and can handle extrapolation.
- def setup(self) -> None: Optional setup.
- def interpolate... | Implement the Python class `InterpolatorBSpline` described below.
Class description:
Interpolate with B-spline.
Method signatures and docstrings:
- def adjust_endpoints(self) -> None: Adjust endpoints such that they are clamped and can handle extrapolation.
- def setup(self) -> None: Optional setup.
- def interpolate... | ad4d779bff57a65b7c77cda0b79c10cf904eb817 | <|skeleton|>
class InterpolatorBSpline:
"""Interpolate with B-spline."""
def adjust_endpoints(self) -> None:
"""Adjust endpoints such that they are clamped and can handle extrapolation."""
<|body_0|>
def setup(self) -> None:
"""Optional setup."""
<|body_1|>
def interpo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterpolatorBSpline:
"""Interpolate with B-spline."""
def adjust_endpoints(self) -> None:
"""Adjust endpoints such that they are clamped and can handle extrapolation."""
self.extrapolated = [list(zip(self.coordinates[0], self.coordinates[1])), list(zip(self.coordinates[-2], self.coordinat... | the_stack_v2_python_sparse | lib/coloraide/interpolate/bspline.py | facelessuser/ColorHelper | train | 279 |
cf312d3d729657d252a5f33e668c3d746ed4b361 | [
"paginator = self.get_paginator(queryset, page_size, orphans=self.get_paginate_orphans(), allow_empty_first_page=self.get_allow_empty())\npage_kwarg = self.page_kwarg\npage = self.kwargs.get(page_kwarg) or self.request.GET.get(page_kwarg) or self.first_page\ntry:\n page_number = paginator.validate_number(page)\n... | <|body_start_0|>
paginator = self.get_paginator(queryset, page_size, orphans=self.get_paginate_orphans(), allow_empty_first_page=self.get_allow_empty())
page_kwarg = self.page_kwarg
page = self.kwargs.get(page_kwarg) or self.request.GET.get(page_kwarg) or self.first_page
try:
... | PerformantPagintorMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PerformantPagintorMixin:
def paginate_queryset(self, queryset, page_size):
"""Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12429 for details"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Insert the single ob... | stack_v2_sparse_classes_36k_train_021343 | 8,021 | permissive | [
{
"docstring": "Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12429 for details",
"name": "paginate_queryset",
"signature": "def paginate_queryset(self, queryset, page_size)"
},
{
"docstring": "Insert the single object into the context dict.",
... | 2 | null | Implement the Python class `PerformantPagintorMixin` described below.
Class description:
Implement the PerformantPagintorMixin class.
Method signatures and docstrings:
- def paginate_queryset(self, queryset, page_size): Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12... | Implement the Python class `PerformantPagintorMixin` described below.
Class description:
Implement the PerformantPagintorMixin class.
Method signatures and docstrings:
- def paginate_queryset(self, queryset, page_size): Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12... | 57cfde4aa8680c08758ee531d69a40b0f7f1d9d7 | <|skeleton|>
class PerformantPagintorMixin:
def paginate_queryset(self, queryset, page_size):
"""Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12429 for details"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Insert the single ob... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PerformantPagintorMixin:
def paginate_queryset(self, queryset, page_size):
"""Overwrite pagination for support non-number paginator See https://github.com/django/django/pull/12429 for details"""
paginator = self.get_paginator(queryset, page_size, orphans=self.get_paginate_orphans(), allow_empt... | the_stack_v2_python_sparse | feder/main/mixins.py | watchdogpolska/feder | train | 18 | |
22d45056d26a52464476e0599408539787e3eadc | [
"if n < 0:\n x = 1 / x\n n = -n\nreturn self.my_pow(x, n)",
"if n == 0:\n return 1\nres = self.my_pow(x, n // 2)\nres *= res\nif n % 2:\n res *= x\nreturn res"
] | <|body_start_0|>
if n < 0:
x = 1 / x
n = -n
return self.my_pow(x, n)
<|end_body_0|>
<|body_start_1|>
if n == 0:
return 1
res = self.my_pow(x, n // 2)
res *= res
if n % 2:
res *= x
return res
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myPow(self, x, n):
"""Args: x: float n: int Return: float"""
<|body_0|>
def my_pow(self, x, n):
"""Args: x: float n: int Return: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 0:
x = 1 / x
n = -n
... | stack_v2_sparse_classes_36k_train_021344 | 651 | no_license | [
{
"docstring": "Args: x: float n: int Return: float",
"name": "myPow",
"signature": "def myPow(self, x, n)"
},
{
"docstring": "Args: x: float n: int Return: float",
"name": "my_pow",
"signature": "def my_pow(self, x, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): Args: x: float n: int Return: float
- def my_pow(self, x, n): Args: x: float n: int Return: float | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): Args: x: float n: int Return: float
- def my_pow(self, x, n): Args: x: float n: int Return: float
<|skeleton|>
class Solution:
def myPow(self, x, n):... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def myPow(self, x, n):
"""Args: x: float n: int Return: float"""
<|body_0|>
def my_pow(self, x, n):
"""Args: x: float n: int Return: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def myPow(self, x, n):
"""Args: x: float n: int Return: float"""
if n < 0:
x = 1 / x
n = -n
return self.my_pow(x, n)
def my_pow(self, x, n):
"""Args: x: float n: int Return: float"""
if n == 0:
return 1
res = se... | the_stack_v2_python_sparse | 剑指offer/剑指 Offer 16. 数值的整数次方.py | AiZhanghan/Leetcode | train | 0 | |
000cf5339989b406fa2b55b1a9e9aefe22dfdb95 | [
"valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additionalProperties': False, 'required': ['lower', 'upper']})\nif not valid:\n raise ValueError('Invalid duration range: %s' % message)\nself.lower_... | <|body_start_0|>
valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additionalProperties': False, 'required': ['lower', 'upper']})
if not valid:
raise ValueError('Invalid duration ... | Range of durations | DurationRange | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DurationRange:
"""Range of durations"""
def __init__(self, drange):
"""Construct a range from a JSON DurationRange."""
<|body_0|>
def __contains__(self, duration):
"""See if the range contains the specified duration, which can be a timedelta or ISO8601 string."""... | stack_v2_sparse_classes_36k_train_021345 | 2,808 | permissive | [
{
"docstring": "Construct a range from a JSON DurationRange.",
"name": "__init__",
"signature": "def __init__(self, drange)"
},
{
"docstring": "See if the range contains the specified duration, which can be a timedelta or ISO8601 string.",
"name": "__contains__",
"signature": "def __cont... | 3 | stack_v2_sparse_classes_30k_train_006884 | Implement the Python class `DurationRange` described below.
Class description:
Range of durations
Method signatures and docstrings:
- def __init__(self, drange): Construct a range from a JSON DurationRange.
- def __contains__(self, duration): See if the range contains the specified duration, which can be a timedelta ... | Implement the Python class `DurationRange` described below.
Class description:
Range of durations
Method signatures and docstrings:
- def __init__(self, drange): Construct a range from a JSON DurationRange.
- def __contains__(self, duration): See if the range contains the specified duration, which can be a timedelta ... | f6d04c0455e5be4d490df16ec1acb377f9025d9f | <|skeleton|>
class DurationRange:
"""Range of durations"""
def __init__(self, drange):
"""Construct a range from a JSON DurationRange."""
<|body_0|>
def __contains__(self, duration):
"""See if the range contains the specified duration, which can be a timedelta or ISO8601 string."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DurationRange:
"""Range of durations"""
def __init__(self, drange):
"""Construct a range from a JSON DurationRange."""
valid, message = json_validate(drange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Duration'}, 'upper': {'$ref': '#/pScheduler/Duration'}}, 'additio... | the_stack_v2_python_sparse | python-pscheduler/pscheduler/pscheduler/durationrange.py | perfsonar/pscheduler | train | 53 |
c039f7de71604cb2e8feaacf083d62f37a42ad05 | [
"if skip_init is False:\n self.center_col, self.center_row, self.radius, self.major, self.minor, self.contour, self.angle = self.calc_pupil_properties_fit_ellipse(frame, threshold=threshold)\nelse:\n self.center_col = None\n self.center_row = None\n self.radius = None\n self.contour = None",
"ret, ... | <|body_start_0|>
if skip_init is False:
self.center_col, self.center_row, self.radius, self.major, self.minor, self.contour, self.angle = self.calc_pupil_properties_fit_ellipse(frame, threshold=threshold)
else:
self.center_col = None
self.center_row = None
... | Object to represent a pupil within a specific frame of the video. | Pupil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pupil:
"""Object to represent a pupil within a specific frame of the video."""
def __init__(self, frame, threshold=10, skip_init=False):
"""Initialize pupil object and find it's center, and radius within frame Parameters ------------------------ frame : array_like Grayscale video fra... | stack_v2_sparse_classes_36k_train_021346 | 7,105 | permissive | [
{
"docstring": "Initialize pupil object and find it's center, and radius within frame Parameters ------------------------ frame : array_like Grayscale video frame containing pupil to be detected threshold: Uint8 Integer representing the value to use for image binary thresholding. Attributes --------------------... | 3 | stack_v2_sparse_classes_30k_train_015813 | Implement the Python class `Pupil` described below.
Class description:
Object to represent a pupil within a specific frame of the video.
Method signatures and docstrings:
- def __init__(self, frame, threshold=10, skip_init=False): Initialize pupil object and find it's center, and radius within frame Parameters ------... | Implement the Python class `Pupil` described below.
Class description:
Object to represent a pupil within a specific frame of the video.
Method signatures and docstrings:
- def __init__(self, frame, threshold=10, skip_init=False): Initialize pupil object and find it's center, and radius within frame Parameters ------... | 76414e2c318f97d121c1d2fb8e9506bf447792c8 | <|skeleton|>
class Pupil:
"""Object to represent a pupil within a specific frame of the video."""
def __init__(self, frame, threshold=10, skip_init=False):
"""Initialize pupil object and find it's center, and radius within frame Parameters ------------------------ frame : array_like Grayscale video fra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Pupil:
"""Object to represent a pupil within a specific frame of the video."""
def __init__(self, frame, threshold=10, skip_init=False):
"""Initialize pupil object and find it's center, and radius within frame Parameters ------------------------ frame : array_like Grayscale video frame containing... | the_stack_v2_python_sparse | ota/pupil/pupil.py | ENPH459-1907/Ocular-Torsion-Quantification | train | 1 |
52ebf09ba6d990f0a2f699d99e53499a64b8405d | [
"self.path = [''] * 100\nself.path[0] = homepage\nself.cur = 0",
"self.cur += 1\nself.path[self.cur] = url\nt = self.path[:self.cur + 1]\nself.path = t + [''] * (100 - self.cur)",
"self.cur = self.cur - steps\nif self.cur < 0:\n return self.path[0]\nreturn self.path[self.cur]",
"if self.cur + steps <= len(... | <|body_start_0|>
self.path = [''] * 100
self.path[0] = homepage
self.cur = 0
<|end_body_0|>
<|body_start_1|>
self.cur += 1
self.path[self.cur] = url
t = self.path[:self.cur + 1]
self.path = t + [''] * (100 - self.cur)
<|end_body_1|>
<|body_start_2|>
self... | BrowserHistory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BrowserHistory:
def __init__(self, homepage):
""":type homepage: str"""
<|body_0|>
def visit(self, url):
""":type url: str :rtype: None"""
<|body_1|>
def back(self, steps):
""":type steps: int :rtype: str"""
<|body_2|>
def forward(se... | stack_v2_sparse_classes_36k_train_021347 | 3,826 | no_license | [
{
"docstring": ":type homepage: str",
"name": "__init__",
"signature": "def __init__(self, homepage)"
},
{
"docstring": ":type url: str :rtype: None",
"name": "visit",
"signature": "def visit(self, url)"
},
{
"docstring": ":type steps: int :rtype: str",
"name": "back",
"s... | 4 | null | Implement the Python class `BrowserHistory` described below.
Class description:
Implement the BrowserHistory class.
Method signatures and docstrings:
- def __init__(self, homepage): :type homepage: str
- def visit(self, url): :type url: str :rtype: None
- def back(self, steps): :type steps: int :rtype: str
- def forw... | Implement the Python class `BrowserHistory` described below.
Class description:
Implement the BrowserHistory class.
Method signatures and docstrings:
- def __init__(self, homepage): :type homepage: str
- def visit(self, url): :type url: str :rtype: None
- def back(self, steps): :type steps: int :rtype: str
- def forw... | 2e1751263f484709102f7f2caf18776a004c8230 | <|skeleton|>
class BrowserHistory:
def __init__(self, homepage):
""":type homepage: str"""
<|body_0|>
def visit(self, url):
""":type url: str :rtype: None"""
<|body_1|>
def back(self, steps):
""":type steps: int :rtype: str"""
<|body_2|>
def forward(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BrowserHistory:
def __init__(self, homepage):
""":type homepage: str"""
self.path = [''] * 100
self.path[0] = homepage
self.cur = 0
def visit(self, url):
""":type url: str :rtype: None"""
self.cur += 1
self.path[self.cur] = url
t = self.path... | the_stack_v2_python_sparse | Python/Contest /5430. Design Browser History.py | YaqianQi/Algorithm-and-Data-Structure | train | 1 | |
011fd74f7ee1e5058d89451fb37547bc94af2209 | [
"logger.debug('Parsing request object to XML')\ntry:\n xml = xmltodict.unparse(request.normalize_xml())\nexcept Exception as e:\n error_msg = 'Error parsing request to XML'\n logger.error('{}: {}'.format(error_msg, e))\n raise SdkError(error_msg, e)\nreturn xml",
"logger.debug('Parsing XML response to... | <|body_start_0|>
logger.debug('Parsing request object to XML')
try:
xml = xmltodict.unparse(request.normalize_xml())
except Exception as e:
error_msg = 'Error parsing request to XML'
logger.error('{}: {}'.format(error_msg, e))
raise SdkError(error_... | Utils to serialize and deserialize objects to XML | XmlUtils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XmlUtils:
"""Utils to serialize and deserialize objects to XML"""
def to_xml(request):
"""This method parse request to XML object :return: string"""
<|body_0|>
def from_xml_api_response(xml):
"""Method parse XML to dict. :param xml: string :return: dict"""
... | stack_v2_sparse_classes_36k_train_021348 | 1,447 | permissive | [
{
"docstring": "This method parse request to XML object :return: string",
"name": "to_xml",
"signature": "def to_xml(request)"
},
{
"docstring": "Method parse XML to dict. :param xml: string :return: dict",
"name": "from_xml_api_response",
"signature": "def from_xml_api_response(xml)"
... | 2 | stack_v2_sparse_classes_30k_test_000114 | Implement the Python class `XmlUtils` described below.
Class description:
Utils to serialize and deserialize objects to XML
Method signatures and docstrings:
- def to_xml(request): This method parse request to XML object :return: string
- def from_xml_api_response(xml): Method parse XML to dict. :param xml: string :r... | Implement the Python class `XmlUtils` described below.
Class description:
Utils to serialize and deserialize objects to XML
Method signatures and docstrings:
- def to_xml(request): This method parse request to XML object :return: string
- def from_xml_api_response(xml): Method parse XML to dict. :param xml: string :r... | 8fcf2a0e9d6d99d18e313f04b9721ccc4769a83f | <|skeleton|>
class XmlUtils:
"""Utils to serialize and deserialize objects to XML"""
def to_xml(request):
"""This method parse request to XML object :return: string"""
<|body_0|>
def from_xml_api_response(xml):
"""Method parse XML to dict. :param xml: string :return: dict"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XmlUtils:
"""Utils to serialize and deserialize objects to XML"""
def to_xml(request):
"""This method parse request to XML object :return: string"""
logger.debug('Parsing request object to XML')
try:
xml = xmltodict.unparse(request.normalize_xml())
except Excep... | the_stack_v2_python_sparse | addonpayments/api/utils.py | ComerciaGP/addonpayments-Python-SDK | train | 3 |
7c294c98568c18ef93b773a5b5236442d0469a1a | [
"points = sorted(points, key=lambda x: x[1])\nres, end = (0, -float('inf'))\nfor interval in points:\n if interval[0] > end:\n res += 1\n end = interval[1]\nreturn res",
"if not points:\n return 0\npoints.sort()\nresult = 0\ni = 0\nwhile i < len(points):\n j = i + 1\n right_bound = point... | <|body_start_0|>
points = sorted(points, key=lambda x: x[1])
res, end = (0, -float('inf'))
for interval in points:
if interval[0] > end:
res += 1
end = interval[1]
return res
<|end_body_0|>
<|body_start_1|>
if not points:
r... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def findMinArrowShots2(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
points = sor... | stack_v2_sparse_classes_36k_train_021349 | 4,349 | permissive | [
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "findMinArrowShots",
"signature": "def findMinArrowShots(self, points)"
},
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "findMinArrowShots2",
"signature": "def findMinArrowShots2(self, points)"
}... | 2 | stack_v2_sparse_classes_30k_val_000760 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int
- def findMinArrowShots2(self, points): :type points: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int
- def findMinArrowShots2(self, points): :type points: List[List[int]] :rtype: int
<|skeleton|>
cla... | 0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c | <|skeleton|>
class Solution:
def findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def findMinArrowShots2(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
points = sorted(points, key=lambda x: x[1])
res, end = (0, -float('inf'))
for interval in points:
if interval[0] > end:
res += 1
end = inte... | the_stack_v2_python_sparse | cs15211/MinimumNumberOfArrowsToBurstBalloons.py | JulyKikuAkita/PythonPrac | train | 1 | |
e0129420310964cd2fbd38f1bf74f957e3458b55 | [
"hashmap = {}\nfor idx, num in enumerate(nums):\n rest = target - num\n if rest in hashmap:\n return [idx, hashmap[rest]]\n hashmap[num] = idx",
"sorted_num = sorted(((num, idx) for idx, num in enumerate(nums)))\nleft, right = (0, len(nums) - 1)\nwhile left < right:\n two_sum = sorted_num[left]... | <|body_start_0|>
hashmap = {}
for idx, num in enumerate(nums):
rest = target - num
if rest in hashmap:
return [idx, hashmap[rest]]
hashmap[num] = idx
<|end_body_0|>
<|body_start_1|>
sorted_num = sorted(((num, idx) for idx, num in enumerate(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
<|body_0|>
def twoSumSorted(self, nums: List[int], target: int) -> List[int]:
"""排序 + 双指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
hashmap = {}
for idx, ... | stack_v2_sparse_classes_36k_train_021350 | 1,647 | no_license | [
{
"docstring": "哈希表",
"name": "twoSum",
"signature": "def twoSum(self, nums: List[int], target: int) -> List[int]"
},
{
"docstring": "排序 + 双指针",
"name": "twoSumSorted",
"signature": "def twoSumSorted(self, nums: List[int], target: int) -> List[int]"
}
] | 2 | stack_v2_sparse_classes_30k_train_013529 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: List[int], target: int) -> List[int]: 哈希表
- def twoSumSorted(self, nums: List[int], target: int) -> List[int]: 排序 + 双指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: List[int], target: int) -> List[int]: 哈希表
- def twoSumSorted(self, nums: List[int], target: int) -> List[int]: 排序 + 双指针
<|skeleton|>
class Solution:
... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
<|body_0|>
def twoSumSorted(self, nums: List[int], target: int) -> List[int]:
"""排序 + 双指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
hashmap = {}
for idx, num in enumerate(nums):
rest = target - num
if rest in hashmap:
return [idx, hashmap[rest]]
hashmap[num] = idx
def twoSumSorte... | the_stack_v2_python_sparse | 1.两数之和/solution.py | QtTao/daily_leetcode | train | 0 | |
868870df14171b28f50aee2fcba567642a6639d9 | [
"course_key = CourseKey.from_string(course_key_string)\nis_staff = has_staff_roles(request.user, course_key)\nif not is_staff:\n return JsonResponse({'success': False})\nmasquerade_settings = request.session.get(MASQUERADE_SETTINGS_KEY, {})\ncourse = masquerade_settings.get(course_key, None)\ncourse = course or ... | <|body_start_0|>
course_key = CourseKey.from_string(course_key_string)
is_staff = has_staff_roles(request.user, course_key)
if not is_staff:
return JsonResponse({'success': False})
masquerade_settings = request.session.get(MASQUERADE_SETTINGS_KEY, {})
course = masquer... | Create an HTTP endpoint to manage masquerade settings | MasqueradeView | [
"MIT",
"AGPL-3.0-only",
"AGPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MasqueradeView:
"""Create an HTTP endpoint to manage masquerade settings"""
def get(self, request, course_key_string):
"""Retrieve data on the active and available masquerade options"""
<|body_0|>
def post(self, request, course_key_string):
"""Handle AJAX posts t... | stack_v2_sparse_classes_36k_train_021351 | 19,538 | permissive | [
{
"docstring": "Retrieve data on the active and available masquerade options",
"name": "get",
"signature": "def get(self, request, course_key_string)"
},
{
"docstring": "Handle AJAX posts to update the current user's masquerade for the specified course. The masquerade settings are stored in the ... | 2 | null | Implement the Python class `MasqueradeView` described below.
Class description:
Create an HTTP endpoint to manage masquerade settings
Method signatures and docstrings:
- def get(self, request, course_key_string): Retrieve data on the active and available masquerade options
- def post(self, request, course_key_string)... | Implement the Python class `MasqueradeView` described below.
Class description:
Create an HTTP endpoint to manage masquerade settings
Method signatures and docstrings:
- def get(self, request, course_key_string): Retrieve data on the active and available masquerade options
- def post(self, request, course_key_string)... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class MasqueradeView:
"""Create an HTTP endpoint to manage masquerade settings"""
def get(self, request, course_key_string):
"""Retrieve data on the active and available masquerade options"""
<|body_0|>
def post(self, request, course_key_string):
"""Handle AJAX posts t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MasqueradeView:
"""Create an HTTP endpoint to manage masquerade settings"""
def get(self, request, course_key_string):
"""Retrieve data on the active and available masquerade options"""
course_key = CourseKey.from_string(course_key_string)
is_staff = has_staff_roles(request.user, ... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/masquerade.py | luque/better-ways-of-thinking-about-software | train | 3 |
0543374d94a4fd164a4c6bbd1c6df64e8abb965b | [
"if self.numSubsystems > 0:\n pwmOfs: int = 0\n if self.enableDrive:\n leftMotors = SpeedControllerGroup(wpilib.VictorSP(0), wpilib.VictorSP(1))\n rightMotors = SpeedControllerGroup(wpilib.VictorSP(2), wpilib.VictorSP(3))\n gamePad: GenericHID = XboxController(0)\n drive: Drive = D... | <|body_start_0|>
if self.numSubsystems > 0:
pwmOfs: int = 0
if self.enableDrive:
leftMotors = SpeedControllerGroup(wpilib.VictorSP(0), wpilib.VictorSP(1))
rightMotors = SpeedControllerGroup(wpilib.VictorSP(2), wpilib.VictorSP(3))
gamePad: G... | Minimal implementation of a robot program using the command based framework. | MyRobot | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyRobot:
"""Minimal implementation of a robot program using the command based framework."""
def robotInit(self):
"""Initalizes all subsystems and user controls."""
<|body_0|>
def loopFunc(self):
"""Override base implementation so we can peek at how long each iter... | stack_v2_sparse_classes_36k_train_021352 | 5,034 | permissive | [
{
"docstring": "Initalizes all subsystems and user controls.",
"name": "robotInit",
"signature": "def robotInit(self)"
},
{
"docstring": "Override base implementation so we can peek at how long each iteration takes.",
"name": "loopFunc",
"signature": "def loopFunc(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005536 | Implement the Python class `MyRobot` described below.
Class description:
Minimal implementation of a robot program using the command based framework.
Method signatures and docstrings:
- def robotInit(self): Initalizes all subsystems and user controls.
- def loopFunc(self): Override base implementation so we can peek ... | Implement the Python class `MyRobot` described below.
Class description:
Minimal implementation of a robot program using the command based framework.
Method signatures and docstrings:
- def robotInit(self): Initalizes all subsystems and user controls.
- def loopFunc(self): Override base implementation so we can peek ... | 6337165ad7fdc1c00927293c3b73deb394fb6220 | <|skeleton|>
class MyRobot:
"""Minimal implementation of a robot program using the command based framework."""
def robotInit(self):
"""Initalizes all subsystems and user controls."""
<|body_0|>
def loopFunc(self):
"""Override base implementation so we can peek at how long each iter... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyRobot:
"""Minimal implementation of a robot program using the command based framework."""
def robotInit(self):
"""Initalizes all subsystems and user controls."""
if self.numSubsystems > 0:
pwmOfs: int = 0
if self.enableDrive:
leftMotors = SpeedCon... | the_stack_v2_python_sparse | minimal-py/robot.py | paul-blankenbaker/frc-2019 | train | 2 |
5e53b81f0e2794d3d95e17b1762dd2492bf41c25 | [
"self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme\nself.loginController = LoginController(toJson, pwdScheme=pwdScheme)\nCreateController.__init__(self, User, None, recordValueProvider=recordValueProvider)",
"try:\n createKwargs = dict(json)\n createKwargs['password'] = self.pwdScheme.ma... | <|body_start_0|>
self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme
self.loginController = LoginController(toJson, pwdScheme=pwdScheme)
CreateController.__init__(self, User, None, recordValueProvider=recordValueProvider)
<|end_body_0|>
<|body_start_1|>
try:
... | Controller to register a user | RegisterController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterController:
"""Controller to register a user"""
def __init__(self, toJson, pwdScheme=None, recordValueProvider=None):
"""Initialize the Register Controller"""
<|body_0|>
def performWithJSON(self, json=None):
"""Create a User record with the given credenti... | stack_v2_sparse_classes_36k_train_021353 | 1,277 | permissive | [
{
"docstring": "Initialize the Register Controller",
"name": "__init__",
"signature": "def __init__(self, toJson, pwdScheme=None, recordValueProvider=None)"
},
{
"docstring": "Create a User record with the given credentials",
"name": "performWithJSON",
"signature": "def performWithJSON(s... | 2 | stack_v2_sparse_classes_30k_train_003662 | Implement the Python class `RegisterController` described below.
Class description:
Controller to register a user
Method signatures and docstrings:
- def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): Initialize the Register Controller
- def performWithJSON(self, json=None): Create a User record wi... | Implement the Python class `RegisterController` described below.
Class description:
Controller to register a user
Method signatures and docstrings:
- def __init__(self, toJson, pwdScheme=None, recordValueProvider=None): Initialize the Register Controller
- def performWithJSON(self, json=None): Create a User record wi... | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | <|skeleton|>
class RegisterController:
"""Controller to register a user"""
def __init__(self, toJson, pwdScheme=None, recordValueProvider=None):
"""Initialize the Register Controller"""
<|body_0|>
def performWithJSON(self, json=None):
"""Create a User record with the given credenti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegisterController:
"""Controller to register a user"""
def __init__(self, toJson, pwdScheme=None, recordValueProvider=None):
"""Initialize the Register Controller"""
self.pwdScheme = PasswordScheme() if pwdScheme is None else pwdScheme
self.loginController = LoginController(toJso... | the_stack_v2_python_sparse | data/train/python/99f7f822e985fbf40ac8620e7a822e58c4b138e0register_controller.py | harshp8l/deep-learning-lang-detection | train | 0 |
8f8b0d900948e6ce06eaffd6c2fd819d84876a02 | [
"if not decompose:\n rwmd, _, _, _, _ = self._rwmd()\n return rwmd\nelif decompose:\n if i2w == None:\n print('i2w argument is missing.')\n else:\n rwmd, flow_source, flow_sink, dist_source, dist_sink = self._rwmd()\n w_source = [i2w[idx] for idx in self.source.idxs]\n w_sink... | <|body_start_0|>
if not decompose:
rwmd, _, _, _, _ = self._rwmd()
return rwmd
elif decompose:
if i2w == None:
print('i2w argument is missing.')
else:
rwmd, flow_source, flow_sink, dist_source, dist_sink = self._rwmd()
... | Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class | RWMD | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RWMD:
"""Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class"""
def get_distance(self, i2w: Dict[int, str]=None, decompose: bool=False) -> Tuple[float, List[float], List[float], List[float], List[float], List[str], List[str]... | stack_v2_sparse_classes_36k_train_021354 | 21,755 | permissive | [
{
"docstring": "Get the RWMD between a pair of documents, with or without decomposed word-level distances. Args: i2w: A dictionary mapping the index of word vectors to the words themselves. decompose: A boolean to determine whether word-level distances should be decomposed. Returns: rwmd: A float value of the R... | 3 | stack_v2_sparse_classes_30k_val_000961 | Implement the Python class `RWMD` described below.
Class description:
Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class
Method signatures and docstrings:
- def get_distance(self, i2w: Dict[int, str]=None, decompose: bool=False) -> Tuple[float, List... | Implement the Python class `RWMD` described below.
Class description:
Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class
Method signatures and docstrings:
- def get_distance(self, i2w: Dict[int, str]=None, decompose: bool=False) -> Tuple[float, List... | 25d81616aeb6a27cd0511d1e12316bc63673e599 | <|skeleton|>
class RWMD:
"""Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class"""
def get_distance(self, i2w: Dict[int, str]=None, decompose: bool=False) -> Tuple[float, List[float], List[float], List[float], List[float], List[str], List[str]... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RWMD:
"""Relaxed Word Mover's Distance (RWMD) with matrix operations in numpy. Inherits the WMD class. Attributes: see WMD class"""
def get_distance(self, i2w: Dict[int, str]=None, decompose: bool=False) -> Tuple[float, List[float], List[float], List[float], List[float], List[str], List[str]]:
""... | the_stack_v2_python_sparse | src/wmdecompose/models.py | maybemkl/wmdecompose | train | 5 |
1c502a7a980e08d8ceb7b3a23fef094e82f18e77 | [
"with open(path) as f:\n text = f.read()\n if not text.startswith(preamble):\n t = ''.join(text.splitlines(keepends=True)[1:])\n if not t.startswith(preamble):\n raise RuntimeError(f'Copyright not present in file \"{path}\"')",
"for directory in self.directories:\n python_files =... | <|body_start_0|>
with open(path) as f:
text = f.read()
if not text.startswith(preamble):
t = ''.join(text.splitlines(keepends=True)[1:])
if not t.startswith(preamble):
raise RuntimeError(f'Copyright not present in file "{path}"')
<|end_... | CheckCopyrightCommand | [
"MIT",
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckCopyrightCommand:
def _check_copyright(self, path, preamble):
"""Check that the given file has the provided copyright."""
<|body_0|>
def run(self):
"""Execution of the command action."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
with open(pa... | stack_v2_sparse_classes_36k_train_021355 | 14,165 | permissive | [
{
"docstring": "Check that the given file has the provided copyright.",
"name": "_check_copyright",
"signature": "def _check_copyright(self, path, preamble)"
},
{
"docstring": "Execution of the command action.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008601 | Implement the Python class `CheckCopyrightCommand` described below.
Class description:
Implement the CheckCopyrightCommand class.
Method signatures and docstrings:
- def _check_copyright(self, path, preamble): Check that the given file has the provided copyright.
- def run(self): Execution of the command action. | Implement the Python class `CheckCopyrightCommand` described below.
Class description:
Implement the CheckCopyrightCommand class.
Method signatures and docstrings:
- def _check_copyright(self, path, preamble): Check that the given file has the provided copyright.
- def run(self): Execution of the command action.
<|s... | fa6808a6ca8063751da92f683f2b810a0690a462 | <|skeleton|>
class CheckCopyrightCommand:
def _check_copyright(self, path, preamble):
"""Check that the given file has the provided copyright."""
<|body_0|>
def run(self):
"""Execution of the command action."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckCopyrightCommand:
def _check_copyright(self, path, preamble):
"""Check that the given file has the provided copyright."""
with open(path) as f:
text = f.read()
if not text.startswith(preamble):
t = ''.join(text.splitlines(keepends=True)[1:])
... | the_stack_v2_python_sparse | setup.py | mramospe/minkit | train | 0 | |
2f55f1eb0ac0ddea810587fa83a41480b956a4e2 | [
"self.log = get_logger_adapter(__name__)\nself._vhost = vhost\nself._host = host\nself._port = port\nself._username = username\nself._password = password\nself.channel = None\nself.connect()",
"self.log.debug('Connecting to RabbitMQ')\nself.connection = amqp.Connection(host='%s:%s' % (self._host, self._port), use... | <|body_start_0|>
self.log = get_logger_adapter(__name__)
self._vhost = vhost
self._host = host
self._port = port
self._username = username
self._password = password
self.channel = None
self.connect()
<|end_body_0|>
<|body_start_1|>
self.log.debug(... | Connection | Connection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Connection:
"""Connection"""
def __init__(self, vhost, host, port, username, password):
"""@type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type username: C{str} @param username: amqp username @type pass... | stack_v2_sparse_classes_36k_train_021356 | 3,211 | no_license | [
{
"docstring": "@type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type username: C{str} @param username: amqp username @type password: C{str} @param password: amqp password",
"name": "__init__",
"signature": "def __init__(se... | 3 | null | Implement the Python class `Connection` described below.
Class description:
Connection
Method signatures and docstrings:
- def __init__(self, vhost, host, port, username, password): @type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type u... | Implement the Python class `Connection` described below.
Class description:
Connection
Method signatures and docstrings:
- def __init__(self, vhost, host, port, username, password): @type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type u... | 34db45fb5c7aa2c8175663e24e1a78a7da4d19d9 | <|skeleton|>
class Connection:
"""Connection"""
def __init__(self, vhost, host, port, username, password):
"""@type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type username: C{str} @param username: amqp username @type pass... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Connection:
"""Connection"""
def __init__(self, vhost, host, port, username, password):
"""@type vhost: C{str} @param vhost: amqp vhost @type host: C{str} @param host: amqp host @type port: C{int} @param port: amqp port @type username: C{str} @param username: amqp username @type password: C{str} ... | the_stack_v2_python_sparse | ots.worker/ots/worker/connection.py | saraso-la/ots-mirror | train | 0 |
854f3461dc624b371440b85174499ddd4c4e9ef7 | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email), first_name=first_name, last_name=last_name, referral=referral)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(username=... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(username=username, email=self.normalize_email(email), first_name=first_name, last_name=last_name, referral=referral)
user.set_password(password)
user.save(using=self._db)
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None):
"""Creates and saves a User with the given email, first name, last name and password."""
<|body_0|>
def create_superuser(self, username, email, pas... | stack_v2_sparse_classes_36k_train_021357 | 7,301 | no_license | [
{
"docstring": "Creates and saves a User with the given email, first name, last name and password.",
"name": "create_user",
"signature": "def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None)"
},
{
"docstring": "Creates and saves a superu... | 2 | stack_v2_sparse_classes_30k_train_003395 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): Creates and saves a User with the given email, first na... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): Creates and saves a User with the given email, first na... | 726e99153ad36d0aa38141822285f79feb910c06 | <|skeleton|>
class MyUserManager:
def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None):
"""Creates and saves a User with the given email, first name, last name and password."""
<|body_0|>
def create_superuser(self, username, email, pas... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None):
"""Creates and saves a User with the given email, first name, last name and password."""
if not email:
raise ValueError('Users must have an email address'... | the_stack_v2_python_sparse | src/accounts/models.py | rcmiskin10/university-marketplace | train | 0 | |
231cf7e8986a90f58101be6707064b0c960dbc4f | [
"self.timeout = timeout\nself.port = port\nres = shutil.which('ipfs')\nif res is None:\n raise Exception('Please install IPFS first!')\nwith subprocess.Popen(['ipfs', '--version'], stdout=subprocess.PIPE, env=os.environ.copy()) as process:\n output, _ = process.communicate()\n if b'0.6.0' not in output:\n ... | <|body_start_0|>
self.timeout = timeout
self.port = port
res = shutil.which('ipfs')
if res is None:
raise Exception('Please install IPFS first!')
with subprocess.Popen(['ipfs', '--version'], stdout=subprocess.PIPE, env=os.environ.copy()) as process:
output... | Set up the IPFS daemon. :raises Exception: if IPFS is not installed. | IPFSDaemon | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPFSDaemon:
"""Set up the IPFS daemon. :raises Exception: if IPFS is not installed."""
def __init__(self, timeout: float=15.0, port: int=5001):
"""Initialise IPFS daemon."""
<|body_0|>
def __enter__(self) -> None:
"""Run the ipfs daemon."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_021358 | 19,456 | permissive | [
{
"docstring": "Initialise IPFS daemon.",
"name": "__init__",
"signature": "def __init__(self, timeout: float=15.0, port: int=5001)"
},
{
"docstring": "Run the ipfs daemon.",
"name": "__enter__",
"signature": "def __enter__(self) -> None"
},
{
"docstring": "Terminate the ipfs dae... | 3 | null | Implement the Python class `IPFSDaemon` described below.
Class description:
Set up the IPFS daemon. :raises Exception: if IPFS is not installed.
Method signatures and docstrings:
- def __init__(self, timeout: float=15.0, port: int=5001): Initialise IPFS daemon.
- def __enter__(self) -> None: Run the ipfs daemon.
- de... | Implement the Python class `IPFSDaemon` described below.
Class description:
Set up the IPFS daemon. :raises Exception: if IPFS is not installed.
Method signatures and docstrings:
- def __init__(self, timeout: float=15.0, port: int=5001): Initialise IPFS daemon.
- def __enter__(self) -> None: Run the ipfs daemon.
- de... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class IPFSDaemon:
"""Set up the IPFS daemon. :raises Exception: if IPFS is not installed."""
def __init__(self, timeout: float=15.0, port: int=5001):
"""Initialise IPFS daemon."""
<|body_0|>
def __enter__(self) -> None:
"""Run the ipfs daemon."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IPFSDaemon:
"""Set up the IPFS daemon. :raises Exception: if IPFS is not installed."""
def __init__(self, timeout: float=15.0, port: int=5001):
"""Initialise IPFS daemon."""
self.timeout = timeout
self.port = port
res = shutil.which('ipfs')
if res is None:
... | the_stack_v2_python_sparse | scripts/generate_ipfs_hashes.py | fetchai/agents-aea | train | 192 |
d472d6f4e814e07b9afebb3f8314e93c7c52a355 | [
"sensor = TimerSensor(self.mudpi, config)\nself.add_component(sensor)\nreturn True",
"self.register_component_actions('start', action='start')\nself.register_component_actions('stop', action='stop')\nself.register_component_actions('reset', action='reset')\nself.register_component_actions('pause', action='pause')... | <|body_start_0|>
sensor = TimerSensor(self.mudpi, config)
self.add_component(sensor)
return True
<|end_body_0|>
<|body_start_1|>
self.register_component_actions('start', action='start')
self.register_component_actions('stop', action='stop')
self.register_component_action... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer sensor component from configs"""
<|body_0|>
def register_actions(self):
"""Register any interface actions"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sensor = TimerSensor(self.mudpi, config)
... | stack_v2_sparse_classes_36k_train_021359 | 4,836 | permissive | [
{
"docstring": "Load timer sensor component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Register any interface actions",
"name": "register_actions",
"signature": "def register_actions(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014043 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer sensor component from configs
- def register_actions(self): Register any interface actions | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer sensor component from configs
- def register_actions(self): Register any interface actions
<|skeleton|>
class Interface:
def load(self,... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer sensor component from configs"""
<|body_0|>
def register_actions(self):
"""Register any interface actions"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Interface:
def load(self, config):
"""Load timer sensor component from configs"""
sensor = TimerSensor(self.mudpi, config)
self.add_component(sensor)
return True
def register_actions(self):
"""Register any interface actions"""
self.register_component_action... | the_stack_v2_python_sparse | mudpi/extensions/timer/sensor.py | mistasp0ck/mudpi-core | train | 0 | |
7f3289c0bba4a73d47266163c1f442a656bbe54b | [
"if prefix is None:\n prefix = self.logical_id\nif suffix.isalnum():\n logical_id = prefix + resource_type + suffix\nelse:\n generator = logical_id_generator.LogicalIdGenerator(prefix + resource_type, suffix)\n logical_id = generator.gen()\nreturn logical_id",
"role_logical_id = self._generate_logical... | <|body_start_0|>
if prefix is None:
prefix = self.logical_id
if suffix.isalnum():
logical_id = prefix + resource_type + suffix
else:
generator = logical_id_generator.LogicalIdGenerator(prefix + resource_type, suffix)
logical_id = generator.gen()
... | Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service. | EventSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventSource:
"""Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service."""
def _generate_logical_id(self, prefix, suffix, resource_type):
"""Helper utility to generate a logicial ID for a new resource :param string pre... | stack_v2_sparse_classes_36k_train_021360 | 19,670 | permissive | [
{
"docstring": "Helper utility to generate a logicial ID for a new resource :param string prefix: Prefix to use for the logical ID of the resource :param string suffix: Suffix to add for the logical ID of the resource :param string resource_type: Type of the resource :returns: the logical ID for the new resourc... | 2 | stack_v2_sparse_classes_30k_train_014419 | Implement the Python class `EventSource` described below.
Class description:
Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service.
Method signatures and docstrings:
- def _generate_logical_id(self, prefix, suffix, resource_type): Helper utility to ge... | Implement the Python class `EventSource` described below.
Class description:
Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service.
Method signatures and docstrings:
- def _generate_logical_id(self, prefix, suffix, resource_type): Helper utility to ge... | 1af3e97b2043369087729cc3849934f8cf838b7e | <|skeleton|>
class EventSource:
"""Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service."""
def _generate_logical_id(self, prefix, suffix, resource_type):
"""Helper utility to generate a logicial ID for a new resource :param string pre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventSource:
"""Base class for event sources for SAM State Machine. :cvar str principal: The AWS service principal of the source service."""
def _generate_logical_id(self, prefix, suffix, resource_type):
"""Helper utility to generate a logicial ID for a new resource :param string prefix: Prefix t... | the_stack_v2_python_sparse | samtranslator/model/stepfunctions/events.py | jfuss/serverless-application-model | train | 2 |
ac76cb6de0f9fc493cbdafa8520af24521dba3f5 | [
"currency = 'USDT'\naccount_from = 1\naccount_to = 5\ntry:\n result = AccountApi.coin_transfer(currency=currency, amount=amount, account_from=account_from, account_to=account_to, to_instrument_id=to_instrument_id)\nexcept OkexAPIException:\n return False\nreturn result",
"currency = 'USDT'\naccount_from = 5... | <|body_start_0|>
currency = 'USDT'
account_from = 1
account_to = 5
try:
result = AccountApi.coin_transfer(currency=currency, amount=amount, account_from=account_from, account_to=account_to, to_instrument_id=to_instrument_id)
except OkexAPIException:
return... | AccountBusiness | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountBusiness:
def coin_transfer_from_spot_to_margin(cls, amount, to_instrument_id):
"""资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账户;17、借贷账户 :param amount: 划转金额 单位:USDT :param to_instrument_id: 转入杠杆币对,例如:EOS-USDT :return: {'result': Tr... | stack_v2_sparse_classes_36k_train_021361 | 3,254 | no_license | [
{
"docstring": "资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账户;17、借贷账户 :param amount: 划转金额 单位:USDT :param to_instrument_id: 转入杠杆币对,例如:EOS-USDT :return: {'result': True, 'amount': '1.00000000', 'from': '1', 'currency': 'USDT', 'transfer_id': '186889369', 'to': '5'... | 4 | stack_v2_sparse_classes_30k_train_021287 | Implement the Python class `AccountBusiness` described below.
Class description:
Implement the AccountBusiness class.
Method signatures and docstrings:
- def coin_transfer_from_spot_to_margin(cls, amount, to_instrument_id): 资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账... | Implement the Python class `AccountBusiness` described below.
Class description:
Implement the AccountBusiness class.
Method signatures and docstrings:
- def coin_transfer_from_spot_to_margin(cls, amount, to_instrument_id): 资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账... | 53d2ae2779de60ea59e73a9c4c5f5c198651e2f2 | <|skeleton|>
class AccountBusiness:
def coin_transfer_from_spot_to_margin(cls, amount, to_instrument_id):
"""资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账户;17、借贷账户 :param amount: 划转金额 单位:USDT :param to_instrument_id: 转入杠杆币对,例如:EOS-USDT :return: {'result': Tr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountBusiness:
def coin_transfer_from_spot_to_margin(cls, amount, to_instrument_id):
"""资金划转: 现货划转资金到杠杆账户 account_from: 1、币币;3、交割合约;4、法币账户;5、币币杠杆;6、资金账户 8、余币宝;9、永续合约账户;12、期权合约;14、挖矿账户;17、借贷账户 :param amount: 划转金额 单位:USDT :param to_instrument_id: 转入杠杆币对,例如:EOS-USDT :return: {'result': True, 'amount': ... | the_stack_v2_python_sparse | lib/api/business/account_business.py | LPLhock/bitcoin | train | 0 | |
fe661f2f2d448500173afc330a038523a5d45ae8 | [
"if 'watts_rsp.auth.WattsBackend' in settings.AUTHENTICATION_BACKENDS:\n logger.debug('Redirect to home/rsp/login/init...')\n return redirect('vfwheron:watts_rsp:login_init')\nelif settings.DEBUG:\n return redirect('vfwheron:login')\nelse:\n raise Http404",
"if not request.user.is_authenticated:\n ... | <|body_start_0|>
if 'watts_rsp.auth.WattsBackend' in settings.AUTHENTICATION_BACKENDS:
logger.debug('Redirect to home/rsp/login/init...')
return redirect('vfwheron:watts_rsp:login_init')
elif settings.DEBUG:
return redirect('vfwheron:login')
else:
... | LoginView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginView:
def post(self, request):
""":param request: :type request: :return: :rtype:"""
<|body_0|>
def dispatch(self, request, *args, **kwargs):
"""When clicked on login, this is the first(?) function to access. If not user.is_authenticated, next function is post a... | stack_v2_sparse_classes_36k_train_021362 | 27,241 | permissive | [
{
"docstring": ":param request: :type request: :return: :rtype:",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "When clicked on login, this is the first(?) function to access. If not user.is_authenticated, next function is post and redirect to watts (django-watts-rsp/... | 2 | stack_v2_sparse_classes_30k_train_020619 | Implement the Python class `LoginView` described below.
Class description:
Implement the LoginView class.
Method signatures and docstrings:
- def post(self, request): :param request: :type request: :return: :rtype:
- def dispatch(self, request, *args, **kwargs): When clicked on login, this is the first(?) function to... | Implement the Python class `LoginView` described below.
Class description:
Implement the LoginView class.
Method signatures and docstrings:
- def post(self, request): :param request: :type request: :return: :rtype:
- def dispatch(self, request, *args, **kwargs): When clicked on login, this is the first(?) function to... | e245101b5278ee1ee8c55f7dbde2445363c9aa26 | <|skeleton|>
class LoginView:
def post(self, request):
""":param request: :type request: :return: :rtype:"""
<|body_0|>
def dispatch(self, request, *args, **kwargs):
"""When clicked on login, this is the first(?) function to access. If not user.is_authenticated, next function is post a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoginView:
def post(self, request):
""":param request: :type request: :return: :rtype:"""
if 'watts_rsp.auth.WattsBackend' in settings.AUTHENTICATION_BACKENDS:
logger.debug('Redirect to home/rsp/login/init...')
return redirect('vfwheron:watts_rsp:login_init')
el... | the_stack_v2_python_sparse | vfwheron/views.py | standardgalactic/vforwater-portal | train | 0 | |
5777296b894b4b56347dc16a6290550e3ae30462 | [
"self.name = name\nself.time_avg = time_avg\nself.time_dev = time_dev\nself.cv = cv\nself.sample_num = samples\nself.lines = lines",
"lines = []\nif self.sample_num > 1:\n lines.append('{}: {:.5f} σ={:.5f}ms with n={} cv={}'.format(self.name, self.time_avg, self.time_dev, self.sample_num, self.cv))\nelse:\n ... | <|body_start_0|>
self.name = name
self.time_avg = time_avg
self.time_dev = time_dev
self.cv = cv
self.sample_num = samples
self.lines = lines
<|end_body_0|>
<|body_start_1|>
lines = []
if self.sample_num > 1:
lines.append('{}: {:.5f} σ={:.5f}m... | TestStats | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestStats:
def __init__(self, name: str, time_avg: float, time_dev: float, cv: float, samples: int, lines: List[LineStats]) -> None:
"""Represents a summary of relevant statistics for a list of tests. Args: name (str): The name of the test whose runs are being averaged. time_avg (float):... | stack_v2_sparse_classes_36k_train_021363 | 13,376 | permissive | [
{
"docstring": "Represents a summary of relevant statistics for a list of tests. Args: name (str): The name of the test whose runs are being averaged. time_avg (float): The average time to execute the test. time_dev (float): The standard deviation in the mean. cv (float): The coefficient of variance of the popu... | 2 | null | Implement the Python class `TestStats` described below.
Class description:
Implement the TestStats class.
Method signatures and docstrings:
- def __init__(self, name: str, time_avg: float, time_dev: float, cv: float, samples: int, lines: List[LineStats]) -> None: Represents a summary of relevant statistics for a list... | Implement the Python class `TestStats` described below.
Class description:
Implement the TestStats class.
Method signatures and docstrings:
- def __init__(self, name: str, time_avg: float, time_dev: float, cv: float, samples: int, lines: List[LineStats]) -> None: Represents a summary of relevant statistics for a list... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class TestStats:
def __init__(self, name: str, time_avg: float, time_dev: float, cv: float, samples: int, lines: List[LineStats]) -> None:
"""Represents a summary of relevant statistics for a list of tests. Args: name (str): The name of the test whose runs are being averaged. time_avg (float):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestStats:
def __init__(self, name: str, time_avg: float, time_dev: float, cv: float, samples: int, lines: List[LineStats]) -> None:
"""Represents a summary of relevant statistics for a list of tests. Args: name (str): The name of the test whose runs are being averaged. time_avg (float): The average t... | the_stack_v2_python_sparse | tools/fuchsia/comparative_tester/generate_perf_report.py | chromium/chromium | train | 17,408 | |
e5c3b1bcab0c28773ea0cdd97d95b246918d7217 | [
"self.strict = strict\nself.record = record.copy()\ntry:\n self._extract_info()\n self._strip_logging_junk()\n self._fix_types()\nexcept ValueError:\n self.record = None\n raise",
"rec = self.record\nmessage = rec.get('message', rec.get('msg', None))\nif message is None:\n g_log.error(\"No 'mess... | <|body_start_0|>
self.strict = strict
self.record = record.copy()
try:
self._extract_info()
self._strip_logging_junk()
self._fix_types()
except ValueError:
self.record = None
raise
<|end_body_0|>
<|body_start_1|>
rec = ... | Convert logged record (dict) to object that we can store in a DB. | DBRecord | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBRecord:
"""Convert logged record (dict) to object that we can store in a DB."""
def __init__(self, record, strict=False):
"""Process input record. Results are stored in `record` attribute. Anything should parse unless `strict` is passed in, which is still pretty lenient but require... | stack_v2_sparse_classes_36k_train_021364 | 20,854 | permissive | [
{
"docstring": "Process input record. Results are stored in `record` attribute. Anything should parse unless `strict` is passed in, which is still pretty lenient but requires the \"event;message\" format. :param record: Input record which is *modified in-place* :type record: dict",
"name": "__init__",
"... | 4 | stack_v2_sparse_classes_30k_train_013088 | Implement the Python class `DBRecord` described below.
Class description:
Convert logged record (dict) to object that we can store in a DB.
Method signatures and docstrings:
- def __init__(self, record, strict=False): Process input record. Results are stored in `record` attribute. Anything should parse unless `strict... | Implement the Python class `DBRecord` described below.
Class description:
Convert logged record (dict) to object that we can store in a DB.
Method signatures and docstrings:
- def __init__(self, record, strict=False): Process input record. Results are stored in `record` attribute. Anything should parse unless `strict... | 52715f3ec6c2ad975a811e50971d793582422395 | <|skeleton|>
class DBRecord:
"""Convert logged record (dict) to object that we can store in a DB."""
def __init__(self, record, strict=False):
"""Process input record. Results are stored in `record` attribute. Anything should parse unless `strict` is passed in, which is still pretty lenient but require... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBRecord:
"""Convert logged record (dict) to object that we can store in a DB."""
def __init__(self, record, strict=False):
"""Process input record. Results are stored in `record` attribute. Anything should parse unless `strict` is passed in, which is still pretty lenient but requires the "event;... | the_stack_v2_python_sparse | src/biokbase/narrative/common/log_proxy.py | kbase/narrative | train | 14 |
2f5863d346a6f805b6c5c395172234271d5ddc0f | [
"self._step = tf.train.get_or_create_global_step() if step is None else step\nself._scope = scope\nself._verbose = verbose\nself._enable_tf = enable_tf",
"step = self._step if step is None else step\nif self._scope:\n name = self._scope + name\nif self._enable_tf:\n tf_summary.scalar(name, value, step=step)... | <|body_start_0|>
self._step = tf.train.get_or_create_global_step() if step is None else step
self._scope = scope
self._verbose = verbose
self._enable_tf = enable_tf
<|end_body_0|>
<|body_start_1|>
step = self._step if step is None else step
if self._scope:
na... | Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assign_add(1) | ScalarSummary | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScalarSummary:
"""Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assign_add(1)"""
def __init__(self, ste... | stack_v2_sparse_classes_36k_train_021365 | 2,338 | permissive | [
{
"docstring": "Creates an instance of this class. Args: step: An optional `tf.Variable` for tracking the logging step. If `None`, will use the global Tensorflow step variable. scope: An optional string that is prepended to metric names passed to `__call__`. enable_tf: Whether to create a TF summary. verbose: W... | 2 | stack_v2_sparse_classes_30k_train_011907 | Implement the Python class `ScalarSummary` described below.
Class description:
Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assig... | Implement the Python class `ScalarSummary` described below.
Class description:
Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assig... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class ScalarSummary:
"""Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assign_add(1)"""
def __init__(self, ste... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScalarSummary:
"""Enables logging a scalar metric to Tensorboard. Example: num_rounds = tf.Variable(0, dtype=tf.int64, trainable=False) summary = ScalarSummary() Anywhere in your code: summary('summary_name', summary_value) After each round: num_rounds.assign_add(1)"""
def __init__(self, step=None, scope... | the_stack_v2_python_sparse | protein_lm/logging.py | Jimmy-INL/google-research | train | 1 |
e6c6ea015e02a2805a2c67a1303d22c70ceedbc0 | [
"self.comp = feature_computer_factory.factory(conf['feature'])(conf)\nself.segment_lengths = segment_lengths\nself.nrS = int(conf['nrs'])\nif 'spk_select' in conf:\n self.nrS_select = map(int, conf['spk_select'].split(' '))\nelse:\n self.nrS_select = range(0, self.nrS)\nself.dim = self.comp.get_dim() * len(se... | <|body_start_0|>
self.comp = feature_computer_factory.factory(conf['feature'])(conf)
self.segment_lengths = segment_lengths
self.nrS = int(conf['nrs'])
if 'spk_select' in conf:
self.nrS_select = map(int, conf['spk_select'].split(' '))
else:
self.nrS_select... | a processor for audio files, this will compute the targets | onehotperfeatureTargetProcessor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class onehotperfeatureTargetProcessor:
"""a processor for audio files, this will compute the targets"""
def __init__(self, conf, segment_lengths):
"""onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: ... | stack_v2_sparse_classes_36k_train_021366 | 3,760 | permissive | [
{
"docstring": "onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths",
"name": "__init__",
"signature": "def __init__(self, conf, se... | 3 | stack_v2_sparse_classes_30k_train_001307 | Implement the Python class `onehotperfeatureTargetProcessor` described below.
Class description:
a processor for audio files, this will compute the targets
Method signatures and docstrings:
- def __init__(self, conf, segment_lengths): onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProce... | Implement the Python class `onehotperfeatureTargetProcessor` described below.
Class description:
a processor for audio files, this will compute the targets
Method signatures and docstrings:
- def __init__(self, conf, segment_lengths): onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProce... | 5e862cbf846d45b8a317f87588533f3fde9f0726 | <|skeleton|>
class onehotperfeatureTargetProcessor:
"""a processor for audio files, this will compute the targets"""
def __init__(self, conf, segment_lengths):
"""onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class onehotperfeatureTargetProcessor:
"""a processor for audio files, this will compute the targets"""
def __init__(self, conf, segment_lengths):
"""onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: A list contai... | the_stack_v2_python_sparse | nabu/processing/processors/onehotperfeature_target_processor.py | JeroenZegers/Nabu-MSSS | train | 19 |
54bc4a58fe75fe9d65190cd706a3ec2cfbb39008 | [
"while '' in a_list:\n a_list.remove('')\nreturn a_list",
"if prefix.endswith('='):\n return a_string.replace(prefix, '')\nelse:\n prefix += ': '\n return a_string.replace(prefix, '')",
"a_list = a_string.split(splitter)\na_list = [item.strip(' .') for item in a_list]\nreturn StringHelper.remove_emp... | <|body_start_0|>
while '' in a_list:
a_list.remove('')
return a_list
<|end_body_0|>
<|body_start_1|>
if prefix.endswith('='):
return a_string.replace(prefix, '')
else:
prefix += ': '
return a_string.replace(prefix, '')
<|end_body_1|>
<|bo... | Utility class for string manipulation relevant to Swiss-Prot. | StringHelper | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StringHelper:
"""Utility class for string manipulation relevant to Swiss-Prot."""
def remove_empty_strings(a_list):
"""Deletes empty string from list."""
<|body_0|>
def remove_prefix(prefix, a_string):
"""Removes specified prefix from string."""
<|body_1|... | stack_v2_sparse_classes_36k_train_021367 | 19,067 | permissive | [
{
"docstring": "Deletes empty string from list.",
"name": "remove_empty_strings",
"signature": "def remove_empty_strings(a_list)"
},
{
"docstring": "Removes specified prefix from string.",
"name": "remove_prefix",
"signature": "def remove_prefix(prefix, a_string)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_013054 | Implement the Python class `StringHelper` described below.
Class description:
Utility class for string manipulation relevant to Swiss-Prot.
Method signatures and docstrings:
- def remove_empty_strings(a_list): Deletes empty string from list.
- def remove_prefix(prefix, a_string): Removes specified prefix from string.... | Implement the Python class `StringHelper` described below.
Class description:
Utility class for string manipulation relevant to Swiss-Prot.
Method signatures and docstrings:
- def remove_empty_strings(a_list): Deletes empty string from list.
- def remove_prefix(prefix, a_string): Removes specified prefix from string.... | 1fa7cc286e5cc8dd02cf524988b94c8ccf9d9a81 | <|skeleton|>
class StringHelper:
"""Utility class for string manipulation relevant to Swiss-Prot."""
def remove_empty_strings(a_list):
"""Deletes empty string from list."""
<|body_0|>
def remove_prefix(prefix, a_string):
"""Removes specified prefix from string."""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StringHelper:
"""Utility class for string manipulation relevant to Swiss-Prot."""
def remove_empty_strings(a_list):
"""Deletes empty string from list."""
while '' in a_list:
a_list.remove('')
return a_list
def remove_prefix(prefix, a_string):
"""Removes sp... | the_stack_v2_python_sparse | prunito/distil/SwissProtRecordCollector.py | kp14/prunito | train | 2 |
46d0680bdd9eb654d50129ac9fb9b103e9ea7dcb | [
"cases = [colors.random() for i in range(ncases)]\nw, h = size\ngrid = [[random.randint(0, 9) for x in range(w)] for y in range(h)]\ngrid = np.array(grid)\nreturn cls(grid, cases)",
"self.grid = grid\nself.cases = cases\nw, h = list(reversed(self.grid.shape[:2]))\nsuper().__init__((w // 2, h // 2), (w, h))",
"w... | <|body_start_0|>
cases = [colors.random() for i in range(ncases)]
w, h = size
grid = [[random.randint(0, 9) for x in range(w)] for y in range(h)]
grid = np.array(grid)
return cls(grid, cases)
<|end_body_0|>
<|body_start_1|>
self.grid = grid
self.cases = cases
... | A simple map is basically just a map with a grid of values, and each value correspond to a type of case. | Map | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Map:
"""A simple map is basically just a map with a grid of values, and each value correspond to a type of case."""
def random(cls, size=(10, 10), ncases=10):
"""Create a random simple map."""
<|body_0|>
def __init__(self, grid, cases):
"""Create a simple map tha... | stack_v2_sparse_classes_36k_train_021368 | 3,336 | permissive | [
{
"docstring": "Create a random simple map.",
"name": "random",
"signature": "def random(cls, size=(10, 10), ncases=10)"
},
{
"docstring": "Create a simple map that is centered in the origin.",
"name": "__init__",
"signature": "def __init__(self, grid, cases)"
},
{
"docstring": "... | 3 | null | Implement the Python class `Map` described below.
Class description:
A simple map is basically just a map with a grid of values, and each value correspond to a type of case.
Method signatures and docstrings:
- def random(cls, size=(10, 10), ncases=10): Create a random simple map.
- def __init__(self, grid, cases): Cr... | Implement the Python class `Map` described below.
Class description:
A simple map is basically just a map with a grid of values, and each value correspond to a type of case.
Method signatures and docstrings:
- def random(cls, size=(10, 10), ncases=10): Create a random simple map.
- def __init__(self, grid, cases): Cr... | 61abbbeac0fd351253e06b19736d9939fd5b316e | <|skeleton|>
class Map:
"""A simple map is basically just a map with a grid of values, and each value correspond to a type of case."""
def random(cls, size=(10, 10), ncases=10):
"""Create a random simple map."""
<|body_0|>
def __init__(self, grid, cases):
"""Create a simple map tha... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Map:
"""A simple map is basically just a map with a grid of values, and each value correspond to a type of case."""
def random(cls, size=(10, 10), ncases=10):
"""Create a random simple map."""
cases = [colors.random() for i in range(ncases)]
w, h = size
grid = [[random.ran... | the_stack_v2_python_sparse | pygame_geometry/map.py | MarcPartensky/Pygame-Geometry | train | 7 |
e1d5a4a6158a68995e582dc5e5359ac10d070b28 | [
"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... | A set of methods for managing MySQL databases. | DatabaseServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseServiceServicer:
"""A set of methods for managing MySQL databases."""
def Get(self, request, context):
"""Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request."""
<|body_0|>
def List(self, request, context):
... | stack_v2_sparse_classes_36k_train_021369 | 8,767 | permissive | [
{
"docstring": "Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request.",
"name": "Get",
"signature": "def Get(self, request, context)"
},
{
"docstring": "Retrieves the list of MySQL databases in the specified cluster.",
"name": "List",
... | 4 | stack_v2_sparse_classes_30k_train_001959 | Implement the Python class `DatabaseServiceServicer` described below.
Class description:
A set of methods for managing MySQL databases.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request.
- def ... | Implement the Python class `DatabaseServiceServicer` described below.
Class description:
A set of methods for managing MySQL databases.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request.
- def ... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class DatabaseServiceServicer:
"""A set of methods for managing MySQL databases."""
def Get(self, request, context):
"""Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request."""
<|body_0|>
def List(self, request, context):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatabaseServiceServicer:
"""A set of methods for managing MySQL databases."""
def Get(self, request, context):
"""Returns the specified MySQL database. To get the list of available MySQL databases, make a [List] request."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.s... | the_stack_v2_python_sparse | yandex/cloud/mdb/mysql/v1alpha/database_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
0f4baa2d5b7d3a26fad7bce10b7093f4a9bb302b | [
"ptr = head\nktail = None\nnew_head = None\nwhile ptr:\n count = 0\n ptr = head\n while count < k and ptr:\n ptr = ptr.next\n count += 1\n if count == k:\n rev_head = self.revers(head, k)\n if not new_head:\n new_head = rev_head\n if ktail:\n ktai... | <|body_start_0|>
ptr = head
ktail = None
new_head = None
while ptr:
count = 0
ptr = head
while count < k and ptr:
ptr = ptr.next
count += 1
if count == k:
rev_head = self.revers(head, k)
... | LinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedList:
def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode':
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:"""
<|body_0|>
def reverse(self, head: 'ListNode', k: int) -> 'ListNode':
"""Reverse k n... | stack_v2_sparse_classes_36k_train_021370 | 3,169 | no_license | [
{
"docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:",
"name": "reverse_k_groups",
"signature": "def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode'"
},
{
"docstring": "Reverse k nodes :param head: :param k: :return:",
... | 4 | stack_v2_sparse_classes_30k_train_015755 | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode': Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:
- def rev... | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode': Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:
- def rev... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class LinkedList:
def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode':
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:"""
<|body_0|>
def reverse(self, head: 'ListNode', k: int) -> 'ListNode':
"""Reverse k n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkedList:
def reverse_k_groups(self, head: 'ListNode', k: int) -> 'ListNode':
"""Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :param k: :return:"""
ptr = head
ktail = None
new_head = None
while ptr:
count = 0
pt... | the_stack_v2_python_sparse | revisited__2021/linked_list/reverse_nodes_in_k_group.py | Shiv2157k/leet_code | train | 1 | |
7fae053d73eaf2f36a37b31080937279f700e664 | [
"super().__init__()\nself.training = True\nndims = len(inshape)\nassert ndims in [1, 2, 3], 'ndims should be one of 1, 2, or 3. found: %d' % ndims\nself.unet_model = Unet(inshape, nb_features=nb_unet_features, nb_levels=nb_unet_levels, feat_mult=unet_feat_mult)\nConv = getattr(nn, 'Conv%dd' % ndims)\nself.flow = Co... | <|body_start_0|>
super().__init__()
self.training = True
ndims = len(inshape)
assert ndims in [1, 2, 3], 'ndims should be one of 1, 2, or 3. found: %d' % ndims
self.unet_model = Unet(inshape, nb_features=nb_unet_features, nb_levels=nb_unet_levels, feat_mult=unet_feat_mult)
... | VoxelMorph network for (unsupervised) nonlinear registration between two images. | VxmDense | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VxmDense:
"""VoxelMorph network for (unsupervised) nonlinear registration between two images."""
def __init__(self, inshape, nb_unet_features=None, nb_unet_levels=None, unet_feat_mult=1, int_steps=7, int_downsize=2, bidir=False, use_probs=False):
"""Parameters: inshape: Input shape. ... | stack_v2_sparse_classes_36k_train_021371 | 9,203 | permissive | [
{
"docstring": "Parameters: inshape: Input shape. e.g. (192, 192, 192) nb_unet_features: Unet convolutional features. Can be specified via a list of lists with the form [[encoder feats], [decoder feats]], or as a single integer. If None (default), the unet features are defined by the default config described in... | 2 | null | Implement the Python class `VxmDense` described below.
Class description:
VoxelMorph network for (unsupervised) nonlinear registration between two images.
Method signatures and docstrings:
- def __init__(self, inshape, nb_unet_features=None, nb_unet_levels=None, unet_feat_mult=1, int_steps=7, int_downsize=2, bidir=Fa... | Implement the Python class `VxmDense` described below.
Class description:
VoxelMorph network for (unsupervised) nonlinear registration between two images.
Method signatures and docstrings:
- def __init__(self, inshape, nb_unet_features=None, nb_unet_levels=None, unet_feat_mult=1, int_steps=7, int_downsize=2, bidir=Fa... | 50909d39289733264dce14666e9deeecbe858819 | <|skeleton|>
class VxmDense:
"""VoxelMorph network for (unsupervised) nonlinear registration between two images."""
def __init__(self, inshape, nb_unet_features=None, nb_unet_levels=None, unet_feat_mult=1, int_steps=7, int_downsize=2, bidir=False, use_probs=False):
"""Parameters: inshape: Input shape. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VxmDense:
"""VoxelMorph network for (unsupervised) nonlinear registration between two images."""
def __init__(self, inshape, nb_unet_features=None, nb_unet_levels=None, unet_feat_mult=1, int_steps=7, int_downsize=2, bidir=False, use_probs=False):
"""Parameters: inshape: Input shape. e.g. (192, 19... | the_stack_v2_python_sparse | proj/voxelmorph/torch_vm/networks.py | NanYoMy/mmregnet | train | 7 |
ea9286e90618c585ee1c81c06b28ccfa8b84b3fd | [
"if isinstance(start, int) and isinstance(end, int):\n pass\nelse:\n print('numbers should be int!')\nself.start = start\nself.end = end",
"@wraps(func)\ndef wrapper(*args, **kwargs):\n gener = self.__iter__()\n return func(gener, *args, **kwargs)\nreturn wrapper",
"try:\n for k in range(self.sta... | <|body_start_0|>
if isinstance(start, int) and isinstance(end, int):
pass
else:
print('numbers should be int!')
self.start = start
self.end = end
<|end_body_0|>
<|body_start_1|>
@wraps(func)
def wrapper(*args, **kwargs):
gener = self._... | Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using | Prime_Filtration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
""... | stack_v2_sparse_classes_36k_train_021372 | 3,273 | no_license | [
{
"docstring": "Introduction ------------ constructor Parameters ---------- start: the start number of the range end : the end number of the range ----------",
"name": "__init__",
"signature": "def __init__(self, start, end)"
},
{
"docstring": "Introduction ------------ Rewrite __call__ function... | 4 | stack_v2_sparse_classes_30k_train_000777 | Implement the Python class `Prime_Filtration` described below.
Class description:
Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using
Method sig... | Implement the Python class `Prime_Filtration` described below.
Class description:
Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using
Method sig... | 661dba7ea846859056fd6ee7a310d352ca178e98 | <|skeleton|>
class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Prime_Filtration:
"""Attentions: This is a decorated class, you should using it by '@', examples please look at Prime_Filtration_TEST.py at the same dictionary. Please check all the using details below and in Prime_Filtration_TEST.py before using"""
def __init__(self, start, end):
"""Introduction... | the_stack_v2_python_sparse | 包亦航2018011890/Regular_homework/Prime_Filtration(second_homework)/Prime_Filtration.py | wanghan79/2020_Python | train | 4 |
c00591a65be37964410e6721427eb7926fcdb278 | [
"virtual = self._ledfx.virtuals.get(virtual_id)\nif virtual is None:\n response = {'status': 'failed', 'reason': f'Virtual with ID {virtual_id} not found'}\n return web.json_response(data=response, status=404)\nresponse = {'status': 'success'}\nresponse[virtual.id] = {'config': virtual.config, 'id': virtual.i... | <|body_start_0|>
virtual = self._ledfx.virtuals.get(virtual_id)
if virtual is None:
response = {'status': 'failed', 'reason': f'Virtual with ID {virtual_id} not found'}
return web.json_response(data=response, status=404)
response = {'status': 'success'}
response[v... | REST end-point for querying and managing virtuals | VirtualEndpoint | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-3.0-only",
"GPL-3.0-or-later",
"LGPL-2.1-or-later",
"GPL-1.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VirtualEndpoint:
"""REST end-point for querying and managing virtuals"""
async def get(self, virtual_id) -> web.Response:
"""Get a virtual's full config"""
<|body_0|>
async def put(self, virtual_id, request) -> web.Response:
"""Set a virtual to active or inactive... | stack_v2_sparse_classes_36k_train_021373 | 7,327 | permissive | [
{
"docstring": "Get a virtual's full config",
"name": "get",
"signature": "async def get(self, virtual_id) -> web.Response"
},
{
"docstring": "Set a virtual to active or inactive",
"name": "put",
"signature": "async def put(self, virtual_id, request) -> web.Response"
},
{
"docstr... | 4 | stack_v2_sparse_classes_30k_train_017503 | Implement the Python class `VirtualEndpoint` described below.
Class description:
REST end-point for querying and managing virtuals
Method signatures and docstrings:
- async def get(self, virtual_id) -> web.Response: Get a virtual's full config
- async def put(self, virtual_id, request) -> web.Response: Set a virtual ... | Implement the Python class `VirtualEndpoint` described below.
Class description:
REST end-point for querying and managing virtuals
Method signatures and docstrings:
- async def get(self, virtual_id) -> web.Response: Get a virtual's full config
- async def put(self, virtual_id, request) -> web.Response: Set a virtual ... | 3146ba9e9d10a2d01cdd4cb15ea37fc0c7bd020f | <|skeleton|>
class VirtualEndpoint:
"""REST end-point for querying and managing virtuals"""
async def get(self, virtual_id) -> web.Response:
"""Get a virtual's full config"""
<|body_0|>
async def put(self, virtual_id, request) -> web.Response:
"""Set a virtual to active or inactive... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VirtualEndpoint:
"""REST end-point for querying and managing virtuals"""
async def get(self, virtual_id) -> web.Response:
"""Get a virtual's full config"""
virtual = self._ledfx.virtuals.get(virtual_id)
if virtual is None:
response = {'status': 'failed', 'reason': f'Vi... | the_stack_v2_python_sparse | ledfx/api/virtual.py | THATDONFC/LedFx | train | 0 |
72dbe0e6908c80c23b7d68da20247d0c364be82e | [
"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... | A set of methods for managing Datasphere folder budgets. | FolderBudgetServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FolderBudgetServiceServicer:
"""A set of methods for managing Datasphere folder budgets."""
def Get(self, request, context):
"""Returns the specified folder budget."""
<|body_0|>
def Set(self, request, context):
"""Sets the unit balance and the limits of the spec... | stack_v2_sparse_classes_36k_train_021374 | 4,843 | permissive | [
{
"docstring": "Returns the specified folder budget.",
"name": "Get",
"signature": "def Get(self, request, context)"
},
{
"docstring": "Sets the unit balance and the limits of the specified folder budget.",
"name": "Set",
"signature": "def Set(self, request, context)"
}
] | 2 | null | Implement the Python class `FolderBudgetServiceServicer` described below.
Class description:
A set of methods for managing Datasphere folder budgets.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified folder budget.
- def Set(self, request, context): Sets the unit balance and t... | Implement the Python class `FolderBudgetServiceServicer` described below.
Class description:
A set of methods for managing Datasphere folder budgets.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified folder budget.
- def Set(self, request, context): Sets the unit balance and t... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class FolderBudgetServiceServicer:
"""A set of methods for managing Datasphere folder budgets."""
def Get(self, request, context):
"""Returns the specified folder budget."""
<|body_0|>
def Set(self, request, context):
"""Sets the unit balance and the limits of the spec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FolderBudgetServiceServicer:
"""A set of methods for managing Datasphere folder budgets."""
def Get(self, request, context):
"""Returns the specified folder budget."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotI... | the_stack_v2_python_sparse | yandex/cloud/datasphere/v1/folder_budget_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
bfdc7fea7c3b7c98b053a8c5425d4542d62a005a | [
"self._name = 'quadratic'\nself._dim = dim\nself._train_size = train_size\nself._noise_level = noise_level\nsuper(quadratic, self).__init__(batch_size)",
"with tf.name_scope(self._name):\n with tf.device('/cpu:0'):\n data = tf.data.Dataset.from_tensor_slices(X)\n if shuffle:\n data = d... | <|body_start_0|>
self._name = 'quadratic'
self._dim = dim
self._train_size = train_size
self._noise_level = noise_level
super(quadratic, self).__init__(batch_size)
<|end_body_0|>
<|body_start_1|>
with tf.name_scope(self._name):
with tf.device('/cpu:0'):
... | DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance specified by ``noise_level``. Args: batch_size (int): The mini-batch size to... | quadratic | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class quadratic:
"""DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance specified by ``noise_level``. Args: bat... | stack_v2_sparse_classes_36k_train_021375 | 5,442 | permissive | [
{
"docstring": "Creates a new Quadratic instance. Args: batch_size (int): The mini-batch size to use. Note that, if ``batch_size`` is not a divider of the dataset size (``1000`` for train and test) the remainder is dropped in each epoch (after shuffling). dim (int): Dimensionality of the quadratic. Defaults to ... | 4 | stack_v2_sparse_classes_30k_val_001142 | Implement the Python class `quadratic` described below.
Class description:
DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance ... | Implement the Python class `quadratic` described below.
Class description:
DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance ... | e85816ce42466326dac18841c58b79f87a4a1a7c | <|skeleton|>
class quadratic:
"""DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance specified by ``noise_level``. Args: bat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class quadratic:
"""DeepOBS data set class to create an n dimensional stochastic quadratic testproblem. This toy data set consists of a fixed number (``train_size``) of iid draws from a zero-mean normal distribution in ``dim`` dimensions with isotropic covariance specified by ``noise_level``. Args: batch_size (int)... | the_stack_v2_python_sparse | deepobs/tensorflow/datasets/quadratic.py | H0merJayS1mpson/deepobscustom | train | 0 |
571307be1e1d20222afe3cbe4527af5fcb38f445 | [
"try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404",
"if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\nsecurity = SecurityGuarantor.get_members_securities(member=member)\nserializer = Secur... | <|body_start_0|>
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
if pk is not None:
member = self.get_member(int(pk))
else:
member = None
self.check_object_permissions... | LoanSecurityGuarantorsView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoanSecurityGuarantorsView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Securities in form Guarantors savings --- serializer: loans.serializers.SecurityGuarantorSerializer"""
<|body_1|>
def po... | stack_v2_sparse_classes_36k_train_021376 | 13,511 | no_license | [
{
"docstring": "Get a member.",
"name": "get_member",
"signature": "def get_member(self, pk)"
},
{
"docstring": "List Securities in form Guarantors savings --- serializer: loans.serializers.SecurityGuarantorSerializer",
"name": "get",
"signature": "def get(self, request, pk, format=None)... | 3 | stack_v2_sparse_classes_30k_train_003964 | Implement the Python class `LoanSecurityGuarantorsView` described below.
Class description:
Implement the LoanSecurityGuarantorsView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Securities in form Guarantors savings --- serializer: ... | Implement the Python class `LoanSecurityGuarantorsView` described below.
Class description:
Implement the LoanSecurityGuarantorsView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Securities in form Guarantors savings --- serializer: ... | c5ac11e40a628c93c3865363e97b4f255a104ca8 | <|skeleton|>
class LoanSecurityGuarantorsView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Securities in form Guarantors savings --- serializer: loans.serializers.SecurityGuarantorSerializer"""
<|body_1|>
def po... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoanSecurityGuarantorsView:
def get_member(self, pk):
"""Get a member."""
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
def get(self, request, pk, format=None):
"""List Securities in form Guarantors savings --- seri... | the_stack_v2_python_sparse | loans/views.py | lubegamark/gosacco | train | 2 | |
0d6e5ee3cc02ede6de613b9c96492372e087416d | [
"self.parentDistr = parentDistr\nself.childDistr = childDistr\nself.numChildren = numChildren",
"parent = self.parentDistr.sample()\nchildren = []\nfor i in range(self.numChildren):\n key = (parent, i)\n child = self.childDistr[key].sample()\n children.append(child)\nreturn (parent, children)"
] | <|body_start_0|>
self.parentDistr = parentDistr
self.childDistr = childDistr
self.numChildren = numChildren
<|end_body_0|>
<|body_start_1|>
parent = self.parentDistr.sample()
children = []
for i in range(self.numChildren):
key = (parent, i)
child ... | ancestral sampler using conditional distribution | AncestralSampler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AncestralSampler:
"""ancestral sampler using conditional distribution"""
def __init__(self, parentDistr, childDistr, numChildren):
"""initializer Parameters parentDistr : parent distr childDistr : childdren distribution dictionary numChildren : no of children"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_021377 | 32,264 | permissive | [
{
"docstring": "initializer Parameters parentDistr : parent distr childDistr : childdren distribution dictionary numChildren : no of children",
"name": "__init__",
"signature": "def __init__(self, parentDistr, childDistr, numChildren)"
},
{
"docstring": "samples value",
"name": "sample",
... | 2 | stack_v2_sparse_classes_30k_train_017607 | Implement the Python class `AncestralSampler` described below.
Class description:
ancestral sampler using conditional distribution
Method signatures and docstrings:
- def __init__(self, parentDistr, childDistr, numChildren): initializer Parameters parentDistr : parent distr childDistr : childdren distribution diction... | Implement the Python class `AncestralSampler` described below.
Class description:
ancestral sampler using conditional distribution
Method signatures and docstrings:
- def __init__(self, parentDistr, childDistr, numChildren): initializer Parameters parentDistr : parent distr childDistr : childdren distribution diction... | 861fd06b6b7abaffe5e8ca795136ab0fbb2234b5 | <|skeleton|>
class AncestralSampler:
"""ancestral sampler using conditional distribution"""
def __init__(self, parentDistr, childDistr, numChildren):
"""initializer Parameters parentDistr : parent distr childDistr : childdren distribution dictionary numChildren : no of children"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AncestralSampler:
"""ancestral sampler using conditional distribution"""
def __init__(self, parentDistr, childDistr, numChildren):
"""initializer Parameters parentDistr : parent distr childDistr : childdren distribution dictionary numChildren : no of children"""
self.parentDistr = parentD... | the_stack_v2_python_sparse | matumizi/matumizi/sampler.py | pranab/whakapai | train | 18 |
927c86cbe0fb719eb4404e075df9e1c2c469b4eb | [
"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... | A set of methods for managing Role resources. | RoleServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleServiceServicer:
"""A set of methods for managing Role resources."""
def Get(self, request, context):
"""Returns the specified Role resource. To get the list of available Role resources, use a [List] request."""
<|body_0|>
def List(self, request, context):
""... | stack_v2_sparse_classes_36k_train_021378 | 2,649 | permissive | [
{
"docstring": "Returns the specified Role resource. To get the list of available Role resources, use a [List] request.",
"name": "Get",
"signature": "def Get(self, request, context)"
},
{
"docstring": "Retrieves the list of Role resources.",
"name": "List",
"signature": "def List(self, ... | 2 | stack_v2_sparse_classes_30k_train_008520 | Implement the Python class `RoleServiceServicer` described below.
Class description:
A set of methods for managing Role resources.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified Role resource. To get the list of available Role resources, use a [List] request.
- def List(sel... | Implement the Python class `RoleServiceServicer` described below.
Class description:
A set of methods for managing Role resources.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified Role resource. To get the list of available Role resources, use a [List] request.
- def List(sel... | 980e2c5d848eadb42799132b35a9f58ab7b27157 | <|skeleton|>
class RoleServiceServicer:
"""A set of methods for managing Role resources."""
def Get(self, request, context):
"""Returns the specified Role resource. To get the list of available Role resources, use a [List] request."""
<|body_0|>
def List(self, request, context):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleServiceServicer:
"""A set of methods for managing Role resources."""
def Get(self, request, context):
"""Returns the specified Role resource. To get the list of available Role resources, use a [List] request."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_detai... | the_stack_v2_python_sparse | yandex/cloud/iam/v1/role_service_pb2_grpc.py | IIKovalenko/python-sdk | train | 1 |
e612a1fa419ddce6ea87a9f7d0ea81d27f8a5b66 | [
"self.string_name = {}\nfor name in vars(QEvent):\n attribute = getattr(QEvent, name)\n if type(attribute) == QEvent.Type:\n self.string_name[attribute] = name",
"try:\n return self.string_name[event]\nexcept KeyError:\n return f'UnknownEvent:{event}'"
] | <|body_start_0|>
self.string_name = {}
for name in vars(QEvent):
attribute = getattr(QEvent, name)
if type(attribute) == QEvent.Type:
self.string_name[attribute] = name
<|end_body_0|>
<|body_start_1|>
try:
return self.string_name[event]
... | Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems. | EventTypes | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventTypes:
"""Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems."""
def __init__(self):
"""Create mapping for all known event types."""
<|body_0|>
d... | stack_v2_sparse_classes_36k_train_021379 | 685 | permissive | [
{
"docstring": "Create mapping for all known event types.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Return the string name for this event.",
"name": "as_string",
"signature": "def as_string(self, event: QEvent.Type) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_013667 | Implement the Python class `EventTypes` described below.
Class description:
Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems.
Method signatures and docstrings:
- def __init__(self): Create mappin... | Implement the Python class `EventTypes` described below.
Class description:
Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems.
Method signatures and docstrings:
- def __init__(self): Create mappin... | d12cb964768459c22f30c22531d3e1734901e814 | <|skeleton|>
class EventTypes:
"""Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems."""
def __init__(self):
"""Create mapping for all known event types."""
<|body_0|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventTypes:
"""Stores a string name for each event type. With PySide2 str() on the event type gives a nice string name, but with PyQt5 it does not. So this method works with both systems."""
def __init__(self):
"""Create mapping for all known event types."""
self.string_name = {}
... | the_stack_v2_python_sparse | lib/candy_editor/qt/controls/QToolWindowManager/EventTypes.py | lihaochen910/Candy | train | 1 |
b74cf901d052a042a0abad90372495fb72f7d9cc | [
"self.config = config\nself.parser = sub_parser.add_parser('setup', help='CLI Interface Setup')\nself.parser.set_defaults(func=self._help)\nsetup_sub = self.parser.add_subparsers()\nsetup_perform = setup_sub.add_parser('perform', help='Perform setup')\nsetup_perform.set_defaults(func=self.setup)",
"console('Perfo... | <|body_start_0|>
self.config = config
self.parser = sub_parser.add_parser('setup', help='CLI Interface Setup')
self.parser.set_defaults(func=self._help)
setup_sub = self.parser.add_subparsers()
setup_perform = setup_sub.add_parser('perform', help='Perform setup')
setup_pe... | Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config | SetupHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetupHandler:
"""Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config"""
def __init__(self, sub_parser, config):
"""Parameters ---------- sub_parser : :py:meth:`argparse.... | stack_v2_sparse_classes_36k_train_021380 | 9,224 | permissive | [
{
"docstring": "Parameters ---------- sub_parser : :py:meth:`argparse.ArgumentParser.add_subparsers' sub parsers object config : ConfigHelper config instance",
"name": "__init__",
"signature": "def __init__(self, sub_parser, config)"
},
{
"docstring": "Performs the setup (if needed) Parameters -... | 2 | stack_v2_sparse_classes_30k_train_002305 | Implement the Python class `SetupHandler` described below.
Class description:
Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config
Method signatures and docstrings:
- def __init__(self, sub_parser, config... | Implement the Python class `SetupHandler` described below.
Class description:
Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config
Method signatures and docstrings:
- def __init__(self, sub_parser, config... | ab5377e3b16f1920d4d9ada443e1e9059715f0fb | <|skeleton|>
class SetupHandler:
"""Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config"""
def __init__(self, sub_parser, config):
"""Parameters ---------- sub_parser : :py:meth:`argparse.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SetupHandler:
"""Handler for config setup related tasks. Setups up the commands under the "setup" sub menu. .. warning:: Should be included in any application that uses the cli config"""
def __init__(self, sub_parser, config):
"""Parameters ---------- sub_parser : :py:meth:`argparse.ArgumentParse... | the_stack_v2_python_sparse | PyPoE/cli/handler.py | Openarl/PyPoE | train | 16 |
fec821290bae8632c004e25a80d4b7507774f725 | [
"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... | Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposals will be supported in a future version. Please use BudgetOrder... | AccountBudgetProposalServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposa... | stack_v2_sparse_classes_36k_train_021381 | 4,735 | permissive | [
{
"docstring": "Returns an account-level budget proposal in full detail.",
"name": "GetAccountBudgetProposal",
"signature": "def GetAccountBudgetProposal(self, request, context)"
},
{
"docstring": "Creates, updates, or removes account budget proposals. Operation statuses are returned.",
"nam... | 2 | null | Implement the Python class `AccountBudgetProposalServiceServicer` described below.
Class description:
Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account... | Implement the Python class `AccountBudgetProposalServiceServicer` described below.
Class description:
Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposals will be su... | the_stack_v2_python_sparse | google/ads/google_ads/v1/proto/services/account_budget_proposal_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
6ce4caed4560e626fd14e4b138382d5f3e8204b2 | [
"super(FunctionComponent, self).__init__(opts)\nself.opts = opts\nself.options = opts.get(CONFIG_DATA_SECTION, {})",
"self.opts = opts\nself.options = opts.get(CONFIG_DATA_SECTION, {})\nmaas360_utils = MaaS360Utils.get_the_maas360_utils()\nmaas360_utils.reload_options(opts)\nmaas360_utils.reconnect()",
"try:\n ... | <|body_start_0|>
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get(CONFIG_DATA_SECTION, {})
<|end_body_0|>
<|body_start_1|>
self.opts = opts
self.options = opts.get(CONFIG_DATA_SECTION, {})
maas360_utils = MaaS360Utils.get_the_maas360... | Component that implements Resilient function 'maas360_delete_app | FunctionComponent | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'maas360_delete_app"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, sa... | stack_v2_sparse_classes_36k_train_021382 | 3,056 | permissive | [
{
"docstring": "constructor provides access to the configuration options",
"name": "__init__",
"signature": "def __init__(self, opts)"
},
{
"docstring": "Configuration options have changed, save new values",
"name": "_reload",
"signature": "def _reload(self, event, opts)"
},
{
"d... | 3 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'maas360_delete_app
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration opt... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'maas360_delete_app
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration opt... | 6878c78b94eeca407998a41ce8db2cc00f2b6758 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'maas360_delete_app"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, sa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that implements Resilient function 'maas360_delete_app"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get(CONFIG_... | the_stack_v2_python_sparse | fn_maas360/fn_maas360/components/maas360_delete_app.py | ibmresilient/resilient-community-apps | train | 81 |
2827112e83607d5c85985331106c2ce62dec9a06 | [
"parser = super(ShotDetectorPlotService, self).add_arguments(parser, **kwargs)\nparser = self.add_video_arguments(parser, **kwargs)\nparser = self.add_plot_arguments(parser, **kwargs)\nreturn parser",
"parser.add_argument('--ff', '--video-first-frame', metavar='sec', dest='first_frame', type=int, default=0)\npars... | <|body_start_0|>
parser = super(ShotDetectorPlotService, self).add_arguments(parser, **kwargs)
parser = self.add_video_arguments(parser, **kwargs)
parser = self.add_plot_arguments(parser, **kwargs)
return parser
<|end_body_0|>
<|body_start_1|>
parser.add_argument('--ff', '--vide... | Simple Shot Detector Service. | ShotDetectorPlotService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShotDetectorPlotService:
"""Simple Shot Detector Service."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_video_arguments(parser, **_):
""":param parser: :param _: :return:"""
<|body_1|>
d... | stack_v2_sparse_classes_36k_train_021383 | 2,083 | permissive | [
{
"docstring": ":param parser: :param kwargs: :return:",
"name": "add_arguments",
"signature": "def add_arguments(self, parser, **kwargs)"
},
{
"docstring": ":param parser: :param _: :return:",
"name": "add_video_arguments",
"signature": "def add_video_arguments(parser, **_)"
},
{
... | 3 | null | Implement the Python class `ShotDetectorPlotService` described below.
Class description:
Simple Shot Detector Service.
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_video_arguments(parser, **_): :param parser: :param _: :return:
- def r... | Implement the Python class `ShotDetectorPlotService` described below.
Class description:
Simple Shot Detector Service.
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_video_arguments(parser, **_): :param parser: :param _: :return:
- def r... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class ShotDetectorPlotService:
"""Simple Shot Detector Service."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_video_arguments(parser, **_):
""":param parser: :param _: :return:"""
<|body_1|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShotDetectorPlotService:
"""Simple Shot Detector Service."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
parser = super(ShotDetectorPlotService, self).add_arguments(parser, **kwargs)
parser = self.add_video_arguments(parser, **kwargs)
... | the_stack_v2_python_sparse | shot_detector/services/shot_detector_service.py | w495/python-video-shot-detector | train | 20 |
3e33a8ffefc16aa193800135bf66d0a940abcefb | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('xcao19', 'xcao19')\nurl = 'http://data.insideairbnb.com/united-states/ma/boston/2019-01-17/visualisations/neighbourhoods.csv'\ndf = pd.read_csv(url, encoding='ISO-8859-1')\njson_df = df.to_json(orient='r... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url = 'http://data.insideairbnb.com/united-states/ma/boston/2019-01-17/visualisations/neighbourhoods.csv'
df = pd.read_csv(url,... | AirBNB_neighborhoods | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AirBNB_neighborhoods:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing eve... | stack_v2_sparse_classes_36k_train_021384 | 3,316 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_013315 | Implement the Python class `AirBNB_neighborhoods` described below.
Class description:
Implement the AirBNB_neighborhoods class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), sta... | Implement the Python class `AirBNB_neighborhoods` described below.
Class description:
Implement the AirBNB_neighborhoods class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), sta... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class AirBNB_neighborhoods:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing eve... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AirBNB_neighborhoods:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url... | the_stack_v2_python_sparse | xcao19/AirBNB_neighborhoods.py | maximega/course-2019-spr-proj | train | 2 | |
358a598ff041cc3ae9d3f5dabb32d30ccecfc9fa | [
"self.__dict__ = Dict(user_cfg)\nself.validate_user_definition()\nself.preset_default()\nself.set_monitoring_cfg()",
"dirname, filename = os.path.split(os.path.abspath(user_cfg_path))\nmodule_name, ext = os.path.splitext(filename)\nsys.path.append(dirname)\nif ext == '.py':\n user_cfg_script = importlib.import... | <|body_start_0|>
self.__dict__ = Dict(user_cfg)
self.validate_user_definition()
self.preset_default()
self.set_monitoring_cfg()
<|end_body_0|>
<|body_start_1|>
dirname, filename = os.path.split(os.path.abspath(user_cfg_path))
module_name, ext = os.path.splitext(filename)... | Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis | TrainValConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainValConfig:
"""Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis"""
def __init__(self, user_cfg):
"""Parameters ---------- user_cfg : dict or Dict user-defined configuration"""
<|body_0|>
def from_file(cls... | stack_v2_sparse_classes_36k_train_021385 | 3,291 | permissive | [
{
"docstring": "Parameters ---------- user_cfg : dict or Dict user-defined configuration",
"name": "__init__",
"signature": "def __init__(self, user_cfg)"
},
{
"docstring": "Alternative constructor that accepts the path to the user-defined configuration python file Parameters ---------- user_cfg... | 5 | stack_v2_sparse_classes_30k_train_001059 | Implement the Python class `TrainValConfig` described below.
Class description:
Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis
Method signatures and docstrings:
- def __init__(self, user_cfg): Parameters ---------- user_cfg : dict or Dict user-defined c... | Implement the Python class `TrainValConfig` described below.
Class description:
Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis
Method signatures and docstrings:
- def __init__(self, user_cfg): Parameters ---------- user_cfg : dict or Dict user-defined c... | 2541885d70d090fdb777339cfb77a3a9f3e7996d | <|skeleton|>
class TrainValConfig:
"""Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis"""
def __init__(self, user_cfg):
"""Parameters ---------- user_cfg : dict or Dict user-defined configuration"""
<|body_0|>
def from_file(cls... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrainValConfig:
"""Nested dictionary representing the configuration for H0rton training, h0_inference, visualization, and analysis"""
def __init__(self, user_cfg):
"""Parameters ---------- user_cfg : dict or Dict user-defined configuration"""
self.__dict__ = Dict(user_cfg)
self.va... | the_stack_v2_python_sparse | h0rton/configs/train_val_config.py | jiwoncpark/h0rton | train | 7 |
e976c043f2799808af619251e252c78be2c4ca02 | [
"if not root:\n return None\nself.maxAverage = float('-inf')\nself.maxNode = None\n\ndef helper(node):\n if not node:\n return (0, 0.0)\n currentTotal = 1\n currentSum = node.val\n for child in node.children:\n childTotal, childSum = helper(child)\n currentTotal += childTotal\n ... | <|body_start_0|>
if not root:
return None
self.maxAverage = float('-inf')
self.maxNode = None
def helper(node):
if not node:
return (0, 0.0)
currentTotal = 1
currentSum = node.val
for child in node.children:
... | Solution2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
def MaximumAverageSubtree3(self, root):
""">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15"""
<|body_0|>
def MaximumAverageSubtree4(self, root):
""">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree4(Tnode1) 18"""
... | stack_v2_sparse_classes_36k_train_021386 | 9,088 | no_license | [
{
"docstring": ">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15",
"name": "MaximumAverageSubtree3",
"signature": "def MaximumAverageSubtree3(self, root)"
},
{
"docstring": ">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree4(Tnode1) 18",
"name": "Maxi... | 2 | stack_v2_sparse_classes_30k_train_000225 | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def MaximumAverageSubtree3(self, root): >>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15
- def MaximumAverageSubtree4(self, root): >>> solution2 = So... | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def MaximumAverageSubtree3(self, root): >>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15
- def MaximumAverageSubtree4(self, root): >>> solution2 = So... | 898dc6b0d1eadf441ba06c69548a3798bcbaea99 | <|skeleton|>
class Solution2:
def MaximumAverageSubtree3(self, root):
""">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15"""
<|body_0|>
def MaximumAverageSubtree4(self, root):
""">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree4(Tnode1) 18"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution2:
def MaximumAverageSubtree3(self, root):
""">>> solution2 = Solution2() >>> solution2.MaximumAverageSubtree3(Tnode1) 15"""
if not root:
return None
self.maxAverage = float('-inf')
self.maxNode = None
def helper(node):
if not node:
... | the_stack_v2_python_sparse | Beginning/subtree_with_max_average.py | workprinond/DS_-_Algo_TechInterview_Practise | train | 0 | |
a164339c418baa636e44f058038fe969b17534e8 | [
"if root == None:\n return 0\nif root.left == None and root.right == None:\n return 1\nif root.left == None or root.right == None:\n return max(self.minDepth(root.left), self.minDepth(root.right)) + 1\nreturn min(self.minDepth(root.left), self.minDepth(root.right)) + 1",
"if not root:\n return 0\nq = ... | <|body_start_0|>
if root == None:
return 0
if root.left == None and root.right == None:
return 1
if root.left == None or root.right == None:
return max(self.minDepth(root.left), self.minDepth(root.right)) + 1
return min(self.minDepth(root.left), self.m... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root == None:
return 0
if root... | stack_v2_sparse_classes_36k_train_021387 | 1,894 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def minDepth(self, root... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
if root == None:
return 0
if root.left == None and root.right == None:
return 1
if root.left == None or root.right == None:
return max(self.minDepth(root.left), self.m... | the_stack_v2_python_sparse | 0111_Minimum_Depth_of_Binary_Tree.py | bingli8802/leetcode | train | 0 | |
923f9447f414f81193353def17042d5976d2b1bd | [
"text = simplicity.file_opener('sample.rst')\nself.assertNotEqual(text, 'sample.rst')\ntext = simplicity.file_opener('README.rst')\nself.assertNotEqual(text, 'README.rst')",
"with open('sample.rst') as f:\n text = f.read()\nself.assertEqual(text, simplicity.file_opener('sample.rst'))"
] | <|body_start_0|>
text = simplicity.file_opener('sample.rst')
self.assertNotEqual(text, 'sample.rst')
text = simplicity.file_opener('README.rst')
self.assertNotEqual(text, 'README.rst')
<|end_body_0|>
<|body_start_1|>
with open('sample.rst') as f:
text = f.read()
... | FileOpener | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileOpener:
def test_basics(self):
"""I test that file_opener returns more than just itself!"""
<|body_0|>
def test_open(self):
"""I test that file_opener gets things correctly!"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
text = simplicity.file_... | stack_v2_sparse_classes_36k_train_021388 | 6,339 | no_license | [
{
"docstring": "I test that file_opener returns more than just itself!",
"name": "test_basics",
"signature": "def test_basics(self)"
},
{
"docstring": "I test that file_opener gets things correctly!",
"name": "test_open",
"signature": "def test_open(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015145 | Implement the Python class `FileOpener` described below.
Class description:
Implement the FileOpener class.
Method signatures and docstrings:
- def test_basics(self): I test that file_opener returns more than just itself!
- def test_open(self): I test that file_opener gets things correctly! | Implement the Python class `FileOpener` described below.
Class description:
Implement the FileOpener class.
Method signatures and docstrings:
- def test_basics(self): I test that file_opener returns more than just itself!
- def test_open(self): I test that file_opener gets things correctly!
<|skeleton|>
class FileOp... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class FileOpener:
def test_basics(self):
"""I test that file_opener returns more than just itself!"""
<|body_0|>
def test_open(self):
"""I test that file_opener gets things correctly!"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileOpener:
def test_basics(self):
"""I test that file_opener returns more than just itself!"""
text = simplicity.file_opener('sample.rst')
self.assertNotEqual(text, 'sample.rst')
text = simplicity.file_opener('README.rst')
self.assertNotEqual(text, 'README.rst')
d... | the_stack_v2_python_sparse | repoData/pydanny-simplicity/allPythonContent.py | aCoffeeYin/pyreco | train | 0 | |
6468e1d69e7d1cbd87c81537ab5a69934bb41a4d | [
"super().__init__()\nself.lin_enc = torch.nn.Linear(encoder_output_size, joint_space_size)\nself.lin_dec = torch.nn.Linear(decoder_output_size, joint_space_size, bias=False)\nself.useKB = useKB\nif self.useKB:\n self.lin_plm = torch.nn.Linear(plm_dim, joint_space_size, bias=False)\nself.lin_out = torch.nn.Linear... | <|body_start_0|>
super().__init__()
self.lin_enc = torch.nn.Linear(encoder_output_size, joint_space_size)
self.lin_dec = torch.nn.Linear(decoder_output_size, joint_space_size, bias=False)
self.useKB = useKB
if self.useKB:
self.lin_plm = torch.nn.Linear(plm_dim, joint_... | Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network | JointNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JointNetwork:
"""Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network"""
def __init__(self, vocab_size: int, encoder_output_size: int, decoder_output_size: int, joint_space_size: int, joint_activation_type:... | stack_v2_sparse_classes_36k_train_021389 | 1,962 | permissive | [
{
"docstring": "Joint network initializer.",
"name": "__init__",
"signature": "def __init__(self, vocab_size: int, encoder_output_size: int, decoder_output_size: int, joint_space_size: int, joint_activation_type: int, useKB: bool=False, plm_dim: int=256)"
},
{
"docstring": "Joint computation of ... | 2 | stack_v2_sparse_classes_30k_train_008023 | Implement the Python class `JointNetwork` described below.
Class description:
Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network
Method signatures and docstrings:
- def __init__(self, vocab_size: int, encoder_output_size: int, dec... | Implement the Python class `JointNetwork` described below.
Class description:
Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network
Method signatures and docstrings:
- def __init__(self, vocab_size: int, encoder_output_size: int, dec... | 4bdef285d177ab1d835e3669d10b55f58d4aa916 | <|skeleton|>
class JointNetwork:
"""Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network"""
def __init__(self, vocab_size: int, encoder_output_size: int, decoder_output_size: int, joint_space_size: int, joint_activation_type:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JointNetwork:
"""Transducer joint network module. Args: joint_space_size: Dimension of joint space joint_activation_type: Activation type for joint network"""
def __init__(self, vocab_size: int, encoder_output_size: int, decoder_output_size: int, joint_space_size: int, joint_activation_type: int, useKB: ... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transducer/joint_network.py | BriansIDP/espnet | train | 3 |
8d90034d6d33a59e63d90dc8c9216bc35554f17f | [
"self.commcell_object = commcell_object\nself._services = commcell_object._services\nself._cvpysdkcommcell_object = commcell_object._cvpysdk_object\nself.update_option = {}",
"if options is None:\n options = 'latest service pack'\nif DownloadOptions.LATEST_SERVICEPACK.value == options:\n self.update_option ... | <|body_start_0|>
self.commcell_object = commcell_object
self._services = commcell_object._services
self._cvpysdkcommcell_object = commcell_object._cvpysdk_object
self.update_option = {}
<|end_body_0|>
<|body_start_1|>
if options is None:
options = 'latest service pac... | "class for downloading software packages | Download | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_021390 | 9,594 | permissive | [
{
"docstring": "Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class",
"name": "__init__",
"signature": "def __init__(self, commcell_object)"
},
{
"docstring": "Downloads the os package... | 2 | stack_v2_sparse_classes_30k_train_005218 | Implement the Python class `Download` described below.
Class description:
"class for downloading software packages
Method signatures and docstrings:
- def __init__(self, commcell_object): Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object... | Implement the Python class `Download` described below.
Class description:
"class for downloading software packages
Method signatures and docstrings:
- def __init__(self, commcell_object): Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object... | 6aa0beb426a95de877cd531602234515723ccc94 | <|skeleton|>
class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
self.commcell_object = co... | the_stack_v2_python_sparse | cvpysdk/deployment/download.py | jack1806/cvpysdk | train | 1 |
4fd8d489c42581bf70adb761c29d8bce9950ee4e | [
"self.xmlFilename = xmlFilename\nself.replacements = replacements\nself.exceptions = exceptions\nself.xmlStart = xmlStart\nself.skipping = bool(xmlStart)\nself.excsInside = []\nif 'inside-tags' in self.exceptions:\n self.excsInside += self.exceptions['inside-tags']\nif 'inside' in self.exceptions:\n self.excs... | <|body_start_0|>
self.xmlFilename = xmlFilename
self.replacements = replacements
self.exceptions = exceptions
self.xmlStart = xmlStart
self.skipping = bool(xmlStart)
self.excsInside = []
if 'inside-tags' in self.exceptions:
self.excsInside += self.exce... | Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles in the dump before this one :param replacements: A list of 2-tuples of original text (as a comp... | XmlDumpReplacePageGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XmlDumpReplacePageGenerator:
"""Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles in the dump before this one :param repla... | stack_v2_sparse_classes_36k_train_021391 | 42,775 | permissive | [
{
"docstring": "Initializer.",
"name": "__init__",
"signature": "def __init__(self, xmlFilename: str, xmlStart: str, replacements: List[Tuple[Any, str]], exceptions: Dict[str, Any], site) -> None"
},
{
"docstring": "Iterator method.",
"name": "__iter__",
"signature": "def __iter__(self)"... | 4 | stack_v2_sparse_classes_30k_train_010854 | Implement the Python class `XmlDumpReplacePageGenerator` described below.
Class description:
Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles i... | Implement the Python class `XmlDumpReplacePageGenerator` described below.
Class description:
Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles i... | 5c01e6bfcd328bc6eae643e661f1a0ae57612808 | <|skeleton|>
class XmlDumpReplacePageGenerator:
"""Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles in the dump before this one :param repla... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XmlDumpReplacePageGenerator:
"""Iterator that will yield Pages that might contain text to replace. These pages will be retrieved from a local XML dump file. :param xmlFilename: The dump's path, either absolute or relative :param xmlStart: Skip all articles in the dump before this one :param replacements: A li... | the_stack_v2_python_sparse | scripts/replace.py | wikimedia/pywikibot | train | 432 |
8fab410c38a59b22a833bf4ff847a360101ee335 | [
"land_owned_indicator = 'Freehold'\nLandCompensationOwnedValidator.validate(land_owned_indicator, '')\ncalls = [call(land_owned_indicator, 'land-owned-indicator', 'Land Owned Type', mock_error_builder(), summary_message='Choose one option', inline_message=\"This is the landowner's title to the land (how they own it... | <|body_start_0|>
land_owned_indicator = 'Freehold'
LandCompensationOwnedValidator.validate(land_owned_indicator, '')
calls = [call(land_owned_indicator, 'land-owned-indicator', 'Land Owned Type', mock_error_builder(), summary_message='Choose one option', inline_message="This is the landowner's t... | TestLandCompensationOwnedValidator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLandCompensationOwnedValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
<|body_0|>
def test_max_params_passed(self, mock_field_validator,... | stack_v2_sparse_classes_36k_train_021392 | 4,310 | permissive | [
{
"docstring": "should pass the given parameter to the fieldset validator and call the expected validations",
"name": "test_min_params_passed",
"signature": "def test_min_params_passed(self, mock_field_validator, mock_error_builder)"
},
{
"docstring": "should pass the given parameter to the fiel... | 6 | null | Implement the Python class `TestLandCompensationOwnedValidator` described below.
Class description:
Implement the TestLandCompensationOwnedValidator class.
Method signatures and docstrings:
- def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset va... | Implement the Python class `TestLandCompensationOwnedValidator` described below.
Class description:
Implement the TestLandCompensationOwnedValidator class.
Method signatures and docstrings:
- def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset va... | d92446a9972ebbcd9a43a7a7444a528aa2f30bf7 | <|skeleton|>
class TestLandCompensationOwnedValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
<|body_0|>
def test_max_params_passed(self, mock_field_validator,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestLandCompensationOwnedValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
land_owned_indicator = 'Freehold'
LandCompensationOwnedValidator.validate(la... | the_stack_v2_python_sparse | unit_tests/Add_land_charge/validation/test_land_compensation_owned_validator.py | uk-gov-mirror/LandRegistry.maintain-frontend | train | 0 | |
51f6da55b44ef8565b8294046b1a8ac99c0f79ab | [
"lifecycle_arg = self.args[0]\nurl_args = self.args[1:]\nif not UrlsAreForSingleProvider(url_args):\n raise CommandException('\"%s\" command spanning providers not allowed.' % self.command_name)\nlifecycle_file = open(lifecycle_arg, 'r')\nlifecycle_txt = lifecycle_file.read()\nlifecycle_file.close()\nsome_matche... | <|body_start_0|>
lifecycle_arg = self.args[0]
url_args = self.args[1:]
if not UrlsAreForSingleProvider(url_args):
raise CommandException('"%s" command spanning providers not allowed.' % self.command_name)
lifecycle_file = open(lifecycle_arg, 'r')
lifecycle_txt = lifec... | Implementation of gsutil lifecycle command. | LifecycleCommand | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LifecycleCommand:
"""Implementation of gsutil lifecycle command."""
def _SetLifecycleConfig(self):
"""Sets lifecycle configuration for a Google Cloud Storage bucket."""
<|body_0|>
def _GetLifecycleConfig(self):
"""Gets lifecycle configuration for a Google Cloud S... | stack_v2_sparse_classes_36k_train_021393 | 7,415 | permissive | [
{
"docstring": "Sets lifecycle configuration for a Google Cloud Storage bucket.",
"name": "_SetLifecycleConfig",
"signature": "def _SetLifecycleConfig(self)"
},
{
"docstring": "Gets lifecycle configuration for a Google Cloud Storage bucket.",
"name": "_GetLifecycleConfig",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_003642 | Implement the Python class `LifecycleCommand` described below.
Class description:
Implementation of gsutil lifecycle command.
Method signatures and docstrings:
- def _SetLifecycleConfig(self): Sets lifecycle configuration for a Google Cloud Storage bucket.
- def _GetLifecycleConfig(self): Gets lifecycle configuration... | Implement the Python class `LifecycleCommand` described below.
Class description:
Implementation of gsutil lifecycle command.
Method signatures and docstrings:
- def _SetLifecycleConfig(self): Sets lifecycle configuration for a Google Cloud Storage bucket.
- def _GetLifecycleConfig(self): Gets lifecycle configuration... | 53102de187a48ac2cfc241fef54dcbc29c453a8e | <|skeleton|>
class LifecycleCommand:
"""Implementation of gsutil lifecycle command."""
def _SetLifecycleConfig(self):
"""Sets lifecycle configuration for a Google Cloud Storage bucket."""
<|body_0|>
def _GetLifecycleConfig(self):
"""Gets lifecycle configuration for a Google Cloud S... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LifecycleCommand:
"""Implementation of gsutil lifecycle command."""
def _SetLifecycleConfig(self):
"""Sets lifecycle configuration for a Google Cloud Storage bucket."""
lifecycle_arg = self.args[0]
url_args = self.args[1:]
if not UrlsAreForSingleProvider(url_args):
... | the_stack_v2_python_sparse | third_party/gsutil/gslib/commands/lifecycle.py | catapult-project/catapult | train | 2,032 |
f5caf4f001fb81da8d681624eb8cbb5d44aeec6d | [
"apply(ttk.Frame.__init__, (self, master), kwargs)\nif initial is None:\n initial = ('',)\nself.fields = []\nself.values = []\ngrid_column = 0\nnum_fields = len(initial)\nfor index in range(num_fields):\n if index > 0:\n ttk.Separator(self, orient=tk.VERTICAL).grid(row=0, column=grid_column, padx=0, pa... | <|body_start_0|>
apply(ttk.Frame.__init__, (self, master), kwargs)
if initial is None:
initial = ('',)
self.fields = []
self.values = []
grid_column = 0
num_fields = len(initial)
for index in range(num_fields):
if index > 0:
... | A specialized frame for displaying a status bar | StatusBar | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusBar:
"""A specialized frame for displaying a status bar"""
def __init__(self, master, initial=None, grip=True, **kwargs):
"""Initializes the status bar widget."""
<|body_0|>
def __getitem__(self, index):
"""Provides index-style access to retrieve each statu... | stack_v2_sparse_classes_36k_train_021394 | 4,589 | permissive | [
{
"docstring": "Initializes the status bar widget.",
"name": "__init__",
"signature": "def __init__(self, master, initial=None, grip=True, **kwargs)"
},
{
"docstring": "Provides index-style access to retrieve each status field.",
"name": "__getitem__",
"signature": "def __getitem__(self,... | 3 | null | Implement the Python class `StatusBar` described below.
Class description:
A specialized frame for displaying a status bar
Method signatures and docstrings:
- def __init__(self, master, initial=None, grip=True, **kwargs): Initializes the status bar widget.
- def __getitem__(self, index): Provides index-style access t... | Implement the Python class `StatusBar` described below.
Class description:
A specialized frame for displaying a status bar
Method signatures and docstrings:
- def __init__(self, master, initial=None, grip=True, **kwargs): Initializes the status bar widget.
- def __getitem__(self, index): Provides index-style access t... | d41c002493a4f5b4667870fca0a2849307d51b34 | <|skeleton|>
class StatusBar:
"""A specialized frame for displaying a status bar"""
def __init__(self, master, initial=None, grip=True, **kwargs):
"""Initializes the status bar widget."""
<|body_0|>
def __getitem__(self, index):
"""Provides index-style access to retrieve each statu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatusBar:
"""A specialized frame for displaying a status bar"""
def __init__(self, master, initial=None, grip=True, **kwargs):
"""Initializes the status bar widget."""
apply(ttk.Frame.__init__, (self, master), kwargs)
if initial is None:
initial = ('',)
self.f... | the_stack_v2_python_sparse | packages/hztk/statusbar.py | zhester/hzpy | train | 3 |
7d69aec2b861c24b5b0d02e061abc49eb1268801 | [
"map_inorder = {}\nfor i, val in enumerate(inorder):\n map_inorder[val] = i\n\ndef helper(low, high):\n if low > high:\n return None\n root = TreeNode(postorder.pop())\n mid = map_inorder[root.val]\n root.right = helper(mid + 1, high)\n root.left = helper(low, mid - 1)\n return root\nret... | <|body_start_0|>
map_inorder = {}
for i, val in enumerate(inorder):
map_inorder[val] = i
def helper(low, high):
if low > high:
return None
root = TreeNode(postorder.pop())
mid = map_inorder[root.val]
root.right = helper... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""using inorder to construct the tree while using postorder to find the root. Property of inorder is that the root node will always be in the middle"""
<|body_0|>
def buildTree(self, inorde... | stack_v2_sparse_classes_36k_train_021395 | 1,815 | no_license | [
{
"docstring": "using inorder to construct the tree while using postorder to find the root. Property of inorder is that the root node will always be in the middle",
"name": "buildTree",
"signature": "def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode"
},
{
"docstring": "us... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: using inorder to construct the tree while using postorder to find the root. Property of inorder is that... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: using inorder to construct the tree while using postorder to find the root. Property of inorder is that... | 5e77c3d7a0632882d16dd064f0aad2667237ef37 | <|skeleton|>
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""using inorder to construct the tree while using postorder to find the root. Property of inorder is that the root node will always be in the middle"""
<|body_0|>
def buildTree(self, inorde... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""using inorder to construct the tree while using postorder to find the root. Property of inorder is that the root node will always be in the middle"""
map_inorder = {}
for i, val in enumerate(inorder... | the_stack_v2_python_sparse | Leetcode/106-tree.py | linnndachen/coding-practice | train | 0 | |
7e4b640de2d395255f223c2f2b575378376ea0ce | [
"self.create_new_team = create_new_team\nself.ms_teams_vec = ms_teams_vec\nself.restore_original_owners_members = restore_original_owners_members\nself.restore_to_original = restore_to_original\nself.target_channel = target_channel\nself.target_ms_team_entity = target_ms_team_entity\nself.target_team = target_team\... | <|body_start_0|>
self.create_new_team = create_new_team
self.ms_teams_vec = ms_teams_vec
self.restore_original_owners_members = restore_original_owners_members
self.restore_to_original = restore_to_original
self.target_channel = target_channel
self.target_ms_team_entity =... | Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365TeamsParams_MSTeamInfo): List of teams getting restored. restore_original_owners_members (boo... | RestoreO365TeamsParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreO365TeamsParams:
"""Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365TeamsParams_MSTeamInfo): List of teams gett... | stack_v2_sparse_classes_36k_train_021396 | 5,738 | permissive | [
{
"docstring": "Constructor for the RestoreO365TeamsParams class",
"name": "__init__",
"signature": "def __init__(self, create_new_team=None, ms_teams_vec=None, restore_original_owners_members=None, restore_to_original=None, target_channel=None, target_ms_team_entity=None, target_team=None, target_team_... | 2 | null | Implement the Python class `RestoreO365TeamsParams` described below.
Class description:
Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365Team... | Implement the Python class `RestoreO365TeamsParams` described below.
Class description:
Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365Team... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreO365TeamsParams:
"""Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365TeamsParams_MSTeamInfo): List of teams gett... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoreO365TeamsParams:
"""Implementation of the 'RestoreO365TeamsParams' model. TODO: type description here. Attributes: create_new_team (bool): Bool which specifies, if we have to create a new team if it doesn't exist. ms_teams_vec (list of RestoreO365TeamsParams_MSTeamInfo): List of teams getting restored.... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_o_365_teams_params.py | cohesity/management-sdk-python | train | 24 |
12b58b3225d863cbcf85c2e5380d45f9d4b90f24 | [
"parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)\nparser = self.add_input_arguments(parser, **kwargs)\nreturn parser",
"parser.add_argument('-i', '--input-uri', dest='raw_input_uri', default='{base}/{name}{ext}', metavar='URI', help='Name of the video file input or path to the resource. ... | <|body_start_0|>
parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)
parser = self.add_input_arguments(parser, **kwargs)
return parser
<|end_body_0|>
<|body_start_1|>
parser.add_argument('-i', '--input-uri', dest='raw_input_uri', default='{base}/{name}{ext}', metav... | ... | BaseDetectorService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_input_arguments(parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_1|>
def handle_options(se... | stack_v2_sparse_classes_36k_train_021397 | 3,731 | permissive | [
{
"docstring": ":param parser: :param kwargs: :return:",
"name": "add_arguments",
"signature": "def add_arguments(self, parser, **kwargs)"
},
{
"docstring": ":param parser: :param kwargs: :return:",
"name": "add_input_arguments",
"signature": "def add_input_arguments(parser, **kwargs)"
... | 4 | null | Implement the Python class `BaseDetectorService` described below.
Class description:
...
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_input_arguments(parser, **kwargs): :param parser: :param kwargs: :return:
- def handle_options(self, ... | Implement the Python class `BaseDetectorService` described below.
Class description:
...
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_input_arguments(parser, **kwargs): :param parser: :param kwargs: :return:
- def handle_options(self, ... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_input_arguments(parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_1|>
def handle_options(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)
parser = self.add_input_arguments(parser, **kwargs)
return parser
def add_i... | the_stack_v2_python_sparse | shot_detector/services/base_detector_service.py | w495/python-video-shot-detector | train | 20 |
7bc75e72dfb1bcf1d3e302368fca234537fc45fc | [
"self.SetTitle('This is an example Dialog')\nself.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)\nreturn True",
"if messageId == c4d.DLG_OK:\n print('User Click on Ok')\n return True\nelif messageId == c4d.DLG_CANCEL:\n print('User Click on Cancel')\n self.Close()\n return True\nreturn True"
] | <|body_start_0|>
self.SetTitle('This is an example Dialog')
self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)
return True
<|end_body_0|>
<|body_start_1|>
if messageId == c4d.DLG_OK:
print('User Click on Ok')
return True
elif messageId == c4d.DLG_CANCEL:
... | ExampleDialog | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExampleDialog:
def CreateLayout(self):
"""This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog."""
<|body_0|>
def Command(self, messageId, bc):
"""This Method is called automatically when the user clicks on a gadget and/or chan... | stack_v2_sparse_classes_36k_train_021398 | 1,800 | permissive | [
{
"docstring": "This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog.",
"name": "CreateLayout",
"signature": "def CreateLayout(self)"
},
{
"docstring": "This Method is called automatically when the user clicks on a gadget and/or changes its value this func... | 2 | stack_v2_sparse_classes_30k_train_007926 | Implement the Python class `ExampleDialog` described below.
Class description:
Implement the ExampleDialog class.
Method signatures and docstrings:
- def CreateLayout(self): This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog.
- def Command(self, messageId, bc): This Method is... | Implement the Python class `ExampleDialog` described below.
Class description:
Implement the ExampleDialog class.
Method signatures and docstrings:
- def CreateLayout(self): This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog.
- def Command(self, messageId, bc): This Method is... | b1ea3fce533df34094bc3d0bd6460dfb84306e53 | <|skeleton|>
class ExampleDialog:
def CreateLayout(self):
"""This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog."""
<|body_0|>
def Command(self, messageId, bc):
"""This Method is called automatically when the user clicks on a gadget and/or chan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExampleDialog:
def CreateLayout(self):
"""This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog."""
self.SetTitle('This is an example Dialog')
self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)
return True
def Command(self, messageId, bc):... | the_stack_v2_python_sparse | scripts/03_application_development/gui/dialog/gedialog_modal_r13.py | PluginCafe/cinema4d_py_sdk_extended | train | 112 | |
e1da87c5bead52d74bd6a0972e86ef6e6e848ebd | [
"flag = False\nfor i in range(len(nums) - 2, -1, -1):\n if nums[i] < nums[i + 1]:\n flag = True\n pivot = nums[i]\n for j in range(len(nums) - 1, i, -1):\n if nums[j] > pivot:\n nums[i] = nums[j]\n nums[j] = pivot\n break\n nums[... | <|body_start_0|>
flag = False
for i in range(len(nums) - 2, -1, -1):
if nums[i] < nums[i + 1]:
flag = True
pivot = nums[i]
for j in range(len(nums) - 1, i, -1):
if nums[j] > pivot:
nums[i] = nums[j]
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def nextPermutation2(self, nums):
""":type nums: List[int] :rtype: None Do not return anything, modify nums in-place i... | stack_v2_sparse_classes_36k_train_021399 | 1,210 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "nextPermutation",
"signature": "def nextPermutation(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.",
"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def nextPermutation2(self, nums): :type nums: List[int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def nextPermutation2(self, nums): :type nums: List[int... | c8bf33af30569177c5276ffcd72a8d93ba4c402a | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def nextPermutation2(self, nums):
""":type nums: List[int] :rtype: None Do not return anything, modify nums in-place i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
flag = False
for i in range(len(nums) - 2, -1, -1):
if nums[i] < nums[i + 1]:
flag = True
pivot = nums[i... | the_stack_v2_python_sparse | 1-100/31-40/31-nextPermutation/nextPermutation.py | xuychen/Leetcode | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.