blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9f698b853477b6f876f0a946e8dad425a05bedb7 | [
"if not date_string and (not time_string):\n raise errors.ParseError('Missing date or time string.')\ntry:\n month_string, day_of_month_string, year_string = date_string.split('/')\n year = int(year_string, 10)\n month = int(month_string, 10)\n day_of_month = int(day_of_month_string, 10)\nexcept (Att... | <|body_start_0|>
if not date_string and (not time_string):
raise errors.ParseError('Missing date or time string.')
try:
month_string, day_of_month_string, year_string = date_string.split('/')
year = int(year_string, 10)
month = int(month_string, 10)
... | Parses the McAfee AV Access Protection Log. | McafeeAccessProtectionParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class McafeeAccessProtectionParser:
"""Parses the McAfee AV Access Protection Log."""
def _CreateDateTime(self, date_string, time_string):
"""Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in l... | stack_v2_sparse_classes_10k_train_001300 | 6,022 | permissive | [
{
"docstring": "Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in local time. The month and day can be either 1 or 2 characters long, for example: \"7/30/2013\\\\t10:22:48 AM\" Args: date_string (str): date string. ... | 3 | stack_v2_sparse_classes_30k_train_003064 | Implement the Python class `McafeeAccessProtectionParser` described below.
Class description:
Parses the McAfee AV Access Protection Log.
Method signatures and docstrings:
- def _CreateDateTime(self, date_string, time_string): Creates a date time value from the date time strings. The format stores the date and time a... | Implement the Python class `McafeeAccessProtectionParser` described below.
Class description:
Parses the McAfee AV Access Protection Log.
Method signatures and docstrings:
- def _CreateDateTime(self, date_string, time_string): Creates a date time value from the date time strings. The format stores the date and time a... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class McafeeAccessProtectionParser:
"""Parses the McAfee AV Access Protection Log."""
def _CreateDateTime(self, date_string, time_string):
"""Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class McafeeAccessProtectionParser:
"""Parses the McAfee AV Access Protection Log."""
def _CreateDateTime(self, date_string, time_string):
"""Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in local time. Th... | the_stack_v2_python_sparse | plaso/parsers/mcafeeav.py | log2timeline/plaso | train | 1,506 |
a3365003191c1ce10b7709b99d7a085d92f282c9 | [
"super().__init__(category, owner, ttl=ttl)\nself.lock_id_seq = itertools.count()\nself.items: Dict[str, Set[str]] = {}\nself.items_condition = Condition()",
"def is_ready():\n for locked in self.items.values():\n if locked.intersection(items_set):\n metrics[f'lock_{self.category}_misses'] +=... | <|body_start_0|>
super().__init__(category, owner, ttl=ttl)
self.lock_id_seq = itertools.count()
self.items: Dict[str, Set[str]] = {}
self.items_condition = Condition()
<|end_body_0|>
<|body_start_1|>
def is_ready():
for locked in self.items.values():
... | Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ``` | ProcessLock | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessLock:
"""Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```"""
def __init__(self, category: str, own... | stack_v2_sparse_classes_10k_train_001301 | 2,673 | permissive | [
{
"docstring": ":param category: Lock category name :param owner: Lock owner id :param ttl: Default lock ttl in seconds",
"name": "__init__",
"signature": "def __init__(self, category: str, owner: str, ttl: Optional[float]=None)"
},
{
"docstring": "Acquire lock by list of items",
"name": "ac... | 3 | null | Implement the Python class `ProcessLock` described below.
Class description:
Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```
Metho... | Implement the Python class `ProcessLock` described below.
Class description:
Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```
Metho... | 6e6d71574e9b9d822bec572cc629a0ea73604a59 | <|skeleton|>
class ProcessLock:
"""Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```"""
def __init__(self, category: str, own... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProcessLock:
"""Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```"""
def __init__(self, category: str, owner: str, ttl:... | the_stack_v2_python_sparse | core/lock/process.py | nocproject/noc | train | 105 |
921dbdddf4b3add131887a38cc23c79b9e68c8d0 | [
"if not link_share_id:\n link_shares = []\n for link_share in Link_Share.objects.filter(user=request.user).exclude(valid_till__lt=timezone.now()).exclude(allowed_reads__lte=0):\n link_shares.append({'id': link_share.id, 'public_title': link_share.public_title, 'allowed_reads': link_share.allowed_reads,... | <|body_start_0|>
if not link_share_id:
link_shares = []
for link_share in Link_Share.objects.filter(user=request.user).exclude(valid_till__lt=timezone.now()).exclude(allowed_reads__lte=0):
link_shares.append({'id': link_share.id, 'public_title': link_share.public_title, '... | Check the REST Token and returns a list of all link_shares or the specified link_shares details | LinkShareView | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share... | stack_v2_sparse_classes_10k_train_001302 | 5,856 | permissive | [
{
"docstring": "Returns either a list of all link_shares with own access privileges or the members specified link_share :param request: :type request: :param link_share_id: :type link_share_id: :param args: :type args: :param kwargs: :type kwargs: :return: 200 / 403 :rtype:",
"name": "get",
"signature":... | 4 | null | Implement the Python class `LinkShareView` described below.
Class description:
Check the REST Token and returns a list of all link_shares or the specified link_shares details
Method signatures and docstrings:
- def get(self, request, link_share_id=None, *args, **kwargs): Returns either a list of all link_shares with ... | Implement the Python class `LinkShareView` described below.
Class description:
Check the REST Token and returns a list of all link_shares or the specified link_shares details
Method signatures and docstrings:
- def get(self, request, link_share_id=None, *args, **kwargs): Returns either a list of all link_shares with ... | 8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf | <|skeleton|>
class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share :param reque... | the_stack_v2_python_sparse | psono/restapi/views/link_share.py | psono/psono-server | train | 76 |
c6b724d3e4e69af61fdfb63ace6d534a8081399f | [
"self.debug = False\nself.filename = None\nself.endpoint = None\nself.engine = None\nself.Base = None\nself.meta = None\nif not database.__monostate:\n database.__monostate = self.__dict__\n self.activate()\nelse:\n self.__dict__ = database.__monostate",
"self.filename = Config.path_expand(os.path.join('... | <|body_start_0|>
self.debug = False
self.filename = None
self.endpoint = None
self.engine = None
self.Base = None
self.meta = None
if not database.__monostate:
database.__monostate = self.__dict__
self.activate()
else:
s... | A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object. | database | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."... | stack_v2_sparse_classes_10k_train_001303 | 22,814 | permissive | [
{
"docstring": "Initializes the database and shares the state with other instantiations of it",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "activates the shared variables",
"name": "activate",
"signature": "def activate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003850 | Implement the Python class `database` described below.
Class description:
A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the mo... | Implement the Python class `database` described below.
Class description:
A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the mo... | ec43eb44be50e10d962ed69631e0a8f83f55c5ca | <|skeleton|>
class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."""
def _... | the_stack_v2_python_sparse | cloudmesh_client/db/model.py | izelarabm/client | train | 0 |
4bd4ec6862a16cd5348d284673bbe52e44be01ba | [
"s = session()\ngoals = Goal.query.all()\nfor goal in goals:\n print(goal.old_numbered, type(goal.old_numbered))\n for each in goal.old_numbered:\n gs = GoalStep(each, goal.id)\n s.add(gs)\n s.commit()",
"rv = []\ntokens = nltk.word_tokenize(data)\nfor token in tokens:\n if token.low... | <|body_start_0|>
s = session()
goals = Goal.query.all()
for goal in goals:
print(goal.old_numbered, type(goal.old_numbered))
for each in goal.old_numbered:
gs = GoalStep(each, goal.id)
s.add(gs)
s.commit()
<|end_body_0|>
<|... | Represent patient/caregiver goal. | Goal | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Goal:
"""Represent patient/caregiver goal."""
def goal_step_extractor():
"""Decompose goal instances into goal-steps."""
<|body_0|>
def handle_proper_nouns(data):
"""Parameters ---------- data"""
<|body_1|>
def __init__(self, data, source):
"... | stack_v2_sparse_classes_10k_train_001304 | 5,825 | permissive | [
{
"docstring": "Decompose goal instances into goal-steps.",
"name": "goal_step_extractor",
"signature": "def goal_step_extractor()"
},
{
"docstring": "Parameters ---------- data",
"name": "handle_proper_nouns",
"signature": "def handle_proper_nouns(data)"
},
{
"docstring": "Goal ... | 3 | stack_v2_sparse_classes_30k_train_000160 | Implement the Python class `Goal` described below.
Class description:
Represent patient/caregiver goal.
Method signatures and docstrings:
- def goal_step_extractor(): Decompose goal instances into goal-steps.
- def handle_proper_nouns(data): Parameters ---------- data
- def __init__(self, data, source): Goal construc... | Implement the Python class `Goal` described below.
Class description:
Represent patient/caregiver goal.
Method signatures and docstrings:
- def goal_step_extractor(): Decompose goal instances into goal-steps.
- def handle_proper_nouns(data): Parameters ---------- data
- def __init__(self, data, source): Goal construc... | 96935bb06f71b509f97ca426afe14713d5830e46 | <|skeleton|>
class Goal:
"""Represent patient/caregiver goal."""
def goal_step_extractor():
"""Decompose goal instances into goal-steps."""
<|body_0|>
def handle_proper_nouns(data):
"""Parameters ---------- data"""
<|body_1|>
def __init__(self, data, source):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Goal:
"""Represent patient/caregiver goal."""
def goal_step_extractor():
"""Decompose goal instances into goal-steps."""
s = session()
goals = Goal.query.all()
for goal in goals:
print(goal.old_numbered, type(goal.old_numbered))
for each in goal.old... | the_stack_v2_python_sparse | tcas/abstract/model/goal.py | mishrasushruti99/TransitionalCareAnalyticsServer | train | 0 |
1f5787212828b7dac5b14cec4eace88093eaed32 | [
"i = 0\nminVal, maxVal = (0, n)\nwhile True:\n i += 1\n t = round((minVal + maxVal) / 2)\n evl = guess(t)\n if evl == 0:\n return t\n elif evl == 1:\n minVal = t\n elif evl == -1:\n maxVal = t\n else:\n print('error')\n return False",
"l, h = (1, n)\nmid = (... | <|body_start_0|>
i = 0
minVal, maxVal = (0, n)
while True:
i += 1
t = round((minVal + maxVal) / 2)
evl = guess(t)
if evl == 0:
return t
elif evl == 1:
minVal = t
elif evl == -1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def guessNumber(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def mySolution(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i = 0
minVal, maxVal = (0, n)
while True:
... | stack_v2_sparse_classes_10k_train_001305 | 1,150 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "guessNumber",
"signature": "def guessNumber(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "mySolution",
"signature": "def mySolution(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002987 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def guessNumber(self, n): :type n: int :rtype: int
- def mySolution(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def guessNumber(self, n): :type n: int :rtype: int
- def mySolution(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def guessNumber(self, n):
""":ty... | 11c8fc663888b48b5417256aab1bf872190267ba | <|skeleton|>
class Solution:
def guessNumber(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def mySolution(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def guessNumber(self, n):
""":type n: int :rtype: int"""
i = 0
minVal, maxVal = (0, n)
while True:
i += 1
t = round((minVal + maxVal) / 2)
evl = guess(t)
if evl == 0:
return t
elif evl == 1:
... | the_stack_v2_python_sparse | Guess Number Higher or Lower.py | lfdyf20/Leetcode | train | 1 | |
c7f2288c28fcf16f96e881628961db1311770979 | [
"if during is None:\n during = {}\nif on_enter is None:\n on_enter = {}\nif on_exit is None:\n on_exit = {}\nif sorted(list(set(states))) != sorted(states):\n raise StateMachineException('Duplicate state names encountered:\\n{0}'.format(states))\nself._states = {}\nfor state in states:\n self._states... | <|body_start_0|>
if during is None:
during = {}
if on_enter is None:
on_enter = {}
if on_exit is None:
on_exit = {}
if sorted(list(set(states))) != sorted(states):
raise StateMachineException('Duplicate state names encountered:\n{0}'.format... | A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function, which performs all tasks and potentially advances to the next state if a cond... | StateMachine | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StateMachine:
"""A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function, which performs all tasks and potentia... | stack_v2_sparse_classes_10k_train_001306 | 8,604 | permissive | [
{
"docstring": "Creates a new state machine. The `during`, `on_enter`, and `on_exit` dictionaries are all optional. Additionally, each is free to have as few or as many of each state as desired, i.e. leaving out states is fine. Args: states (List[str]): A list of all possible states in the FSM. transitions (Lis... | 2 | stack_v2_sparse_classes_30k_train_005334 | Implement the Python class `StateMachine` described below.
Class description:
A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function... | Implement the Python class `StateMachine` described below.
Class description:
A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function... | 90db2ae532667c48ca080108b895c2e1fe16b1e8 | <|skeleton|>
class StateMachine:
"""A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function, which performs all tasks and potentia... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StateMachine:
"""A minimal state machine with the ability to declare state transition conditions, functions to call when entering and exiting any state, and functions to call while in any particular state. All of this is done through a single `step` function, which performs all tasks and potentially advances ... | the_stack_v2_python_sparse | securitybot/state_machine.py | gyrospectre/securitybot | train | 3 |
f0a1f12694e99ba46af996e444ef32d7ebce0b22 | [
"if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None",
"if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None",
"if obj1._meta.app_label == 'researcherquery' and obj2._meta.app_label == 'researcherquery':\n return True\nreturn None",
"if app_label == ... | <|body_start_0|>
if model._meta.app_label == 'researcherquery':
return 'safedb'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'researcherquery':
return 'safedb'
return None
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_label... | A router to control all database operations on models in the researcherquery application. | ResearcherqueryRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResearcherqueryRouter:
"""A router to control all database operations on models in the researcherquery application."""
def db_for_read(self, model, **hints):
"""Attempts to read researcherquery models go to safedb."""
<|body_0|>
def db_for_write(self, model, **hints):
... | stack_v2_sparse_classes_10k_train_001307 | 1,295 | no_license | [
{
"docstring": "Attempts to read researcherquery models go to safedb.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attempts to write researcherquery models go to safedb.",
"name": "db_for_write",
"signature": "def db_for_write(self, mod... | 4 | stack_v2_sparse_classes_30k_train_001027 | Implement the Python class `ResearcherqueryRouter` described below.
Class description:
A router to control all database operations on models in the researcherquery application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb.
- def db_for... | Implement the Python class `ResearcherqueryRouter` described below.
Class description:
A router to control all database operations on models in the researcherquery application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb.
- def db_for... | 685c2b9d40fb24ca1735352846a39fdf5d3728eb | <|skeleton|>
class ResearcherqueryRouter:
"""A router to control all database operations on models in the researcherquery application."""
def db_for_read(self, model, **hints):
"""Attempts to read researcherquery models go to safedb."""
<|body_0|>
def db_for_write(self, model, **hints):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResearcherqueryRouter:
"""A router to control all database operations on models in the researcherquery application."""
def db_for_read(self, model, **hints):
"""Attempts to read researcherquery models go to safedb."""
if model._meta.app_label == 'researcherquery':
return 'safe... | the_stack_v2_python_sparse | researcherquery/router.py | guekling/ifs4205team1 | train | 0 |
27f5f1f1b7a38544d0a826d763b46b74f1f9330b | [
"if row is None:\n results = self._calculate_row(feature_resource)\n try:\n results = zip(*results)\n except TypeError:\n results = [tuple([results])]\n rows = []\n status = []\n for j in results:\n row = tuple(feature_resource)\n if isinstance(j, list) is True:\n ... | <|body_start_0|>
if row is None:
results = self._calculate_row(feature_resource)
try:
results = zip(*results)
except TypeError:
results = [tuple([results])]
rows = []
status = []
for j in results:
... | Generates rows to be placed into the uncached tables | WorkDirRows | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkDirRows:
"""Generates rows to be placed into the uncached tables"""
def construct_row(self, feature, feature_resource, row=None):
"""If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @p... | stack_v2_sparse_classes_10k_train_001308 | 22,952 | permissive | [
{
"docstring": "If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @param: row - row for a workdir table (default: None) @return: rows",
"name": "construct_row",
"signature": "def construct_row(self, feature, f... | 3 | null | Implement the Python class `WorkDirRows` described below.
Class description:
Generates rows to be placed into the uncached tables
Method signatures and docstrings:
- def construct_row(self, feature, feature_resource, row=None): If row is nothing a feature is calculated otherwise the row is formated in the workdir tab... | Implement the Python class `WorkDirRows` described below.
Class description:
Generates rows to be placed into the uncached tables
Method signatures and docstrings:
- def construct_row(self, feature, feature_resource, row=None): If row is nothing a feature is calculated otherwise the row is formated in the workdir tab... | be337668b090de83a5b539b0e89b0ea8292166da | <|skeleton|>
class WorkDirRows:
"""Generates rows to be placed into the uncached tables"""
def construct_row(self, feature, feature_resource, row=None):
"""If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkDirRows:
"""Generates rows to be placed into the uncached tables"""
def construct_row(self, feature, feature_resource, row=None):
"""If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @param: row - r... | the_stack_v2_python_sparse | source/bqfeature/bq/features/controllers/TablesInterface.py | UCSB-VRL/bisqueUCSB | train | 40 |
48df80d22e15ffcf2fb30a6ae88ab75842e759fe | [
"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... | Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interprete... | InviteAPIServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OP... | stack_v2_sparse_classes_10k_train_001309 | 4,794 | no_license | [
{
"docstring": "Generates a new token for the user with a validity of 24 hours.",
"name": "GenerateInviteToken",
"signature": "def GenerateInviteToken(self, request, context)"
},
{
"docstring": "Forwards a received invite to the sync'n'share system provider.",
"name": "ForwardInvite",
"s... | 3 | stack_v2_sparse_classes_30k_val_000354 | Implement the Python class `InviteAPIServicer` described below.
Class description:
Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHO... | Implement the Python class `InviteAPIServicer` described below.
Class description:
Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHO... | dad1a042b38db5f8bedcac3b6af25066f4d6eef9 | <|skeleton|>
class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OP... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in th... | the_stack_v2_python_sparse | cs3/invite/v1beta1/invite_api_pb2_grpc.py | SamuAlfageme/python-cs3apis | train | 0 |
821ced1924541beac87d68d2066ca75365cf22ed | [
"a1, a2 = ([], [])\nwhile l1:\n a1.append(l1.val)\n l1 = l1.next\nwhile l2:\n a2.append(l2.val)\n l2 = l2.next\ns1 = ''\nfor i in range(len(a1) - 1, -1, -1):\n s1 = s1 + str(a1[i])\ns2 = ''\nfor j in range(len(a2) - 1, -1, -1):\n s2 = s2 + str(a2[j])\nm1, m2 = (int(s1), int(s2))\nm3 = str(m1 + m2)... | <|body_start_0|>
a1, a2 = ([], [])
while l1:
a1.append(l1.val)
l1 = l1.next
while l2:
a2.append(l2.val)
l2 = l2.next
s1 = ''
for i in range(len(a1) - 1, -1, -1):
s1 = s1 + str(a1[i])
s2 = ''
for j in rang... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode:
"""正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-ji... | stack_v2_sparse_classes_10k_train_001310 | 7,511 | no_license | [
{
"docstring": "正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-xing-yun-de-bei-ji-lang/ # 注意此思路没问题,结果有问题。。。。 :param l1: :param l2: :return:",
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode:
"""正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-ji... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode:
"""正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-xing-yun-... | the_stack_v2_python_sparse | LeetCode_practice/LinkedList/0002_AddTwoNumbers.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
a67513f277511b882cb7d915c72ee52d4a728f86 | [
"self.img_width = img_width\nself.img_height = img_height\nself.flip_horiz = flip_horiz\nself.inter = inter",
"crops = []\nheight, width = image.shape[:2]\ncorners = [[0, 0, self.img_width, self.img_height], [width - self.img_width, 0, width, self.img_height], [width - self.img_width, height - self.img_height, wi... | <|body_start_0|>
self.img_width = img_width
self.img_height = img_height
self.flip_horiz = flip_horiz
self.inter = inter
<|end_body_0|>
<|body_start_1|>
crops = []
height, width = image.shape[:2]
corners = [[0, 0, self.img_width, self.img_height], [width - self.i... | CropPreprocessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CropPreprocessor:
def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA):
"""Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in... | stack_v2_sparse_classes_10k_train_001311 | 2,378 | no_license | [
{
"docstring": "Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation method",
"name": "__init__",
"signature": "def __init__(self, img_width, img_height, flip_h... | 2 | stack_v2_sparse_classes_30k_train_000155 | Implement the Python class `CropPreprocessor` described below.
Class description:
Implement the CropPreprocessor class.
Method signatures and docstrings:
- def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de... | Implement the Python class `CropPreprocessor` described below.
Class description:
Implement the CropPreprocessor class.
Method signatures and docstrings:
- def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de... | e9f2010715fa06f50095d05684617c86e18ca661 | <|skeleton|>
class CropPreprocessor:
def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA):
"""Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CropPreprocessor:
def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA):
"""Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation me... | the_stack_v2_python_sparse | dltoolkit/preprocess/crop.py | GeoffBreemer/DLToolkit | train | 2 | |
7ce419484239945874650041c5a0fe02f16a476d | [
"if len(prices) == 0:\n return 0\nbuy = [0] * len(prices)\nsell = buy.copy()\nstop = buy.copy()\nbuy[0], sell[0], stop[0] = (-prices[0], 0, 0)\nfor i in range(1, len(prices)):\n buy[i] = max(stop[i - 1] - prices[i], buy[i - 1])\n sell[i] = buy[i - 1] + prices[i]\n stop[i] = max(stop[i - 1], sell[i - 1])... | <|body_start_0|>
if len(prices) == 0:
return 0
buy = [0] * len(prices)
sell = buy.copy()
stop = buy.copy()
buy[0], sell[0], stop[0] = (-prices[0], 0, 0)
for i in range(1, len(prices)):
buy[i] = max(stop[i - 1] - prices[i], buy[i - 1])
s... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_old(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(prices) == 0:
retu... | stack_v2_sparse_classes_10k_train_001312 | 1,097 | permissive | [
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit_old",
"signature": "def maxProfit_old(self, prices)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003285 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit_old(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit_old(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solution:
def max... | d203aecd1afe1af13a0384a9c657c8424aab322d | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_old(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
if len(prices) == 0:
return 0
buy = [0] * len(prices)
sell = buy.copy()
stop = buy.copy()
buy[0], sell[0], stop[0] = (-prices[0], 0, 0)
for i in range(1, len(pri... | the_stack_v2_python_sparse | medium/Q309_BestTimeToBuyAndSellStockWithCooldown.py | Kaciras/leetcode | train | 0 | |
ecb96a3a2ba4adacc3434459e291d6ebe958f56c | [
"self.xi = np.asarray(xi)\nself.T = T\nself.n_waypoints = self.xi.shape[0]\ntimesteps = np.linspace(0, self.T, self.n_waypoints)\nself.f1 = interp1d(timesteps, self.xi[:, 0], kind='cubic')\nself.f2 = interp1d(timesteps, self.xi[:, 1], kind='cubic')\nself.f3 = interp1d(timesteps, self.xi[:, 2], kind='cubic')\nself.f... | <|body_start_0|>
self.xi = np.asarray(xi)
self.T = T
self.n_waypoints = self.xi.shape[0]
timesteps = np.linspace(0, self.T, self.n_waypoints)
self.f1 = interp1d(timesteps, self.xi[:, 0], kind='cubic')
self.f2 = interp1d(timesteps, self.xi[:, 1], kind='cubic')
self... | Trajectory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trajectory:
def __init__(self, xi, T):
"""create cublic interpolators between waypoints"""
<|body_0|>
def get(self, t):
"""get interpolated position"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.xi = np.asarray(xi)
self.T = T
... | stack_v2_sparse_classes_10k_train_001313 | 4,949 | permissive | [
{
"docstring": "create cublic interpolators between waypoints",
"name": "__init__",
"signature": "def __init__(self, xi, T)"
},
{
"docstring": "get interpolated position",
"name": "get",
"signature": "def get(self, t)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000034 | Implement the Python class `Trajectory` described below.
Class description:
Implement the Trajectory class.
Method signatures and docstrings:
- def __init__(self, xi, T): create cublic interpolators between waypoints
- def get(self, t): get interpolated position | Implement the Python class `Trajectory` described below.
Class description:
Implement the Trajectory class.
Method signatures and docstrings:
- def __init__(self, xi, T): create cublic interpolators between waypoints
- def get(self, t): get interpolated position
<|skeleton|>
class Trajectory:
def __init__(self,... | 65695ac0ad4ffc28474f1920c2d2ff484481caf3 | <|skeleton|>
class Trajectory:
def __init__(self, xi, T):
"""create cublic interpolators between waypoints"""
<|body_0|>
def get(self, t):
"""get interpolated position"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Trajectory:
def __init__(self, xi, T):
"""create cublic interpolators between waypoints"""
self.xi = np.asarray(xi)
self.T = T
self.n_waypoints = self.xi.shape[0]
timesteps = np.linspace(0, self.T, self.n_waypoints)
self.f1 = interp1d(timesteps, self.xi[:, 0], k... | the_stack_v2_python_sparse | simulations/panda/task2/collect_human_demos.py | VT-Collab/choice-sets | train | 1 | |
fe6ec0b0172bccfe1dfef58f3ff38453d0091efb | [
"with testing.test_setup():\n user = models.User(name='test', email='test@test.com', password='test')\n user.deletion_behaviour = settings_enums.DeletionBehaviour.CASCADE\n db.DB.session.add(user)\n db.DB.session.commit()\n setting = user.get_setting('deletion_behaviour')\n self.assertEqual('delet... | <|body_start_0|>
with testing.test_setup():
user = models.User(name='test', email='test@test.com', password='test')
user.deletion_behaviour = settings_enums.DeletionBehaviour.CASCADE
db.DB.session.add(user)
db.DB.session.commit()
setting = user.get_set... | Tests for User model. | UserTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
<|body_0|>
def test_get_setting__setting_does_not_exist(self):
"""Test User.get_settings when the setting does not exist."""
... | stack_v2_sparse_classes_10k_train_001314 | 1,956 | permissive | [
{
"docstring": "Test User.get_settings when the setting exists.",
"name": "test_get_setting__setting_exists",
"signature": "def test_get_setting__setting_exists(self)"
},
{
"docstring": "Test User.get_settings when the setting does not exist.",
"name": "test_get_setting__setting_does_not_exi... | 3 | stack_v2_sparse_classes_30k_train_006059 | Implement the Python class `UserTest` described below.
Class description:
Tests for User model.
Method signatures and docstrings:
- def test_get_setting__setting_exists(self): Test User.get_settings when the setting exists.
- def test_get_setting__setting_does_not_exist(self): Test User.get_settings when the setting ... | Implement the Python class `UserTest` described below.
Class description:
Tests for User model.
Method signatures and docstrings:
- def test_get_setting__setting_exists(self): Test User.get_settings when the setting exists.
- def test_get_setting__setting_does_not_exist(self): Test User.get_settings when the setting ... | 7d529d9eaeb9de7a9aebe6aa373e1b3611bfd2ad | <|skeleton|>
class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
<|body_0|>
def test_get_setting__setting_does_not_exist(self):
"""Test User.get_settings when the setting does not exist."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
with testing.test_setup():
user = models.User(name='test', email='test@test.com', password='test')
user.deletion_behaviour = sett... | the_stack_v2_python_sparse | lime/database/user_test.py | toastwaffle/LiME | train | 1 |
3c08eb4060380679ae1d50a4fd567add0c475bb0 | [
"self.get_matching()\nself.remove_virtual()\nself.apply_matching()\nif self.graph.gl_plot:\n self.graph.gl_plot.plot_lines(self.matching)",
"verts, plaqs, tv, tp = ([], [], [], [])\ndvert, dplaq, dv, dp = ([], [], [], [])\nfor layer in self.graph.S.values():\n for stab in layer.values():\n type, y, x... | <|body_start_0|>
self.get_matching()
self.remove_virtual()
self.apply_matching()
if self.graph.gl_plot:
self.graph.gl_plot.plot_lines(self.matching)
<|end_body_0|>
<|body_start_1|>
verts, plaqs, tv, tp = ([], [], [], [])
dvert, dplaq, dv, dp = ([], [], [], []... | Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero. | planar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode function... | stack_v2_sparse_classes_10k_train_001315 | 11,180 | no_license | [
{
"docstring": "Decode functions for the MWPM planar decoder",
"name": "decode",
"signature": "def decode(self)"
},
{
"docstring": "Returns all anyons in the graph, as well as their respective virtual anyons in the boundary, for both their current layer as well as on the decode layer. This is th... | 5 | stack_v2_sparse_classes_30k_train_002630 | Implement the Python class `planar` described below.
Class description:
Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero.
Method signa... | Implement the Python class `planar` described below.
Class description:
Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero.
Method signa... | 8d952fc8d8d728086360e1718f43c0bc445f26b1 | <|skeleton|>
class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode function... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode functions for the MWP... | the_stack_v2_python_sparse | oopsc/decoder/mwpm.py | Poeloe/oop_surface_code | train | 3 |
b0851a16c5f80dd34dc0d5374b49545dae364c8e | [
"return_type = ClientResult(context, SiteSharingReportStatus())\nbinding_type = SiteSharingReportHelper(context)\nqry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True)\ncontext.add_query(qry)\nreturn return_type",
"return_type = ClientResult(context, SiteSharingR... | <|body_start_0|>
return_type = ClientResult(context, SiteSharingReportStatus())
binding_type = SiteSharingReportHelper(context)
qry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True)
context.add_query(qry)
return return_type
<|end... | SiteSharingReportHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
<|body_0|>
def create_sharing_report_job(context, web_url, folder_url):
""":type context: office365.sharepoint.client_context.Clien... | stack_v2_sparse_classes_10k_train_001316 | 1,460 | permissive | [
{
"docstring": ":type context: office365.sharepoint.client_context.ClientContext",
"name": "cancel_sharing_report_job",
"signature": "def cancel_sharing_report_job(context)"
},
{
"docstring": ":type context: office365.sharepoint.client_context.ClientContext :param str web_url: :param str folder_... | 2 | null | Implement the Python class `SiteSharingReportHelper` described below.
Class description:
Implement the SiteSharingReportHelper class.
Method signatures and docstrings:
- def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext
- def create_sharing_report_job(context, we... | Implement the Python class `SiteSharingReportHelper` described below.
Class description:
Implement the SiteSharingReportHelper class.
Method signatures and docstrings:
- def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext
- def create_sharing_report_job(context, we... | cbd245d1af8d69e013c469cfc2a9851f51c91417 | <|skeleton|>
class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
<|body_0|>
def create_sharing_report_job(context, web_url, folder_url):
""":type context: office365.sharepoint.client_context.Clien... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
return_type = ClientResult(context, SiteSharingReportStatus())
binding_type = SiteSharingReportHelper(context)
qry = ServiceOperationQuery(bin... | the_stack_v2_python_sparse | office365/sharepoint/sharing/site_sharing_report_helper.py | vgrem/Office365-REST-Python-Client | train | 1,006 | |
469f78d625ccd566a6c66658c4edb7247a22eb5f | [
"if m != 2 or n != 2:\n raise ValueError('m must be 2 and n must be 2')\nsuper().__init__(m, n)",
"res = 0\nif i == 0:\n res = 10000.0 * x[0][0] * x[1][0] - 1\nelif i == 1:\n res = math.exp(-x[0][0]) + math.exp(-x[1][0]) - 1.0001\nreturn res",
"res = np.zeros((2, 1), dtype=np.float)\nif i == 0:\n re... | <|body_start_0|>
if m != 2 or n != 2:
raise ValueError('m must be 2 and n must be 2')
super().__init__(m, n)
<|end_body_0|>
<|body_start_1|>
res = 0
if i == 0:
res = 10000.0 * x[0][0] * x[1][0] - 1
elif i == 1:
res = math.exp(-x[0][0]) + math.... | PowellBadlyScaled | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowellBadlyScaled:
def __init__(self, m=2, n=2):
""":param m: :param n:"""
<|body_0|>
def _r_i(self, x, i):
""":param x: :param i: :return:"""
<|body_1|>
def _dr_i(self, x, i):
""":param x: :param i: :return:"""
<|body_2|>
def _ddr_i... | stack_v2_sparse_classes_10k_train_001317 | 15,975 | permissive | [
{
"docstring": ":param m: :param n:",
"name": "__init__",
"signature": "def __init__(self, m=2, n=2)"
},
{
"docstring": ":param x: :param i: :return:",
"name": "_r_i",
"signature": "def _r_i(self, x, i)"
},
{
"docstring": ":param x: :param i: :return:",
"name": "_dr_i",
"... | 4 | stack_v2_sparse_classes_30k_val_000229 | Implement the Python class `PowellBadlyScaled` described below.
Class description:
Implement the PowellBadlyScaled class.
Method signatures and docstrings:
- def __init__(self, m=2, n=2): :param m: :param n:
- def _r_i(self, x, i): :param x: :param i: :return:
- def _dr_i(self, x, i): :param x: :param i: :return:
- d... | Implement the Python class `PowellBadlyScaled` described below.
Class description:
Implement the PowellBadlyScaled class.
Method signatures and docstrings:
- def __init__(self, m=2, n=2): :param m: :param n:
- def _r_i(self, x, i): :param x: :param i: :return:
- def _dr_i(self, x, i): :param x: :param i: :return:
- d... | d7786b7bd5f24af4ebb8fef43f63e7faa7d7569f | <|skeleton|>
class PowellBadlyScaled:
def __init__(self, m=2, n=2):
""":param m: :param n:"""
<|body_0|>
def _r_i(self, x, i):
""":param x: :param i: :return:"""
<|body_1|>
def _dr_i(self, x, i):
""":param x: :param i: :return:"""
<|body_2|>
def _ddr_i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PowellBadlyScaled:
def __init__(self, m=2, n=2):
""":param m: :param n:"""
if m != 2 or n != 2:
raise ValueError('m must be 2 and n must be 2')
super().__init__(m, n)
def _r_i(self, x, i):
""":param x: :param i: :return:"""
res = 0
if i == 0:
... | the_stack_v2_python_sparse | testFunction.py | cxgoal-97/optimization | train | 9 | |
52ece4c97166a0325852f5589c321c3a39c46019 | [
"self.id = Customer.id_counter\nCustomer.id_counter += 1\nself.behave_per_month = behavior_rates\nself.behave_per_day = 1.0 / 30.0 * self.behave_per_month\nself.channel = channel_name\nif start_of_month:\n self.age = random.uniform(Customer.MIN_AGE, Customer.MAX_AGE)\n self.date_of_birth = start_of_month + re... | <|body_start_0|>
self.id = Customer.id_counter
Customer.id_counter += 1
self.behave_per_month = behavior_rates
self.behave_per_day = 1.0 / 30.0 * self.behave_per_month
self.channel = channel_name
if start_of_month:
self.age = random.uniform(Customer.MIN_AGE, C... | Customer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Customer:
def __init__(self, behavior_rates, satisfaction=None, channel_name='NA', start_of_month=None, country=None):
"""Creates a customer for simulation, given an ndarray of behavior rates, which are converted to daily. Each customer also has a unique integer id which will become the ... | stack_v2_sparse_classes_10k_train_001318 | 3,713 | permissive | [
{
"docstring": "Creates a customer for simulation, given an ndarray of behavior rates, which are converted to daily. Each customer also has a unique integer id which will become the account_id in the database, and holds its own subscriptions and events. :param behavior_rates: ndarray of behavior rates, which ar... | 2 | stack_v2_sparse_classes_30k_train_002498 | Implement the Python class `Customer` described below.
Class description:
Implement the Customer class.
Method signatures and docstrings:
- def __init__(self, behavior_rates, satisfaction=None, channel_name='NA', start_of_month=None, country=None): Creates a customer for simulation, given an ndarray of behavior rates... | Implement the Python class `Customer` described below.
Class description:
Implement the Customer class.
Method signatures and docstrings:
- def __init__(self, behavior_rates, satisfaction=None, channel_name='NA', start_of_month=None, country=None): Creates a customer for simulation, given an ndarray of behavior rates... | 9d9bfec7bbcb97e60ad8d1f614ae58d13b81ee16 | <|skeleton|>
class Customer:
def __init__(self, behavior_rates, satisfaction=None, channel_name='NA', start_of_month=None, country=None):
"""Creates a customer for simulation, given an ndarray of behavior rates, which are converted to daily. Each customer also has a unique integer id which will become the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Customer:
def __init__(self, behavior_rates, satisfaction=None, channel_name='NA', start_of_month=None, country=None):
"""Creates a customer for simulation, given an ndarray of behavior rates, which are converted to daily. Each customer also has a unique integer id which will become the account_id in ... | the_stack_v2_python_sparse | data-generation/py/customer.py | karthiks/fight-churn | train | 1 | |
522930f6233f03311e8cfd44a9dfbf511b4ff3e7 | [
"if PiStreamingCamera.camera is None:\n PiStreamingCamera.camera = PiCamera(framerate=settings.FRAME_RATE, resolution=settings.CAMERA_RESOLUTION)\n sleep(2)\nif PiStreamingCamera.streamer is None:\n PiStreamingCamera.streamer = MeowlPiStreamer()\nPiStreamingCamera.camera.start_recording(PiStreamingCamera.s... | <|body_start_0|>
if PiStreamingCamera.camera is None:
PiStreamingCamera.camera = PiCamera(framerate=settings.FRAME_RATE, resolution=settings.CAMERA_RESOLUTION)
sleep(2)
if PiStreamingCamera.streamer is None:
PiStreamingCamera.streamer = MeowlPiStreamer()
PiStr... | A Raspberry Pi Camera class interface for streaming purposes | PiStreamingCamera | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PiStreamingCamera:
"""A Raspberry Pi Camera class interface for streaming purposes"""
def start(video_format='h264'):
"""Starts streaming from the camera on to the endpoint"""
<|body_0|>
def stop():
"""Stops streaming from the camera"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k_train_001319 | 1,599 | no_license | [
{
"docstring": "Starts streaming from the camera on to the endpoint",
"name": "start",
"signature": "def start(video_format='h264')"
},
{
"docstring": "Stops streaming from the camera",
"name": "stop",
"signature": "def stop()"
}
] | 2 | stack_v2_sparse_classes_30k_train_006197 | Implement the Python class `PiStreamingCamera` described below.
Class description:
A Raspberry Pi Camera class interface for streaming purposes
Method signatures and docstrings:
- def start(video_format='h264'): Starts streaming from the camera on to the endpoint
- def stop(): Stops streaming from the camera | Implement the Python class `PiStreamingCamera` described below.
Class description:
A Raspberry Pi Camera class interface for streaming purposes
Method signatures and docstrings:
- def start(video_format='h264'): Starts streaming from the camera on to the endpoint
- def stop(): Stops streaming from the camera
<|skele... | 5201f67b3c3dd35283a649e7b47c26a68105f7ee | <|skeleton|>
class PiStreamingCamera:
"""A Raspberry Pi Camera class interface for streaming purposes"""
def start(video_format='h264'):
"""Starts streaming from the camera on to the endpoint"""
<|body_0|>
def stop():
"""Stops streaming from the camera"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PiStreamingCamera:
"""A Raspberry Pi Camera class interface for streaming purposes"""
def start(video_format='h264'):
"""Starts streaming from the camera on to the endpoint"""
if PiStreamingCamera.camera is None:
PiStreamingCamera.camera = PiCamera(framerate=settings.FRAME_RAT... | the_stack_v2_python_sparse | src/camera/pi/meowlpi/camera/camera.py | meowl-surveillance-system/meowl | train | 1 |
a26e541444bf78217fdf77a2ae20bf3ec645591d | [
"self.environment = mls.rl.common.Environment()\nself.environment.game = mls.rl.common.Game(max_step=max_step)\nself.environment.current_state = self.environment.game.init_state(self.environment)",
"observation = self.environment.get_observation_for_agent()\nfor ag in self.environment.agents:\n ag.observation ... | <|body_start_0|>
self.environment = mls.rl.common.Environment()
self.environment.game = mls.rl.common.Game(max_step=max_step)
self.environment.current_state = self.environment.game.init_state(self.environment)
<|end_body_0|>
<|body_start_1|>
observation = self.environment.get_observatio... | Engine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Engine:
def __init__(self, max_step=-1):
"""initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game"""
<|body_0|>
def execute(self):
"""Main loop of the application."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k_train_001320 | 1,269 | permissive | [
{
"docstring": "initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game",
"name": "__init__",
"signature": "def __init__(self, max_step=-1)"
},
{
"docstring": "Main loop of the application.",
"name": "execute",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_002465 | Implement the Python class `Engine` described below.
Class description:
Implement the Engine class.
Method signatures and docstrings:
- def __init__(self, max_step=-1): initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game
- def execute(self): Main lo... | Implement the Python class `Engine` described below.
Class description:
Implement the Engine class.
Method signatures and docstrings:
- def __init__(self, max_step=-1): initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game
- def execute(self): Main lo... | 373598d067c7f0930ba13fe8da9756ce26eecbaf | <|skeleton|>
class Engine:
def __init__(self, max_step=-1):
"""initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game"""
<|body_0|>
def execute(self):
"""Main loop of the application."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Engine:
def __init__(self, max_step=-1):
"""initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game"""
self.environment = mls.rl.common.Environment()
self.environment.game = mls.rl.common.Game(max_step=max_step)
s... | the_stack_v2_python_sparse | mlsurvey/rl/engine/engine.py | jlaumonier/mlsurvey | train | 0 | |
3522289e97b2f7d8ff97dd19f855ae501c79922d | [
"if validator is not None and (not isinstance(validator, Evaluator)):\n raise TypeError(f'validator must be a monai.engines.evaluator.Evaluator but is {type(validator).__name__}.')\nself.validator = validator\nself.interval = interval\nself.epoch_level = epoch_level",
"if not isinstance(validator, Evaluator):\... | <|body_start_0|>
if validator is not None and (not isinstance(validator, Evaluator)):
raise TypeError(f'validator must be a monai.engines.evaluator.Evaluator but is {type(validator).__name__}.')
self.validator = validator
self.interval = interval
self.epoch_level = epoch_leve... | Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations. | ValidationHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidationHandler:
"""Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations."""
def __init__(self, interval: int, validator: Evaluator | None=None, epoch_level: bool=True) -> None:
"""Args: interval: do validation ... | stack_v2_sparse_classes_10k_train_001321 | 3,269 | permissive | [
{
"docstring": "Args: interval: do validation every N epochs or every N iterations during training. validator: run the validator when trigger validation, suppose to be Evaluator. if None, should call `set_validator()` before training. epoch_level: execute validation every N epochs or N iterations. `True` is epo... | 4 | stack_v2_sparse_classes_30k_train_003219 | Implement the Python class `ValidationHandler` described below.
Class description:
Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations.
Method signatures and docstrings:
- def __init__(self, interval: int, validator: Evaluator | None=None, epoch_... | Implement the Python class `ValidationHandler` described below.
Class description:
Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations.
Method signatures and docstrings:
- def __init__(self, interval: int, validator: Evaluator | None=None, epoch_... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class ValidationHandler:
"""Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations."""
def __init__(self, interval: int, validator: Evaluator | None=None, epoch_level: bool=True) -> None:
"""Args: interval: do validation ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ValidationHandler:
"""Attach validator to the trainer engine in Ignite. It can support to execute validation every N epochs or every N iterations."""
def __init__(self, interval: int, validator: Evaluator | None=None, epoch_level: bool=True) -> None:
"""Args: interval: do validation every N epoch... | the_stack_v2_python_sparse | monai/handlers/validation_handler.py | Project-MONAI/MONAI | train | 4,805 |
0631eea7b21ec222ed5ccb4b2d934943d08c4f30 | [
"super().__init__(im_ids=im_ids, in_dir=in_dir, transforms=transforms, preprocessing=preprocessing)\nself.num_pseudo_slices = num_pseudo_slices\nassert num_pseudo_slices % 2 == 1, '`num_pseudo_slices` must be odd. i.e. 7 -> 3 above and 3 below'",
"case_fpath, center_slice_idx_str = self.split_case_slice_idx_str(c... | <|body_start_0|>
super().__init__(im_ids=im_ids, in_dir=in_dir, transforms=transforms, preprocessing=preprocessing)
self.num_pseudo_slices = num_pseudo_slices
assert num_pseudo_slices % 2 == 1, '`num_pseudo_slices` must be odd. i.e. 7 -> 3 above and 3 below'
<|end_body_0|>
<|body_start_1|>
... | Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney + tumor) Stage 1: Sampled each class with p=0.33 Stage 2: Samples only K and KT (p=0.5... | PseudoSliceDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PseudoSliceDataset:
"""Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney + tumor) Stage 1: Sampled each class wit... | stack_v2_sparse_classes_10k_train_001322 | 6,324 | permissive | [
{
"docstring": "Attributes im_ids (np.ndarray): of image names. in_dir (str): path to where all of the cases and slices are located transforms (albumentations.augmentation): transforms to apply before preprocessing. Defaults to HFlip and ToTensor preprocessing: ops to perform after transforms, such as z-score s... | 2 | stack_v2_sparse_classes_30k_train_005565 | Implement the Python class `PseudoSliceDataset` described below.
Class description:
Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney +... | Implement the Python class `PseudoSliceDataset` described below.
Class description:
Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney +... | 81d7413022220ea86a23212737b3682e84ae74a4 | <|skeleton|>
class PseudoSliceDataset:
"""Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney + tumor) Stage 1: Sampled each class wit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PseudoSliceDataset:
"""Reads from a directory of 2D slice numpy arrays and samples positive slices. Assumes the data directory contains 2D slices processed by `io.Preprocessor.save_dir_as_2d()`. Generates 2.5D outputs B (background), K (kidney), KT (kidney + tumor) Stage 1: Sampled each class with p=0.33 Stag... | the_stack_v2_python_sparse | kits19cnn/io/dataset.py | jchen42703/kits19-2d-reproduce | train | 9 |
0670e3c6c8cf4576effc01a6d76e614c73b7bf12 | [
"self.set = set()\nself.list = []\nself.label = True",
"if val not in self.set:\n self.set.add(val)\n self.list.append(val)\n return True\nelse:\n return False",
"if val in self.set:\n self.set.remove(val)\n self.label = False\n return True\nelse:\n return False",
"if self.label is Fal... | <|body_start_0|>
self.set = set()
self.list = []
self.label = True
<|end_body_0|>
<|body_start_1|>
if val not in self.set:
self.set.add(val)
self.list.append(val)
return True
else:
return False
<|end_body_1|>
<|body_start_2|>
... | RandomizedSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_001323 | 1,619 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool",
"name": "insert",
"signature": ... | 4 | null | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | 0c4c38849309124121b03cc0b4bf39071b5d1c8c | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
self.set = set()
self.list = []
self.label = True
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: i... | the_stack_v2_python_sparse | 380.py | zhangchizju2012/LeetCode | train | 7 | |
24906ed6aa5b0f57be95b64f1c61cde5804d26b9 | [
"super().__init__(**kwargs)\nfor td in ['pad', 'h_pad', 'w_pad', 'rect']:\n self._params[td] = None\nself.set(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)",
"info = self._params\nrenderer = fig._get_renderer()\nwith getattr(renderer, '_draw_disabled', nullcontext)():\n kwargs = get_tight_layout_figure(fig,... | <|body_start_0|>
super().__init__(**kwargs)
for td in ['pad', 'h_pad', 'w_pad', 'rect']:
self._params[td] = None
self.set(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
<|end_body_0|>
<|body_start_1|>
info = self._params
renderer = fig._get_renderer()
with get... | Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details. | TightLayoutEngine | [
"CC0-1.0",
"BSD-3-Clause",
"MIT",
"Bitstream-Charter",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-bakoma-fonts-1995",
"LicenseRef-scancode-unknown-license-reference",
"OFL-1.1",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TightLayoutEngine:
"""Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details."""
def __init__(self, *, pad=1.08, h_pad=None, w_pad=None, rect=(0, 0, 1, 1), **kwargs):
"""Initialize tight_layout engine. Parameters -------... | stack_v2_sparse_classes_10k_train_001324 | 11,335 | permissive | [
{
"docstring": "Initialize tight_layout engine. Parameters ---------- pad : float, default: 1.08 Padding between the figure edge and the edges of subplots, as a fraction of the font size. h_pad, w_pad : float Padding (height/width) between edges of adjacent subplots. Defaults to *pad*. rect : tuple (left, botto... | 3 | stack_v2_sparse_classes_30k_train_005826 | Implement the Python class `TightLayoutEngine` described below.
Class description:
Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details.
Method signatures and docstrings:
- def __init__(self, *, pad=1.08, h_pad=None, w_pad=None, rect=(0, 0, 1, 1), **kw... | Implement the Python class `TightLayoutEngine` described below.
Class description:
Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details.
Method signatures and docstrings:
- def __init__(self, *, pad=1.08, h_pad=None, w_pad=None, rect=(0, 0, 1, 1), **kw... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class TightLayoutEngine:
"""Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details."""
def __init__(self, *, pad=1.08, h_pad=None, w_pad=None, rect=(0, 0, 1, 1), **kwargs):
"""Initialize tight_layout engine. Parameters -------... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TightLayoutEngine:
"""Implements the ``tight_layout`` geometry management. See :doc:`/tutorials/intermediate/tight_layout_guide` for details."""
def __init__(self, *, pad=1.08, h_pad=None, w_pad=None, rect=(0, 0, 1, 1), **kwargs):
"""Initialize tight_layout engine. Parameters ---------- pad : flo... | the_stack_v2_python_sparse | contrib/python/matplotlib/py3/matplotlib/layout_engine.py | catboost/catboost | train | 8,012 |
817f8c4a36a79b254fc6e92bfa08df0426a5bd93 | [
"self.depth = depth\nself.qubits = qubits\nself.quantum_program = QuantumProgram()\nself.quantum_register = self.quantum_program.create_quantum_register('qr', qubits)\nself.classical_register = self.quantum_program.create_classical_register('cr', qubits)\nif seed is not None:\n random.seed(a=seed)",
"circuit_n... | <|body_start_0|>
self.depth = depth
self.qubits = qubits
self.quantum_program = QuantumProgram()
self.quantum_register = self.quantum_program.create_quantum_register('qr', qubits)
self.classical_register = self.quantum_program.create_classical_register('cr', qubits)
if se... | Generate circuits with random operations for profiling. | RandomQasmGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomQasmGenerator:
"""Generate circuits with random operations for profiling."""
def __init__(self, seed=None, qubits=16, depth=40):
"""Args: seed: Random number seed. If none, don't seed the generator. depth: Number of operations in the circuit. qubits: Number of qubits in the cir... | stack_v2_sparse_classes_10k_train_001325 | 4,544 | permissive | [
{
"docstring": "Args: seed: Random number seed. If none, don't seed the generator. depth: Number of operations in the circuit. qubits: Number of qubits in the circuit.",
"name": "__init__",
"signature": "def __init__(self, seed=None, qubits=16, depth=40)"
},
{
"docstring": "Creates a circuit Gen... | 2 | stack_v2_sparse_classes_30k_train_005368 | Implement the Python class `RandomQasmGenerator` described below.
Class description:
Generate circuits with random operations for profiling.
Method signatures and docstrings:
- def __init__(self, seed=None, qubits=16, depth=40): Args: seed: Random number seed. If none, don't seed the generator. depth: Number of opera... | Implement the Python class `RandomQasmGenerator` described below.
Class description:
Generate circuits with random operations for profiling.
Method signatures and docstrings:
- def __init__(self, seed=None, qubits=16, depth=40): Args: seed: Random number seed. If none, don't seed the generator. depth: Number of opera... | e0f8d9fd61322623fe59a11b4d03cbd3f54d9015 | <|skeleton|>
class RandomQasmGenerator:
"""Generate circuits with random operations for profiling."""
def __init__(self, seed=None, qubits=16, depth=40):
"""Args: seed: Random number seed. If none, don't seed the generator. depth: Number of operations in the circuit. qubits: Number of qubits in the cir... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomQasmGenerator:
"""Generate circuits with random operations for profiling."""
def __init__(self, seed=None, qubits=16, depth=40):
"""Args: seed: Random number seed. If none, don't seed the generator. depth: Number of operations in the circuit. qubits: Number of qubits in the circuit."""
... | the_stack_v2_python_sparse | tools/random_qasm_generator.py | sulavtimilsina/qiskit-terra | train | 1 |
fd94796047c557b42d455180121d18b4c96ee72f | [
"ind = int(self.value) - 1\ncontent = self.context['content']\nsize = self.kwargs.get('size', False)\ncss_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', ''))\nimages = content.get_pictures()\nimage = images[ind] if 0 <= ind <= images.count() else None\nreturn {'image': image... | <|body_start_0|>
ind = int(self.value) - 1
content = self.context['content']
size = self.kwargs.get('size', False)
css_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', ''))
images = content.get_pictures()
image = images[ind] if 0 <= ... | Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}} | ContentPictureInline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContentPictureInline:
"""Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
<|body_0|>
def get_templat... | stack_v2_sparse_classes_10k_train_001326 | 6,816 | no_license | [
{
"docstring": "Renvoyer le contexte de rendu de l'inline",
"name": "get_context",
"signature": "def get_context(self)"
},
{
"docstring": "Renvoyer le chemin du template",
"name": "get_template_name",
"signature": "def get_template_name(self)"
}
] | 2 | null | Implement the Python class `ContentPictureInline` described below.
Class description:
Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}}
Method signatures and docstrings:
- def get_context(self): Renvoyer le contexte de ren... | Implement the Python class `ContentPictureInline` described below.
Class description:
Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}}
Method signatures and docstrings:
- def get_context(self): Renvoyer le contexte de ren... | 8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7 | <|skeleton|>
class ContentPictureInline:
"""Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
<|body_0|>
def get_templat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ContentPictureInline:
"""Inline d'insertion d'images liées aux contenus Format : {{content_image index [css_class=name]}} Exemple : {{content_image 1 css_class="class1"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
ind = int(self.value) - 1
content = ... | the_stack_v2_python_sparse | scoop/content/util/inlines.py | artscoop/scoop | train | 0 |
9a6a4715c618d8ca04ed8790b77e3ca623c601de | [
"self.cause_var = cause_var\nself.effect_var = effect_var\nself.cause_states = cause_states\nself.effect_states = effect_states\nself.cause_cprob = cause_cprob\nself.effect_cprob = effect_cprob\nself.grid = grid",
"g = self.grid\nquery_nodes = []\nfor vname in disc_bn.V:\n query_name = \"'\" + self.effect_var ... | <|body_start_0|>
self.cause_var = cause_var
self.effect_var = effect_var
self.cause_states = cause_states
self.effect_states = effect_states
self.cause_cprob = cause_cprob
self.effect_cprob = effect_cprob
self.grid = grid
<|end_body_0|>
<|body_start_1|>
g... | This type or rule creates a grid and group by the center of the cell. | GridRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GridRule:
"""This type or rule creates a grid and group by the center of the cell."""
def __init__(self, cause_var, effect_var, cause_states, effect_states, cause_cprob, effect_cprob, grid):
"""Construct. :param cause_var: cause variable or parent (str) :param effect_var: effect vari... | stack_v2_sparse_classes_10k_train_001327 | 3,558 | no_license | [
{
"docstring": "Construct. :param cause_var: cause variable or parent (str) :param effect_var: effect variable (str) ----> TRIGGER. :param cause_states: possible states of the cause variable (str[]) :param effect_states: possible states of the effect variable (str[]) :param cause_cprob: Conditional Probability ... | 2 | stack_v2_sparse_classes_30k_train_000688 | Implement the Python class `GridRule` described below.
Class description:
This type or rule creates a grid and group by the center of the cell.
Method signatures and docstrings:
- def __init__(self, cause_var, effect_var, cause_states, effect_states, cause_cprob, effect_cprob, grid): Construct. :param cause_var: caus... | Implement the Python class `GridRule` described below.
Class description:
This type or rule creates a grid and group by the center of the cell.
Method signatures and docstrings:
- def __init__(self, cause_var, effect_var, cause_states, effect_states, cause_cprob, effect_cprob, grid): Construct. :param cause_var: caus... | 961a7102f0be273bb962eba211a7144535753c2d | <|skeleton|>
class GridRule:
"""This type or rule creates a grid and group by the center of the cell."""
def __init__(self, cause_var, effect_var, cause_states, effect_states, cause_cprob, effect_cprob, grid):
"""Construct. :param cause_var: cause variable or parent (str) :param effect_var: effect vari... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GridRule:
"""This type or rule creates a grid and group by the center of the cell."""
def __init__(self, cause_var, effect_var, cause_states, effect_states, cause_cprob, effect_cprob, grid):
"""Construct. :param cause_var: cause variable or parent (str) :param effect_var: effect variable (str) --... | the_stack_v2_python_sparse | inference-engine/infengine/rules/GridRule.py | verlab/perceptive-turtles | train | 0 |
d6e87e3492b54bc69fb90139bcd9415c3e2a094c | [
"ring = self.coordinate_ring()\nargs = ring.arguments()\nrepr_x = self.change_ring(SR)._repr_()\nif len(args) == 1:\n return '%s |--> %s' % (args[0], repr_x)\nelse:\n args = ', '.join(map(str, args))\n return '(%s) |--> %s' % (args, repr_x)",
"from sage.misc.latex import latex\nring = self.coordinate_rin... | <|body_start_0|>
ring = self.coordinate_ring()
args = ring.arguments()
repr_x = self.change_ring(SR)._repr_()
if len(args) == 1:
return '%s |--> %s' % (args[0], repr_x)
else:
args = ', '.join(map(str, args))
return '(%s) |--> %s' % (args, repr_... | Vector_callable_symbolic_dense | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
<|body_0|>
def... | stack_v2_sparse_classes_10k_train_001328 | 3,334 | no_license | [
{
"docstring": "Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))",
"name": "_repr_",
"signature": "def _repr_(self)"
},
{
"docstring": "Retu... | 2 | stack_v2_sparse_classes_30k_train_004751 | Implement the Python class `Vector_callable_symbolic_dense` described below.
Class description:
Implement the Vector_callable_symbolic_dense class.
Method signatures and docstrings:
- def _repr_(self): Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |-->... | Implement the Python class `Vector_callable_symbolic_dense` described below.
Class description:
Implement the Vector_callable_symbolic_dense class.
Method signatures and docstrings:
- def _repr_(self): Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |-->... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
<|body_0|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
ring = self.coordinate_ring()
... | the_stack_v2_python_sparse | sage/src/sage/modules/vector_callable_symbolic_dense.py | bopopescu/geosci | train | 0 | |
eb441bded980d8d5b60ad1eb9aae1c1da830aa92 | [
"self.adder = Adder()\nself.subtracter = Subtracter()\nself.multiplier = Multiplier()\nself.divider = Divider()\nself.calculator = Calculator(self.adder, self.subtracter, self.multiplier, self.divider)",
"self.calculator.enter_number(0)\nwith self.assertRaises(InsufficientOperands):\n self.calculator.add()",
... | <|body_start_0|>
self.adder = Adder()
self.subtracter = Subtracter()
self.multiplier = Multiplier()
self.divider = Divider()
self.calculator = Calculator(self.adder, self.subtracter, self.multiplier, self.divider)
<|end_body_0|>
<|body_start_1|>
self.calculator.enter_num... | Contain tests for Calculator class. | CalculatorTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalculatorTests:
"""Contain tests for Calculator class."""
def setUp(self):
"""Initialize calculator with new operator objects."""
<|body_0|>
def test_insufficient_operands(self):
"""Test Insufficient Operands exception."""
<|body_1|>
def test_adder_... | stack_v2_sparse_classes_10k_train_001329 | 2,991 | no_license | [
{
"docstring": "Initialize calculator with new operator objects.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test Insufficient Operands exception.",
"name": "test_insufficient_operands",
"signature": "def test_insufficient_operands(self)"
},
{
"docstring"... | 4 | stack_v2_sparse_classes_30k_train_006799 | Implement the Python class `CalculatorTests` described below.
Class description:
Contain tests for Calculator class.
Method signatures and docstrings:
- def setUp(self): Initialize calculator with new operator objects.
- def test_insufficient_operands(self): Test Insufficient Operands exception.
- def test_adder_call... | Implement the Python class `CalculatorTests` described below.
Class description:
Contain tests for Calculator class.
Method signatures and docstrings:
- def setUp(self): Initialize calculator with new operator objects.
- def test_insufficient_operands(self): Test Insufficient Operands exception.
- def test_adder_call... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class CalculatorTests:
"""Contain tests for Calculator class."""
def setUp(self):
"""Initialize calculator with new operator objects."""
<|body_0|>
def test_insufficient_operands(self):
"""Test Insufficient Operands exception."""
<|body_1|>
def test_adder_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CalculatorTests:
"""Contain tests for Calculator class."""
def setUp(self):
"""Initialize calculator with new operator objects."""
self.adder = Adder()
self.subtracter = Subtracter()
self.multiplier = Multiplier()
self.divider = Divider()
self.calculator = ... | the_stack_v2_python_sparse | students/alexander_boone/lesson01/activity/test_unit.py | JavaRod/SP_Python220B_2019 | train | 1 |
b19bb67b87de2b83dfe6e9335cd70e8539429dab | [
"ctx.save_for_backward(input)\nz = torch.rand_like(input, requires_grad=False)\np = (torch.clamp(input, -1, 1) + 1) / 2\nreturn -1.0 + 2.0 * (z < p).float()",
"input, = ctx.saved_tensors\ngrad_input = grad_output.clone()\ngrad_input[torch.abs(input) > 1.001] = 0\nreturn grad_input"
] | <|body_start_0|>
ctx.save_for_backward(input)
z = torch.rand_like(input, requires_grad=False)
p = (torch.clamp(input, -1, 1) + 1) / 2
return -1.0 + 2.0 * (z < p).float()
<|end_body_0|>
<|body_start_1|>
input, = ctx.saved_tensors
grad_input = grad_output.clone()
g... | Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}` | BinaryConnectStochastic | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryConnectStochastic:
"""Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`"""
def forward(ctx, input):
"""Apply stochastic binarization on input tensor."""
<|body_0|>
def b... | stack_v2_sparse_classes_10k_train_001330 | 7,014 | permissive | [
{
"docstring": "Apply stochastic binarization on input tensor.",
"name": "forward",
"signature": "def forward(ctx, input)"
},
{
"docstring": "Compute the back propagation of the binarization op.",
"name": "backward",
"signature": "def backward(ctx, grad_output)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006175 | Implement the Python class `BinaryConnectStochastic` described below.
Class description:
Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`
Method signatures and docstrings:
- def forward(ctx, input): Apply stochastic binar... | Implement the Python class `BinaryConnectStochastic` described below.
Class description:
Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`
Method signatures and docstrings:
- def forward(ctx, input): Apply stochastic binar... | 990e970b1fbd299ff88200db21a9cc3fe44706d3 | <|skeleton|>
class BinaryConnectStochastic:
"""Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`"""
def forward(ctx, input):
"""Apply stochastic binarization on input tensor."""
<|body_0|>
def b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BinaryConnectStochastic:
"""Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`"""
def forward(ctx, input):
"""Apply stochastic binarization on input tensor."""
ctx.save_for_backward(input)
... | the_stack_v2_python_sparse | QuantTorch/functions/binary_connect.py | AamirRaihan/Pytorch_Quantize_impls | train | 0 |
57efe61e025fff8b6a5e5d4cba5b634ad9c5dc1b | [
"reg_type = self.request.POST['registration_type']\nuser = self.request.user\nif reg_type == 'registration':\n message = self.register_user(user)\nelif reg_type == 'deregistration':\n message = self.deregister_user(user)\nelse:\n message = 'Her skjedde det noe galt.'\nself.messages.info(message)\nreturn Ht... | <|body_start_0|>
reg_type = self.request.POST['registration_type']
user = self.request.user
if reg_type == 'registration':
message = self.register_user(user)
elif reg_type == 'deregistration':
message = self.deregister_user(user)
else:
message ... | View for at en bruker skal kunne melde seg av og på. | RegisterUserView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
<|body_0|>
def register_user(self, user):
"""Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment ... | stack_v2_sparse_classes_10k_train_001331 | 24,750 | permissive | [
{
"docstring": "Handle http post request",
"name": "post",
"signature": "def post(self, *args, **kwargs)"
},
{
"docstring": "Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment for brukeren.",
"name": "register_user",
"signature": "def register_user(self, user)"
... | 3 | stack_v2_sparse_classes_30k_train_003011 | Implement the Python class `RegisterUserView` described below.
Class description:
View for at en bruker skal kunne melde seg av og på.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Handle http post request
- def register_user(self, user): Prøver å melde en bruker på arrangementet. Returnerer en... | Implement the Python class `RegisterUserView` described below.
Class description:
View for at en bruker skal kunne melde seg av og på.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Handle http post request
- def register_user(self, user): Prøver å melde en bruker på arrangementet. Returnerer en... | 5661cbea1011f8851a244ae3d72351fce647123f | <|skeleton|>
class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
<|body_0|>
def register_user(self, user):
"""Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
reg_type = self.request.POST['registration_type']
user = self.request.user
if reg_type == 'registration':
message = self... | the_stack_v2_python_sparse | nablapps/events/views.py | Nabla-NTNU/nablaweb | train | 21 |
0448bb395c42a0d4bdfe8142c0f139af1b8d74df | [
"lst = []\nfor i in A:\n if i not in lst:\n lst.append(i)\n else:\n lst.remove(i)\nreturn lst[0]",
"ret = 0\nfor i in A:\n ret ^= i\nreturn ret"
] | <|body_start_0|>
lst = []
for i in A:
if i not in lst:
lst.append(i)
else:
lst.remove(i)
return lst[0]
<|end_body_0|>
<|body_start_1|>
ret = 0
for i in A:
ret ^= i
return ret
<|end_body_1|>
| @param: A: An integer array @return: An integer | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""@param: A: An integer array @return: An integer"""
def singleNumber_1(self, A):
"""第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数"""
<|body_0|>
def singleNumber(self, A):
"""异或"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
lst = []
for i i... | stack_v2_sparse_classes_10k_train_001332 | 859 | no_license | [
{
"docstring": "第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数",
"name": "singleNumber_1",
"signature": "def singleNumber_1(self, A)"
},
{
"docstring": "异或",
"name": "singleNumber",
"signature": "def singleNumber(self, A)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006394 | Implement the Python class `Solution` described below.
Class description:
@param: A: An integer array @return: An integer
Method signatures and docstrings:
- def singleNumber_1(self, A): 第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数
- def singleNumber(self, A): 异或 | Implement the Python class `Solution` described below.
Class description:
@param: A: An integer array @return: An integer
Method signatures and docstrings:
- def singleNumber_1(self, A): 第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数
- def singleNumber(self, A): 异或
<|skeleton|>
class Solution:
"""@param: A: An integer array @ret... | 87592a39d67d8e734e693327d6b063be334b37e2 | <|skeleton|>
class Solution:
"""@param: A: An integer array @return: An integer"""
def singleNumber_1(self, A):
"""第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数"""
<|body_0|>
def singleNumber(self, A):
"""异或"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""@param: A: An integer array @return: An integer"""
def singleNumber_1(self, A):
"""第1次出现加入列表,第2次出现从列表删除,剩余的为落单的数"""
lst = []
for i in A:
if i not in lst:
lst.append(i)
else:
lst.remove(i)
return lst[0]
... | the_stack_v2_python_sparse | LintCode/LintCode-82:落单的数.py | hoshizorahikari/PythonExercise | train | 0 |
58c365a77cb3a8fbf63ed0bf940313624d084707 | [
"super(Domain, self).__init__(xh)\nself.dg = 0.5 * self.dxh\nreturn",
"self.p = order\nq = polys.Legendre()\nself.zp = q.zeros[order]\nself.wp = q.weights[order]\nb = polys.Lagrange()\nb.interpolate(self.zp, np.ones(self.p))\nself.Lm1 = np.zeros(self.nh * self.p)\nself.Lp1 = np.zeros(self.nh * self.p)\nself.xp = ... | <|body_start_0|>
super(Domain, self).__init__(xh)
self.dg = 0.5 * self.dxh
return
<|end_body_0|>
<|body_start_1|>
self.p = order
q = polys.Legendre()
self.zp = q.zeros[order]
self.wp = q.weights[order]
b = polys.Lagrange()
b.interpolate(self.zp, n... | Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix | Domain | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Domain:
"""Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix"""
def __init__(self, xh):
"""initialise Domain with cell vertices and sizes"""... | stack_v2_sparse_classes_10k_train_001333 | 4,877 | no_license | [
{
"docstring": "initialise Domain with cell vertices and sizes",
"name": "__init__",
"signature": "def __init__(self, xh)"
},
{
"docstring": "set the expansion basis type and order, and the quadrature point type calculate the physical nodal points, cell jacobians and cell boundary extrapolation ... | 2 | stack_v2_sparse_classes_30k_val_000029 | Implement the Python class `Domain` described below.
Class description:
Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix
Method signatures and docstrings:
- def __init__(sel... | Implement the Python class `Domain` described below.
Class description:
Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix
Method signatures and docstrings:
- def __init__(sel... | 35ccd15fce4df144446b84319cf467562a69a44b | <|skeleton|>
class Domain:
"""Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix"""
def __init__(self, xh):
"""initialise Domain with cell vertices and sizes"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Domain:
"""Domain for a discontinuous galerkin field has attributes for cell vertex and nodal points, quadrature points and weights, cell boundary extrapolation vectors and cell jacobians, and mass matrix"""
def __init__(self, xh):
"""initialise Domain with cell vertices and sizes"""
supe... | the_stack_v2_python_sparse | dg/fields.py | JHopeCollins/Sandbox | train | 0 |
8b65546e0921706d76ff03285aaf646194255e69 | [
"team = Team.get_or_404(id=team_id)\nquery = TeamService.followers(team=team)\npage = self.paginate_query(query)\ndata = self.render_page_info(page)\ndata['followers'] = []\nuids = set()\n\ndef merge_followers(ids, parteam_users):\n for uid in ids:\n user = parteam_users[uid]\n data.setdefault('fol... | <|body_start_0|>
team = Team.get_or_404(id=team_id)
query = TeamService.followers(team=team)
page = self.paginate_query(query)
data = self.render_page_info(page)
data['followers'] = []
uids = set()
def merge_followers(ids, parteam_users):
for uid in i... | 用户关注和取消关注俱乐部 | FollowTeamHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FollowTeamHandler:
"""用户关注和取消关注俱乐部"""
def get(self, team_id: int):
"""俱乐部粉丝列表"""
<|body_0|>
def post(self, team_id: int):
"""关注俱乐部 :param team_id: :return:"""
<|body_1|>
def delete(self, team_id: int):
"""取消关注 :param team_id: :return:"""
... | stack_v2_sparse_classes_10k_train_001334 | 13,604 | no_license | [
{
"docstring": "俱乐部粉丝列表",
"name": "get",
"signature": "def get(self, team_id: int)"
},
{
"docstring": "关注俱乐部 :param team_id: :return:",
"name": "post",
"signature": "def post(self, team_id: int)"
},
{
"docstring": "取消关注 :param team_id: :return:",
"name": "delete",
"signat... | 3 | stack_v2_sparse_classes_30k_train_002894 | Implement the Python class `FollowTeamHandler` described below.
Class description:
用户关注和取消关注俱乐部
Method signatures and docstrings:
- def get(self, team_id: int): 俱乐部粉丝列表
- def post(self, team_id: int): 关注俱乐部 :param team_id: :return:
- def delete(self, team_id: int): 取消关注 :param team_id: :return: | Implement the Python class `FollowTeamHandler` described below.
Class description:
用户关注和取消关注俱乐部
Method signatures and docstrings:
- def get(self, team_id: int): 俱乐部粉丝列表
- def post(self, team_id: int): 关注俱乐部 :param team_id: :return:
- def delete(self, team_id: int): 取消关注 :param team_id: :return:
<|skeleton|>
class Fo... | 49c31d9cce6ca451ff069697913b33fe55028a46 | <|skeleton|>
class FollowTeamHandler:
"""用户关注和取消关注俱乐部"""
def get(self, team_id: int):
"""俱乐部粉丝列表"""
<|body_0|>
def post(self, team_id: int):
"""关注俱乐部 :param team_id: :return:"""
<|body_1|>
def delete(self, team_id: int):
"""取消关注 :param team_id: :return:"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FollowTeamHandler:
"""用户关注和取消关注俱乐部"""
def get(self, team_id: int):
"""俱乐部粉丝列表"""
team = Team.get_or_404(id=team_id)
query = TeamService.followers(team=team)
page = self.paginate_query(query)
data = self.render_page_info(page)
data['followers'] = []
... | the_stack_v2_python_sparse | PaiDuiGuanJia/yiyun/handlers/rest/team.py | haoweiking/image_tesseract_private | train | 0 |
45f9a14b40a5267d1d89f337bfd4211fda452139 | [
"all_cpis = []\nall_modules = []\nall_submods = []\nfor sub_class in configurator.common.Configurator.__subclasses__():\n all_cpis.append((sub_class.module(sub_class), sub_class.submod(sub_class)))\n all_modules.append(sub_class.module(sub_class))\n all_submods.append(sub_class.submod(sub_class))\nself.get... | <|body_start_0|>
all_cpis = []
all_modules = []
all_submods = []
for sub_class in configurator.common.Configurator.__subclasses__():
all_cpis.append((sub_class.module(sub_class), sub_class.submod(sub_class)))
all_modules.append(sub_class.module(sub_class))
... | The configurator plugin | CPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CPI:
"""The configurator plugin"""
def __init__(self):
"""Initialize. :param: None :returns: None :raises: None"""
<|body_0|>
def get_configurators(cls, module=None, submod=None):
"""Get configurators of 'module'.'submod'. :param module(optional): %s :param submo... | stack_v2_sparse_classes_10k_train_001335 | 7,577 | no_license | [
{
"docstring": "Initialize. :param: None :returns: None :raises: None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get configurators of 'module'.'submod'. :param module(optional): %s :param submod(optional): %s :returns list: Success, all found configurators or null... | 3 | stack_v2_sparse_classes_30k_train_003849 | Implement the Python class `CPI` described below.
Class description:
The configurator plugin
Method signatures and docstrings:
- def __init__(self): Initialize. :param: None :returns: None :raises: None
- def get_configurators(cls, module=None, submod=None): Get configurators of 'module'.'submod'. :param module(optio... | Implement the Python class `CPI` described below.
Class description:
The configurator plugin
Method signatures and docstrings:
- def __init__(self): Initialize. :param: None :returns: None :raises: None
- def get_configurators(cls, module=None, submod=None): Get configurators of 'module'.'submod'. :param module(optio... | e4f257d00305849b9a52a033651da09412436785 | <|skeleton|>
class CPI:
"""The configurator plugin"""
def __init__(self):
"""Initialize. :param: None :returns: None :raises: None"""
<|body_0|>
def get_configurators(cls, module=None, submod=None):
"""Get configurators of 'module'.'submod'. :param module(optional): %s :param submo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CPI:
"""The configurator plugin"""
def __init__(self):
"""Initialize. :param: None :returns: None :raises: None"""
all_cpis = []
all_modules = []
all_submods = []
for sub_class in configurator.common.Configurator.__subclasses__():
all_cpis.append((sub_c... | the_stack_v2_python_sparse | analysis/plugin/plugin.py | hanxinke/A-Tune | train | 0 |
16735da1a755908f562d3d59cf5ed009f837f213 | [
"rqcz = int(rqcz)\ndqrq = get_strftime2()[:8]\nclwjm = (datetime.datetime.strptime(dqrq, '%Y%m%d') + datetime.timedelta(days=rqcz)).strftime(self.dxbm)\nresult = self.findfiles(wjml, clwjm)\nresult = pickle_dumps(result) if result else ''\nwith sjapi.connection() as db:\n csxx = {'id': get_uuid(), 'ssdxid': self... | <|body_start_0|>
rqcz = int(rqcz)
dqrq = get_strftime2()[:8]
clwjm = (datetime.datetime.strptime(dqrq, '%Y%m%d') + datetime.timedelta(days=rqcz)).strftime(self.dxbm)
result = self.findfiles(wjml, clwjm)
result = pickle_dumps(result) if result else ''
with sjapi.connection... | File | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class File:
def ind_filedir_exist(self, wjml, rqcz):
"""文件是否在指定目录存在"""
<|body_0|>
def ind_filedb_exist(self, zt, rqcz, ywlx):
"""文件是否在文件处理登记表中存在"""
<|body_1|>
def findfiles(self, dirname, pattern):
"""获取指定目录下的文件信息"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_10k_train_001336 | 16,132 | no_license | [
{
"docstring": "文件是否在指定目录存在",
"name": "ind_filedir_exist",
"signature": "def ind_filedir_exist(self, wjml, rqcz)"
},
{
"docstring": "文件是否在文件处理登记表中存在",
"name": "ind_filedb_exist",
"signature": "def ind_filedb_exist(self, zt, rqcz, ywlx)"
},
{
"docstring": "获取指定目录下的文件信息",
"name... | 3 | stack_v2_sparse_classes_30k_train_006902 | Implement the Python class `File` described below.
Class description:
Implement the File class.
Method signatures and docstrings:
- def ind_filedir_exist(self, wjml, rqcz): 文件是否在指定目录存在
- def ind_filedb_exist(self, zt, rqcz, ywlx): 文件是否在文件处理登记表中存在
- def findfiles(self, dirname, pattern): 获取指定目录下的文件信息 | Implement the Python class `File` described below.
Class description:
Implement the File class.
Method signatures and docstrings:
- def ind_filedir_exist(self, wjml, rqcz): 文件是否在指定目录存在
- def ind_filedb_exist(self, zt, rqcz, ywlx): 文件是否在文件处理登记表中存在
- def findfiles(self, dirname, pattern): 获取指定目录下的文件信息
<|skeleton|>
cla... | 68ddf3df6d2cd731e6634b09d27aff4c22debd8e | <|skeleton|>
class File:
def ind_filedir_exist(self, wjml, rqcz):
"""文件是否在指定目录存在"""
<|body_0|>
def ind_filedb_exist(self, zt, rqcz, ywlx):
"""文件是否在文件处理登记表中存在"""
<|body_1|>
def findfiles(self, dirname, pattern):
"""获取指定目录下的文件信息"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class File:
def ind_filedir_exist(self, wjml, rqcz):
"""文件是否在指定目录存在"""
rqcz = int(rqcz)
dqrq = get_strftime2()[:8]
clwjm = (datetime.datetime.strptime(dqrq, '%Y%m%d') + datetime.timedelta(days=rqcz)).strftime(self.dxbm)
result = self.findfiles(wjml, clwjm)
result = pi... | the_stack_v2_python_sparse | zh_manage/apps/_init/oa/yw_jkgl/yw_jkgl_001/yw_jkgl_001.py | yizhong120110/CPOS | train | 0 | |
99fd14e433ce72ec855a699c8327fc057f812260 | [
"super().__init__()\nself.resizable(width=False, height=False)\nself.geometry()\nself.title('Zip File Maker')\nself.treeview_frame = ttk.Frame(self)\nself.button_row_frame = ttk.Frame(self)\nself.files_treeview = ttk.Treeview(self.treeview_frame, columns=('path',), selectmode='browse', show='tree')\nself.files_tree... | <|body_start_0|>
super().__init__()
self.resizable(width=False, height=False)
self.geometry()
self.title('Zip File Maker')
self.treeview_frame = ttk.Frame(self)
self.button_row_frame = ttk.Frame(self)
self.files_treeview = ttk.Treeview(self.treeview_frame, columns... | The class for interacting with tkinter. | MainWindow | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainWindow:
"""The class for interacting with tkinter."""
def __init__(self):
"""Initialize main window."""
<|body_0|>
def add_files(self):
"""Ask user to give file path and save new file."""
<|body_1|>
def remove_file(self):
"""Remove curren... | stack_v2_sparse_classes_10k_train_001337 | 4,820 | permissive | [
{
"docstring": "Initialize main window.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Ask user to give file path and save new file.",
"name": "add_files",
"signature": "def add_files(self)"
},
{
"docstring": "Remove currently selected file.",
"nam... | 4 | stack_v2_sparse_classes_30k_train_000604 | Implement the Python class `MainWindow` described below.
Class description:
The class for interacting with tkinter.
Method signatures and docstrings:
- def __init__(self): Initialize main window.
- def add_files(self): Ask user to give file path and save new file.
- def remove_file(self): Remove currently selected fi... | Implement the Python class `MainWindow` described below.
Class description:
The class for interacting with tkinter.
Method signatures and docstrings:
- def __init__(self): Initialize main window.
- def add_files(self): Ask user to give file path and save new file.
- def remove_file(self): Remove currently selected fi... | 73b554d9796510fc86e5fc55016732aa866266c6 | <|skeleton|>
class MainWindow:
"""The class for interacting with tkinter."""
def __init__(self):
"""Initialize main window."""
<|body_0|>
def add_files(self):
"""Ask user to give file path and save new file."""
<|body_1|>
def remove_file(self):
"""Remove curren... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MainWindow:
"""The class for interacting with tkinter."""
def __init__(self):
"""Initialize main window."""
super().__init__()
self.resizable(width=False, height=False)
self.geometry()
self.title('Zip File Maker')
self.treeview_frame = ttk.Frame(self)
... | the_stack_v2_python_sparse | Files/Zip File Maker/zip_file_maker.pyw | fossabot/IdeaBag2-Solutions | train | 0 |
07f361369e2d9dd9a11ce9a1eda5577e116772e9 | [
"if not self._run_id:\n if self.config.pipelineRunId:\n self._run_id = str(self.config.pipelineRunId.__root__)\n else:\n self._run_id = str(uuid.uuid4())\nreturn self._run_id",
"if self.config.ingestionPipelineFQN:\n if state in (PipelineState.queued, PipelineState.running):\n pipeli... | <|body_start_0|>
if not self._run_id:
if self.config.pipelineRunId:
self._run_id = str(self.config.pipelineRunId.__root__)
else:
self._run_id = str(uuid.uuid4())
return self._run_id
<|end_body_0|>
<|body_start_1|>
if self.config.ingestionP... | Helper methods to manage IngestionPipeline status and workflow run ID | WorkflowStatusMixin | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkflowStatusMixin:
"""Helper methods to manage IngestionPipeline status and workflow run ID"""
def run_id(self) -> str:
"""If the config does not have an informed run id, we'll generate and assign one here."""
<|body_0|>
def set_ingestion_pipeline_status(self, state: P... | stack_v2_sparse_classes_10k_train_001338 | 3,278 | permissive | [
{
"docstring": "If the config does not have an informed run id, we'll generate and assign one here.",
"name": "run_id",
"signature": "def run_id(self) -> str"
},
{
"docstring": "Method to set the pipeline status of current ingestion pipeline",
"name": "set_ingestion_pipeline_status",
"si... | 3 | null | Implement the Python class `WorkflowStatusMixin` described below.
Class description:
Helper methods to manage IngestionPipeline status and workflow run ID
Method signatures and docstrings:
- def run_id(self) -> str: If the config does not have an informed run id, we'll generate and assign one here.
- def set_ingestio... | Implement the Python class `WorkflowStatusMixin` described below.
Class description:
Helper methods to manage IngestionPipeline status and workflow run ID
Method signatures and docstrings:
- def run_id(self) -> str: If the config does not have an informed run id, we'll generate and assign one here.
- def set_ingestio... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class WorkflowStatusMixin:
"""Helper methods to manage IngestionPipeline status and workflow run ID"""
def run_id(self) -> str:
"""If the config does not have an informed run id, we'll generate and assign one here."""
<|body_0|>
def set_ingestion_pipeline_status(self, state: P... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkflowStatusMixin:
"""Helper methods to manage IngestionPipeline status and workflow run ID"""
def run_id(self) -> str:
"""If the config does not have an informed run id, we'll generate and assign one here."""
if not self._run_id:
if self.config.pipelineRunId:
... | the_stack_v2_python_sparse | govern/data-meta/OpenMetadata/ingestion/src/metadata/workflow/workflow_status_mixin.py | alldatacenter/alldata | train | 774 |
eba84ad1fec5cd34417f7023701b7c94cd3b29a4 | [
"super().__init__()\nimport sklearn\nimport sklearn.neighbors\nself.model = sklearn.neighbors.KNeighborsRegressor",
"specs = super(KNeighborsRegressor, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{KNeighborsRegressor} is a type of instance-based learning or\\n non-gen... | <|body_start_0|>
super().__init__()
import sklearn
import sklearn.neighbors
self.model = sklearn.neighbors.KNeighborsRegressor
<|end_body_0|>
<|body_start_1|>
specs = super(KNeighborsRegressor, cls).getInputSpecification()
specs.description = 'The \\xmlNode{KNeighborsReg... | KNeighborsRegressor Regressor implementing the k-nearest neighbors vote. | KNeighborsRegressor | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KNeighborsRegressor:
"""KNeighborsRegressor Regressor implementing the k-nearest neighbors vote."""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
<|body_0|>
def getInputSpecification(cls):
... | stack_v2_sparse_classes_10k_train_001339 | 7,196 | permissive | [
{
"docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for... | 3 | null | Implement the Python class `KNeighborsRegressor` described below.
Class description:
KNeighborsRegressor Regressor implementing the k-nearest neighbors vote.
Method signatures and docstrings:
- def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None
- def... | Implement the Python class `KNeighborsRegressor` described below.
Class description:
KNeighborsRegressor Regressor implementing the k-nearest neighbors vote.
Method signatures and docstrings:
- def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None
- def... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class KNeighborsRegressor:
"""KNeighborsRegressor Regressor implementing the k-nearest neighbors vote."""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
<|body_0|>
def getInputSpecification(cls):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KNeighborsRegressor:
"""KNeighborsRegressor Regressor implementing the k-nearest neighbors vote."""
def __init__(self):
"""Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None"""
super().__init__()
import sklearn
import sklearn... | the_stack_v2_python_sparse | ravenframework/SupervisedLearning/ScikitLearn/Neighbors/KNeighborsRegressor.py | idaholab/raven | train | 201 |
232df1b07995329430a3df7898d5e762ea03eb3c | [
"try:\n state = self.add_model_schema.load(request.json)\n key = CreateExplorePermalinkCommand(state=state).run()\n http_origin = request.headers.environ.get('HTTP_ORIGIN')\n url = f'{http_origin}/superset/explore/p/{key}/'\n return self.response(201, key=key, url=url)\nexcept ValidationError as ex:\... | <|body_start_0|>
try:
state = self.add_model_schema.load(request.json)
key = CreateExplorePermalinkCommand(state=state).run()
http_origin = request.headers.environ.get('HTTP_ORIGIN')
url = f'{http_origin}/superset/explore/p/{key}/'
return self.response... | ExplorePermalinkRestApi | [
"Apache-2.0",
"OFL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExplorePermalinkRestApi:
def post(self) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ExplorePermalinkPostSchema' responses: 201: description: ... | stack_v2_sparse_classes_10k_train_001340 | 6,288 | permissive | [
{
"docstring": "Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ExplorePermalinkPostSchema' responses: 201: description: The permanent link was stored successfully. content: application... | 2 | null | Implement the Python class `ExplorePermalinkRestApi` described below.
Class description:
Implement the ExplorePermalinkRestApi class.
Method signatures and docstrings:
- def post(self) -> Response: Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content:... | Implement the Python class `ExplorePermalinkRestApi` described below.
Class description:
Implement the ExplorePermalinkRestApi class.
Method signatures and docstrings:
- def post(self) -> Response: Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content:... | 0945d4a2f46667aebb9b93d0d7685215627ad237 | <|skeleton|>
class ExplorePermalinkRestApi:
def post(self) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ExplorePermalinkPostSchema' responses: 201: description: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExplorePermalinkRestApi:
def post(self) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ExplorePermalinkPostSchema' responses: 201: description: The permanent ... | the_stack_v2_python_sparse | superset/explore/permalink/api.py | apache-superset/incubator-superset | train | 21 | |
e669bce7a6f60541978b3057826e3637ec22734b | [
"if message is not None:\n self.message = message\nif code is not None:\n self.code = code",
"if len(value) > 255:\n raise ValidationError(self.message, self.code)\nif value[-1] == '.':\n value = value[:-1]\nif not self.regex.match(value):\n raise ValidationError(self.message, self.code)"
] | <|body_start_0|>
if message is not None:
self.message = message
if code is not None:
self.code = code
<|end_body_0|>
<|body_start_1|>
if len(value) > 255:
raise ValidationError(self.message, self.code)
if value[-1] == '.':
value = value[:-... | Validator for fqdn. | HostnameValidator | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostnameValidator:
"""Validator for fqdn."""
def __init__(self, message=None, code=None):
"""Constructor."""
<|body_0|>
def __call__(self, value):
"""Check value."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if message is not None:
... | stack_v2_sparse_classes_10k_train_001341 | 1,896 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, message=None, code=None)"
},
{
"docstring": "Check value.",
"name": "__call__",
"signature": "def __call__(self, value)"
}
] | 2 | null | Implement the Python class `HostnameValidator` described below.
Class description:
Validator for fqdn.
Method signatures and docstrings:
- def __init__(self, message=None, code=None): Constructor.
- def __call__(self, value): Check value. | Implement the Python class `HostnameValidator` described below.
Class description:
Validator for fqdn.
Method signatures and docstrings:
- def __init__(self, message=None, code=None): Constructor.
- def __call__(self, value): Check value.
<|skeleton|>
class HostnameValidator:
"""Validator for fqdn."""
def _... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class HostnameValidator:
"""Validator for fqdn."""
def __init__(self, message=None, code=None):
"""Constructor."""
<|body_0|>
def __call__(self, value):
"""Check value."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HostnameValidator:
"""Validator for fqdn."""
def __init__(self, message=None, code=None):
"""Constructor."""
if message is not None:
self.message = message
if code is not None:
self.code = code
def __call__(self, value):
"""Check value."""
... | the_stack_v2_python_sparse | modoboa/lib/validators.py | modoboa/modoboa | train | 2,201 |
3df4e1858e26fe7e014b54b644efe469609bcf35 | [
"result = {}\nup_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id))\nbus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id))\nif up_off_station and bus_station_list:\n result['up_off_station'] = up_off_station\n result['bus_station_list'] = bus... | <|body_start_0|>
result = {}
up_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id))
bus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id))
if up_off_station and bus_station_list:
result['up_off_station'] = up_o... | BusStationService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BusStationService:
def get_bus_station(self, login_user_id):
"""获取校车列表"""
<|body_0|>
def update_bus_station(self, login_user_id, info):
"""修改上下车站点 :param login_user_id: :param info: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {... | stack_v2_sparse_classes_10k_train_001342 | 2,478 | no_license | [
{
"docstring": "获取校车列表",
"name": "get_bus_station",
"signature": "def get_bus_station(self, login_user_id)"
},
{
"docstring": "修改上下车站点 :param login_user_id: :param info: :return:",
"name": "update_bus_station",
"signature": "def update_bus_station(self, login_user_id, info)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006103 | Implement the Python class `BusStationService` described below.
Class description:
Implement the BusStationService class.
Method signatures and docstrings:
- def get_bus_station(self, login_user_id): 获取校车列表
- def update_bus_station(self, login_user_id, info): 修改上下车站点 :param login_user_id: :param info: :return: | Implement the Python class `BusStationService` described below.
Class description:
Implement the BusStationService class.
Method signatures and docstrings:
- def get_bus_station(self, login_user_id): 获取校车列表
- def update_bus_station(self, login_user_id, info): 修改上下车站点 :param login_user_id: :param info: :return:
<|ske... | a7cf5a0b6daa372ed860dc43d92c55fcde764eb9 | <|skeleton|>
class BusStationService:
def get_bus_station(self, login_user_id):
"""获取校车列表"""
<|body_0|>
def update_bus_station(self, login_user_id, info):
"""修改上下车站点 :param login_user_id: :param info: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BusStationService:
def get_bus_station(self, login_user_id):
"""获取校车列表"""
result = {}
up_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id))
bus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id))
if up_of... | the_stack_v2_python_sparse | python_project/smart_schoolBus_project/app/schoolbus_situation/services/bus_station_service.py | malqch/aibus | train | 0 | |
d52dda6e9972a945db4028d5bac7f7d27b1ffdc0 | [
"idxDict = dict()\nfor idx, num in enumerate(nums):\n if target - num in idxDict:\n return [idxDict[target - num], idx]\n idxDict[num] = idx",
"_nums = []\nfor i in xrange(len(nums)):\n _nums.append((i, nums[i]))\n_nums = sorted(_nums, key=lambda num: num[1])\ni, j = (0, len(_nums) - 1)\nwhile i <... | <|body_start_0|>
idxDict = dict()
for idx, num in enumerate(nums):
if target - num in idxDict:
return [idxDict[target - num], idx]
idxDict[num] = idx
<|end_body_0|>
<|body_start_1|>
_nums = []
for i in xrange(len(nums)):
_nums.append((... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 先排... | stack_v2_sparse_classes_10k_train_001343 | 1,382 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 先排序再用夹逼法进行查找",
"name"... | 2 | stack_v2_sparse_classes_30k_train_005243 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)
- def twoSum2(self, nums, target):... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)
- def twoSum2(self, nums, target):... | 9687f8e743a8b6396fff192f22b5256d1025f86b | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 先排... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
idxDict = dict()
for idx, num in enumerate(nums):
if target - num in idxDict:
return [idxDict[targ... | the_stack_v2_python_sparse | 2017/hashtab/Two_Sum.py | buhuipao/LeetCode | train | 5 | |
9993e677e99b989c73404e03cd185f57ae8352b8 | [
"r = self.param\nsid = ''\nresult = rq_getScreenList(r, PageSize='100')\nfor li in result['data']['ScreenList']:\n if li['ScreenName'] == getConf('constant', 'led_name'):\n sid = li['Sid']\nif not sid:\n raise Exception('screen not exits')\n unittest.main(failfast=True)\nsetConf('data', 'sid', sid)\... | <|body_start_0|>
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100')
for li in result['data']['ScreenList']:
if li['ScreenName'] == getConf('constant', 'led_name'):
sid = li['Sid']
if not sid:
raise Exception('screen not ex... | Test_getConstant | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
<|body_0|>
def test_b(self):
"""make username and password for ftp"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100'... | stack_v2_sparse_classes_10k_train_001344 | 1,550 | no_license | [
{
"docstring": "获取并保存sid",
"name": "test_a",
"signature": "def test_a(self)"
},
{
"docstring": "make username and password for ftp",
"name": "test_b",
"signature": "def test_b(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003358 | Implement the Python class `Test_getConstant` described below.
Class description:
Implement the Test_getConstant class.
Method signatures and docstrings:
- def test_a(self): 获取并保存sid
- def test_b(self): make username and password for ftp | Implement the Python class `Test_getConstant` described below.
Class description:
Implement the Test_getConstant class.
Method signatures and docstrings:
- def test_a(self): 获取并保存sid
- def test_b(self): make username and password for ftp
<|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid... | 04369bc5ef3a2400a4b468a51b54259bd6afb878 | <|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
<|body_0|>
def test_b(self):
"""make username and password for ftp"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100')
for li in result['data']['ScreenList']:
if li['ScreenName'] == getConf('constant', 'led_name'):
sid = li['Sid']
if... | the_stack_v2_python_sparse | src/test_B_main/test_getConstant.py | linbossdegithub/autotest | train | 1 | |
eaa8000765ae446e630cec15bb39601bfbb90441 | [
"df_list = []\nfor content1 in os.listdir(predictions_dir):\n if pred_nametag in content1:\n patientID1 = int(content1.split('_')[1])\n for content2 in os.listdir(ground_truth_dir):\n if gt_nametag in content2:\n patientID2 = int(content2.split('_')[1])\n if... | <|body_start_0|>
df_list = []
for content1 in os.listdir(predictions_dir):
if pred_nametag in content1:
patientID1 = int(content1.split('_')[1])
for content2 in os.listdir(ground_truth_dir):
if gt_nametag in content2:
... | EvaluatePredictedFiles | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No... | stack_v2_sparse_classes_10k_train_001345 | 9,017 | no_license | [
{
"docstring": "Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the predicted files should be inside the given predictions_dir, and GT files in ground_truth_dir as well. Parameters ---... | 2 | stack_v2_sparse_classes_30k_train_001170 | Implement the Python class `EvaluatePredictedFiles` described below.
Class description:
Implement the EvaluatePredictedFiles class.
Method signatures and docstrings:
- def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont... | Implement the Python class `EvaluatePredictedFiles` described below.
Class description:
Implement the EvaluatePredictedFiles class.
Method signatures and docstrings:
- def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont... | fad319f2f8061ff662b16bd935abefbc0c5e176d | <|skeleton|>
class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the pr... | the_stack_v2_python_sparse | evaluate_predicted_files.py | youpele52/thesis | train | 2 | |
a92d92f0d509646d051134d9a7ffcb8989c6d48d | [
"if instance is None and data is not empty:\n data = data.copy()\n ModelClass = self.Meta.model\n fields = model_meta.get_field_info(ModelClass)\n for field_name, field in fields.fields.items():\n '\\n Update the field IF (and ONLY IF):\\n - The field has a specified... | <|body_start_0|>
if instance is None and data is not empty:
data = data.copy()
ModelClass = self.Meta.model
fields = model_meta.get_field_info(ModelClass)
for field_name, field in fields.fields.items():
'\n Update the field IF (and O... | Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation. | InvenTreeModelSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvenTreeModelSerializer:
"""Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation."""
def __init__(self, instance=None, data=empty, **kwargs):
"""Custom __init__ routine to ensure that *default* values (as... | stack_v2_sparse_classes_10k_train_001346 | 7,561 | permissive | [
{
"docstring": "Custom __init__ routine to ensure that *default* values (as specified in the ORM) are used by the DRF serializers, *if* the values are not provided by the user.",
"name": "__init__",
"signature": "def __init__(self, instance=None, data=empty, **kwargs)"
},
{
"docstring": "Constru... | 4 | stack_v2_sparse_classes_30k_train_002212 | Implement the Python class `InvenTreeModelSerializer` described below.
Class description:
Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.
Method signatures and docstrings:
- def __init__(self, instance=None, data=empty, **kwargs): Cu... | Implement the Python class `InvenTreeModelSerializer` described below.
Class description:
Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.
Method signatures and docstrings:
- def __init__(self, instance=None, data=empty, **kwargs): Cu... | 2a0ea66f6591756eeb62da28d24daec3ad4209e8 | <|skeleton|>
class InvenTreeModelSerializer:
"""Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation."""
def __init__(self, instance=None, data=empty, **kwargs):
"""Custom __init__ routine to ensure that *default* values (as... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InvenTreeModelSerializer:
"""Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation."""
def __init__(self, instance=None, data=empty, **kwargs):
"""Custom __init__ routine to ensure that *default* values (as specified in... | the_stack_v2_python_sparse | InvenTree/InvenTree/serializers.py | MedShift/InvenTree | train | 0 |
4729d47b89a5e28e7552820741e106e9a61cdcac | [
"news_liat = []\ntry:\n for new_num in new_numlist:\n self._params['new_num'] = new_num\n text = self.step(read_dir, 'get_the_news_read').text\n news_liat.append(text)\n print(f'獲取到的消息是:{text}')\n return news_liat\nexcept Exception as e:\n raise e",
"self._params['new_num'] = ... | <|body_start_0|>
news_liat = []
try:
for new_num in new_numlist:
self._params['new_num'] = new_num
text = self.step(read_dir, 'get_the_news_read').text
news_liat.append(text)
print(f'獲取到的消息是:{text}')
return news_liat... | Read | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Read:
def get_the_news_read(self, new_numlist):
"""根据传进来的nums去取第几条信息 获取第一行信息的text"""
<|body_0|>
def goto_overtime_for_news_read(self, new_num):
"""根據傳進來的序號獲取第N條消息並點擊進入改應用 驗證進入了加班應用,返回”加班詳情“text"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
news_li... | stack_v2_sparse_classes_10k_train_001347 | 1,051 | no_license | [
{
"docstring": "根据传进来的nums去取第几条信息 获取第一行信息的text",
"name": "get_the_news_read",
"signature": "def get_the_news_read(self, new_numlist)"
},
{
"docstring": "根據傳進來的序號獲取第N條消息並點擊進入改應用 驗證進入了加班應用,返回”加班詳情“text",
"name": "goto_overtime_for_news_read",
"signature": "def goto_overtime_for_news_read(s... | 2 | stack_v2_sparse_classes_30k_train_003579 | Implement the Python class `Read` described below.
Class description:
Implement the Read class.
Method signatures and docstrings:
- def get_the_news_read(self, new_numlist): 根据传进来的nums去取第几条信息 获取第一行信息的text
- def goto_overtime_for_news_read(self, new_num): 根據傳進來的序號獲取第N條消息並點擊進入改應用 驗證進入了加班應用,返回”加班詳情“text | Implement the Python class `Read` described below.
Class description:
Implement the Read class.
Method signatures and docstrings:
- def get_the_news_read(self, new_numlist): 根据传进来的nums去取第几条信息 获取第一行信息的text
- def goto_overtime_for_news_read(self, new_num): 根據傳進來的序號獲取第N條消息並點擊進入改應用 驗證進入了加班應用,返回”加班詳情“text
<|skeleton|>
cl... | 42545bad476dd3ab99bf421e702a3d6b4795aa01 | <|skeleton|>
class Read:
def get_the_news_read(self, new_numlist):
"""根据传进来的nums去取第几条信息 获取第一行信息的text"""
<|body_0|>
def goto_overtime_for_news_read(self, new_num):
"""根據傳進來的序號獲取第N條消息並點擊進入改應用 驗證進入了加班應用,返回”加班詳情“text"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Read:
def get_the_news_read(self, new_numlist):
"""根据传进来的nums去取第几条信息 获取第一行信息的text"""
news_liat = []
try:
for new_num in new_numlist:
self._params['new_num'] = new_num
text = self.step(read_dir, 'get_the_news_read').text
news_l... | the_stack_v2_python_sparse | page/news_list/read.py | xmaimiao/wmPC_oevertime | train | 0 | |
2b8d87586eb6662c10256fc004b80eaafe221199 | [
"super(PointNetEstimation, self).__init__()\nself.conv1 = nn.Conv1d(3, 128, 1)\nself.conv2 = nn.Conv1d(128, 128, 1)\nself.conv3 = nn.Conv1d(128, 256, 1)\nself.conv4 = nn.Conv1d(256, 512, 1)\nself.bn1 = nn.BatchNorm1d(128)\nself.bn2 = nn.BatchNorm1d(128)\nself.bn3 = nn.BatchNorm1d(256)\nself.bn4 = nn.BatchNorm1d(512... | <|body_start_0|>
super(PointNetEstimation, self).__init__()
self.conv1 = nn.Conv1d(3, 128, 1)
self.conv2 = nn.Conv1d(128, 128, 1)
self.conv3 = nn.Conv1d(128, 256, 1)
self.conv4 = nn.Conv1d(256, 512, 1)
self.bn1 = nn.BatchNorm1d(128)
self.bn2 = nn.BatchNorm1d(128)
... | PointNetEstimation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PointNetEstimation:
def __init__(self, n_classes=3):
"""v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]"""
<|body_0|>
def forward(self, pts, one_hot_vec):
""":param pts: [bs,3,m]: x,y,z after InstanceSeg :return: box_pred: [b... | stack_v2_sparse_classes_10k_train_001348 | 11,900 | permissive | [
{
"docstring": "v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]",
"name": "__init__",
"signature": "def __init__(self, n_classes=3)"
},
{
"docstring": ":param pts: [bs,3,m]: x,y,z after InstanceSeg :return: box_pred: [bs,3+NUM_HEADING_BIN*2+NUM_SIZE_CLUS... | 2 | stack_v2_sparse_classes_30k_train_006359 | Implement the Python class `PointNetEstimation` described below.
Class description:
Implement the PointNetEstimation class.
Method signatures and docstrings:
- def __init__(self, n_classes=3): v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]
- def forward(self, pts, one_hot_ve... | Implement the Python class `PointNetEstimation` described below.
Class description:
Implement the PointNetEstimation class.
Method signatures and docstrings:
- def __init__(self, n_classes=3): v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]
- def forward(self, pts, one_hot_ve... | 64bcfa4b292dacc91f92f2542e11d489b1fa2c8a | <|skeleton|>
class PointNetEstimation:
def __init__(self, n_classes=3):
"""v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]"""
<|body_0|>
def forward(self, pts, one_hot_vec):
""":param pts: [bs,3,m]: x,y,z after InstanceSeg :return: box_pred: [b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PointNetEstimation:
def __init__(self, n_classes=3):
"""v1 Amodal 3D Box Estimation Pointnet :param n_classes:3 :param one_hot_vec:[bs,n_classes]"""
super(PointNetEstimation, self).__init__()
self.conv1 = nn.Conv1d(3, 128, 1)
self.conv2 = nn.Conv1d(128, 128, 1)
self.con... | the_stack_v2_python_sparse | frustum_pointnet/models/frustum_pointnets_v1_old.py | ayushjain1144/SeeingByMoving | train | 24 | |
972bc0c46efb864e06950a1ff9cc4b46fe6f95ef | [
"if init in self._fun2str:\n return self._fun2str[init]\nelse:\n raise Exception(\"Shared-memory graph store doesn't support user's initializer\")",
"if init in self._str2fun:\n return self._str2fun[init]\nelse:\n raise Exception(\"Shared-memory graph store doesn't support initializer \" + str(init))"... | <|body_start_0|>
if init in self._fun2str:
return self._fun2str[init]
else:
raise Exception("Shared-memory graph store doesn't support user's initializer")
<|end_body_0|>
<|body_start_1|>
if init in self._str2fun:
return self._str2fun[init]
else:
... | Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer. | InitializerManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InitializerManager:
"""Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer."""
def serialize(self, init):
"... | stack_v2_sparse_classes_10k_train_001349 | 40,469 | permissive | [
{
"docstring": "Convert the initializer function to string. Parameters ---------- init : callable the initializer function. Returns ------ string The name of the built-in initializer function.",
"name": "serialize",
"signature": "def serialize(self, init)"
},
{
"docstring": "Convert the string t... | 2 | stack_v2_sparse_classes_30k_train_003787 | Implement the Python class `InitializerManager` described below.
Class description:
Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer.
Meth... | Implement the Python class `InitializerManager` described below.
Class description:
Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer.
Meth... | 195f99362d883f8b6d131b70a7868a537e55b786 | <|skeleton|>
class InitializerManager:
"""Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer."""
def serialize(self, init):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InitializerManager:
"""Manage initializer. We need to convert built-in frame initializer to strings and send them to the graph store server through RPC. Through the conversion, we need to convert local built-in initializer to shared-memory initializer."""
def serialize(self, init):
"""Convert the... | the_stack_v2_python_sparse | python/dgl/contrib/graph_store.py | hengruizhang98/dgl | train | 3 |
472f04d47d5578cc55fa7fd848b0688250e4e2eb | [
"self._input = input_file\nself._spill = BufferedStream()\nself._zlib = zlib.compressobj(level=1, method=zlib.DEFLATED, wbits=-zlib.MAX_WBITS)\nself._crc = zlib.crc32(b'')\nself._read_size = 0\nif not mtime:\n mtime = time.time()\nself._spill.write(pack('<3sBL2s', b'\\x1f\\x8b\\x08', 8 if filename else 0, int(mt... | <|body_start_0|>
self._input = input_file
self._spill = BufferedStream()
self._zlib = zlib.compressobj(level=1, method=zlib.DEFLATED, wbits=-zlib.MAX_WBITS)
self._crc = zlib.crc32(b'')
self._read_size = 0
if not mtime:
mtime = time.time()
self._spill.w... | Gzip-compressed stream from a readable stream | GzipStreamWrapper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GzipStreamWrapper:
"""Gzip-compressed stream from a readable stream"""
def __init__(self, input_file, mtime=None, filename: str=None):
"""Initialize the stream"""
<|body_0|>
def read(self, size=-1):
"""Read data from input and compress it"""
<|body_1|>
<... | stack_v2_sparse_classes_10k_train_001350 | 4,086 | permissive | [
{
"docstring": "Initialize the stream",
"name": "__init__",
"signature": "def __init__(self, input_file, mtime=None, filename: str=None)"
},
{
"docstring": "Read data from input and compress it",
"name": "read",
"signature": "def read(self, size=-1)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006063 | Implement the Python class `GzipStreamWrapper` described below.
Class description:
Gzip-compressed stream from a readable stream
Method signatures and docstrings:
- def __init__(self, input_file, mtime=None, filename: str=None): Initialize the stream
- def read(self, size=-1): Read data from input and compress it | Implement the Python class `GzipStreamWrapper` described below.
Class description:
Gzip-compressed stream from a readable stream
Method signatures and docstrings:
- def __init__(self, input_file, mtime=None, filename: str=None): Initialize the stream
- def read(self, size=-1): Read data from input and compress it
<|... | 9c9040f6a173af5c495f5447889e9349fa56f234 | <|skeleton|>
class GzipStreamWrapper:
"""Gzip-compressed stream from a readable stream"""
def __init__(self, input_file, mtime=None, filename: str=None):
"""Initialize the stream"""
<|body_0|>
def read(self, size=-1):
"""Read data from input and compress it"""
<|body_1|>
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GzipStreamWrapper:
"""Gzip-compressed stream from a readable stream"""
def __init__(self, input_file, mtime=None, filename: str=None):
"""Initialize the stream"""
self._input = input_file
self._spill = BufferedStream()
self._zlib = zlib.compressobj(level=1, method=zlib.DEF... | the_stack_v2_python_sparse | tessia/server/lib/compression.py | tessia-project/tessia | train | 10 |
f72a5dc52dd5d6d089341b9ff7d54c93685556d4 | [
"form = super().get_form(request, obj=obj, change=change, **kwargs)\nplaceholder_id = request.GET.get('placeholder_id')\nif not placeholder_id and (not obj):\n return form\nif placeholder_id:\n placeholder = Placeholder.objects.only('slot').get(id=placeholder_id)\nelse:\n placeholder = obj.placeholder\nfor... | <|body_start_0|>
form = super().get_form(request, obj=obj, change=change, **kwargs)
placeholder_id = request.GET.get('placeholder_id')
if not placeholder_id and (not obj):
return form
if placeholder_id:
placeholder = Placeholder.objects.only('slot').get(id=placeho... | A plugin to add text with CKEditor widget. | CKEditorPlugin | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CKEditorPlugin:
"""A plugin to add text with CKEditor widget."""
def get_form(self, request, obj=None, change=False, **kwargs):
"""Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder."""
<|body_0... | stack_v2_sparse_classes_10k_train_001351 | 2,489 | permissive | [
{
"docstring": "Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.",
"name": "get_form",
"signature": "def get_form(self, request, obj=None, change=False, **kwargs)"
},
{
"docstring": "Build plugin context passed ... | 2 | stack_v2_sparse_classes_30k_train_002709 | Implement the Python class `CKEditorPlugin` described below.
Class description:
A plugin to add text with CKEditor widget.
Method signatures and docstrings:
- def get_form(self, request, obj=None, change=False, **kwargs): Add an HTML max length validator and/or a CKEditor configuration based on what is configured in ... | Implement the Python class `CKEditorPlugin` described below.
Class description:
A plugin to add text with CKEditor widget.
Method signatures and docstrings:
- def get_form(self, request, obj=None, change=False, **kwargs): Add an HTML max length validator and/or a CKEditor configuration based on what is configured in ... | f2d46fc46b271eb3b4d565039a29c15ba15f027c | <|skeleton|>
class CKEditorPlugin:
"""A plugin to add text with CKEditor widget."""
def get_form(self, request, obj=None, change=False, **kwargs):
"""Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder."""
<|body_0... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CKEditorPlugin:
"""A plugin to add text with CKEditor widget."""
def get_form(self, request, obj=None, change=False, **kwargs):
"""Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder."""
form = super().get_fo... | the_stack_v2_python_sparse | src/richie/plugins/simple_text_ckeditor/cms_plugins.py | openfun/richie | train | 238 |
6815c30386a904b0d1f9a12476307995e9fead0d | [
"self.ensure_one()\ndomain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_domain()\ncandidates = self.env['stock.move'].search(domain, order='date, id')\nreturn candidates",
"self.ensure_one()\ndomain = [('product_id', '=... | <|body_start_0|>
self.ensure_one()
domain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_domain()
candidates = self.env['stock.move'].search(domain, order='date, id')
return candidates
<|end_body... | ProductProduct | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductProduct:
def _get_fifo_candidates_in_move_location(self, location_id):
"""Buscar movimientos por ubicacion"""
<|body_0|>
def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_id):
"""Buscar movimientos por ubicacion"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k_train_001352 | 3,276 | no_license | [
{
"docstring": "Buscar movimientos por ubicacion",
"name": "_get_fifo_candidates_in_move_location",
"signature": "def _get_fifo_candidates_in_move_location(self, location_id)"
},
{
"docstring": "Buscar movimientos por ubicacion",
"name": "_get_fifo_candidates_in_move_location_lot",
"sign... | 2 | stack_v2_sparse_classes_30k_val_000014 | Implement the Python class `ProductProduct` described below.
Class description:
Implement the ProductProduct class.
Method signatures and docstrings:
- def _get_fifo_candidates_in_move_location(self, location_id): Buscar movimientos por ubicacion
- def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_... | Implement the Python class `ProductProduct` described below.
Class description:
Implement the ProductProduct class.
Method signatures and docstrings:
- def _get_fifo_candidates_in_move_location(self, location_id): Buscar movimientos por ubicacion
- def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_... | 6682e60630064641474ddb2d8cbc520e30f64832 | <|skeleton|>
class ProductProduct:
def _get_fifo_candidates_in_move_location(self, location_id):
"""Buscar movimientos por ubicacion"""
<|body_0|>
def _get_fifo_candidates_in_move_location_lot(self, location_id, lot_id):
"""Buscar movimientos por ubicacion"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProductProduct:
def _get_fifo_candidates_in_move_location(self, location_id):
"""Buscar movimientos por ubicacion"""
self.ensure_one()
domain = [('product_id', '=', self.id), ('remaining_qty', '>', 0.0), ('location_dest_id', '=', location_id)] + self.env['stock.move']._get_in_base_doma... | the_stack_v2_python_sparse | poi_purchase_imports/models/product.py | blue-connect/illuminati | train | 0 | |
fd07364b1590a2ca32e76c5871c8f70410c7c633 | [
"self.total = 0\nself.size = size\nself.queue = []",
"if len(self.queue) >= self.size:\n out = self.queue.pop(0)\n self.total -= out\nself.queue.append(val)\nself.total += val\nreturn self.total / len(self.queue)"
] | <|body_start_0|>
self.total = 0
self.size = size
self.queue = []
<|end_body_0|>
<|body_start_1|>
if len(self.queue) >= self.size:
out = self.queue.pop(0)
self.total -= out
self.queue.append(val)
self.total += val
return self.total / len(se... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size: int):
"""Initialize your data structure here."""
<|body_0|>
def next(self, val: int) -> float:
"""如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大小。 保持一个窗口里,因此total要减去pop出来的数字,此操作为O(1) 再把当前数字val 放到queue里,并且加入到tot... | stack_v2_sparse_classes_10k_train_001353 | 1,545 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self, size: int)"
},
{
"docstring": "如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大小。 保持一个窗口里,因此total要减去pop出来的数字,此操作为O(1) 再把当前数字val 放到queue里,并且加入到total, 除以当前size即使平均数",
"nam... | 2 | stack_v2_sparse_classes_30k_train_006399 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size: int): Initialize your data structure here.
- def next(self, val: int) -> float: 如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大... | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size: int): Initialize your data structure here.
- def next(self, val: int) -> float: 如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大... | 034efcefe9940267abcf4c9cab655b2344e3e901 | <|skeleton|>
class MovingAverage:
def __init__(self, size: int):
"""Initialize your data structure here."""
<|body_0|>
def next(self, val: int) -> float:
"""如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大小。 保持一个窗口里,因此total要减去pop出来的数字,此操作为O(1) 再把当前数字val 放到queue里,并且加入到tot... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size: int):
"""Initialize your data structure here."""
self.total = 0
self.size = size
self.queue = []
def next(self, val: int) -> float:
"""如果当前的size超过了初始size, 即弹出第一个数字 queue.pop(0), 这样queue总保持初始size-1的大小。 保持一个窗口里,因此total要减去pop出来的... | the_stack_v2_python_sparse | 346_moving_average_from_data_stream.py | HongsenHe/algo2018 | train | 0 | |
15f775824d1a77b6451160c08c7eaf4b047d9f1b | [
"from collections import defaultdict\ncourseDict = defaultdict(list)\nfor relation in prerequisites:\n nextCourse, prevCourse = (relation[0], relation[1])\n courseDict[prevCourse].append(nextCourse)\npath = [False] * numCourses\nfor currCourse in range(numCourses):\n if self.isCyclic(currCourse, courseDict... | <|body_start_0|>
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relation[0], relation[1])
courseDict[prevCourse].append(nextCourse)
path = [False] * numCourses
for currCourse in r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path):
"""backtracking method to check that no cycle would be formed starting... | stack_v2_sparse_classes_10k_train_001354 | 26,504 | no_license | [
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool",
"name": "canFinish",
"signature": "def canFinish(self, numCourses, prerequisites)"
},
{
"docstring": "backtracking method to check that no cycle would be formed starting from currCourse",
"name": "isCyc... | 2 | stack_v2_sparse_classes_30k_val_000051 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path): backtr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path): backtr... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path):
"""backtracking method to check that no cycle would be formed starting... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relati... | the_stack_v2_python_sparse | leetcode_python/Breadth-First-Search/course-schedule.py | yennanliu/CS_basics | train | 64 | |
047b64bbd85c3f5606e3b1ae0bf1fa95257faada | [
"def build_prefix(words):\n tree = SuffixTree()\n for i, word in enumerate(words):\n tree.add(word, i)\n return tree\nself.prefix_tree = build_prefix(words)\nself.suffix_tree = build_prefix([word[::-1] for word in words])",
"p = self.prefix_tree.find(prefix)\ns = self.suffix_tree.find(suffix[::-1]... | <|body_start_0|>
def build_prefix(words):
tree = SuffixTree()
for i, word in enumerate(words):
tree.add(word, i)
return tree
self.prefix_tree = build_prefix(words)
self.suffix_tree = build_prefix([word[::-1] for word in words])
<|end_body_0|>
... | WordFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def build_prefix(words):
tree ... | stack_v2_sparse_classes_10k_train_001355 | 3,233 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | null | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter:
def __in... | e5dd213411b5c82b07171c3adf4556dcf9c44207 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
def build_prefix(words):
tree = SuffixTree()
for i, word in enumerate(words):
tree.add(word, i)
return tree
self.prefix_tree = build_prefix(words)
self.suffix... | the_stack_v2_python_sparse | python/745.prefix-and-suffix-search.py | songzy12/LeetCode | train | 4 | |
f4d8b32220926433d2d1a23a2e1371ff284c648b | [
"super(PatchEmbedding, self).__init__()\nself.out_channels: int = out_channels\nself.linear_embedding: nn.Module = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(patch_size, patch_size), stride=(patch_size, patch_size))\nself.normalization: nn.Module = nn.LayerNorm(normalized_shape=out_c... | <|body_start_0|>
super(PatchEmbedding, self).__init__()
self.out_channels: int = out_channels
self.linear_embedding: nn.Module = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(patch_size, patch_size), stride=(patch_size, patch_size))
self.normalization: nn.Mod... | Module embeds a given image into patch embeddings. | PatchEmbedding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output chann... | stack_v2_sparse_classes_10k_train_001356 | 41,159 | no_license | [
{
"docstring": "Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output channels :param patch_size: (int) Patch size to be utilized :param image_size: (int) Image size to be used",
"name": "__init__",
"signature": "def __init__(self, in_channels:... | 2 | stack_v2_sparse_classes_30k_train_004404 | Implement the Python class `PatchEmbedding` described below.
Class description:
Module embeds a given image into patch embeddings.
Method signatures and docstrings:
- def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None: Constructor method :param in_channels: (int) Number of input c... | Implement the Python class `PatchEmbedding` described below.
Class description:
Module embeds a given image into patch embeddings.
Method signatures and docstrings:
- def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None: Constructor method :param in_channels: (int) Number of input c... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output chann... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output channels :param pa... | the_stack_v2_python_sparse | generated/test_ChristophReich1996_Swin_Transformer_V2.py | jansel/pytorch-jit-paritybench | train | 35 |
61e05ddce9bc09f0f81f3442a1ca80b544608ad8 | [
"self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]]\nself.weights = [2.5, 3.0, 3.5]\nfor i in range(0, 3):\n self.assertEqual(self.nuts[i].weight, self.weights[i], 'The weight is wrong')",
"varieties = [variety() for variety in [Middle_Eastern, South_Asian, South_Asian, American, Am... | <|body_start_0|>
self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]]
self.weights = [2.5, 3.0, 3.5]
for i in range(0, 3):
self.assertEqual(self.nuts[i].weight, self.weights[i], 'The weight is wrong')
<|end_body_0|>
<|body_start_1|>
varieties = [var... | TestCoconuts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCoconuts:
def test_weight(self):
"""Tests that different coconut types each have a different weight"""
<|body_0|>
def test_total_weight(self):
"""Tests that the sum of a specified number of coconuts of each type returned matches the expected total"""
<|bo... | stack_v2_sparse_classes_10k_train_001357 | 2,195 | no_license | [
{
"docstring": "Tests that different coconut types each have a different weight",
"name": "test_weight",
"signature": "def test_weight(self)"
},
{
"docstring": "Tests that the sum of a specified number of coconuts of each type returned matches the expected total",
"name": "test_total_weight"... | 3 | stack_v2_sparse_classes_30k_train_002537 | Implement the Python class `TestCoconuts` described below.
Class description:
Implement the TestCoconuts class.
Method signatures and docstrings:
- def test_weight(self): Tests that different coconut types each have a different weight
- def test_total_weight(self): Tests that the sum of a specified number of coconuts... | Implement the Python class `TestCoconuts` described below.
Class description:
Implement the TestCoconuts class.
Method signatures and docstrings:
- def test_weight(self): Tests that different coconut types each have a different weight
- def test_total_weight(self): Tests that the sum of a specified number of coconuts... | 4ca74dd054be17e7a57da891c5d239e3f915d3f1 | <|skeleton|>
class TestCoconuts:
def test_weight(self):
"""Tests that different coconut types each have a different weight"""
<|body_0|>
def test_total_weight(self):
"""Tests that the sum of a specified number of coconuts of each type returned matches the expected total"""
<|bo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestCoconuts:
def test_weight(self):
"""Tests that different coconut types each have a different weight"""
self.nuts = [variety() for variety in [Middle_Eastern, South_Asian, American]]
self.weights = [2.5, 3.0, 3.5]
for i in range(0, 3):
self.assertEqual(self.nuts[... | the_stack_v2_python_sparse | Lesson 2 - Converting Data Into Structured Objects/project/attempt_2/test_coconuts.py | jmwoloso/Python_3 | train | 0 | |
81ca6311d8bfdfc2c75064b7aa6fd5485aa3bec7 | [
"self.variables = np.array([])\nself.cardinality = np.array([], dtype=int)\nself.inhibitor_probability = []\nself.add_variables(variables, cardinality, inhibitor_probability)",
"if len(variables) == 1:\n if not isinstance(inhibitor_probability[0], (list, tuple)):\n inhibitor_probability = [inhibitor_pro... | <|body_start_0|>
self.variables = np.array([])
self.cardinality = np.array([], dtype=int)
self.inhibitor_probability = []
self.add_variables(variables, cardinality, inhibitor_probability)
<|end_body_0|>
<|body_start_1|>
if len(variables) == 1:
if not isinstance(inhib... | Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford.edu/~srinivas/research/6-UAI93-Srinivas-Generalization-of-Noisy-Or.pdf | NoisyOrModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoisyOrModel:
"""Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford.edu/~srinivas/research/6-UAI93-Sriniva... | stack_v2_sparse_classes_10k_train_001358 | 5,683 | permissive | [
{
"docstring": "Init method for NoisyOrModel. Parameters ---------- variables: list, tuple, dict (array like) array containing names of the variables. cardinality: list, tuple, dict (array like) array containing integers representing the cardinality of the variables. inhibitor_probability: list, tuple, dict (ar... | 3 | stack_v2_sparse_classes_30k_train_006241 | Implement the Python class `NoisyOrModel` described below.
Class description:
Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford... | Implement the Python class `NoisyOrModel` described below.
Class description:
Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford... | 6d66bde4c7f140ba14892174c59370b2b7964e90 | <|skeleton|>
class NoisyOrModel:
"""Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford.edu/~srinivas/research/6-UAI93-Sriniva... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NoisyOrModel:
"""Base class for Noisy-Or models. This is an implementation of generalized Noisy-Or models and is not limited to Boolean variables and also any arbitrary function can be used instead of the boolean OR function. Reference: http://xenon.stanford.edu/~srinivas/research/6-UAI93-Srinivas-Generalizat... | the_stack_v2_python_sparse | pgmpy/models/NoisyOrModel.py | pgmpy/pgmpy | train | 2,617 |
5e0bb01d74bbd6f718e89f791108781631760596 | [
"yes_to_all = force_import_from_game\nfor data_type in self.DATA_TYPES:\n yes_to_all = self.import_data_type(data_type, force_import_from_game, yes_to_all, with_window=with_window)\n if data_type == 'maps' and first_time and (self.maps is not None):\n archives_msb = self.maps.DukesArchives\n rep... | <|body_start_0|>
yes_to_all = force_import_from_game
for data_type in self.DATA_TYPES:
yes_to_all = self.import_data_type(data_type, force_import_from_game, yes_to_all, with_window=with_window)
if data_type == 'maps' and first_time and (self.maps is not None):
arc... | GameDirectoryProject | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameDirectoryProject:
def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False):
"""Also offer to translate events/regions with entity IDs and export entities modules."""
<|body_0|>
def offer_fix_broken_regions(self, with_w... | stack_v2_sparse_classes_10k_train_001359 | 6,562 | no_license | [
{
"docstring": "Also offer to translate events/regions with entity IDs and export entities modules.",
"name": "initialize_project",
"signature": "def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False)"
},
{
"docstring": "Offer to fix broken ... | 4 | stack_v2_sparse_classes_30k_train_001306 | Implement the Python class `GameDirectoryProject` described below.
Class description:
Implement the GameDirectoryProject class.
Method signatures and docstrings:
- def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): Also offer to translate events/regions with... | Implement the Python class `GameDirectoryProject` described below.
Class description:
Implement the GameDirectoryProject class.
Method signatures and docstrings:
- def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): Also offer to translate events/regions with... | 88693c0015056ee8e3d1dbcb795c05fca4349e38 | <|skeleton|>
class GameDirectoryProject:
def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False):
"""Also offer to translate events/regions with entity IDs and export entities modules."""
<|body_0|>
def offer_fix_broken_regions(self, with_w... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GameDirectoryProject:
def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False):
"""Also offer to translate events/regions with entity IDs and export entities modules."""
yes_to_all = force_import_from_game
for data_type in self.DATA_... | the_stack_v2_python_sparse | soulstruct/darksouls1r/project/core.py | Nahnahchi/soulstruct | train | 0 | |
73e5992754d792172c7819412d7d7f89c3659ac7 | [
"Editeur.__init__(self, pere, objet, attribut)\nself.ajouter_option('a', self.ajouter_resp)\nself.ajouter_option('s', self.suppr_resp)",
"evenement = self.objet\nmsg = '| |tit|' + 'Responsables de {}'.format(evenement.id).ljust(76)\nmsg += '|ff||\\n' + self.opts.separateur + '\\n'\nmsg += self.aide_courte\nmsg +=... | <|body_start_0|>
Editeur.__init__(self, pere, objet, attribut)
self.ajouter_option('a', self.ajouter_resp)
self.ajouter_option('s', self.suppr_resp)
<|end_body_0|>
<|body_start_1|>
evenement = self.objet
msg = '| |tit|' + 'Responsables de {}'.format(evenement.id).ljust(76)
... | Contexte-éditeur d'édition des responsables. | EdtResponsables | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
<|body_0|>
def accueil(self):
"""Message d'accueil du contexte"""
<|body_1|>
def suppr_resp(self,... | stack_v2_sparse_classes_10k_train_001360 | 3,848 | permissive | [
{
"docstring": "Constructeur de l'éditeur",
"name": "__init__",
"signature": "def __init__(self, pere, objet=None, attribut=None)"
},
{
"docstring": "Message d'accueil du contexte",
"name": "accueil",
"signature": "def accueil(self)"
},
{
"docstring": "Supprime un responsable ; s... | 4 | null | Implement the Python class `EdtResponsables` described below.
Class description:
Contexte-éditeur d'édition des responsables.
Method signatures and docstrings:
- def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur
- def accueil(self): Message d'accueil du contexte
- def suppr_resp(self, arg... | Implement the Python class `EdtResponsables` described below.
Class description:
Contexte-éditeur d'édition des responsables.
Method signatures and docstrings:
- def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur
- def accueil(self): Message d'accueil du contexte
- def suppr_resp(self, arg... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
<|body_0|>
def accueil(self):
"""Message d'accueil du contexte"""
<|body_1|>
def suppr_resp(self,... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
Editeur.__init__(self, pere, objet, attribut)
self.ajouter_option('a', self.ajouter_resp)
self.ajouter_option('s', self.... | the_stack_v2_python_sparse | src/secondaires/calendrier/editeurs/evedit/edt_responsables.py | vincent-lg/tsunami | train | 5 |
4c0312dc8f3ee2d4a6cb3382855135b44d47f9c6 | [
"head = 0\nlongest = 0\ndic = {}\nfor i in range(len(s)):\n if s[i] not in dic:\n dic[s[i]] = i\n else:\n if dic[s[i]] >= head:\n head = dic[s[i]] + 1\n dic[s[i]] = i\n longest = i - head + 1 if i - head + 1 > longest else longest\nreturn longest",
"head = 0\nlongest = 0\n... | <|body_start_0|>
head = 0
longest = 0
dic = {}
for i in range(len(s)):
if s[i] not in dic:
dic[s[i]] = i
else:
if dic[s[i]] >= head:
head = dic[s[i]] + 1
dic[s[i]] = i
longest = i - he... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = 0
longest = 0
dic =... | stack_v2_sparse_classes_10k_train_001361 | 2,425 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring1",
"signature": "def lengthOfLongestSubstring1(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000267 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | 4012c16ccedeebc7852fda707a2399ecb0b5b60a | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
head = 0
longest = 0
dic = {}
for i in range(len(s)):
if s[i] not in dic:
dic[s[i]] = i
else:
if dic[s[i]] >= head:
... | the_stack_v2_python_sparse | py/3.py | XMK233/Leetcode-Journey | train | 0 | |
081dc29a1fc95b725e09bf79c65e6400305fbc09 | [
"heapq.heapify(nums)\nself.nums = nums\nself.k = k",
"heapq.heappush(self.nums, val)\ntry:\n return heapq.nlargest(self.k, self.nums)[self.k - 1]\nexcept:\n print('No such Kth element in the queue')"
] | <|body_start_0|>
heapq.heapify(nums)
self.nums = nums
self.k = k
<|end_body_0|>
<|body_start_1|>
heapq.heappush(self.nums, val)
try:
return heapq.nlargest(self.k, self.nums)[self.k - 1]
except:
print('No such Kth element in the queue')
<|end_body_... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
heapq.heapify(nums)
self.nums = nums
self.... | stack_v2_sparse_classes_10k_train_001362 | 3,962 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000549 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | b925bb22d1daa4a56c5a238a5758a926905559b4 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
heapq.heapify(nums)
self.nums = nums
self.k = k
def add(self, val):
""":type val: int :rtype: int"""
heapq.heappush(self.nums, val)
try:
return heapq.nlarg... | the_stack_v2_python_sparse | Heap/703. Kth Largest Element in a Stream.py | beninghton/notGivenUpToG | train | 0 | |
eff864014e5328433d897d836c0bbd3de8948fca | [
"self._top = Toplevel()\nself._top.focus_set()\nself._top.grab_set()\nself._reason = reason_window\nself._a = a\nself._b = b\nself._make_widgets(n)",
"self._all_input = []\nfor i in range(n):\n tmp_frame = Frame(self._top)\n Label(tmp_frame, text='x{}:'.format(i), font=('arial', '16', 'bold')).pack(side=LEF... | <|body_start_0|>
self._top = Toplevel()
self._top.focus_set()
self._top.grab_set()
self._reason = reason_window
self._a = a
self._b = b
self._make_widgets(n)
<|end_body_0|>
<|body_start_1|>
self._all_input = []
for i in range(n):
tmp_f... | Діалогове вікно, в якому необхідно ввести n координат вектора. | Dialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dialog:
"""Діалогове вікно, в якому необхідно ввести n координат вектора."""
def __init__(self, n: int, a: float, b: float, reason_window):
"""Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b: права межа відрізку :param reason_window: вікно, яке сп... | stack_v2_sparse_classes_10k_train_001363 | 5,760 | no_license | [
{
"docstring": "Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b: права межа відрізку :param reason_window: вікно, яке спричинило даний екземпляр класу",
"name": "__init__",
"signature": "def __init__(self, n: int, a: float, b: float, reason_window)"
},
{
"doc... | 3 | stack_v2_sparse_classes_30k_train_000970 | Implement the Python class `Dialog` described below.
Class description:
Діалогове вікно, в якому необхідно ввести n координат вектора.
Method signatures and docstrings:
- def __init__(self, n: int, a: float, b: float, reason_window): Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b... | Implement the Python class `Dialog` described below.
Class description:
Діалогове вікно, в якому необхідно ввести n координат вектора.
Method signatures and docstrings:
- def __init__(self, n: int, a: float, b: float, reason_window): Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b... | e44bf2b535b34bc31fb323c20901a77b0b3072f2 | <|skeleton|>
class Dialog:
"""Діалогове вікно, в якому необхідно ввести n координат вектора."""
def __init__(self, n: int, a: float, b: float, reason_window):
"""Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b: права межа відрізку :param reason_window: вікно, яке сп... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Dialog:
"""Діалогове вікно, в якому необхідно ввести n координат вектора."""
def __init__(self, n: int, a: float, b: float, reason_window):
"""Ініціалізація :param n: к-ть компонент вектора :param a: ліва межа відрізку :param b: права межа відрізку :param reason_window: вікно, яке спричинило дани... | the_stack_v2_python_sparse | dz_others/subject24_gui/t24_22/t24_7.py | davendiy/ads_course2 | train | 0 |
194eab8f4d0e39ebf8f755c2e3183c68e41c6d45 | [
"key_list = list()\nfor _ in range(3):\n keypair = self.create_keypair()\n keypair.pop('private_key')\n keypair.pop('user_id')\n key_list.append(keypair)\nfetched_list = self.keypairs_client.list_keypairs()['keypairs']\nnew_list = list()\nfor keypair in fetched_list:\n new_list.append(keypair['keypai... | <|body_start_0|>
key_list = list()
for _ in range(3):
keypair = self.create_keypair()
keypair.pop('private_key')
keypair.pop('user_id')
key_list.append(keypair)
fetched_list = self.keypairs_client.list_keypairs()['keypairs']
new_list = list... | Test keypairs API with compute microversion less than 2.2 | KeyPairsV2TestJSON | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyPairsV2TestJSON:
"""Test keypairs API with compute microversion less than 2.2"""
def test_keypairs_create_list_delete(self):
"""Test create/list/delete keypairs Keypairs created should be available in the response list"""
<|body_0|>
def test_keypair_create_delete(self... | stack_v2_sparse_classes_10k_train_001364 | 4,286 | permissive | [
{
"docstring": "Test create/list/delete keypairs Keypairs created should be available in the response list",
"name": "test_keypairs_create_list_delete",
"signature": "def test_keypairs_create_list_delete(self)"
},
{
"docstring": "Test create/delete keypair",
"name": "test_keypair_create_dele... | 4 | null | Implement the Python class `KeyPairsV2TestJSON` described below.
Class description:
Test keypairs API with compute microversion less than 2.2
Method signatures and docstrings:
- def test_keypairs_create_list_delete(self): Test create/list/delete keypairs Keypairs created should be available in the response list
- def... | Implement the Python class `KeyPairsV2TestJSON` described below.
Class description:
Test keypairs API with compute microversion less than 2.2
Method signatures and docstrings:
- def test_keypairs_create_list_delete(self): Test create/list/delete keypairs Keypairs created should be available in the response list
- def... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class KeyPairsV2TestJSON:
"""Test keypairs API with compute microversion less than 2.2"""
def test_keypairs_create_list_delete(self):
"""Test create/list/delete keypairs Keypairs created should be available in the response list"""
<|body_0|>
def test_keypair_create_delete(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KeyPairsV2TestJSON:
"""Test keypairs API with compute microversion less than 2.2"""
def test_keypairs_create_list_delete(self):
"""Test create/list/delete keypairs Keypairs created should be available in the response list"""
key_list = list()
for _ in range(3):
keypair... | the_stack_v2_python_sparse | tempest/api/compute/keypairs/test_keypairs.py | openstack/tempest | train | 270 |
25f92074745d5500df3fe8faba7db564bbae874d | [
"self.__base_url = base_url\nself.__initialized = False\nself.__url_spec = {'%(instance)s': instance_name or ''}",
"if self.__initialized:\n return False\nself.__url_spec['%(type)s'] = message_type\nself.__url_spec['%(hash)s'] = message_digest.hash\nself.__url_spec['%(sizebytes)s'] = str(message_digest.size_by... | <|body_start_0|>
self.__base_url = base_url
self.__initialized = False
self.__url_spec = {'%(instance)s': instance_name or ''}
<|end_body_0|>
<|body_start_1|>
if self.__initialized:
return False
self.__url_spec['%(type)s'] = message_type
self.__url_spec['%(ha... | BrowserURL | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BrowserURL:
def __init__(self, base_url, instance_name=None):
"""Begins browser URL helper initialization."""
<|body_0|>
def for_message(self, message_type, message_digest):
"""Completes browser URL initialization for a protobuf message."""
<|body_1|>
de... | stack_v2_sparse_classes_10k_train_001365 | 10,679 | permissive | [
{
"docstring": "Begins browser URL helper initialization.",
"name": "__init__",
"signature": "def __init__(self, base_url, instance_name=None)"
},
{
"docstring": "Completes browser URL initialization for a protobuf message.",
"name": "for_message",
"signature": "def for_message(self, mes... | 3 | stack_v2_sparse_classes_30k_train_004162 | Implement the Python class `BrowserURL` described below.
Class description:
Implement the BrowserURL class.
Method signatures and docstrings:
- def __init__(self, base_url, instance_name=None): Begins browser URL helper initialization.
- def for_message(self, message_type, message_digest): Completes browser URL initi... | Implement the Python class `BrowserURL` described below.
Class description:
Implement the BrowserURL class.
Method signatures and docstrings:
- def __init__(self, base_url, instance_name=None): Begins browser URL helper initialization.
- def for_message(self, message_type, message_digest): Completes browser URL initi... | f39416d81d55ff8bcfb83a50d6a12541f2884ffc | <|skeleton|>
class BrowserURL:
def __init__(self, base_url, instance_name=None):
"""Begins browser URL helper initialization."""
<|body_0|>
def for_message(self, message_type, message_digest):
"""Completes browser URL initialization for a protobuf message."""
<|body_1|>
de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BrowserURL:
def __init__(self, base_url, instance_name=None):
"""Begins browser URL helper initialization."""
self.__base_url = base_url
self.__initialized = False
self.__url_spec = {'%(instance)s': instance_name or ''}
def for_message(self, message_type, message_digest):
... | the_stack_v2_python_sparse | buildgrid/utils.py | henryaj/buildgrid | train | 0 | |
1155b519a9a3255c0864d4760cad13aafd5602c2 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.index = index\nsuper(LSVertexType, self).__init__(Line=Line, Sample=Sample, **kwargs)",
"if array is None:\n return None\nif isinstance(array, (numpy.ndarray, list, tu... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.index = index
super(LSVertexType, self).__init__(Line=Line, Sample=Sample, **kwargs)
<|end_body_0|>
<|body_start_1|... | An array element of LSType. | LSVertexType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
<|body_0|>
def from_array(cls, array, index=1):
"""Create from an array ty... | stack_v2_sparse_classes_10k_train_001366 | 10,131 | permissive | [
{
"docstring": "Parameters ---------- Line : float Sample : float index : int kwargs",
"name": "__init__",
"signature": "def __init__(self, Line=None, Sample=None, index=None, **kwargs)"
},
{
"docstring": "Create from an array type entry. Parameters ---------- array: numpy.ndarray|list|tuple ass... | 2 | null | Implement the Python class `LSVertexType` described below.
Class description:
An array element of LSType.
Method signatures and docstrings:
- def __init__(self, Line=None, Sample=None, index=None, **kwargs): Parameters ---------- Line : float Sample : float index : int kwargs
- def from_array(cls, array, index=1): Cr... | Implement the Python class `LSVertexType` described below.
Class description:
An array element of LSType.
Method signatures and docstrings:
- def __init__(self, Line=None, Sample=None, index=None, **kwargs): Parameters ---------- Line : float Sample : float index : int kwargs
- def from_array(cls, array, index=1): Cr... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
<|body_0|>
def from_array(cls, array, index=1):
"""Create from an array ty... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LSVertexType:
"""An array element of LSType."""
def __init__(self, Line=None, Sample=None, index=None, **kwargs):
"""Parameters ---------- Line : float Sample : float index : int kwargs"""
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwa... | the_stack_v2_python_sparse | sarpy/io/phase_history/cphd1_elements/blocks.py | ngageoint/sarpy | train | 192 |
b69f442a65f2e9c8f819e76d75ef6f48b2cb1056 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | The MruV server service provides procedures for managing game platform server actions. | MruVServerServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
<|body_0|>
def GetRegisteredServers(self, request, ... | stack_v2_sparse_classes_10k_train_001367 | 9,501 | permissive | [
{
"docstring": "Register instance of server for further managing.",
"name": "RegisterServer",
"signature": "def RegisterServer(self, request, context)"
},
{
"docstring": "Get all registered servers.",
"name": "GetRegisteredServers",
"signature": "def GetRegisteredServers(self, request, c... | 5 | stack_v2_sparse_classes_30k_train_000765 | Implement the Python class `MruVServerServiceServicer` described below.
Class description:
The MruV server service provides procedures for managing game platform server actions.
Method signatures and docstrings:
- def RegisterServer(self, request, context): Register instance of server for further managing.
- def GetR... | Implement the Python class `MruVServerServiceServicer` described below.
Class description:
The MruV server service provides procedures for managing game platform server actions.
Method signatures and docstrings:
- def RegisterServer(self, request, context): Register instance of server for further managing.
- def GetR... | 2a640f7667d23f39e50ccc9ba73c98138c6839b5 | <|skeleton|>
class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
<|body_0|>
def GetRegisteredServers(self, request, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MruVServerServiceServicer:
"""The MruV server service provides procedures for managing game platform server actions."""
def RegisterServer(self, request, context):
"""Register instance of server for further managing."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_d... | the_stack_v2_python_sparse | server/server_pb2_grpc.py | MruV-RP/mruv-pb_python | train | 0 |
c9baccb09e5ac57daef9000707807c94034c59e4 | [
"self.screen_width = 1200\nself.screen_height = 680\nself.bg_color = (0, 20, 50)\nself.hero_limit = 3\nself.bullets_allowed = 5\nself.covid_vertical_speed_factor = 1\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()",
"self.hero_speed_factor = 1.5\nself.bullet_speed_factor = 1\nself.covid_horizontal_s... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 680
self.bg_color = (0, 20, 50)
self.hero_limit = 3
self.bullets_allowed = 5
self.covid_vertical_speed_factor = 1
self.speedup_scale = 1.1
self.initialize_dynamic_settings()
<|end_body_0|>
<|b... | A class that have all configurations of the game | Settings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
<|body_0|>
def initialize_dynamic_settings(self):
"""Initializes the configurations that increase during the game"""
<|body_1|>
def... | stack_v2_sparse_classes_10k_train_001368 | 2,241 | permissive | [
{
"docstring": "Initialize the game configs",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Initializes the configurations that increase during the game",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_004236 | Implement the Python class `Settings` described below.
Class description:
A class that have all configurations of the game
Method signatures and docstrings:
- def __init__(self): Initialize the game configs
- def initialize_dynamic_settings(self): Initializes the configurations that increase during the game
- def inc... | Implement the Python class `Settings` described below.
Class description:
A class that have all configurations of the game
Method signatures and docstrings:
- def __init__(self): Initialize the game configs
- def initialize_dynamic_settings(self): Initializes the configurations that increase during the game
- def inc... | 4b336ebf0bc29aa4c644f0996431d13f853ac6e7 | <|skeleton|>
class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
<|body_0|>
def initialize_dynamic_settings(self):
"""Initializes the configurations that increase during the game"""
<|body_1|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
self.screen_width = 1200
self.screen_height = 680
self.bg_color = (0, 20, 50)
self.hero_limit = 3
self.bullets_allowed = 5
self.co... | the_stack_v2_python_sparse | pygame/hero_combat/hero_settings.py | carlinhoshk/python | train | 0 |
b4f8836e3f900777b69125134be2b320fb524eb4 | [
"if 'gateway' not in os.popen('jps').read():\n os.system('java gateway &')\n delay(0.5)\n LOGGER.debug('Started Java gateway')\nLOGGER.debug('Connecting to gateway from py4j')\ngate = JavaGateway()\nreturn gate",
"gate = Authentication.create_gateway()\njava_import(gate.jvm, 'com.splicemachine.shiro.Spli... | <|body_start_0|>
if 'gateway' not in os.popen('jps').read():
os.system('java gateway &')
delay(0.5)
LOGGER.debug('Started Java gateway')
LOGGER.debug('Connecting to gateway from py4j')
gate = JavaGateway()
return gate
<|end_body_0|>
<|body_start_1|>
... | Utilities to assist with Authentication | Authentication | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Authentication:
"""Utilities to assist with Authentication"""
def create_gateway():
"""Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object"""
<|body_0|>
def validate_auth(username: str, password: str) -> Optio... | stack_v2_sparse_classes_10k_train_001369 | 2,895 | permissive | [
{
"docstring": "Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object",
"name": "create_gateway",
"signature": "def create_gateway()"
},
{
"docstring": "This function uses the Shiro authentication API and retrieves whether or not the us... | 2 | stack_v2_sparse_classes_30k_train_000366 | Implement the Python class `Authentication` described below.
Class description:
Utilities to assist with Authentication
Method signatures and docstrings:
- def create_gateway(): Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object
- def validate_auth(userna... | Implement the Python class `Authentication` described below.
Class description:
Utilities to assist with Authentication
Method signatures and docstrings:
- def create_gateway(): Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object
- def validate_auth(userna... | 2f9a0d3d2814941c6bd78f9dcc019870a4e8c2da | <|skeleton|>
class Authentication:
"""Utilities to assist with Authentication"""
def create_gateway():
"""Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object"""
<|body_0|>
def validate_auth(username: str, password: str) -> Optio... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Authentication:
"""Utilities to assist with Authentication"""
def create_gateway():
"""Starts the java gateway server if it doesn't exist and creates the gateway :return: (Gateway) java gateway object"""
if 'gateway' not in os.popen('jps').read():
os.system('java gateway &')
... | the_stack_v2_python_sparse | shared/shared/services/authentication.py | myles-novick/ml-workflow | train | 0 |
1752802e88ede6bf7271518731223039f8b9cda2 | [
"self.c = c\nself.beadList: list[tuple[Position, Chapter]] = []\nself.beadPointer = -1\nself.skipBeadUpdate = False",
"c = self.c\nif g.unitTesting or not self.beadList:\n return\nprint(f'NodeHisory.beadList: {c.shortFileName()}:')\nfor i, data in enumerate(self.beadList):\n p, chapter = data\n p_s = p.h... | <|body_start_0|>
self.c = c
self.beadList: list[tuple[Position, Chapter]] = []
self.beadPointer = -1
self.skipBeadUpdate = False
<|end_body_0|>
<|body_start_1|>
c = self.c
if g.unitTesting or not self.beadList:
return
print(f'NodeHisory.beadList: {c.s... | A class encapsulating knowledge of visited nodes. | NodeHistory | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeHistory:
"""A class encapsulating knowledge of visited nodes."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for NodeHistory class."""
<|body_0|>
def dump(self) -> None:
"""Dump the beadList"""
<|body_1|>
def goNext(self) -> Optional[Position]:
... | stack_v2_sparse_classes_10k_train_001370 | 4,612 | permissive | [
{
"docstring": "Ctor for NodeHistory class.",
"name": "__init__",
"signature": "def __init__(self, c: Cmdr) -> None"
},
{
"docstring": "Dump the beadList",
"name": "dump",
"signature": "def dump(self) -> None"
},
{
"docstring": "Select the next node, if possible.",
"name": "g... | 6 | null | Implement the Python class `NodeHistory` described below.
Class description:
A class encapsulating knowledge of visited nodes.
Method signatures and docstrings:
- def __init__(self, c: Cmdr) -> None: Ctor for NodeHistory class.
- def dump(self) -> None: Dump the beadList
- def goNext(self) -> Optional[Position]: Sele... | Implement the Python class `NodeHistory` described below.
Class description:
A class encapsulating knowledge of visited nodes.
Method signatures and docstrings:
- def __init__(self, c: Cmdr) -> None: Ctor for NodeHistory class.
- def dump(self) -> None: Dump the beadList
- def goNext(self) -> Optional[Position]: Sele... | a3f6c3ebda805dc40cd93123948f153a26eccee5 | <|skeleton|>
class NodeHistory:
"""A class encapsulating knowledge of visited nodes."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for NodeHistory class."""
<|body_0|>
def dump(self) -> None:
"""Dump the beadList"""
<|body_1|>
def goNext(self) -> Optional[Position]:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NodeHistory:
"""A class encapsulating knowledge of visited nodes."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for NodeHistory class."""
self.c = c
self.beadList: list[tuple[Position, Chapter]] = []
self.beadPointer = -1
self.skipBeadUpdate = False
def dump... | the_stack_v2_python_sparse | leo/core/leoHistory.py | leo-editor/leo-editor | train | 1,671 |
e96945fababa77d483574550ab01855da9d66d98 | [
"user = get_authenticated_user()\nif not user.stripe_id:\n raise NotFound()\nreturn {'fields': get_invoice_fields(user)[0]}",
"user = get_authenticated_user()\nif not user.stripe_id:\n raise NotFound()\ndata = request.get_json()\ncreated_field = create_billing_invoice_field(user, data['title'], data['value'... | <|body_start_0|>
user = get_authenticated_user()
if not user.stripe_id:
raise NotFound()
return {'fields': get_invoice_fields(user)[0]}
<|end_body_0|>
<|body_start_1|>
user = get_authenticated_user()
if not user.stripe_id:
raise NotFound()
data = ... | Resource for listing and creating a user's custom invoice fields. | UserInvoiceFieldList | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserInvoiceFieldList:
"""Resource for listing and creating a user's custom invoice fields."""
def get(self):
"""List the invoice fields for the current user."""
<|body_0|>
def post(self):
"""Creates a new invoice field."""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_10k_train_001371 | 33,890 | permissive | [
{
"docstring": "List the invoice fields for the current user.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Creates a new invoice field.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005431 | Implement the Python class `UserInvoiceFieldList` described below.
Class description:
Resource for listing and creating a user's custom invoice fields.
Method signatures and docstrings:
- def get(self): List the invoice fields for the current user.
- def post(self): Creates a new invoice field. | Implement the Python class `UserInvoiceFieldList` described below.
Class description:
Resource for listing and creating a user's custom invoice fields.
Method signatures and docstrings:
- def get(self): List the invoice fields for the current user.
- def post(self): Creates a new invoice field.
<|skeleton|>
class Us... | e400a0c22c5f89dd35d571654b13d262b1f6e3b3 | <|skeleton|>
class UserInvoiceFieldList:
"""Resource for listing and creating a user's custom invoice fields."""
def get(self):
"""List the invoice fields for the current user."""
<|body_0|>
def post(self):
"""Creates a new invoice field."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserInvoiceFieldList:
"""Resource for listing and creating a user's custom invoice fields."""
def get(self):
"""List the invoice fields for the current user."""
user = get_authenticated_user()
if not user.stripe_id:
raise NotFound()
return {'fields': get_invoic... | the_stack_v2_python_sparse | endpoints/api/billing.py | quay/quay | train | 2,363 |
6c2ca81f10b03dab9a20586a6bca92323d023fb3 | [
"idx += 1\nself._attr_name = f'{entry[CONF_NAME]} {idx}'\nself._attr_device_class = entry.get(CONF_DEVICE_CLASS)\nself._attr_unique_id = entry.get(CONF_UNIQUE_ID)\nif self._attr_unique_id:\n self._attr_unique_id = f'{self._attr_unique_id}_{idx}'\nself._attr_available = False\nself._result_inx = idx\nsuper().__in... | <|body_start_0|>
idx += 1
self._attr_name = f'{entry[CONF_NAME]} {idx}'
self._attr_device_class = entry.get(CONF_DEVICE_CLASS)
self._attr_unique_id = entry.get(CONF_UNIQUE_ID)
if self._attr_unique_id:
self._attr_unique_id = f'{self._attr_unique_id}_{idx}'
self... | Modbus slave binary sensor. | SlaveSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlaveSensor:
"""Modbus slave binary sensor."""
def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None:
"""Initialize the Modbus binary sensor."""
<|body_0|>
async def async_added_to_hass(self) -> None:
""... | stack_v2_sparse_classes_10k_train_001372 | 5,764 | permissive | [
{
"docstring": "Initialize the Modbus binary sensor.",
"name": "__init__",
"signature": "def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None"
},
{
"docstring": "Handle entity which will be added.",
"name": "async_added_to_hass",
... | 3 | stack_v2_sparse_classes_30k_train_001021 | Implement the Python class `SlaveSensor` described below.
Class description:
Modbus slave binary sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None: Initialize the Modbus binary sensor.
- async def async_added_t... | Implement the Python class `SlaveSensor` described below.
Class description:
Modbus slave binary sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None: Initialize the Modbus binary sensor.
- async def async_added_t... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class SlaveSensor:
"""Modbus slave binary sensor."""
def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None:
"""Initialize the Modbus binary sensor."""
<|body_0|>
async def async_added_to_hass(self) -> None:
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SlaveSensor:
"""Modbus slave binary sensor."""
def __init__(self, coordinator: DataUpdateCoordinator[list[int] | None], idx: int, entry: dict[str, Any]) -> None:
"""Initialize the Modbus binary sensor."""
idx += 1
self._attr_name = f'{entry[CONF_NAME]} {idx}'
self._attr_de... | the_stack_v2_python_sparse | homeassistant/components/modbus/binary_sensor.py | home-assistant/core | train | 35,501 |
c496dbd0244bc28e482f95e7d831f9c6b753f613 | [
"self.device_bus = device_bus\nself.device_index = device_index\nself.disk_size_bytes = disk_size_bytes",
"if dictionary is None:\n return None\ndevice_bus = dictionary.get('deviceBus')\ndevice_index = dictionary.get('deviceIndex')\ndisk_size_bytes = dictionary.get('diskSizeBytes')\nreturn cls(device_bus, devi... | <|body_start_0|>
self.device_bus = device_bus
self.device_index = device_index
self.disk_size_bytes = disk_size_bytes
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
device_bus = dictionary.get('deviceBus')
device_index = dictionary.get('de... | Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes. | VirtualDiskConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VirtualDiskConfig:
"""Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes."""
def __ini... | stack_v2_sparse_classes_10k_train_001373 | 1,862 | permissive | [
{
"docstring": "Constructor for the VirtualDiskConfig class",
"name": "__init__",
"signature": "def __init__(self, device_bus=None, device_index=None, disk_size_bytes=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe... | 2 | null | Implement the Python class `VirtualDiskConfig` described below.
Class description:
Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int)... | Implement the Python class `VirtualDiskConfig` described below.
Class description:
Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int)... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class VirtualDiskConfig:
"""Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes."""
def __ini... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VirtualDiskConfig:
"""Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes."""
def __init__(self, dev... | the_stack_v2_python_sparse | cohesity_management_sdk/models/virtual_disk_config.py | cohesity/management-sdk-python | train | 24 |
b93ccbbeb49e048b9f874a28c38bd084eca037d4 | [
"context = request.environ['cinder.context']\ntrimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_type.get('is_public'))\nif context.authorize(policy.SHOW_ACCESS_POLICY, fatal=False):\n trimmed['group_specs'] = group_type.get('group_spec... | <|body_start_0|>
context = request.environ['cinder.context']
trimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_type.get('is_public'))
if context.authorize(policy.SHOW_ACCESS_POLICY, fatal=False):
trimmed['g... | ViewBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewBuilder:
def show(self, request, group_type, brief=False):
"""Trim away extraneous group type attributes."""
<|body_0|>
def index(self, request, group_types):
"""Index over trimmed group types."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
con... | stack_v2_sparse_classes_10k_train_001374 | 1,894 | permissive | [
{
"docstring": "Trim away extraneous group type attributes.",
"name": "show",
"signature": "def show(self, request, group_type, brief=False)"
},
{
"docstring": "Index over trimmed group types.",
"name": "index",
"signature": "def index(self, request, group_types)"
}
] | 2 | null | Implement the Python class `ViewBuilder` described below.
Class description:
Implement the ViewBuilder class.
Method signatures and docstrings:
- def show(self, request, group_type, brief=False): Trim away extraneous group type attributes.
- def index(self, request, group_types): Index over trimmed group types. | Implement the Python class `ViewBuilder` described below.
Class description:
Implement the ViewBuilder class.
Method signatures and docstrings:
- def show(self, request, group_type, brief=False): Trim away extraneous group type attributes.
- def index(self, request, group_types): Index over trimmed group types.
<|sk... | 04a5d6b8c28271f6aefe2bbae6a1e16c1c235835 | <|skeleton|>
class ViewBuilder:
def show(self, request, group_type, brief=False):
"""Trim away extraneous group type attributes."""
<|body_0|>
def index(self, request, group_types):
"""Index over trimmed group types."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ViewBuilder:
def show(self, request, group_type, brief=False):
"""Trim away extraneous group type attributes."""
context = request.environ['cinder.context']
trimmed = dict(id=group_type.get('id'), name=group_type.get('name'), description=group_type.get('description'), is_public=group_t... | the_stack_v2_python_sparse | cinder/api/v3/views/group_types.py | LINBIT/openstack-cinder | train | 9 | |
c8d440779e232d56375599b688c7b0d572231148 | [
"self.create_pst = create_pst\nself.option_flags = option_flags\nself.pst_name_prefix = pst_name_prefix\nself.pst_password = pst_password\nself.pst_size_threshold = pst_size_threshold",
"if dictionary is None:\n return None\ncreate_pst = dictionary.get('createPst')\noption_flags = dictionary.get('optionFlags')... | <|body_start_0|>
self.create_pst = create_pst
self.option_flags = option_flags
self.pst_name_prefix = pst_name_prefix
self.pst_password = pst_password
self.pst_size_threshold = pst_size_threshold
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return N... | Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ConvertEwsToPst flags of type ConvertEwsToPSTOptionFlags. pst_name_prefix (string): Name pr... | EwsToPstConversionParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EwsToPstConversionParams:
"""Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ConvertEwsToPst flags of type ConvertEw... | stack_v2_sparse_classes_10k_train_001375 | 2,573 | permissive | [
{
"docstring": "Constructor for the EwsToPstConversionParams class",
"name": "__init__",
"signature": "def __init__(self, create_pst=None, option_flags=None, pst_name_prefix=None, pst_password=None, pst_size_threshold=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary ... | 2 | stack_v2_sparse_classes_30k_train_005044 | Implement the Python class `EwsToPstConversionParams` described below.
Class description:
Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ... | Implement the Python class `EwsToPstConversionParams` described below.
Class description:
Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class EwsToPstConversionParams:
"""Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ConvertEwsToPst flags of type ConvertEw... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EwsToPstConversionParams:
"""Implementation of the 'EwsToPstConversionParams' model. TODO: type description here. Attributes: create_pst (bool): Create Msg files or Pst. false value indicates only create msg files. Default value is true. option_flags (int): ConvertEwsToPst flags of type ConvertEwsToPSTOptionF... | the_stack_v2_python_sparse | cohesity_management_sdk/models/ews_to_pst_conversion_params.py | cohesity/management-sdk-python | train | 24 |
512b145a65da12587d310400d972040efbcf7822 | [
"self.gate_idx = np.random.randint(0, self.n_expert, size=(200,)).astype(self.dtype)\nexpert_count = count(self.gate_idx, self.n_expert * self.n_worker)\ncapacity = np.random.randint(10, 200, size=(self.n_expert,))\nself.expert_count = limit_by_capacity(expert_count, capacity, self.n_worker).astype(self.dtype)\nsel... | <|body_start_0|>
self.gate_idx = np.random.randint(0, self.n_expert, size=(200,)).astype(self.dtype)
expert_count = count(self.gate_idx, self.n_expert * self.n_worker)
capacity = np.random.randint(10, 200, size=(self.n_expert,))
self.expert_count = limit_by_capacity(expert_count, capacit... | TestPruneGateByCapacityAPI | TestPruneGateByCapacityAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPruneGateByCapacityAPI:
"""TestPruneGateByCapacityAPI"""
def init_test_case(self):
"""init_test_case"""
<|body_0|>
def setUp(self):
"""setUp"""
<|body_1|>
def test_MoE_prune_gate_by_capacity_static(self):
"""test_MoE_prune_gate_by_capacit... | stack_v2_sparse_classes_10k_train_001376 | 4,813 | no_license | [
{
"docstring": "init_test_case",
"name": "init_test_case",
"signature": "def init_test_case(self)"
},
{
"docstring": "setUp",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "test_MoE_prune_gate_by_capacity_static",
"name": "test_MoE_prune_gate_by_capacity_s... | 4 | stack_v2_sparse_classes_30k_test_000007 | Implement the Python class `TestPruneGateByCapacityAPI` described below.
Class description:
TestPruneGateByCapacityAPI
Method signatures and docstrings:
- def init_test_case(self): init_test_case
- def setUp(self): setUp
- def test_MoE_prune_gate_by_capacity_static(self): test_MoE_prune_gate_by_capacity_static
- def ... | Implement the Python class `TestPruneGateByCapacityAPI` described below.
Class description:
TestPruneGateByCapacityAPI
Method signatures and docstrings:
- def init_test_case(self): init_test_case
- def setUp(self): setUp
- def test_MoE_prune_gate_by_capacity_static(self): test_MoE_prune_gate_by_capacity_static
- def ... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class TestPruneGateByCapacityAPI:
"""TestPruneGateByCapacityAPI"""
def init_test_case(self):
"""init_test_case"""
<|body_0|>
def setUp(self):
"""setUp"""
<|body_1|>
def test_MoE_prune_gate_by_capacity_static(self):
"""test_MoE_prune_gate_by_capacit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPruneGateByCapacityAPI:
"""TestPruneGateByCapacityAPI"""
def init_test_case(self):
"""init_test_case"""
self.gate_idx = np.random.randint(0, self.n_expert, size=(200,)).astype(self.dtype)
expert_count = count(self.gate_idx, self.n_expert * self.n_worker)
capacity = np.... | the_stack_v2_python_sparse | distributed/CE_API/case/dist_MoE_prune_gate_by_capacity.py | PaddlePaddle/PaddleTest | train | 42 |
ebcffbf9dd917968fd195e6fbf4d98370e704ca5 | [
"distance = len(words)\nidx1 = idx2 = -1\nfor i, w in enumerate(words):\n if w == word1:\n idx1 = i\n if w == word2:\n idx2 = i\n if idx2 != -1 and idx1 != -1:\n distance = min(distance, abs(idx1 - idx2))\nreturn distance",
"distance = len(words)\nidx1 = idx2 = -1\nfor i, w in enumer... | <|body_start_0|>
distance = len(words)
idx1 = idx2 = -1
for i, w in enumerate(words):
if w == word1:
idx1 = i
if w == word2:
idx2 = i
if idx2 != -1 and idx1 != -1:
distance = min(distance, abs(idx1 - idx2))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def shortestDistance(self, words, word1, word2):
""":type words: list[str] :type word1: str :type word2: str :rtype: int"""
<|body_0|>
def shortestDistanceEqual(self, words, word1, word2):
""":type words: list[str] :type word1: str :type word2: str :rtype: ... | stack_v2_sparse_classes_10k_train_001377 | 2,113 | no_license | [
{
"docstring": ":type words: list[str] :type word1: str :type word2: str :rtype: int",
"name": "shortestDistance",
"signature": "def shortestDistance(self, words, word1, word2)"
},
{
"docstring": ":type words: list[str] :type word1: str :type word2: str :rtype: int",
"name": "shortestDistanc... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestDistance(self, words, word1, word2): :type words: list[str] :type word1: str :type word2: str :rtype: int
- def shortestDistanceEqual(self, words, word1, word2): :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestDistance(self, words, word1, word2): :type words: list[str] :type word1: str :type word2: str :rtype: int
- def shortestDistanceEqual(self, words, word1, word2): :typ... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def shortestDistance(self, words, word1, word2):
""":type words: list[str] :type word1: str :type word2: str :rtype: int"""
<|body_0|>
def shortestDistanceEqual(self, words, word1, word2):
""":type words: list[str] :type word1: str :type word2: str :rtype: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def shortestDistance(self, words, word1, word2):
""":type words: list[str] :type word1: str :type word2: str :rtype: int"""
distance = len(words)
idx1 = idx2 = -1
for i, w in enumerate(words):
if w == word1:
idx1 = i
if w == wor... | the_stack_v2_python_sparse | S/ShortestWordDistance.py | bssrdf/pyleet | train | 2 | |
c20c59e628155f5c19be50f7e75e804b5e8ac08e | [
"create_url = f'https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token={access_token}'\ndata = {'tagname': '测试', 'tagid': tagid}\nr = requests.post(url=create_url, json=data)\nreturn r.json()",
"update_url = f'https://qyapi.weixin.qq.com/cgi-bin/tag/update?access_token={access_token}'\ndata = {'tagname': '开发... | <|body_start_0|>
create_url = f'https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token={access_token}'
data = {'tagname': '测试', 'tagid': tagid}
r = requests.post(url=create_url, json=data)
return r.json()
<|end_body_0|>
<|body_start_1|>
update_url = f'https://qyapi.weixin.q... | 标签管理 | Label | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Label:
"""标签管理"""
def create_label(self, access_token, tagid):
"""创建标签"""
<|body_0|>
def update_label(self, access_token, tagid):
"""修改标签名字"""
<|body_1|>
def delete_label(self, access_token, tagid):
"""删除标签"""
<|body_2|>
def get_... | stack_v2_sparse_classes_10k_train_001378 | 2,002 | no_license | [
{
"docstring": "创建标签",
"name": "create_label",
"signature": "def create_label(self, access_token, tagid)"
},
{
"docstring": "修改标签名字",
"name": "update_label",
"signature": "def update_label(self, access_token, tagid)"
},
{
"docstring": "删除标签",
"name": "delete_label",
"sign... | 4 | stack_v2_sparse_classes_30k_train_001873 | Implement the Python class `Label` described below.
Class description:
标签管理
Method signatures and docstrings:
- def create_label(self, access_token, tagid): 创建标签
- def update_label(self, access_token, tagid): 修改标签名字
- def delete_label(self, access_token, tagid): 删除标签
- def get_label_memberlist(self, access_token): 获取... | Implement the Python class `Label` described below.
Class description:
标签管理
Method signatures and docstrings:
- def create_label(self, access_token, tagid): 创建标签
- def update_label(self, access_token, tagid): 修改标签名字
- def delete_label(self, access_token, tagid): 删除标签
- def get_label_memberlist(self, access_token): 获取... | 26b4211a9548a96838bb571030c59bee7c1ad77a | <|skeleton|>
class Label:
"""标签管理"""
def create_label(self, access_token, tagid):
"""创建标签"""
<|body_0|>
def update_label(self, access_token, tagid):
"""修改标签名字"""
<|body_1|>
def delete_label(self, access_token, tagid):
"""删除标签"""
<|body_2|>
def get_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Label:
"""标签管理"""
def create_label(self, access_token, tagid):
"""创建标签"""
create_url = f'https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token={access_token}'
data = {'tagname': '测试', 'tagid': tagid}
r = requests.post(url=create_url, json=data)
return r.json(... | the_stack_v2_python_sparse | Python_testing/Work9/api/label.py | Lcq-z/Pythontestpro | train | 0 |
0484230a889cb8bc673e56ff8162f2fbf5ba242b | [
"n = len(nums)\nleft, right = ([0] * (n + 1), [0] * (n + 1))\nfor i in range(1, n + 1):\n left[i] = left[i - 1] + nums[i - 1]\nfor i in range(n - 1, -1, -1):\n right[i] = right[i + 1] + nums[i]\nres = [0] * n\nfor i in range(n):\n res[i] = nums[i] * (2 * i - n + 1) - left[i] + right[i + 1]\nreturn res",
... | <|body_start_0|>
n = len(nums)
left, right = ([0] * (n + 1), [0] * (n + 1))
for i in range(1, n + 1):
left[i] = left[i - 1] + nums[i - 1]
for i in range(n - 1, -1, -1):
right[i] = right[i + 1] + nums[i]
res = [0] * n
for i in range(n):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getSumAbsoluteDifferences(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def getSumAbsoluteDifferencesLessSpace(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_001379 | 1,971 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "getSumAbsoluteDifferences",
"signature": "def getSumAbsoluteDifferences(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "getSumAbsoluteDifferencesLessSpace",
"signature": "def getSumAbsol... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSumAbsoluteDifferences(self, nums): :type nums: List[int] :rtype: List[int]
- def getSumAbsoluteDifferencesLessSpace(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 getSumAbsoluteDifferences(self, nums): :type nums: List[int] :rtype: List[int]
- def getSumAbsoluteDifferencesLessSpace(self, nums): :type nums: List[int] :rtype: List[int]
... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def getSumAbsoluteDifferences(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def getSumAbsoluteDifferencesLessSpace(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def getSumAbsoluteDifferences(self, nums):
""":type nums: List[int] :rtype: List[int]"""
n = len(nums)
left, right = ([0] * (n + 1), [0] * (n + 1))
for i in range(1, n + 1):
left[i] = left[i - 1] + nums[i - 1]
for i in range(n - 1, -1, -1):
... | the_stack_v2_python_sparse | S/SumofAbsoluteDifferencesinaSortedArray.py | bssrdf/pyleet | train | 2 | |
9657ad66cc2346c3209b516edf30743f24a4e513 | [
"today_str = pendulum.today('UTC').format('YYYY-MM-DD')\ninfo = self.inner_compute_last_repair_info(today_str)\nlast_repair_info = info['last_repair_info']\ninfo_cache = info['info_cache']\nfor record in self:\n if record.id in last_repair_info:\n record.last_mile_repair_date = last_repair_info[record.id]... | <|body_start_0|>
today_str = pendulum.today('UTC').format('YYYY-MM-DD')
info = self.inner_compute_last_repair_info(today_str)
last_repair_info = info['last_repair_info']
info_cache = info['info_cache']
for record in self:
if record.id in last_repair_info:
... | 车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段 | TrainDev | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
<|body_0|>
def inner_compute_last_repair_info(self, date_str):
"""计算最终的修程信息 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
today_... | stack_v2_sparse_classes_10k_train_001380 | 2,455 | no_license | [
{
"docstring": "计算上次里程修信息 :return:",
"name": "_compute_last_repair_info",
"signature": "def _compute_last_repair_info(self)"
},
{
"docstring": "计算最终的修程信息 :return:",
"name": "inner_compute_last_repair_info",
"signature": "def inner_compute_last_repair_info(self, date_str)"
}
] | 2 | null | Implement the Python class `TrainDev` described below.
Class description:
车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段
Method signatures and docstrings:
- def _compute_last_repair_info(self): 计算上次里程修信息 :return:
- def inner_compute_last_repair_info(self, date_str): 计算最终的修程信息 :return: | Implement the Python class `TrainDev` described below.
Class description:
车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段
Method signatures and docstrings:
- def _compute_last_repair_info(self): 计算上次里程修信息 :return:
- def inner_compute_last_repair_info(self, date_str): 计算最终的修程信息 :return:
<|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设... | 13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9 | <|skeleton|>
class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
<|body_0|>
def inner_compute_last_repair_info(self, date_str):
"""计算最终的修程信息 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrainDev:
"""车辆设备, 说明,由于初期设计原因,多了一堆的废弃字段"""
def _compute_last_repair_info(self):
"""计算上次里程修信息 :return:"""
today_str = pendulum.today('UTC').format('YYYY-MM-DD')
info = self.inner_compute_last_repair_info(today_str)
last_repair_info = info['last_repair_info']
info_c... | the_stack_v2_python_sparse | mdias_addons/metro_park_base_data_10/models/train_dev.py | rezaghanimi/main_mdias | train | 0 |
8b090c85807616328655677f860db8276c8c078e | [
"super().__init__(name=name)\nself._loss = loss if loss is not None else tf.keras.losses.BinaryCrossentropy()\nself._ranking_metrics = metrics or []\nself._prediction_metrics = prediction_metrics or []\nself._label_metrics = label_metrics or []\nself._loss_metrics = loss_metrics or []",
"loss = self._loss(y_true=... | <|body_start_0|>
super().__init__(name=name)
self._loss = loss if loss is not None else tf.keras.losses.BinaryCrossentropy()
self._ranking_metrics = metrics or []
self._prediction_metrics = prediction_metrics or []
self._label_metrics = label_metrics or []
self._loss_metr... | A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few dozen candidates. This task helps wit... | Ranking | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ranking:
"""A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few do... | stack_v2_sparse_classes_10k_train_001381 | 4,074 | permissive | [
{
"docstring": "Initializes the task. Args: loss: Loss function. Defaults to BinaryCrossentropy. metrics: List of Keras metrics to be evaluated. prediction_metrics: List of Keras metrics used to summarize the predictions. label_metrics: List of Keras metrics used to summarize the labels. loss_metrics: List of K... | 2 | stack_v2_sparse_classes_30k_train_007192 | Implement the Python class `Ranking` described below.
Class description:
A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model t... | Implement the Python class `Ranking` described below.
Class description:
A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model t... | f4f42c1a183a262539e21f5ab8d25f0dc3e5621d | <|skeleton|>
class Ranking:
"""A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few do... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Ranking:
"""A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few dozen candidate... | the_stack_v2_python_sparse | tensorflow_recommenders/tasks/ranking.py | tensorflow/recommenders | train | 1,666 |
38dd0bdbac31d9409157cebea6ff65cae258f1f6 | [
"self.filename = filename\nself.input_queue = input_queue\nself.pcap_writer = None\nself.snaplen = 0\nself.linktype = link_type\nself.EXIT = multiprocessing.Event()\nmultiprocessing.Process.__init__(self)",
"logger.debug('Destroying PCAP Writer.')\nif self.pcap_writer is not None:\n try:\n self.pcap_wri... | <|body_start_0|>
self.filename = filename
self.input_queue = input_queue
self.pcap_writer = None
self.snaplen = 0
self.linktype = link_type
self.EXIT = multiprocessing.Event()
multiprocessing.Process.__init__(self)
<|end_body_0|>
<|body_start_1|>
logger.d... | Very simple class to create a pcap file from a network stream | PcapWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PcapWriter:
"""Very simple class to create a pcap file from a network stream"""
def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB):
"""Initialize our pcap writer"""
<|body_0|>
def __del__(self):
"""Try to close our file nicely"""
<|... | stack_v2_sparse_classes_10k_train_001382 | 3,619 | no_license | [
{
"docstring": "Initialize our pcap writer",
"name": "__init__",
"signature": "def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB)"
},
{
"docstring": "Try to close our file nicely",
"name": "__del__",
"signature": "def __del__(self)"
},
{
"docstring": "Read ... | 4 | stack_v2_sparse_classes_30k_train_004081 | Implement the Python class `PcapWriter` described below.
Class description:
Very simple class to create a pcap file from a network stream
Method signatures and docstrings:
- def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): Initialize our pcap writer
- def __del__(self): Try to close our file... | Implement the Python class `PcapWriter` described below.
Class description:
Very simple class to create a pcap file from a network stream
Method signatures and docstrings:
- def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): Initialize our pcap writer
- def __del__(self): Try to close our file... | 8f92c4efb94061cb08b7e9b0ff96346565c12653 | <|skeleton|>
class PcapWriter:
"""Very simple class to create a pcap file from a network stream"""
def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB):
"""Initialize our pcap writer"""
<|body_0|>
def __del__(self):
"""Try to close our file nicely"""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PcapWriter:
"""Very simple class to create a pcap file from a network stream"""
def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB):
"""Initialize our pcap writer"""
self.filename = filename
self.input_queue = input_queue
self.pcap_writer = None
... | the_stack_v2_python_sparse | python-lophi/lophi/capture/network.py | puppycodes/LO-PHI | train | 0 |
c3c6c1f3ea5634d704e09f64c83ff1c7c8f5e5a1 | [
"if not lang:\n lang = SettingsDAO().get_value('language', str)\nself.set_many(True)\nfor name, value in strValues.items():\n data = {'lang': lang, 'target_id': objectId, 'type': objectType.value, 'name': name, 'value': value}\n self.insert('translates', data)\nself.insert_many_execute()\nself.set_many(Fal... | <|body_start_0|>
if not lang:
lang = SettingsDAO().get_value('language', str)
self.set_many(True)
for name, value in strValues.items():
data = {'lang': lang, 'target_id': objectId, 'type': objectType.value, 'name': name, 'value': value}
self.insert('translates... | ObjectDatabase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectDatabase:
def insert_translate(self, strValues: dict, lang: str, objectId: int, objectType: ObjectType) -> None:
"""Insert translate for object to database :param strValues: dictionary of names and values :param lang: lang of translate :param objectId: id ob object :param objectTyp... | stack_v2_sparse_classes_10k_train_001383 | 2,991 | no_license | [
{
"docstring": "Insert translate for object to database :param strValues: dictionary of names and values :param lang: lang of translate :param objectId: id ob object :param objectType: objectType of object",
"name": "insert_translate",
"signature": "def insert_translate(self, strValues: dict, lang: str,... | 2 | stack_v2_sparse_classes_30k_train_004117 | Implement the Python class `ObjectDatabase` described below.
Class description:
Implement the ObjectDatabase class.
Method signatures and docstrings:
- def insert_translate(self, strValues: dict, lang: str, objectId: int, objectType: ObjectType) -> None: Insert translate for object to database :param strValues: dicti... | Implement the Python class `ObjectDatabase` described below.
Class description:
Implement the ObjectDatabase class.
Method signatures and docstrings:
- def insert_translate(self, strValues: dict, lang: str, objectId: int, objectType: ObjectType) -> None: Insert translate for object to database :param strValues: dicti... | 40b088e061042599cbb30373ac229d37dddc01e6 | <|skeleton|>
class ObjectDatabase:
def insert_translate(self, strValues: dict, lang: str, objectId: int, objectType: ObjectType) -> None:
"""Insert translate for object to database :param strValues: dictionary of names and values :param lang: lang of translate :param objectId: id ob object :param objectTyp... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObjectDatabase:
def insert_translate(self, strValues: dict, lang: str, objectId: int, objectType: ObjectType) -> None:
"""Insert translate for object to database :param strValues: dictionary of names and values :param lang: lang of translate :param objectId: id ob object :param objectType: objectType ... | the_stack_v2_python_sparse | Program/data/database/ObjectDatabase.py | Wilson194/DeskChar | train | 0 | |
dae094eabed79e27474fcbd601057fc2bcc0785e | [
"self.desired_caps = {'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': APP_PACKAGE, 'appActivity': APP_ACTIVITY}\nself.driver = webdriver.Remote(DRIVER_SERVER, self.desired_caps)\nself.wait = WebDriverWait(self.driver, TIMEOUT)\nself.client = MongoClient('localhost')\nself.db = self.client[DB_DB]\... | <|body_start_0|>
self.desired_caps = {'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': APP_PACKAGE, 'appActivity': APP_ACTIVITY}
self.driver = webdriver.Remote(DRIVER_SERVER, self.desired_caps)
self.wait = WebDriverWait(self.driver, TIMEOUT)
self.client = MongoClient('l... | Moments | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Moments:
def __init__(self):
"""初始化"""
<|body_0|>
def login(self):
"""微信登录"""
<|body_1|>
def enter(self):
"""进入朋友圈"""
<|body_2|>
def crawl(self):
"""爬去"""
<|body_3|>
def main(self):
"""住函数入口"""
<|... | stack_v2_sparse_classes_10k_train_001384 | 3,140 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "微信登录",
"name": "login",
"signature": "def login(self)"
},
{
"docstring": "进入朋友圈",
"name": "enter",
"signature": "def enter(self)"
},
{
"docstring": "爬去",
"name": "cr... | 5 | stack_v2_sparse_classes_30k_train_001738 | Implement the Python class `Moments` described below.
Class description:
Implement the Moments class.
Method signatures and docstrings:
- def __init__(self): 初始化
- def login(self): 微信登录
- def enter(self): 进入朋友圈
- def crawl(self): 爬去
- def main(self): 住函数入口 | Implement the Python class `Moments` described below.
Class description:
Implement the Moments class.
Method signatures and docstrings:
- def __init__(self): 初始化
- def login(self): 微信登录
- def enter(self): 进入朋友圈
- def crawl(self): 爬去
- def main(self): 住函数入口
<|skeleton|>
class Moments:
def __init__(self):
... | a7d83b58ef95806f061f375952db604afe98bc13 | <|skeleton|>
class Moments:
def __init__(self):
"""初始化"""
<|body_0|>
def login(self):
"""微信登录"""
<|body_1|>
def enter(self):
"""进入朋友圈"""
<|body_2|>
def crawl(self):
"""爬去"""
<|body_3|>
def main(self):
"""住函数入口"""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Moments:
def __init__(self):
"""初始化"""
self.desired_caps = {'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': APP_PACKAGE, 'appActivity': APP_ACTIVITY}
self.driver = webdriver.Remote(DRIVER_SERVER, self.desired_caps)
self.wait = WebDriverWait(self.driver, TIMEO... | the_stack_v2_python_sparse | Python3-Spider-Actual-Combat/c11/Moments.py | xueyes/py3_study | train | 1 | |
6de0436abd47ba94fac9bb05fdbe77550bf7c91f | [
"self.action: Action = kargs.pop('action')\nsuper().__init__(*args, **kargs)\nself.set_field_from_dict('subject')\nif len(settings.CANVAS_INFO_DICT) > 1:\n self.fields['target_url'] = forms.ChoiceField(initial=self._FormWithPayload__form_info.get('target_url', None), required=True, choices=[('', '---')] + [(key,... | <|body_start_0|>
self.action: Action = kargs.pop('action')
super().__init__(*args, **kargs)
self.set_field_from_dict('subject')
if len(settings.CANVAS_INFO_DICT) > 1:
self.fields['target_url'] = forms.ChoiceField(initial=self._FormWithPayload__form_info.get('target_url', None... | Form to process information to run a Canvas Email action. | CanvasEmailActionForm | [
"MIT",
"LGPL-2.0-or-later",
"Python-2.0",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CanvasEmailActionForm:
"""Form to process information to run a Canvas Email action."""
def __init__(self, *args, **kargs):
"""Store the action and modify certain field data."""
<|body_0|>
def clean(self):
"""Store the target_url if not part of the form"""
... | stack_v2_sparse_classes_10k_train_001385 | 20,237 | permissive | [
{
"docstring": "Store the action and modify certain field data.",
"name": "__init__",
"signature": "def __init__(self, *args, **kargs)"
},
{
"docstring": "Store the target_url if not part of the form",
"name": "clean",
"signature": "def clean(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004125 | Implement the Python class `CanvasEmailActionForm` described below.
Class description:
Form to process information to run a Canvas Email action.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store the action and modify certain field data.
- def clean(self): Store the target_url if not part o... | Implement the Python class `CanvasEmailActionForm` described below.
Class description:
Form to process information to run a Canvas Email action.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store the action and modify certain field data.
- def clean(self): Store the target_url if not part o... | 5473e9faa24c71a2a1102d47ebc2cbf27608e42a | <|skeleton|>
class CanvasEmailActionForm:
"""Form to process information to run a Canvas Email action."""
def __init__(self, *args, **kargs):
"""Store the action and modify certain field data."""
<|body_0|>
def clean(self):
"""Store the target_url if not part of the form"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CanvasEmailActionForm:
"""Form to process information to run a Canvas Email action."""
def __init__(self, *args, **kargs):
"""Store the action and modify certain field data."""
self.action: Action = kargs.pop('action')
super().__init__(*args, **kargs)
self.set_field_from_d... | the_stack_v2_python_sparse | ontask/action/forms/run.py | LucasFranciscoCorreia/ontask_b | train | 0 |
4d312b627466621e5c71ccf2617988a108323fbb | [
"super(FinalizeSlicedDownloadTask, self).__init__()\nself._source_resource = source_resource\nself._destination_resource = destination_resource",
"tracker_file_util.delete_download_tracker_files(self._destination_resource.storage_url)\nwith files.BinaryFileReader(self._destination_resource.storage_url.object_name... | <|body_start_0|>
super(FinalizeSlicedDownloadTask, self).__init__()
self._source_resource = source_resource
self._destination_resource = destination_resource
<|end_body_0|>
<|body_start_1|>
tracker_file_util.delete_download_tracker_files(self._destination_resource.storage_url)
w... | Performs final steps of sliced download. | FinalizeSlicedDownloadTask | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, destination_resource):
"""Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contain object's metadata for checking content encoding. destin... | stack_v2_sparse_classes_10k_train_001386 | 3,847 | permissive | [
{
"docstring": "Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contain object's metadata for checking content encoding. destination_resource (resource_reference.FileObjectResource): Must contain local filesystem path to downloaded object.",
"name": "__init__",
"signa... | 2 | stack_v2_sparse_classes_30k_val_000298 | Implement the Python class `FinalizeSlicedDownloadTask` described below.
Class description:
Performs final steps of sliced download.
Method signatures and docstrings:
- def __init__(self, source_resource, destination_resource): Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contai... | Implement the Python class `FinalizeSlicedDownloadTask` described below.
Class description:
Performs final steps of sliced download.
Method signatures and docstrings:
- def __init__(self, source_resource, destination_resource): Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contai... | 849d09dd7863efecbdf4072a504e1554e119f6ae | <|skeleton|>
class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, destination_resource):
"""Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contain object's metadata for checking content encoding. destin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, destination_resource):
"""Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contain object's metadata for checking content encoding. destination_resourc... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/tasks/cp/finalize_sliced_download_task.py | PrateekKhatri/gcloud_cli | train | 0 |
cf5ef9679cd1ec863b2ee1a29df0912ac42c1207 | [
"if new_server_name:\n srv_dyn.stop()\n srv_dyn = self.get_server(new_server_name)\n srv_dyn.start()\nclient = self.get_client('client')\nif isinstance(client, Wrk):\n client.duration = self.min_duration\nelse:\n client.options[0] += f' --duration {self.min_duration}'\nclient.start()\nself.wait_while... | <|body_start_0|>
if new_server_name:
srv_dyn.stop()
srv_dyn = self.get_server(new_server_name)
srv_dyn.start()
client = self.get_client('client')
if isinstance(client, Wrk):
client.duration = self.min_duration
else:
client.optio... | Check that server weight is re-calculated based on it's performance. | RatioDynamic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RatioDynamic:
"""Check that server weight is re-calculated based on it's performance."""
def run_test(self, srv_const, srv_dyn, new_server_name=None):
"""Run wrk and get performance statistics from backends and Tempesta. If 'new_server_name' of 'srv_dyn' is set, first reload its conf... | stack_v2_sparse_classes_10k_train_001387 | 8,514 | no_license | [
{
"docstring": "Run wrk and get performance statistics from backends and Tempesta. If 'new_server_name' of 'srv_dyn' is set, first reload its configuration.",
"name": "run_test",
"signature": "def run_test(self, srv_const, srv_dyn, new_server_name=None)"
},
{
"docstring": "Calculate weights of s... | 3 | null | Implement the Python class `RatioDynamic` described below.
Class description:
Check that server weight is re-calculated based on it's performance.
Method signatures and docstrings:
- def run_test(self, srv_const, srv_dyn, new_server_name=None): Run wrk and get performance statistics from backends and Tempesta. If 'ne... | Implement the Python class `RatioDynamic` described below.
Class description:
Check that server weight is re-calculated based on it's performance.
Method signatures and docstrings:
- def run_test(self, srv_const, srv_dyn, new_server_name=None): Run wrk and get performance statistics from backends and Tempesta. If 'ne... | d56358ea653dbb367624937197ce5e489abf0b00 | <|skeleton|>
class RatioDynamic:
"""Check that server weight is re-calculated based on it's performance."""
def run_test(self, srv_const, srv_dyn, new_server_name=None):
"""Run wrk and get performance statistics from backends and Tempesta. If 'new_server_name' of 'srv_dyn' is set, first reload its conf... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RatioDynamic:
"""Check that server weight is re-calculated based on it's performance."""
def run_test(self, srv_const, srv_dyn, new_server_name=None):
"""Run wrk and get performance statistics from backends and Tempesta. If 'new_server_name' of 'srv_dyn' is set, first reload its configuration."""... | the_stack_v2_python_sparse | t_sched/test_ratio_dynamic_recalc.py | tempesta-tech/tempesta-test | train | 13 |
572d5d12bb177bc53625d3de3b5fa50ae218e790 | [
"self.dist = dist\nself.alias_initialisation()\nself.table_prob_list = list(self.table_prob)",
"n = len(self.dist)\nself.table_prob = {}\nself.table_alias = {}\nscaled_prob = {}\nsmall = []\nlarge = []\nfor o, p in self.dist.items():\n scaled_prob[o] = Decimal(p) * n\n if scaled_prob[o] < 1:\n small.... | <|body_start_0|>
self.dist = dist
self.alias_initialisation()
self.table_prob_list = list(self.table_prob)
<|end_body_0|>
<|body_start_1|>
n = len(self.dist)
self.table_prob = {}
self.table_alias = {}
scaled_prob = {}
small = []
large = []
... | A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/). | VoseAlias | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VoseAlias:
"""A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/)."""
def __init__(self, dist):
""... | stack_v2_sparse_classes_10k_train_001388 | 9,862 | permissive | [
{
"docstring": "Given a definition try matching a word to the definition :) Parameters ---------- key : str Your dictionary.com api key wordlist : str Path to any wordlist you want by default it uses the OSX built in word list Raises ------ TypeError If the randomly generated word is not found on dictionary.com... | 4 | stack_v2_sparse_classes_30k_train_004981 | Implement the Python class `VoseAlias` described below.
Class description:
A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).
Meth... | Implement the Python class `VoseAlias` described below.
Class description:
A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/).
Meth... | c61bbe8a41dcd76898813c846ea99a275d0af6f3 | <|skeleton|>
class VoseAlias:
"""A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/)."""
def __init__(self, dist):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VoseAlias:
"""A probability distribution for discrete weighted random variables and its probability/alias tables for efficient sampling via Vose's Alias Method (a good explanation of which can be found at http://www.keithschwarz.com/darts-dice-coins/)."""
def __init__(self, dist):
"""Given a defi... | the_stack_v2_python_sparse | src/dictogram.py | imthaghost/tweetGen | train | 1 |
0996e31f12ab51a6a7af4eaf175549f278da21b8 | [
"result = do(self, platform)\nlogging.info('GET charge result: %s' % result)\nself.write(result)",
"result = do(self, platform)\nlogging.info('POST charge result: %s' % result)\nself.write(result)"
] | <|body_start_0|>
result = do(self, platform)
logging.info('GET charge result: %s' % result)
self.write(result)
<|end_body_0|>
<|body_start_1|>
result = do(self, platform)
logging.info('POST charge result: %s' % result)
self.write(result)
<|end_body_1|>
| Notification | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notification:
def get(self, platform):
"""1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx"""
<|body_0|>
def post(self, platf... | stack_v2_sparse_classes_10k_train_001389 | 1,263 | no_license | [
{
"docstring": "1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx",
"name": "get",
"signature": "def get(self, platform)"
},
{
"docstring": "1.XY S... | 2 | stack_v2_sparse_classes_30k_train_006166 | Implement the Python class `Notification` described below.
Class description:
Implement the Notification class.
Method signatures and docstrings:
- def get(self, platform): 1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&s... | Implement the Python class `Notification` described below.
Class description:
Implement the Notification class.
Method signatures and docstrings:
- def get(self, platform): 1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&s... | 4f430d5631b1118ad251bdaf8384bc0dbdaf07b9 | <|skeleton|>
class Notification:
def get(self, platform):
"""1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx"""
<|body_0|>
def post(self, platf... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Notification:
def get(self, platform):
"""1.易接SDK支付: alliance.xtzj.luckyfuturetech.com/notification/EZ?app=1234567890ABCDEF&cbi=CBI123456&ct=1376578903&fee=100&pt=1376577801&ssid=123456&st=1&tcd=137657AVDEDFS&uid=1234&ver=1&sign=xxxxxxxxxxx"""
result = do(self, platform)
logging.info('... | the_stack_v2_python_sparse | server/apps/handlers/charge.py | wade333777/cocos-js-tips | train | 0 | |
7d6244a4a3acfef1ac86bfa6758fdce17d50565c | [
"self.name = name\nmodule = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name))\nself.send_menu = getattr(module, 'send_{menu_name}_menu'.format(menu_name=self.name))",
"say_command_manager.register_commands((self.name, '!' + self.name), _send_command_menu)\nsay_command_manager.register_co... | <|body_start_0|>
self.name = name
module = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name))
self.send_menu = getattr(module, 'send_{menu_name}_menu'.format(menu_name=self.name))
<|end_body_0|>
<|body_start_1|>
say_command_manager.register_commands((self.name, ... | Class used to register a command to its menu. | _MenuCommand | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _MenuCommand:
"""Class used to register a command to its menu."""
def __init__(self, name):
"""Store the base name and send_menu callback."""
<|body_0|>
def register_commands(self):
"""Register the public, private, and client commands."""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_001390 | 4,337 | no_license | [
{
"docstring": "Store the base name and send_menu callback.",
"name": "__init__",
"signature": "def __init__(self, name)"
},
{
"docstring": "Register the public, private, and client commands.",
"name": "register_commands",
"signature": "def register_commands(self)"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_005275 | Implement the Python class `_MenuCommand` described below.
Class description:
Class used to register a command to its menu.
Method signatures and docstrings:
- def __init__(self, name): Store the base name and send_menu callback.
- def register_commands(self): Register the public, private, and client commands.
- def ... | Implement the Python class `_MenuCommand` described below.
Class description:
Class used to register a command to its menu.
Method signatures and docstrings:
- def __init__(self, name): Store the base name and send_menu callback.
- def register_commands(self): Register the public, private, and client commands.
- def ... | dd76d1f581a1a8aff18c2194834665fa66a82aab | <|skeleton|>
class _MenuCommand:
"""Class used to register a command to its menu."""
def __init__(self, name):
"""Store the base name and send_menu callback."""
<|body_0|>
def register_commands(self):
"""Register the public, private, and client commands."""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _MenuCommand:
"""Class used to register a command to its menu."""
def __init__(self, name):
"""Store the base name and send_menu callback."""
self.name = name
module = import_module('gungame.core.menus.{menu_name}'.format(menu_name=self.name))
self.send_menu = getattr(modu... | the_stack_v2_python_sparse | addons/source-python/plugins/gungame/core/commands.py | Hackmastr/GunGame-SP | train | 0 |
6936c171df3d01a2b3947f1bd5d2ffb196fd11f2 | [
"self.n = n\nself.identity = identity_element_func\nself.binary = binary_operation_func\nn2 = 1\nwhile n2 < n:\n n2 <<= 1\nself.n2 = n2\nself.tree = [identity_element_func() for _ in range(n2 << 1)]",
"index += self.n2\nself.tree[index] = self.binary(self.tree[index], x)\nwhile index > 1:\n x = self.binary(... | <|body_start_0|>
self.n = n
self.identity = identity_element_func
self.binary = binary_operation_func
n2 = 1
while n2 < n:
n2 <<= 1
self.n2 = n2
self.tree = [identity_element_func() for _ in range(n2 << 1)]
<|end_body_0|>
<|body_start_1|>
inde... | Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func : func identity_element for initialization if operator is * and identiry ... | segtree | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class segtree:
"""Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func : func identity_element for initializa... | stack_v2_sparse_classes_10k_train_001391 | 4,132 | permissive | [
{
"docstring": "Constructer(Initialize parameter in this class) Parameters ---------- n : int Number of elements identity_element_func : func identity element for initialization if operator is * and identiry element is e, e * A = A and A * e = A binary_operation_func : func function for binary operation x and y... | 3 | stack_v2_sparse_classes_30k_train_004053 | Implement the Python class `segtree` described below.
Class description:
Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func... | Implement the Python class `segtree` described below.
Class description:
Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func... | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | <|skeleton|>
class segtree:
"""Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func : func identity_element for initializa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class segtree:
"""Segment tree Store value as object type and optional function for binary operarion get function return a value by binary operarion result update function update tree's a value Attributes ---------- n : int Number of elements identity element_func : func identity_element for initialization if opera... | the_stack_v2_python_sparse | src/data/403.py | NULLCT/LOMC | train | 0 |
dee1dddc7a9e65d8b49a2d1e7f8eea3946aae35b | [
"mime_message = _parse_mime_message(mime_message)\nsuper(InboundEmailMessage, self).update_from_mime_message(mime_message)\nfor property_, header in six.iteritems(InboundEmailMessage.__HEADER_PROPERTIES):\n value = mime_message[header]\n if value:\n setattr(self, property_, value)",
"if content_type ... | <|body_start_0|>
mime_message = _parse_mime_message(mime_message)
super(InboundEmailMessage, self).update_from_mime_message(mime_message)
for property_, header in six.iteritems(InboundEmailMessage.__HEADER_PROPERTIES):
value = mime_message[header]
if value:
... | Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming mail, where the developer has less control over the content. Example: # Read mail mes... | InboundEmailMessage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InboundEmailMessage:
"""Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming mail, where the developer has less con... | stack_v2_sparse_classes_10k_train_001392 | 48,523 | permissive | [
{
"docstring": "Updates the values of a MIME message. This function copies over date values. Args: mime_message: The `email.Message` instance from which you want to copy information.",
"name": "update_from_mime_message",
"signature": "def update_from_mime_message(self, mime_message)"
},
{
"docst... | 4 | stack_v2_sparse_classes_30k_train_001634 | Implement the Python class `InboundEmailMessage` described below.
Class description:
Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming... | Implement the Python class `InboundEmailMessage` described below.
Class description:
Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming... | 8a5abedfe99b27a4dcb31fd47d3ba7b62fd0e47c | <|skeleton|>
class InboundEmailMessage:
"""Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming mail, where the developer has less con... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InboundEmailMessage:
"""Receives a parsed email as it is recevied from an external source. This class makes use of a `date` field and can store any number of additional bodies. These additional attributes make the email more flexible as required for incoming mail, where the developer has less control over the... | the_stack_v2_python_sparse | src/google/appengine/api/mail.py | asriniva/appengine-python-standard | train | 0 |
6e7ecb404ee43b4f766ec93fee08b22db9ab9c8a | [
"from __builtin__ import xrange\ncnt = [0]\n\ndef count(ary):\n for i in xrange(len(ary)):\n if i == 0:\n cnt[0] = cnt[0] + sum(ary[i])\n continue\n for j in xrange(len(ary[0])):\n if ary[i][j] == 1:\n if ary[i - 1][j] != 1:\n cnt[0... | <|body_start_0|>
from __builtin__ import xrange
cnt = [0]
def count(ary):
for i in xrange(len(ary)):
if i == 0:
cnt[0] = cnt[0] + sum(ary[i])
continue
for j in xrange(len(ary[0])):
if ary[i][... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def islandPerimeter(self, grid):
""":type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。"""
<|body_0|>
def rewrite(self, grid):
""":type grid: List[List[int]] :rtype: int [0, 1, 0, 0] [0, 0, 1, 0, 0] [0, 1, 0, 0, 0]"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_001393 | 2,201 | no_license | [
{
"docstring": ":type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。",
"name": "islandPerimeter",
"signature": "def islandPerimeter(self, grid)"
},
{
"docstring": ":type grid: List[List[int]] :rtype: int [0, 1, 0, 0] [0, 0, 1, 0, 0] [0, 1, 0, 0, 0]",
"name": "rewrite",
"signatu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def islandPerimeter(self, grid): :type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。
- def rewrite(self, grid): :type grid: List[List[int]] :rtype: int [0, 1, 0, 0] [0... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def islandPerimeter(self, grid): :type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。
- def rewrite(self, grid): :type grid: List[List[int]] :rtype: int [0, 1, 0, 0] [0... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def islandPerimeter(self, grid):
""":type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。"""
<|body_0|>
def rewrite(self, grid):
""":type grid: List[List[int]] :rtype: int [0, 1, 0, 0] [0, 0, 1, 0, 0] [0, 1, 0, 0, 0]"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def islandPerimeter(self, grid):
""":type grid: List[List[int]] :rtype: int 翻轉四次 一次只處理單一方向. 即處理北面。"""
from __builtin__ import xrange
cnt = [0]
def count(ary):
for i in xrange(len(ary)):
if i == 0:
cnt[0] = cnt[0] + sum(... | the_stack_v2_python_sparse | co_fb/463_Island_Perimeter.py | vsdrun/lc_public | train | 6 | |
f860a8bb1b534a711bd2a6dcb7413fe0663cebb9 | [
"if not nums:\n return 0\nn = nums.__len__()\ndp = [1 for _ in range(n)]\nfor i in range(n - 2, -1, -1):\n iter_max = 0\n for j in range(i + 1, n):\n if nums[i] < nums[j]:\n iter_max = max(dp[j], iter_max)\n dp[i] = iter_max + 1\nreturn max(dp)",
"if not nums:\n return 0\nn = nums... | <|body_start_0|>
if not nums:
return 0
n = nums.__len__()
dp = [1 for _ in range(n)]
for i in range(n - 2, -1, -1):
iter_max = 0
for j in range(i + 1, n):
if nums[i] < nums[j]:
iter_max = max(dp[j], iter_max)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def lengthOfLIS1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return 0
n ... | stack_v2_sparse_classes_10k_train_001394 | 4,613 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "lengthOfLIS1",
"signature": "def lengthOfLIS1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000304 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def lengthOfLIS1(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 lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def lengthOfLI... | 472f780c3214aab5c713612812d834ccbe589434 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def lengthOfLIS1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 0
n = nums.__len__()
dp = [1 for _ in range(n)]
for i in range(n - 2, -1, -1):
iter_max = 0
for j in range(i + 1, n):
i... | the_stack_v2_python_sparse | 4/300-Longest_Increasing_Subsequence.py | ChangXiaodong/Leetcode-solutions | train | 4 | |
f218a16813a9351c677fdbc7a6ebe9d0242e2284 | [
"ItemTextsFormRecord._init_map(self)\nItemFilesFormRecord._init_map(self)\nsuper(ItemTextsAndFilesMixin, self)._init_map()",
"ItemTextsFormRecord._init_metadata(self)\nItemFilesFormRecord._init_metadata(self)\nsuper(ItemTextsAndFilesMixin, self)._init_metadata()"
] | <|body_start_0|>
ItemTextsFormRecord._init_map(self)
ItemFilesFormRecord._init_map(self)
super(ItemTextsAndFilesMixin, self)._init_map()
<|end_body_0|>
<|body_start_1|>
ItemTextsFormRecord._init_metadata(self)
ItemFilesFormRecord._init_metadata(self)
super(ItemTextsAndFi... | Mixin class to make the two classes compatible with super() for _init_map and _init_metadata | ItemTextsAndFilesMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemTextsAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_001395 | 22,562 | permissive | [
{
"docstring": "stub",
"name": "_init_map",
"signature": "def _init_map(self)"
},
{
"docstring": "stub",
"name": "_init_metadata",
"signature": "def _init_metadata(self)"
}
] | 2 | null | Implement the Python class `ItemTextsAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub | Implement the Python class `ItemTextsAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub
<|skeleton|>
class ItemTextsAndFilesMixin... | 445f968a175d61c8d92c0f617a3c17dc1dc7c584 | <|skeleton|>
class ItemTextsAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ItemTextsAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
ItemTextsFormRecord._init_map(self)
ItemFilesFormRecord._init_map(self)
super(ItemTextsAndFilesMixin, self)._init_map(... | the_stack_v2_python_sparse | dlkit/records/assessment/basic/simple_records.py | mitsei/dlkit | train | 2 |
892cbc07a1524f47caaf9eddeb1e1485bb79c915 | [
"data = form.cleaned_data\nself.success_url = reverse('mark_scripts', kwargs={'course': data['course'].id})\nreturn super().form_valid(form)",
"context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Exam Scripts To Mark'\ncontext['detail_text'] = 'Please select details of the exam\\n ... | <|body_start_0|>
data = form.cleaned_data
self.success_url = reverse('mark_scripts', kwargs={'course': data['course'].id})
return super().form_valid(form)
<|end_body_0|>
<|body_start_1|>
context = super().get_context_data(**kwargs)
context['title_text'] = 'Choose Exam Scripts To... | View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success. | MarkScriptView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MarkScriptView:
"""View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0... | stack_v2_sparse_classes_10k_train_001396 | 29,759 | no_license | [
{
"docstring": "Compute the success URL and call super.form_valid()",
"name": "form_valid",
"signature": "def form_valid(self, form)"
},
{
"docstring": "Return the data used in the templates rendering.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
... | 2 | stack_v2_sparse_classes_30k_train_006119 | Implement the Python class `MarkScriptView` described below.
Class description:
View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success.
Method signatures and docstrings:
- def form_valid(self, form): Compute the su... | Implement the Python class `MarkScriptView` described below.
Class description:
View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success.
Method signatures and docstrings:
- def form_valid(self, form): Compute the su... | 06bc577d01d3dbf6c425e03dcb903977a38e377c | <|skeleton|>
class MarkScriptView:
"""View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MarkScriptView:
"""View for choosing which exam script to mark. Check that the user is a lecturer and that the account is still active. Redirects to Mark Scripts page on success."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
data = form.cleaned_d... | the_stack_v2_python_sparse | cbt/views.py | Festusali/CBTest | train | 6 |
0fb841c8db69dc4b94ac81245a36c97f11c0f222 | [
"m = len(coins)\ntable = [[0] * m for _ in range(amount + 1)]\nfor j in range(m):\n table[0][j] = 1\nfor j, c in enumerate(coins):\n for i in range(1, amount + 1):\n x = table[i - c][j] if i >= c else 0\n y = table[i][j - 1] if j > 0 else 0\n table[i][j] = x + y\nreturn table[-1][-1]",
... | <|body_start_0|>
m = len(coins)
table = [[0] * m for _ in range(amount + 1)]
for j in range(m):
table[0][j] = 1
for j, c in enumerate(coins):
for i in range(1, amount + 1):
x = table[i - c][j] if i >= c else 0
y = table[i][j - 1] if... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def coinChange_v1(self, coins: List[int], amount: int) -> int:
"""Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | ... | stack_v2_sparse_classes_10k_train_001397 | 3,481 | no_license | [
{
"docstring": "Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | 1 2 3 --+-------- 0 | 1 1 1 1 | 1 1 1 2 | 1 2 2 3 | 1 2 3 4 | 1 3 4",
"name": "c... | 2 | stack_v2_sparse_classes_30k_val_000065 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange_v1(self, coins: List[int], amount: int) -> int: Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange_v1(self, coins: List[int], amount: int) -> int: Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(... | 97a2386f5e3adbd7138fd123810c3232bdf7f622 | <|skeleton|>
class Solution:
def coinChange_v1(self, coins: List[int], amount: int) -> int:
"""Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def coinChange_v1(self, coins: List[int], amount: int) -> int:
"""Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | 1 2 3 --+-----... | the_stack_v2_python_sparse | python3/dynamic_programming/coin_change.py | victorchu/algorithms | train | 0 | |
ab7379a4c9a97f98b95ce3f1338bd27c9e10e034 | [
"self.min_loss = float('inf')\nself.max_acc = -float('inf')\nself.min_delta = min_delta\nself.model_name = model_name\nself.path = str(os.path.join(model_dir, self.model_name + '.pth'))\nself.count = 0\nself.first_run = True\nself.best_model = None",
"print(f'Loss to beat: {self.min_loss - self.min_delta:.4f}')\n... | <|body_start_0|>
self.min_loss = float('inf')
self.max_acc = -float('inf')
self.min_delta = min_delta
self.model_name = model_name
self.path = str(os.path.join(model_dir, self.model_name + '.pth'))
self.count = 0
self.first_run = True
self.best_model = Non... | EarlyStopping | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EarlyStopping:
def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representin... | stack_v2_sparse_classes_10k_train_001398 | 29,312 | permissive | [
{
"docstring": "Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current fold. `min_delta` : `int`, `optional` Smallest number the given metric needs to change in... | 2 | stack_v2_sparse_classes_30k_train_007266 | Implement the Python class `EarlyStopping` described below.
Class description:
Implement the EarlyStopping class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ----... | Implement the Python class `EarlyStopping` described below.
Class description:
Implement the EarlyStopping class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ----... | d0ee019e5a573bf9b8e232786a9051cd54904487 | <|skeleton|>
class EarlyStopping:
def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EarlyStopping:
def __init__(self, model_dir: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- `TODO` Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current ... | the_stack_v2_python_sparse | pytorch_vision_utils/TrainingUtilities.py | nclgbd/PyTorch-Utilities | train | 0 | |
d0cc8b9b807ad16ffff58f24cfc51758d98b67ba | [
"ctx.args = args_to_numpy(input_)\nctx.kwargs = kwargs_to_numpy(input_kwargs)\nctx.save_for_backward(*input_)\nres = qnode(*ctx.args, **ctx.kwargs)\nif not isinstance(res, np.ndarray):\n res = np.array(res)\nfor i in input_:\n if isinstance(i, torch.Tensor):\n if i.is_cuda:\n cuda_device = i... | <|body_start_0|>
ctx.args = args_to_numpy(input_)
ctx.kwargs = kwargs_to_numpy(input_kwargs)
ctx.save_for_backward(*input_)
res = qnode(*ctx.args, **ctx.kwargs)
if not isinstance(res, np.ndarray):
res = np.array(res)
for i in input_:
if isinstance(... | The TorchQNode | _TorchQNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _TorchQNode:
"""The TorchQNode"""
def forward(ctx, input_kwargs, *input_):
"""Implements the forward pass QNode evaluation"""
<|body_0|>
def backward(ctx, grad_output):
"""Implements the backwards pass QNode vector-Jacobian product"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_001399 | 12,847 | permissive | [
{
"docstring": "Implements the forward pass QNode evaluation",
"name": "forward",
"signature": "def forward(ctx, input_kwargs, *input_)"
},
{
"docstring": "Implements the backwards pass QNode vector-Jacobian product",
"name": "backward",
"signature": "def backward(ctx, grad_output)"
}
... | 2 | stack_v2_sparse_classes_30k_train_004440 | Implement the Python class `_TorchQNode` described below.
Class description:
The TorchQNode
Method signatures and docstrings:
- def forward(ctx, input_kwargs, *input_): Implements the forward pass QNode evaluation
- def backward(ctx, grad_output): Implements the backwards pass QNode vector-Jacobian product | Implement the Python class `_TorchQNode` described below.
Class description:
The TorchQNode
Method signatures and docstrings:
- def forward(ctx, input_kwargs, *input_): Implements the forward pass QNode evaluation
- def backward(ctx, grad_output): Implements the backwards pass QNode vector-Jacobian product
<|skeleto... | 40f2219b5e048d4bd93df815811ca5ed3f5327fa | <|skeleton|>
class _TorchQNode:
"""The TorchQNode"""
def forward(ctx, input_kwargs, *input_):
"""Implements the forward pass QNode evaluation"""
<|body_0|>
def backward(ctx, grad_output):
"""Implements the backwards pass QNode vector-Jacobian product"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _TorchQNode:
"""The TorchQNode"""
def forward(ctx, input_kwargs, *input_):
"""Implements the forward pass QNode evaluation"""
ctx.args = args_to_numpy(input_)
ctx.kwargs = kwargs_to_numpy(input_kwargs)
ctx.save_for_backward(*input_)
res = qnode(*ctx.args, **ctx.kwa... | the_stack_v2_python_sparse | pennylane/interfaces/torch.py | AroosaIjaz/Mypennylane | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.