blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dbe305dc88da2a66825e0d36cfef78d535799111 | [
"if is_token_expired(request):\n request.user.auth_token.delete()\n return Response('Your session has expired you will need to login again')\nelse:\n serializer = self.get_serializer(self.queryset, many=True)\n response = []\n for user in serializer.data:\n if str(request.user) == user['userna... | <|body_start_0|>
if is_token_expired(request):
request.user.auth_token.delete()
return Response('Your session has expired you will need to login again')
else:
serializer = self.get_serializer(self.queryset, many=True)
response = []
for user in ... | An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy | UserView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserView:
"""An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy"""
def list(self, request):
"""Returns a list of all existing Users The list function takes into account the user making the request and edits the list to obscure ... | stack_v2_sparse_classes_75kplus_train_068800 | 10,383 | no_license | [
{
"docstring": "Returns a list of all existing Users The list function takes into account the user making the request and edits the list to obscure private details such as the email Parameters: request : the request from the user Returns: Response (list) : A list of all the users",
"name": "list",
"sign... | 2 | stack_v2_sparse_classes_30k_train_002762 | Implement the Python class `UserView` described below.
Class description:
An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy
Method signatures and docstrings:
- def list(self, request): Returns a list of all existing Users The list function takes into account t... | Implement the Python class `UserView` described below.
Class description:
An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy
Method signatures and docstrings:
- def list(self, request): Returns a list of all existing Users The list function takes into account t... | b17b488312450a5fb80bf758ba2b8da1c3a0f8bb | <|skeleton|>
class UserView:
"""An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy"""
def list(self, request):
"""Returns a list of all existing Users The list function takes into account the user making the request and edits the list to obscure ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserView:
"""An altered View class for User with the list and the retrieve method overidden to allow for minimal privacy"""
def list(self, request):
"""Returns a list of all existing Users The list function takes into account the user making the request and edits the list to obscure private detai... | the_stack_v2_python_sparse | Week3/Django Rest Framework/Twitter Rest Framework/users/views.py | MJahangeerQureshi/Python_Training | train | 0 |
0b5ae7524a41b5835dc8ed47cb51cc3fe231261f | [
"GameSprite.__init__(self, *containers)\nself.rect = pygame.Rect(position, size)\nself.x, self.y = position\nself.rect.midbottom = position\nself._image = None\nself._timeCollected = 0\nself._nextLightChange = randomTime()\nself._phase = 1",
"if self._image:\n return self._image\nphase = self._phase\nif phase ... | <|body_start_0|>
GameSprite.__init__(self, *containers)
self.rect = pygame.Rect(position, size)
self.x, self.y = position
self.rect.midbottom = position
self._image = None
self._timeCollected = 0
self._nextLightChange = randomTime()
self._phase = 1
<|end_b... | Animation for a lighting that strike the ground | Lighting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lighting:
"""Animation for a lighting that strike the ground"""
def __init__(self, position, size, *containers):
"""The position used is the lighting strike point of the ground (midbottom)"""
<|body_0|>
def image(self):
"""Draw the 2 images of the lighting"""
... | stack_v2_sparse_classes_75kplus_train_068801 | 3,507 | no_license | [
{
"docstring": "The position used is the lighting strike point of the ground (midbottom)",
"name": "__init__",
"signature": "def __init__(self, position, size, *containers)"
},
{
"docstring": "Draw the 2 images of the lighting",
"name": "image",
"signature": "def image(self)"
},
{
... | 3 | null | Implement the Python class `Lighting` described below.
Class description:
Animation for a lighting that strike the ground
Method signatures and docstrings:
- def __init__(self, position, size, *containers): The position used is the lighting strike point of the ground (midbottom)
- def image(self): Draw the 2 images o... | Implement the Python class `Lighting` described below.
Class description:
Animation for a lighting that strike the ground
Method signatures and docstrings:
- def __init__(self, position, size, *containers): The position used is the lighting strike point of the ground (midbottom)
- def image(self): Draw the 2 images o... | 6a017bb3124415b67b55979c36edd24c865bda4d | <|skeleton|>
class Lighting:
"""Animation for a lighting that strike the ground"""
def __init__(self, position, size, *containers):
"""The position used is the lighting strike point of the ground (midbottom)"""
<|body_0|>
def image(self):
"""Draw the 2 images of the lighting"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Lighting:
"""Animation for a lighting that strike the ground"""
def __init__(self, position, size, *containers):
"""The position used is the lighting strike point of the ground (midbottom)"""
GameSprite.__init__(self, *containers)
self.rect = pygame.Rect(position, size)
se... | the_stack_v2_python_sparse | cheeseboys/sprites/storm.py | keul/Cheese-Boys | train | 1 |
a235728867f1b992557f5be15cb0f25a17e12f4e | [
"if terminating_type is None:\n terminating_type = object\nself._terminating_type = terminating_type\nsuper(LazyOneWayGraph, self).__init__()",
"mro_ = [self[base] for base in of_type.__bases__ if self._terminating_type in base.mro() and base is not of_type]\nself[of_type] = MergingProxyDictionary({}, *mro_)\n... | <|body_start_0|>
if terminating_type is None:
terminating_type = object
self._terminating_type = terminating_type
super(LazyOneWayGraph, self).__init__()
<|end_body_0|>
<|body_start_1|>
mro_ = [self[base] for base in of_type.__bases__ if self._terminating_type in base.mro() ... | A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes. | LazyOneWayGraph | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LazyOneWayGraph:
"""A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes."""
def __init__(self, terminating_type=None):
""":param type terminating_type: class of which must exist in a node's bases for it to b... | stack_v2_sparse_classes_75kplus_train_068802 | 9,824 | permissive | [
{
"docstring": ":param type terminating_type: class of which must exist in a node's bases for it to be included as dependant for each queried class. otherwise each node without the terminating class will exist as a non-depending node",
"name": "__init__",
"signature": "def __init__(self, terminating_typ... | 2 | null | Implement the Python class `LazyOneWayGraph` described below.
Class description:
A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes.
Method signatures and docstrings:
- def __init__(self, terminating_type=None): :param type terminating_type... | Implement the Python class `LazyOneWayGraph` described below.
Class description:
A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes.
Method signatures and docstrings:
- def __init__(self, terminating_type=None): :param type terminating_type... | 96b371727764538bd8ca7a1ffde6e81b14e99c2f | <|skeleton|>
class LazyOneWayGraph:
"""A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes."""
def __init__(self, terminating_type=None):
""":param type terminating_type: class of which must exist in a node's bases for it to b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LazyOneWayGraph:
"""A lazily initialized one way graph. node's dependants are resolved if the terminating_type exists in the mro of the base classes."""
def __init__(self, terminating_type=None):
""":param type terminating_type: class of which must exist in a node's bases for it to be included as... | the_stack_v2_python_sparse | prestans3/utils.py | coderatchet/snatserp3 | train | 0 |
21431fa037ee56eddbd2c61d4f56dfb6a4f13f49 | [
"self.nums = nums\nself.i = 0\nself.j = len(nums) - 1\nself.temp = sum(nums[self.i:self.j + 1])",
"if self.i <= i <= self.j:\n self.temp = self.temp - self.nums[i] + val\nself.nums[i] = val",
"if i < self.i:\n self.temp += sum(self.nums[i:self.i])\nelse:\n self.temp -= sum(self.nums[self.i:i])\nself.i ... | <|body_start_0|>
self.nums = nums
self.i = 0
self.j = len(nums) - 1
self.temp = sum(nums[self.i:self.j + 1])
<|end_body_0|>
<|body_start_1|>
if self.i <= i <= self.j:
self.temp = self.temp - self.nums[i] + val
self.nums[i] = val
<|end_body_1|>
<|body_start_2... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_75kplus_train_068803 | 1,765 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, i, val)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
... | 3 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): :type i: int :type j: int :rtype:... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): :type i: int :type j: int :rtype:... | 0c4c38849309124121b03cc0b4bf39071b5d1c8c | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.nums = nums
self.i = 0
self.j = len(nums) - 1
self.temp = sum(nums[self.i:self.j + 1])
def update(self, i, val):
""":type i: int :type val: int :rtype: void"""
if self.i <= i <= se... | the_stack_v2_python_sparse | 307.py | zhangchizju2012/LeetCode | train | 7 | |
c33ebdd141e66f4351182b8776dc268d05edcb15 | [
"segment = track.get_segment(track.segments[-1])\nbandwidth = round(segment.segment.seek(0, io.SEEK_END) * 8 / segment.duration * 1.2)\ncodecs = get_codec_string(segment.segment)\nlines = ['#EXTM3U', f'#EXT-X-STREAM-INF:BANDWIDTH={bandwidth},CODECS=\"{codecs}\"', 'playlist.m3u8']\nreturn '\\n'.join(lines) + '\\n'",... | <|body_start_0|>
segment = track.get_segment(track.segments[-1])
bandwidth = round(segment.segment.seek(0, io.SEEK_END) * 8 / segment.duration * 1.2)
codecs = get_codec_string(segment.segment)
lines = ['#EXTM3U', f'#EXT-X-STREAM-INF:BANDWIDTH={bandwidth},CODECS="{codecs}"', 'playlist.m3u... | Stream view used only for Chromecast compatibility. | HlsMasterPlaylistView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HlsMasterPlaylistView:
"""Stream view used only for Chromecast compatibility."""
def render(track):
"""Render M3U8 file."""
<|body_0|>
async def handle(self, request, stream, sequence):
"""Return m3u8 playlist."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_068804 | 7,210 | permissive | [
{
"docstring": "Render M3U8 file.",
"name": "render",
"signature": "def render(track)"
},
{
"docstring": "Return m3u8 playlist.",
"name": "handle",
"signature": "async def handle(self, request, stream, sequence)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047578 | Implement the Python class `HlsMasterPlaylistView` described below.
Class description:
Stream view used only for Chromecast compatibility.
Method signatures and docstrings:
- def render(track): Render M3U8 file.
- async def handle(self, request, stream, sequence): Return m3u8 playlist. | Implement the Python class `HlsMasterPlaylistView` described below.
Class description:
Stream view used only for Chromecast compatibility.
Method signatures and docstrings:
- def render(track): Render M3U8 file.
- async def handle(self, request, stream, sequence): Return m3u8 playlist.
<|skeleton|>
class HlsMasterPl... | 4ab0151fb1cbefb31def23ba850e197da0a5027f | <|skeleton|>
class HlsMasterPlaylistView:
"""Stream view used only for Chromecast compatibility."""
def render(track):
"""Render M3U8 file."""
<|body_0|>
async def handle(self, request, stream, sequence):
"""Return m3u8 playlist."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HlsMasterPlaylistView:
"""Stream view used only for Chromecast compatibility."""
def render(track):
"""Render M3U8 file."""
segment = track.get_segment(track.segments[-1])
bandwidth = round(segment.segment.seek(0, io.SEEK_END) * 8 / segment.duration * 1.2)
codecs = get_cod... | the_stack_v2_python_sparse | homeassistant/components/stream/hls.py | turbokongen/home-assistant | train | 4 |
873df292033c56e40dc1b08d2d830e5d741204fe | [
"user = request.user\nuser_movies_count = Movie.objects.filter(user=user).count()\nif user_movies_count >= MOVIE_PER_USER:\n return Response(status=status.HTTP_406_NOT_ACCEPTABLE, data={'detail': 'you reached the limit of adding movie. limit:{0}'.format(MOVIE_PER_USER)})\nif 'name' not in request.data:\n retu... | <|body_start_0|>
user = request.user
user_movies_count = Movie.objects.filter(user=user).count()
if user_movies_count >= MOVIE_PER_USER:
return Response(status=status.HTTP_406_NOT_ACCEPTABLE, data={'detail': 'you reached the limit of adding movie. limit:{0}'.format(MOVIE_PER_USER)})
... | on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user. | CreateAndGetMovieView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateAndGetMovieView:
"""on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user."""
def post(self, request, format=None):
"""Attributes ---------- user -> djan... | stack_v2_sparse_classes_75kplus_train_068805 | 17,909 | no_license | [
{
"docstring": "Attributes ---------- user -> django.contrib.auth.models.User(object) : authenticated user which sending the request user_movies_count -> int : count all movies of the user movie -> api.models.Movie(object) : contain movie object that get created with user data Responses ---------- 406 -> key=\"... | 2 | stack_v2_sparse_classes_30k_train_018993 | Implement the Python class `CreateAndGetMovieView` described below.
Class description:
on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user.
Method signatures and docstrings:
- def post(self, ... | Implement the Python class `CreateAndGetMovieView` described below.
Class description:
on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user.
Method signatures and docstrings:
- def post(self, ... | c36306209797a3a389620434a519f7a114e7a3cb | <|skeleton|>
class CreateAndGetMovieView:
"""on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user."""
def post(self, request, format=None):
"""Attributes ---------- user -> djan... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateAndGetMovieView:
"""on post add movie can include fields ["name", "description", "year", "imdb_rate", "download_link", "poster_link", "review"] and name is required. on get return all movies of user."""
def post(self, request, format=None):
"""Attributes ---------- user -> django.contrib.au... | the_stack_v2_python_sparse | api/views.py | F4R4N/film-review | train | 3 |
f929426df3250d243e1f3ca8f9d89dfdc19ea536 | [
"Model = model_admin.model\nmeta_name = '%smetadata' % Model._meta.object_name\nct = ContentType.objects.get(app_label='django_models_from_csv', model=meta_name)\ntags = Tag.objects.filter(taggit_taggeditem_items__content_type=ct).values_list('name', 'slug').distinct()\nreturn tags",
"value = self.value()\nif not... | <|body_start_0|>
Model = model_admin.model
meta_name = '%smetadata' % Model._meta.object_name
ct = ContentType.objects.get(app_label='django_models_from_csv', model=meta_name)
tags = Tag.objects.filter(taggit_taggeditem_items__content_type=ct).values_list('name', 'slug').distinct()
... | A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global. | TagListFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagListFilter:
"""A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global."""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will a... | stack_v2_sparse_classes_75kplus_train_068806 | 1,641 | permissive | [
{
"docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.",
"name": "lookups",
"signature": "def lookups(self, request,... | 2 | stack_v2_sparse_classes_30k_train_036403 | Implement the Python class `TagListFilter` described below.
Class description:
A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in... | Implement the Python class `TagListFilter` described below.
Class description:
A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in... | 6fa1592a83100fe414b84e4dab58e90d7855309b | <|skeleton|>
class TagListFilter:
"""A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global."""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TagListFilter:
"""A custom filterable for tags. Restricts the displayed tags by the current data source, even though tags are global."""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the ... | the_stack_v2_python_sparse | collaborative/filters.py | propublica/django-collaborative | train | 94 |
c96ad0fd0c6f4f8313221a38849e27fd107d0e4d | [
"self.mCritter = aCritter\nself.mLogger = logging.getLogger(self.__class__.__name__)\nself.mLogger.propagate = False\nhandler = logging.FileHandler('/tmp/' + self.mCritter.mCrittnick + '.log')\nformatter = logging.Formatter('[%(asctime)s][%(threadName)28s][%(levelname)8s] - %(message)s')\nhandler.setFormatter(forma... | <|body_start_0|>
self.mCritter = aCritter
self.mLogger = logging.getLogger(self.__class__.__name__)
self.mLogger.propagate = False
handler = logging.FileHandler('/tmp/' + self.mCritter.mCrittnick + '.log')
formatter = logging.Formatter('[%(asctime)s][%(threadName)28s][%(levelname... | The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger. | CritterBehavior | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CritterBehavior:
"""The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger."""
def __init__(self, aCritter):
"""Initializes the Critter's behavior. Arguments: aCritter The critter."""
<|body_0|>
def run(self):
"""Starts the behavior. All d... | stack_v2_sparse_classes_75kplus_train_068807 | 1,520 | no_license | [
{
"docstring": "Initializes the Critter's behavior. Arguments: aCritter The critter.",
"name": "__init__",
"signature": "def __init__(self, aCritter)"
},
{
"docstring": "Starts the behavior. All decisions are taken here.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_032289 | Implement the Python class `CritterBehavior` described below.
Class description:
The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger.
Method signatures and docstrings:
- def __init__(self, aCritter): Initializes the Critter's behavior. Arguments: aCritter The critter.
- def run(self): Start... | Implement the Python class `CritterBehavior` described below.
Class description:
The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger.
Method signatures and docstrings:
- def __init__(self, aCritter): Initializes the Critter's behavior. Arguments: aCritter The critter.
- def run(self): Start... | a09e04af758ecb405f86775b646e9d01d9452ecd | <|skeleton|>
class CritterBehavior:
"""The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger."""
def __init__(self, aCritter):
"""Initializes the Critter's behavior. Arguments: aCritter The critter."""
<|body_0|>
def run(self):
"""Starts the behavior. All d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CritterBehavior:
"""The Critter's behavior. Attributes: mCritter: The critter. mLogger: The logger."""
def __init__(self, aCritter):
"""Initializes the Critter's behavior. Arguments: aCritter The critter."""
self.mCritter = aCritter
self.mLogger = logging.getLogger(self.__class__.... | the_stack_v2_python_sparse | Critter/CritterBehavior.py | BrianRickardMason/Critter | train | 0 |
13578308bc92d8831df9c20df035e079814f36eb | [
"gym.Wrapper.__init__(self, env)\nself.noop_max = noop_max\nself.override_num_noops = None\nassert env.unwrapped.get_action_meanings()[0] == 'NOOP'",
"self.env.reset()\nif self.override_num_noops is not None:\n noops = self.override_num_noops\nelse:\n noops = self.unwrapped.np_random.randint(1, self.noop_ma... | <|body_start_0|>
gym.Wrapper.__init__(self, env)
self.noop_max = noop_max
self.override_num_noops = None
assert env.unwrapped.get_action_meanings()[0] == 'NOOP'
<|end_body_0|>
<|body_start_1|>
self.env.reset()
if self.override_num_noops is not None:
noops = s... | NoopResetEnv | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoopResetEnv:
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0."""
<|body_0|>
def reset(self):
"""Do no-op action for a number of steps in [1, noop_max]."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_068808 | 12,746 | permissive | [
{
"docstring": "Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.",
"name": "__init__",
"signature": "def __init__(self, env, noop_max=30)"
},
{
"docstring": "Do no-op action for a number of steps in [1, noop_max].",
"name": "reset",
"sign... | 2 | null | Implement the Python class `NoopResetEnv` described below.
Class description:
Implement the NoopResetEnv class.
Method signatures and docstrings:
- def __init__(self, env, noop_max=30): Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.
- def reset(self): Do no-op actio... | Implement the Python class `NoopResetEnv` described below.
Class description:
Implement the NoopResetEnv class.
Method signatures and docstrings:
- def __init__(self, env, noop_max=30): Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.
- def reset(self): Do no-op actio... | 38322aac7d1dcb1f9e86dd32bc1d861d143dcd7a | <|skeleton|>
class NoopResetEnv:
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0."""
<|body_0|>
def reset(self):
"""Do no-op action for a number of steps in [1, noop_max]."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NoopResetEnv:
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0."""
gym.Wrapper.__init__(self, env)
self.noop_max = noop_max
self.override_num_noops = None
assert env.unwrapped.get_... | the_stack_v2_python_sparse | RL/wrappers/atari_wrappers.py | bhatiaabhinav/RL-v2 | train | 9 | |
c0a86a17a14e0e7ce30c8f49cd241e537dc88345 | [
"self.winners, self.times = ([], times)\nvote_count, counts = (0, collections.defaultdict(int))\nfor person in persons:\n counts[person] += 1\n if counts[person] >= vote_count:\n vote_count = counts[person]\n winner = person\n self.winners.append(winner)",
"i, j = (0, len(self.times))\nwhil... | <|body_start_0|>
self.winners, self.times = ([], times)
vote_count, counts = (0, collections.defaultdict(int))
for person in persons:
counts[person] += 1
if counts[person] >= vote_count:
vote_count = counts[person]
winner = person
... | TopVotedCandidate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.winners, self.times = ([], times... | stack_v2_sparse_classes_75kplus_train_068809 | 823 | no_license | [
{
"docstring": ":type persons: List[int] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, persons, times)"
},
{
"docstring": ":type t: int :rtype: int",
"name": "q",
"signature": "def q(self, t)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000781 | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int
<|skeleton|>
class TopVotedCandi... | fa1ed20d266b9c226f10fdb64528ffae0a595aa4 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
self.winners, self.times = ([], times)
vote_count, counts = (0, collections.defaultdict(int))
for person in persons:
counts[person] += 1
if count... | the_stack_v2_python_sparse | medium_911. Online Election.py | sdksfo/leetcode | train | 0 | |
923e50affb761c879de83da61a30abbdcc052b37 | [
"_url_path = '/url-info'\n_query_builder = Configuration.get_base_uri()\n_query_builder += _url_path\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json'}\n_form_parameters = {'output-case': 'camel', 'url': url, 'fetch-content': fetch_content, 'ignore-certificate-errors': igno... | <|body_start_0|>
_url_path = '/url-info'
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
_headers = {'accept': 'application/json'}
_form_parameters = {'output-case': 'camel', 'url': url, 'fetch-con... | A Controller to access Endpoints in the neutrino_api API. | WWW | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WWW:
"""A Controller to access Endpoints in the neutrino_api API."""
def url_info(self, url, fetch_content=False, ignore_certificate_errors=False, timeout=20):
"""Does a POST request to /url-info. Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi... | stack_v2_sparse_classes_75kplus_train_068810 | 9,141 | permissive | [
{
"docstring": "Does a POST request to /url-info. Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi.com/api/url-info/ Args: url (string): The URL to probe fetch_content (bool, optional): If this URL responds with html, text, json or xml then return the response. This option... | 3 | null | Implement the Python class `WWW` described below.
Class description:
A Controller to access Endpoints in the neutrino_api API.
Method signatures and docstrings:
- def url_info(self, url, fetch_content=False, ignore_certificate_errors=False, timeout=20): Does a POST request to /url-info. Parse, analyze and retrieve co... | Implement the Python class `WWW` described below.
Class description:
A Controller to access Endpoints in the neutrino_api API.
Method signatures and docstrings:
- def url_info(self, url, fetch_content=False, ignore_certificate_errors=False, timeout=20): Does a POST request to /url-info. Parse, analyze and retrieve co... | cc00933eefef0f40710f606e9fbf2dfb97a4f063 | <|skeleton|>
class WWW:
"""A Controller to access Endpoints in the neutrino_api API."""
def url_info(self, url, fetch_content=False, ignore_certificate_errors=False, timeout=20):
"""Does a POST request to /url-info. Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WWW:
"""A Controller to access Endpoints in the neutrino_api API."""
def url_info(self, url, fetch_content=False, ignore_certificate_errors=False, timeout=20):
"""Does a POST request to /url-info. Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi.com/api/url-... | the_stack_v2_python_sparse | neutrino_api/controllers/www.py | NeutrinoAPI/NeutrinoAPI-Python | train | 3 |
36e0ac6a1cb1668f19cf3605c7abd74562ab1cbb | [
"if self.exportPng.get() == 1:\n self.exportPngCommand()\nif self.exportRecolored.get() == 1:\n self.exportRecoloredCommand()\nif self.exportSeparate.get() == 1:\n self.exportSeparateCommand()\nself.frame.destroy()",
"self.root = root\nself.app = app\nself.exportPngCommand = exportPng\nself.exportSeparat... | <|body_start_0|>
if self.exportPng.get() == 1:
self.exportPngCommand()
if self.exportRecolored.get() == 1:
self.exportRecoloredCommand()
if self.exportSeparate.get() == 1:
self.exportSeparateCommand()
self.frame.destroy()
<|end_body_0|>
<|body_start_1... | :Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer | ExportMenu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExportMenu:
""":Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer"""
def doneCommand(self):
""":description: Checks which boxes have been checked, and runs the appropriate export command for each."""
<|body_... | stack_v2_sparse_classes_75kplus_train_068811 | 3,045 | no_license | [
{
"docstring": ":description: Checks which boxes have been checked, and runs the appropriate export command for each.",
"name": "doneCommand",
"signature": "def doneCommand(self)"
},
{
"docstring": ":Description: Create the menu object that shows export options :param root: (tkinter.Tk) the root... | 2 | stack_v2_sparse_classes_30k_train_014806 | Implement the Python class `ExportMenu` described below.
Class description:
:Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer
Method signatures and docstrings:
- def doneCommand(self): :description: Checks which boxes have been checked, and runs th... | Implement the Python class `ExportMenu` described below.
Class description:
:Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer
Method signatures and docstrings:
- def doneCommand(self): :description: Checks which boxes have been checked, and runs th... | 8dda8fc474f3af1fe7ed611c801a541b1723b985 | <|skeleton|>
class ExportMenu:
""":Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer"""
def doneCommand(self):
""":description: Checks which boxes have been checked, and runs the appropriate export command for each."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExportMenu:
""":Description: Menu that contains the functionality for exporting different types of files. :interracts with: Visualizer"""
def doneCommand(self):
""":description: Checks which boxes have been checked, and runs the appropriate export command for each."""
if self.exportPng.ge... | the_stack_v2_python_sparse | src/GUI/export_menu.py | nchaconbgeo/pointcloudpackage | train | 1 |
8f2b2685938e00cf1d85d0f82c2271cf8f26b032 | [
"codes = []\nfor s in strs:\n codes.append(str(len(s)).zfill(4) + s)\nreturn ''.join(codes)",
"strs = []\nlocation = 0\nwhile location < len(s):\n length_str = s[location:location + 4].lstrip('0')\n if length_str:\n length = int(length_str)\n else:\n length = 0\n location += 4\n st... | <|body_start_0|>
codes = []
for s in strs:
codes.append(str(len(s)).zfill(4) + s)
return ''.join(codes)
<|end_body_0|>
<|body_start_1|>
strs = []
location = 0
while location < len(s):
length_str = s[location:location + 4].lstrip('0')
i... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs: List[str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> List[str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
c... | stack_v2_sparse_classes_75kplus_train_068812 | 2,143 | permissive | [
{
"docstring": "Encodes a list of strings to a single string.",
"name": "encode",
"signature": "def encode(self, strs: List[str]) -> str"
},
{
"docstring": "Decodes a single string to a list of strings.",
"name": "decode",
"signature": "def decode(self, s: str) -> List[str]"
}
] | 2 | stack_v2_sparse_classes_30k_train_049113 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: List[str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> List[str]: Decodes a single string to a list of strings. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: List[str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> List[str]: Decodes a single string to a list of strings.
<|skelet... | 24cf8d5f1831e838ea99f50ce4d8f048bd46c136 | <|skeleton|>
class Codec:
def encode(self, strs: List[str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> List[str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def encode(self, strs: List[str]) -> str:
"""Encodes a list of strings to a single string."""
codes = []
for s in strs:
codes.append(str(len(s)).zfill(4) + s)
return ''.join(codes)
def decode(self, s: str) -> List[str]:
"""Decodes a single string... | the_stack_v2_python_sparse | python/271_encode_and_decode_strings.py | jixinfeng/leetcode-soln | train | 0 | |
3c4d150c1c28708a2ef7c2f13b91a8462b59d963 | [
"if counter < 0:\n return\nif len(s) == 2 * n:\n if counter == 0:\n res.append(s)\n return\nself.helper(s + '(', counter + 1, n, res)\nself.helper(s + ')', counter - 1, n, res)",
"res = []\nself.helper('', 0, n, res)\nreturn res"
] | <|body_start_0|>
if counter < 0:
return
if len(s) == 2 * n:
if counter == 0:
res.append(s)
return
self.helper(s + '(', counter + 1, n, res)
self.helper(s + ')', counter - 1, n, res)
<|end_body_0|>
<|body_start_1|>
res = []
... | Solution description | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Solution description"""
def helper(self, s, counter, n, res):
"""helper func"""
<|body_0|>
def func(self, n):
"""Solution function description"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if counter < 0:
return
... | stack_v2_sparse_classes_75kplus_train_068813 | 738 | permissive | [
{
"docstring": "helper func",
"name": "helper",
"signature": "def helper(self, s, counter, n, res)"
},
{
"docstring": "Solution function description",
"name": "func",
"signature": "def func(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Solution description
Method signatures and docstrings:
- def helper(self, s, counter, n, res): helper func
- def func(self, n): Solution function description | Implement the Python class `Solution` described below.
Class description:
Solution description
Method signatures and docstrings:
- def helper(self, s, counter, n, res): helper func
- def func(self, n): Solution function description
<|skeleton|>
class Solution:
"""Solution description"""
def helper(self, s, ... | 869ee24c50c08403b170e8f7868699185e9dfdd1 | <|skeleton|>
class Solution:
"""Solution description"""
def helper(self, s, counter, n, res):
"""helper func"""
<|body_0|>
def func(self, n):
"""Solution function description"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Solution description"""
def helper(self, s, counter, n, res):
"""helper func"""
if counter < 0:
return
if len(s) == 2 * n:
if counter == 0:
res.append(s)
return
self.helper(s + '(', counter + 1, n, res)
... | the_stack_v2_python_sparse | 22.generate.parentheses/2.py | cerebrumaize/leetcode | train | 0 |
f296a4c747ce1929ebac75e45d096183ef34c1c4 | [
"super(MonitorServer, self).__init__()\nself.port = port\nself.address = (ip_address, self.port)\nself.rpi_address = (ip_address, self.port)\nself.sock = socket.socket(family, sock_type)\nself.sock.bind(self.address)\nself.request_type = {'GET_SYSTEM_DATA': self.get_system_data}",
"while True:\n try:\n ... | <|body_start_0|>
super(MonitorServer, self).__init__()
self.port = port
self.address = (ip_address, self.port)
self.rpi_address = (ip_address, self.port)
self.sock = socket.socket(family, sock_type)
self.sock.bind(self.address)
self.request_type = {'GET_SYSTEM_DAT... | Klasa koja nasljeđuje od Thread klase | MonitorServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorServer:
"""Klasa koja nasljeđuje od Thread klase"""
def __init__(self, family, sock_type, ip_address='0.0.0.0', port=5300):
"""Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete sock_t... | stack_v2_sparse_classes_75kplus_train_068814 | 2,735 | no_license | [
{
"docstring": "Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete sock_type {enum SocketKind} -- tip socketa koji će se koristiti Keyword Arguments: ip_address {str} -- ip adresa na koju će socket biti vezan (default: ... | 4 | stack_v2_sparse_classes_30k_train_007330 | Implement the Python class `MonitorServer` described below.
Class description:
Klasa koja nasljeđuje od Thread klase
Method signatures and docstrings:
- def __init__(self, family, sock_type, ip_address='0.0.0.0', port=5300): Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enu... | Implement the Python class `MonitorServer` described below.
Class description:
Klasa koja nasljeđuje od Thread klase
Method signatures and docstrings:
- def __init__(self, family, sock_type, ip_address='0.0.0.0', port=5300): Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enu... | 0dd6346aa5f5e0b23127e33814aa0265b3eecf46 | <|skeleton|>
class MonitorServer:
"""Klasa koja nasljeđuje od Thread klase"""
def __init__(self, family, sock_type, ip_address='0.0.0.0', port=5300):
"""Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete sock_t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MonitorServer:
"""Klasa koja nasljeđuje od Thread klase"""
def __init__(self, family, sock_type, ip_address='0.0.0.0', port=5300):
"""Inicijalna metoda za MonitorServer. Stvara socket i veže ga na adresu. Arguments: family {enum AddressFamily} -- tip adrese korišten za sockete sock_type {enum Soc... | the_stack_v2_python_sparse | desktop/servers/system_monitor.py | JBarti/MacroTouch | train | 0 |
104f1d5acd28bf5b80277b069535f64f70b390f6 | [
"parser = reqparse.RequestParser()\nparser.add_argument('page', type=int, location='args')\nparser.add_argument('per_page', type=int, location='args')\nargs = parser.parse_args()\npage = args['page']\nper_page = args['per_page']\ncurrent_user = get_jwt_identity()\nreturn db_client.get_user_liked_quotes(page, per_pa... | <|body_start_0|>
parser = reqparse.RequestParser()
parser.add_argument('page', type=int, location='args')
parser.add_argument('per_page', type=int, location='args')
args = parser.parse_args()
page = args['page']
per_page = args['per_page']
current_user = get_jwt_i... | Resource for likes. | Likes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Likes:
"""Resource for likes."""
def get(cls):
"""Returns the liked quotes of the current user."""
<|body_0|>
def post(cls):
"""Creates a like for the current user."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
parser = reqparse.RequestParser(... | stack_v2_sparse_classes_75kplus_train_068815 | 2,152 | no_license | [
{
"docstring": "Returns the liked quotes of the current user.",
"name": "get",
"signature": "def get(cls)"
},
{
"docstring": "Creates a like for the current user.",
"name": "post",
"signature": "def post(cls)"
}
] | 2 | stack_v2_sparse_classes_30k_train_033332 | Implement the Python class `Likes` described below.
Class description:
Resource for likes.
Method signatures and docstrings:
- def get(cls): Returns the liked quotes of the current user.
- def post(cls): Creates a like for the current user. | Implement the Python class `Likes` described below.
Class description:
Resource for likes.
Method signatures and docstrings:
- def get(cls): Returns the liked quotes of the current user.
- def post(cls): Creates a like for the current user.
<|skeleton|>
class Likes:
"""Resource for likes."""
def get(cls):
... | 6718d90111a49a902deae461858b29a48167ee0e | <|skeleton|>
class Likes:
"""Resource for likes."""
def get(cls):
"""Returns the liked quotes of the current user."""
<|body_0|>
def post(cls):
"""Creates a like for the current user."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Likes:
"""Resource for likes."""
def get(cls):
"""Returns the liked quotes of the current user."""
parser = reqparse.RequestParser()
parser.add_argument('page', type=int, location='args')
parser.add_argument('per_page', type=int, location='args')
args = parser.pars... | the_stack_v2_python_sparse | devquotes/routes/like.py | bertdida/devquotes-flask | train | 1 |
f4b1e03e0b59a8a0794cd5339c92daeb1d3bd54e | [
"service = 'autoscaling'\norca_config = OrcaConfig()\nself.regions = orca_config.get_regions()\nself.clients = {}\nself.auto_scaling_groups = {}\nif profile_names is not None:\n for profile_name in profile_names:\n session = boto3.Session(profile_name=profile_name)\n self.clients[profile_name] = se... | <|body_start_0|>
service = 'autoscaling'
orca_config = OrcaConfig()
self.regions = orca_config.get_regions()
self.clients = {}
self.auto_scaling_groups = {}
if profile_names is not None:
for profile_name in profile_names:
session = boto3.Sessio... | The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface | AwsServiceAutoScaling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AwsServiceAutoScaling:
"""The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface"""
def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False):
"""Create a autoscaling service client to one ore more envir... | stack_v2_sparse_classes_75kplus_train_068816 | 5,491 | permissive | [
{
"docstring": "Create a autoscaling service client to one ore more environments by name.",
"name": "__init__",
"signature": "def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False)"
},
{
"docstring": "Return all the autoscaling groups. :type p... | 4 | stack_v2_sparse_classes_30k_train_053526 | Implement the Python class `AwsServiceAutoScaling` described below.
Class description:
The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface
Method signatures and docstrings:
- def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False): ... | Implement the Python class `AwsServiceAutoScaling` described below.
Class description:
The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface
Method signatures and docstrings:
- def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False): ... | c74662c963542eb52b4d88ede9c6ff5b21ce3016 | <|skeleton|>
class AwsServiceAutoScaling:
"""The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface"""
def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False):
"""Create a autoscaling service client to one ore more envir... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AwsServiceAutoScaling:
"""The class provides a simpler abstraction to the AWS boto3 cloudwatch client interface"""
def __init__(self, profile_names=None, access_key_id=None, secret_access_key=None, iam_role_discover=False):
"""Create a autoscaling service client to one ore more environments by na... | the_stack_v2_python_sparse | orcalib/autoscaling_service.py | bdastur/orca | train | 3 |
69d69a41a0afdb9d406532c3505835b3a4e4515a | [
"client_class_obj = readnodestatus.ReadNodeStatus(connection_object=client_object.connection, addnode_id=client_object.id_)\nstatus_schema_object = client_class_obj.read()\nstatus_schema_dict = status_schema_object.get_py_dict_from_object()\nresult_dict = dict()\nresult_dict['response'] = status_schema_dict\nresult... | <|body_start_0|>
client_class_obj = readnodestatus.ReadNodeStatus(connection_object=client_object.connection, addnode_id=client_object.id_)
status_schema_object = client_class_obj.read()
status_schema_dict = status_schema_object.get_py_dict_from_object()
result_dict = dict()
resu... | NSX70AggregationImpl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NSX70AggregationImpl:
def get_node_status(cls, client_object, get_node_status=None):
"""Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: Client object @type get_node_status: List @param get_node_status: A list of dicts. It is not used. @rtype: Dic... | stack_v2_sparse_classes_75kplus_train_068817 | 2,724 | no_license | [
{
"docstring": "Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: Client object @type get_node_status: List @param get_node_status: A list of dicts. It is not used. @rtype: Dict @return: Dict having fabric host node status Endpoint: /fabric/nodes/<node-id>/status",
"n... | 2 | stack_v2_sparse_classes_30k_val_002838 | Implement the Python class `NSX70AggregationImpl` described below.
Class description:
Implement the NSX70AggregationImpl class.
Method signatures and docstrings:
- def get_node_status(cls, client_object, get_node_status=None): Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: C... | Implement the Python class `NSX70AggregationImpl` described below.
Class description:
Implement the NSX70AggregationImpl class.
Method signatures and docstrings:
- def get_node_status(cls, client_object, get_node_status=None): Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: C... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class NSX70AggregationImpl:
def get_node_status(cls, client_object, get_node_status=None):
"""Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: Client object @type get_node_status: List @param get_node_status: A list of dicts. It is not used. @rtype: Dic... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NSX70AggregationImpl:
def get_node_status(cls, client_object, get_node_status=None):
"""Get fabric host node status. @type client_object: HostNodeAPIClient @param client_object: Client object @type get_node_status: List @param get_node_status: A list of dicts. It is not used. @rtype: Dict @return: Dic... | the_stack_v2_python_sparse | SystemTesting/pylib/vmware/nsx/manager/hostnode/api/nsx70_aggregation_impl.py | Cloudxtreme/MyProject | train | 0 | |
7902f514a76f0bc58127bfa8c7e97af84e461e92 | [
"username = self.cleaned_data.get('username')\nis_exist = models.User.objects.filter(username=username)\nif is_exist:\n self.add_error('username', '用户名已存在')\nreturn username",
"phone = self.cleaned_data.get('phone')\nif not len(str(phone)) <= 11:\n self.add_error('phone', '手机号最多11位')\nreturn phone"
] | <|body_start_0|>
username = self.cleaned_data.get('username')
is_exist = models.User.objects.filter(username=username)
if is_exist:
self.add_error('username', '用户名已存在')
return username
<|end_body_0|>
<|body_start_1|>
phone = self.cleaned_data.get('phone')
if ... | 使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验 | AccountForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountForm:
"""使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验"""
def clean_username(self):
"""使用局部hook校验变更后是否为已存在用户名"""
<|body_0|>
def clean_phone(self):
"""使用局部hook校验用户手机号是否正确"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
username = self.cleaned_... | stack_v2_sparse_classes_75kplus_train_068818 | 2,555 | no_license | [
{
"docstring": "使用局部hook校验变更后是否为已存在用户名",
"name": "clean_username",
"signature": "def clean_username(self)"
},
{
"docstring": "使用局部hook校验用户手机号是否正确",
"name": "clean_phone",
"signature": "def clean_phone(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035985 | Implement the Python class `AccountForm` described below.
Class description:
使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验
Method signatures and docstrings:
- def clean_username(self): 使用局部hook校验变更后是否为已存在用户名
- def clean_phone(self): 使用局部hook校验用户手机号是否正确 | Implement the Python class `AccountForm` described below.
Class description:
使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验
Method signatures and docstrings:
- def clean_username(self): 使用局部hook校验变更后是否为已存在用户名
- def clean_phone(self): 使用局部hook校验用户手机号是否正确
<|skeleton|>
class AccountForm:
"""使用django中的form组件生成帐号信息界面form表... | 26c49e8f525ca57dca27f8de53d15bcab24d00e4 | <|skeleton|>
class AccountForm:
"""使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验"""
def clean_username(self):
"""使用局部hook校验变更后是否为已存在用户名"""
<|body_0|>
def clean_phone(self):
"""使用局部hook校验用户手机号是否正确"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountForm:
"""使用django中的form组件生成帐号信息界面form表单,并对用户输入内容校验"""
def clean_username(self):
"""使用局部hook校验变更后是否为已存在用户名"""
username = self.cleaned_data.get('username')
is_exist = models.User.objects.filter(username=username)
if is_exist:
self.add_error('username', '用户... | the_stack_v2_python_sparse | iframe_api/forms/accountForm.py | A35-Zhou/Rental-House-Manager | train | 0 |
a0266aedc1cb8b3ec3e13ebea46c7473f04bf21e | [
"if isinstance(request.auth, ProjectKey):\n return self.respond(status=401)\npaginate_kwargs = {}\ntry:\n environment = self._get_environment_from_request(request, project.organization_id)\nexcept Environment.DoesNotExist:\n queryset = UserReport.objects.none()\nelse:\n queryset = UserReport.objects.fil... | <|body_start_0|>
if isinstance(request.auth, ProjectKey):
return self.respond(status=401)
paginate_kwargs = {}
try:
environment = self._get_environment_from_request(request, project.organization_id)
except Environment.DoesNotExist:
queryset = UserRepor... | ProjectUserReportsEndpoint | [
"Apache-2.0",
"BUSL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectUserReportsEndpoint:
def get(self, request: Request, project) -> Response:
"""List a Project's User Feedback `````````````````````````````` Return a list of user feedback items within this project. :pparam string organization_slug: the slug of the organization. :pparam string proj... | stack_v2_sparse_classes_75kplus_train_068819 | 4,699 | permissive | [
{
"docstring": "List a Project's User Feedback `````````````````````````````` Return a list of user feedback items within this project. :pparam string organization_slug: the slug of the organization. :pparam string project_slug: the slug of the project. :auth: required",
"name": "get",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_028063 | Implement the Python class `ProjectUserReportsEndpoint` described below.
Class description:
Implement the ProjectUserReportsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project) -> Response: List a Project's User Feedback `````````````````````````````` Return a list of user feed... | Implement the Python class `ProjectUserReportsEndpoint` described below.
Class description:
Implement the ProjectUserReportsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project) -> Response: List a Project's User Feedback `````````````````````````````` Return a list of user feed... | d9dd4f382f96b5c4576b64cbf015db651556c18b | <|skeleton|>
class ProjectUserReportsEndpoint:
def get(self, request: Request, project) -> Response:
"""List a Project's User Feedback `````````````````````````````` Return a list of user feedback items within this project. :pparam string organization_slug: the slug of the organization. :pparam string proj... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectUserReportsEndpoint:
def get(self, request: Request, project) -> Response:
"""List a Project's User Feedback `````````````````````````````` Return a list of user feedback items within this project. :pparam string organization_slug: the slug of the organization. :pparam string project_slug: the ... | the_stack_v2_python_sparse | src/sentry/api/endpoints/project_user_reports.py | nagyist/sentry | train | 0 | |
b64368d3884faf8c83ae2a8925399ebf9bd8e949 | [
"super().__init__(self.PROBLEM_NAME)\nself.input_range_list1 = input_range_list1\nself.input_range_list2 = input_range_list2",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nmerged_list = []\ninterval_list = sorted(self.input_range_list1 + self.input_range_list2, key=lambda x: x[0])\nfor interval in ... | <|body_start_0|>
super().__init__(self.PROBLEM_NAME)
self.input_range_list1 = input_range_list1
self.input_range_list2 = input_range_list2
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
merged_list = []
interval_list = sorted(se... | Merge Intervals | MergeIntervals | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MergeIntervals:
"""Merge Intervals"""
def __init__(self, input_range_list1, input_range_list2):
"""Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the... | stack_v2_sparse_classes_75kplus_train_068820 | 2,067 | no_license | [
{
"docstring": "Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, input_range_list1, input_range_list2)"
},
{
"docstring": "Solve the problem Note: O(n logn) (runtime) an... | 2 | stack_v2_sparse_classes_30k_train_022957 | Implement the Python class `MergeIntervals` described below.
Class description:
Merge Intervals
Method signatures and docstrings:
- def __init__(self, input_range_list1, input_range_list2): Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None
- def s... | Implement the Python class `MergeIntervals` described below.
Class description:
Merge Intervals
Method signatures and docstrings:
- def __init__(self, input_range_list1, input_range_list2): Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None
- def s... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class MergeIntervals:
"""Merge Intervals"""
def __init__(self, input_range_list1, input_range_list2):
"""Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MergeIntervals:
"""Merge Intervals"""
def __init__(self, input_range_list1, input_range_list2):
"""Merge Intervals Args: input_range_list1: First range list input_range_list2: First range list Returns: None Raises: None"""
super().__init__(self.PROBLEM_NAME)
self.input_range_list1... | the_stack_v2_python_sparse | python/problems/array/merge_intervals.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
944b4dae257ba4a43bcf4b8ea855b66cb7077af0 | [
"self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 3\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullets_allowed = 3\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()",
"self.sh... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullets_allowed = 3
self.fleet_drop_speed = 1... | 存储《外星人入侵》的所有设置的类 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_068821 | 1,010 | no_license | [
{
"docstring": "初始化游戏的静态设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置",
"name": "increase_speed",
"signat... | 3 | stack_v2_sparse_classes_30k_train_014000 | Implement the Python class `Settings` described below.
Class description:
存储《外星人入侵》的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置 | Implement the Python class `Settings` described below.
Class description:
存储《外星人入侵》的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置
<|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __i... | e30e4316c040d6af4af486b46fccb581bdc83ce9 | <|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60... | the_stack_v2_python_sparse | basic/alien_invasion/settings.py | zhudingsuifeng/python | train | 0 |
a61eb8948b43b30a5bb9d95e5418b3963317fedb | [
"webob.exc.HTTPError.__init__(self, detail=detail)\nserializer = serializers.XMLResponseSerializer()\nserializer.default(self, self.get_unserialized_body())",
"if self.detail:\n message = ':'.join([self.explanation, self.detail])\nelse:\n message = self.explanation\nreturn {'ErrorResponse': {'Error': {'Type... | <|body_start_0|>
webob.exc.HTTPError.__init__(self, detail=detail)
serializer = serializers.XMLResponseSerializer()
serializer.default(self, self.get_unserialized_body())
<|end_body_0|>
<|body_start_1|>
if self.detail:
message = ':'.join([self.explanation, self.detail])
... | webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used directly, instead use the subclasses defined below which map to AWS API errors. | HeatAPIException | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HeatAPIException:
"""webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used directly, instead use the subclasses defined ... | stack_v2_sparse_classes_75kplus_train_068822 | 10,462 | permissive | [
{
"docstring": "Overload HTTPError constructor to create a default serialized body. This is required because not all error responses are processed by the wsgi controller (such as auth errors), which are further up the paste pipeline. We serialize in XML by default (as AWS does).",
"name": "__init__",
"s... | 2 | stack_v2_sparse_classes_30k_train_018910 | Implement the Python class `HeatAPIException` described below.
Class description:
webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used direct... | Implement the Python class `HeatAPIException` described below.
Class description:
webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used direct... | aad322c705b338af52cccbbe1d100e9e885c08ea | <|skeleton|>
class HeatAPIException:
"""webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used directly, instead use the subclasses defined ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HeatAPIException:
"""webob HTTPError subclass that creates a serialized body. Subclass webob HTTPError so we can correctly serialize the wsgi response into the http response body, using the format specified by the request. Note this should not be used directly, instead use the subclasses defined below which m... | the_stack_v2_python_sparse | heat/api/aws/exception.py | containers-kraken/heat | train | 1 |
597601b644ed581ff16fcdb0ca1f820023b29cbb | [
"super().__init__(name)\nself._maintype = 'Artifact'\nself._feature2 = ['Hexproof', 'Indestructible', 'Flash']\nself._power = None\nself._toughness = None",
"if subtype is not None:\n if isinstance(subtype, list):\n self._subtype = subtype\n else:\n self._subtype = subtype.split(' ')\n if s... | <|body_start_0|>
super().__init__(name)
self._maintype = 'Artifact'
self._feature2 = ['Hexproof', 'Indestructible', 'Flash']
self._power = None
self._toughness = None
<|end_body_0|>
<|body_start_1|>
if subtype is not None:
if isinstance(subtype, list):
... | Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Artifact has no power (unless subtype includes 'Vehicle'). _toughness: [Integer... | Artifact | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Artifact:
"""Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Artifact has no power (unless subtype inclu... | stack_v2_sparse_classes_75kplus_train_068823 | 1,581 | no_license | [
{
"docstring": "Class constructor. Creates a new card. Args: name: [String] Name of the card.",
"name": "__init__",
"signature": "def __init__(self, name)"
},
{
"docstring": "Sets card's subtypes. If subtype includes 'Vehicle', power and toughness are set on. Args: subtype: [List or String] List... | 2 | null | Implement the Python class `Artifact` described below.
Class description:
Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Arti... | Implement the Python class `Artifact` described below.
Class description:
Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Arti... | 37e859857570f398b5c237dacd283e7b00bb1b26 | <|skeleton|>
class Artifact:
"""Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Artifact has no power (unless subtype inclu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Artifact:
"""Card subclass that represents a single Artifact card. Attributes: _maintype: [String] Card's maintype is Artifact. _feature2: [List String] If the card has a limited set of features, the available features are listed here. _power: [Integer] Artifact has no power (unless subtype includes 'Vehicle'... | the_stack_v2_python_sparse | src/entities/card_artifact.py | Noissi/ot_harjoitustyo | train | 0 |
15da776c60eb9709d51893323e5739a29aadb7d6 | [
"self.start_pos = start_pos\nself.end_pos = end_pos\nself.type = type\nself.text = text\nself.feature_list = feature_list\nself.part = part",
"if part == 'content':\n instances = [instance.content for feature in self.feature_list if feature.feature_name == instance_type for instance in feature.feature_instance... | <|body_start_0|>
self.start_pos = start_pos
self.end_pos = end_pos
self.type = type
self.text = text
self.feature_list = feature_list
self.part = part
<|end_body_0|>
<|body_start_1|>
if part == 'content':
instances = [instance.content for feature in s... | Segment | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Segment:
def __init__(self, type, start_pos, end_pos, text, feature_list, part=None):
""":param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence segments :param start_pos: The starting position of the segment in the article :param end_pos: ... | stack_v2_sparse_classes_75kplus_train_068824 | 1,542 | permissive | [
{
"docstring": ":param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence segments :param start_pos: The starting position of the segment in the article :param end_pos: The end position of the segment in the article :param text: The text contained in the segment :pa... | 2 | stack_v2_sparse_classes_30k_val_000662 | Implement the Python class `Segment` described below.
Class description:
Implement the Segment class.
Method signatures and docstrings:
- def __init__(self, type, start_pos, end_pos, text, feature_list, part=None): :param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence... | Implement the Python class `Segment` described below.
Class description:
Implement the Segment class.
Method signatures and docstrings:
- def __init__(self, type, start_pos, end_pos, text, feature_list, part=None): :param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence... | 2e6a85dc9e95ef94bec2339987950f4e88f5d909 | <|skeleton|>
class Segment:
def __init__(self, type, start_pos, end_pos, text, feature_list, part=None):
""":param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence segments :param start_pos: The starting position of the segment in the article :param end_pos: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Segment:
def __init__(self, type, start_pos, end_pos, text, feature_list, part=None):
""":param type: Sentence segment or article segment. Paragraph segments get created from multiple sentence segments :param start_pos: The starting position of the segment in the article :param end_pos: The end positi... | the_stack_v2_python_sparse | newssimilarity/model/segment.py | imackerracher/NewsSimilarity | train | 0 | |
897b322fecd306f7fdad551cb2ab22ea07c905ce | [
"if numCourses < 2:\n return True\nnode_map = {}\nfor to_num, from_num in prerequisites:\n from_node = node_map.get(from_num, Node(from_num))\n to_node = node_map.get(to_num, Node(to_num))\n from_node.children.add(to_node)\n to_node.parents.add(from_node)\n node_map[from_num] = from_node\n node... | <|body_start_0|>
if numCourses < 2:
return True
node_map = {}
for to_num, from_num in prerequisites:
from_node = node_map.get(from_num, Node(from_num))
to_node = node_map.get(to_num, Node(to_num))
from_node.children.add(to_node)
to_node... | 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 findOrder(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: Li... | stack_v2_sparse_classes_75kplus_train_068825 | 2,427 | no_license | [
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool",
"name": "canFinish",
"signature": "def canFinish(self, numCourses, prerequisites)"
},
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]",
"name": "findOrder",
... | 2 | stack_v2_sparse_classes_30k_train_030924 | 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 findOrder(self, numCourses, prerequisites): :type nu... | 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 findOrder(self, numCourses, prerequisites): :type nu... | 75e5b66e950692fe62aaaaa33806c9dc29171bac | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def findOrder(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: Li... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
if numCourses < 2:
return True
node_map = {}
for to_num, from_num in prerequisites:
from_node = node_map.get(from_num,... | the_stack_v2_python_sparse | course_schedule.py | Zylophone/practice | train | 0 | |
700103e5b3b016d0101185f1168e8b0db6797ec5 | [
"self.local_name: dict[str, list[_T]] = {}\nself.service_uuid: dict[str, list[_T]] = {}\nself.service_data_uuid: dict[str, list[_T]] = {}\nself.manufacturer_id: dict[int, list[_T]] = {}\nself.service_uuid_set: set[str] = set()\nself.service_data_uuid_set: set[str] = set()\nself.manufacturer_id_set: set[int] = set()... | <|body_start_0|>
self.local_name: dict[str, list[_T]] = {}
self.service_uuid: dict[str, list[_T]] = {}
self.service_data_uuid: dict[str, list[_T]] = {}
self.manufacturer_id: dict[int, list[_T]] = {}
self.service_uuid_set: set[str] = set()
self.service_data_uuid_set: set[s... | Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cases when no service infos will be matched in any bucke... | BluetoothMatcherIndexBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BluetoothMatcherIndexBase:
"""Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cas... | stack_v2_sparse_classes_75kplus_train_068826 | 15,444 | permissive | [
{
"docstring": "Initialize the matcher index.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Add a matcher to the index. Matchers must end up only in one bucket. We put them in the bucket that they are most likely to match.",
"name": "add",
"signature"... | 5 | stack_v2_sparse_classes_30k_train_051111 | Implement the Python class `BluetoothMatcherIndexBase` described below.
Class description:
Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match agai... | Implement the Python class `BluetoothMatcherIndexBase` described below.
Class description:
Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match agai... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class BluetoothMatcherIndexBase:
"""Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BluetoothMatcherIndexBase:
"""Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cases when no se... | the_stack_v2_python_sparse | homeassistant/components/bluetooth/match.py | home-assistant/core | train | 35,501 |
c5b10117db60a7b57d69c366be998e962a58f27d | [
"super(ClientError, self).__init__(message=message, original_exception=original_exception)\nself.error_code = error_code\nself.result = result",
"msg = 'Received error code {0:d} from API'.format(self.error_code)\nif self.message:\n msg += ': {0:s}'.format(self.message)\nelse:\n msg += ' (No further informa... | <|body_start_0|>
super(ClientError, self).__init__(message=message, original_exception=original_exception)
self.error_code = error_code
self.result = result
<|end_body_0|>
<|body_start_1|>
msg = 'Received error code {0:d} from API'.format(self.error_code)
if self.message:
... | A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server. | ClientError | [
"MIT",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientError:
"""A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server."""
def __init__(self, error_code, message, result=None, original_exception=None):
"""Initialize the ClientError. Args: error_code (int): The error code that was received from... | stack_v2_sparse_classes_75kplus_train_068827 | 8,094 | permissive | [
{
"docstring": "Initialize the ClientError. Args: error_code (int): The error code that was received from the server. message (str): The actual error message. result (object): The result of the operation from the server. original_exception (Exception): The exception that caused this one to be raised.",
"nam... | 2 | null | Implement the Python class `ClientError` described below.
Class description:
A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server.
Method signatures and docstrings:
- def __init__(self, error_code, message, result=None, original_exception=None): Initialize the ClientError. Args... | Implement the Python class `ClientError` described below.
Class description:
A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server.
Method signatures and docstrings:
- def __init__(self, error_code, message, result=None, original_exception=None): Initialize the ClientError. Args... | 32dd08d2185f7113f87834002e720db31c8c910e | <|skeleton|>
class ClientError:
"""A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server."""
def __init__(self, error_code, message, result=None, original_exception=None):
"""Initialize the ClientError. Args: error_code (int): The error code that was received from... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClientError:
"""A ClientError is raised when an HTTP 4xx error code is returned from the Carbon Black server."""
def __init__(self, error_code, message, result=None, original_exception=None):
"""Initialize the ClientError. Args: error_code (int): The error code that was received from the server. ... | the_stack_v2_python_sparse | src/cbapi/errors.py | carbonblack/cbapi-python | train | 158 |
a646b7054896f0d9a7ee069518cbafa44683c889 | [
"trigger = SunTrigger(self.mudpi, config)\nif trigger:\n self.add_component(trigger)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('source'):\n raise ConfigError('Missing `source` key in Sun Trigger config.')\nreturn config"
] | <|body_start_0|>
trigger = SunTrigger(self.mudpi, config)
if trigger:
self.add_component(trigger)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [config]
for conf in config:
if not conf.get('source'):
... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load Trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
trigger = SunTrigger(self.mudpi, config)
if tr... | stack_v2_sparse_classes_75kplus_train_068828 | 3,967 | permissive | [
{
"docstring": "Load Trigger component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the trigger config",
"name": "validate",
"signature": "def validate(self, config)"
}
] | 2 | null | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load Trigger component from configs
- def validate(self, config): Validate the trigger config | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load Trigger component from configs
- def validate(self, config): Validate the trigger config
<|skeleton|>
class Interface:
def load(self, config)... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load Trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Interface:
def load(self, config):
"""Load Trigger component from configs"""
trigger = SunTrigger(self.mudpi, config)
if trigger:
self.add_component(trigger)
return True
def validate(self, config):
"""Validate the trigger config"""
if not isinst... | the_stack_v2_python_sparse | mudpi/extensions/sun/trigger.py | mistasp0ck/mudpi-core | train | 0 | |
610f415dd3004c76f98c52a0069c0ad72d7389a4 | [
"self.stopwords = self.get_stopwords(stopword_filepath)\nself.raker = r.Rake(self.stopwords)\nself.counter = w.WordCounter(self.stopwords)",
"rake_keys = self.extract_rake(text, False)\ntop_keys = self.extract_top(text, True)\nkey_list = {}\nfor rake_key in rake_keys:\n key_list[rake_key[0]] = 0\n key_score... | <|body_start_0|>
self.stopwords = self.get_stopwords(stopword_filepath)
self.raker = r.Rake(self.stopwords)
self.counter = w.WordCounter(self.stopwords)
<|end_body_0|>
<|body_start_1|>
rake_keys = self.extract_rake(text, False)
top_keys = self.extract_top(text, True)
key... | keywords class | KeyWords | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyWords:
"""keywords class"""
def __init__(self, stopword_filepath='SmartStoplist.txt'):
"""Init @param stopword_filepath Filepath for stopwordlist, can be modified"""
<|body_0|>
def extract(self, text, return_amount=10):
"""Does a combined rake and relevant wor... | stack_v2_sparse_classes_75kplus_train_068829 | 3,760 | no_license | [
{
"docstring": "Init @param stopword_filepath Filepath for stopwordlist, can be modified",
"name": "__init__",
"signature": "def __init__(self, stopword_filepath='SmartStoplist.txt')"
},
{
"docstring": "Does a combined rake and relevant word count of the given string in order to give some releva... | 5 | stack_v2_sparse_classes_30k_train_016027 | Implement the Python class `KeyWords` described below.
Class description:
keywords class
Method signatures and docstrings:
- def __init__(self, stopword_filepath='SmartStoplist.txt'): Init @param stopword_filepath Filepath for stopwordlist, can be modified
- def extract(self, text, return_amount=10): Does a combined ... | Implement the Python class `KeyWords` described below.
Class description:
keywords class
Method signatures and docstrings:
- def __init__(self, stopword_filepath='SmartStoplist.txt'): Init @param stopword_filepath Filepath for stopwordlist, can be modified
- def extract(self, text, return_amount=10): Does a combined ... | 5e67a73cb08165bce415131555f21c4713321b0c | <|skeleton|>
class KeyWords:
"""keywords class"""
def __init__(self, stopword_filepath='SmartStoplist.txt'):
"""Init @param stopword_filepath Filepath for stopwordlist, can be modified"""
<|body_0|>
def extract(self, text, return_amount=10):
"""Does a combined rake and relevant wor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeyWords:
"""keywords class"""
def __init__(self, stopword_filepath='SmartStoplist.txt'):
"""Init @param stopword_filepath Filepath for stopwordlist, can be modified"""
self.stopwords = self.get_stopwords(stopword_filepath)
self.raker = r.Rake(self.stopwords)
self.counter ... | the_stack_v2_python_sparse | media_conversation/keywords.py | linriedi/UvA-Home | train | 0 |
c3d4b0139cba0453fde7f8e5a03a998c1b172de7 | [
"super().__init__()\nself.fc = torch.nn.Linear(latent_dim, num_channels * img_size ** 2)\nself.l1 = torch.nn.Sequential(torch.nn.Conv2d(num_channels * 2, 64, 3, 1, 1), torch.nn.ReLU(inplace=True))\nresblocks = []\nfor _ in range(n_residual_blocks):\n resblocks.append(ResidualBlock(num_filts))\nself.resblocks = t... | <|body_start_0|>
super().__init__()
self.fc = torch.nn.Linear(latent_dim, num_channels * img_size ** 2)
self.l1 = torch.nn.Sequential(torch.nn.Conv2d(num_channels * 2, 64, 3, 1, 1), torch.nn.ReLU(inplace=True))
resblocks = []
for _ in range(n_residual_blocks):
resbloc... | The generator topology | Generator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Generator:
"""The generator topology"""
def __init__(self, latent_dim, num_channels, img_size, n_residual_blocks, num_filts=64):
"""Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number of image channels to generate img_size : int number of pix... | stack_v2_sparse_classes_75kplus_train_068830 | 5,861 | permissive | [
{
"docstring": "Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number of image channels to generate img_size : int number of pixels per side of the image n_residual_blocks : int number of residual blocks inside the generator num_filts : int number of filters inside each o... | 2 | stack_v2_sparse_classes_30k_train_031205 | Implement the Python class `Generator` described below.
Class description:
The generator topology
Method signatures and docstrings:
- def __init__(self, latent_dim, num_channels, img_size, n_residual_blocks, num_filts=64): Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number o... | Implement the Python class `Generator` described below.
Class description:
The generator topology
Method signatures and docstrings:
- def __init__(self, latent_dim, num_channels, img_size, n_residual_blocks, num_filts=64): Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number o... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class Generator:
"""The generator topology"""
def __init__(self, latent_dim, num_channels, img_size, n_residual_blocks, num_filts=64):
"""Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number of image channels to generate img_size : int number of pix... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Generator:
"""The generator topology"""
def __init__(self, latent_dim, num_channels, img_size, n_residual_blocks, num_filts=64):
"""Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number of image channels to generate img_size : int number of pixels per side ... | the_stack_v2_python_sparse | dlutils/models/gans/pixel_da/models.py | justusschock/dl-utils | train | 15 |
cca5af8132e068d043a998b1f3287aac3f8b94f2 | [
"super(Transformer, self).__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)",
"enc_output = self.encoder(inputs, training, encoder_mask)\n... | <|body_start_0|>
super(Transformer, self).__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)
self.linear = tf.keras.layers.Dense(target_vocab)
<|end_body_0|>
<|body_... | class Transformer | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""class Transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Constructor @params N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads ... | stack_v2_sparse_classes_75kplus_train_068831 | 2,755 | no_license | [
{
"docstring": "Constructor @params N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layers input_vocab - the size of the input vocabulary target_vocab - the size of the target vocabulary m... | 2 | stack_v2_sparse_classes_30k_train_011829 | Implement the Python class `Transformer` described below.
Class description:
class Transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Constructor @params N - the number of blocks in the encoder and decoder dm -... | Implement the Python class `Transformer` described below.
Class description:
class Transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Constructor @params N - the number of blocks in the encoder and decoder dm -... | ff1af62484620b599cc3813068770db03b37036d | <|skeleton|>
class Transformer:
"""class Transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Constructor @params N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Transformer:
"""class Transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Constructor @params N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the ... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/11-transformer.py | paurbano/holbertonschool-machine_learning | train | 0 |
8a4aa46280107cb5121e2b71cc8097fed50bd8f8 | [
"RadianceDefault.__init__(self, name, descriptiveName)\nself._relativePath = relativePath\nself._checkExists = checkExists\nself._extension = extension",
"if value is not None:\n value = str(value)\n assert isinstance(value, str), 'The input for %s should be string containing the path name. %s %s was provid... | <|body_start_0|>
RadianceDefault.__init__(self, name, descriptiveName)
self._relativePath = relativePath
self._checkExists = checkExists
self._extension = extension
<|end_body_0|>
<|body_start_1|>
if value is not None:
value = str(value)
assert isinstance... | This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are actually keywords in python. For example -or in rcollate or -as in rtrace. In su... | RadiancePath | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadiancePath:
"""This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are actually keywords in python. For example... | stack_v2_sparse_classes_75kplus_train_068832 | 32,130 | permissive | [
{
"docstring": "Init path descriptor.",
"name": "__init__",
"signature": "def __init__(self, name, descriptiveName=None, relativePath=None, checkExists=False, extension=None)"
},
{
"docstring": "Set the value. Run tests based on _expandRelative, _checkExists and _extension before assigning the v... | 2 | null | Implement the Python class `RadiancePath` described below.
Class description:
This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are a... | Implement the Python class `RadiancePath` described below.
Class description:
This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are a... | 983fccc934e5546082557f6c2d1f2d9e00eba332 | <|skeleton|>
class RadiancePath:
"""This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are actually keywords in python. For example... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RadiancePath:
"""This input is expected to be a file path. (Attributes inherited from base-class are explained there.) Attributes: name: Required for all cases. Name of the flag, like 'ab' for '-ab 5' in rtrace etc. Note that some of the radiance flags are actually keywords in python. For example -or in rcoll... | the_stack_v2_python_sparse | honeybee/radiance/datatype.py | ladybug-tools/honeybee-server | train | 7 |
1d6f0b3fb9ca8ae665f3fa18c7438b42a51a426b | [
"self.available_camera = pypylon.factory.find_devices()\nif bool(self.available_camera):\n self.camera = pypylon.factory.create_device(self.available_camera[0])\n return self.camera.device_info\nelse:\n return False",
"port_list = list(serial.tools.list_ports.comports())\nfor port in port_list:\n if '... | <|body_start_0|>
self.available_camera = pypylon.factory.find_devices()
if bool(self.available_camera):
self.camera = pypylon.factory.create_device(self.available_camera[0])
return self.camera.device_info
else:
return False
<|end_body_0|>
<|body_start_1|>
... | Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera | ImageCapture | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageCapture:
"""Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera"""
def acquire_camera(self):
"""Accesses the pypylon wrapper and ch... | stack_v2_sparse_classes_75kplus_train_068833 | 7,810 | no_license | [
{
"docstring": "Accesses the pypylon wrapper and checks the ethernet ports for a connected camera Creates the camera object and returns camera information if found, else False is returned",
"name": "acquire_camera",
"signature": "def acquire_camera(self)"
},
{
"docstring": "Grabs a list of all t... | 6 | stack_v2_sparse_classes_30k_train_033004 | Implement the Python class `ImageCapture` described below.
Class description:
Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera
Method signatures and docstrings:
- def ... | Implement the Python class `ImageCapture` described below.
Class description:
Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera
Method signatures and docstrings:
- def ... | cdcdfad34691fb8434f67c69d2f8b037197028cc | <|skeleton|>
class ImageCapture:
"""Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera"""
def acquire_camera(self):
"""Accesses the pypylon wrapper and ch... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageCapture:
"""Module used to capture images from the connected Basler Ace acA3800-10gm GigE camera if attached Also contains methods to look for an attached camera and trigger, and to apply settings to said camera"""
def acquire_camera(self):
"""Accesses the pypylon wrapper and checks the ethe... | the_stack_v2_python_sparse | image_capture.py | Spinarakk/defectmonitor | train | 0 |
6104aebaf6abeea867571df0001cfe598e9a44e0 | [
"indexes = {'oids': ['.1.3.6.1.4.1.2021.10.1.2'], 'values': {'Load-1': None, 'Load-5': None, 'Load-15': None}}\nperfdata = [PerfDataItem(key='load_1', oid='.1.3.6.1.4.1.2021.10.1.3', index_label='Load-1', return_value=True, value_type='%f'), PerfDataItem(key='alert_load_5', oid='.1.3.6.1.4.1.2021.10.1.3', index_lab... | <|body_start_0|>
indexes = {'oids': ['.1.3.6.1.4.1.2021.10.1.2'], 'values': {'Load-1': None, 'Load-5': None, 'Load-15': None}}
perfdata = [PerfDataItem(key='load_1', oid='.1.3.6.1.4.1.2021.10.1.3', index_label='Load-1', return_value=True, value_type='%f'), PerfDataItem(key='alert_load_5', oid='.1.3.6.1.... | Check Machine's Load Metrics Method | CheckLoad | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckLoad:
"""Check Machine's Load Metrics Method"""
def __init__(self, params, *args, **kwargs):
"""Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs"""
<|body_0|>
def probe(self):
"""Query ... | stack_v2_sparse_classes_75kplus_train_068834 | 3,097 | no_license | [
{
"docstring": "Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs",
"name": "__init__",
"signature": "def __init__(self, params, *args, **kwargs)"
},
{
"docstring": "Query system state and return metrics. This is the only me... | 2 | null | Implement the Python class `CheckLoad` described below.
Class description:
Check Machine's Load Metrics Method
Method signatures and docstrings:
- def __init__(self, params, *args, **kwargs): Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs
- de... | Implement the Python class `CheckLoad` described below.
Class description:
Check Machine's Load Metrics Method
Method signatures and docstrings:
- def __init__(self, params, *args, **kwargs): Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs
- de... | fc8c808c46f65696f7c6ac8fd6266c1091dbb14d | <|skeleton|>
class CheckLoad:
"""Check Machine's Load Metrics Method"""
def __init__(self, params, *args, **kwargs):
"""Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs"""
<|body_0|>
def probe(self):
"""Query ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CheckLoad:
"""Check Machine's Load Metrics Method"""
def __init__(self, params, *args, **kwargs):
"""Class initialization. :param params: Args list to pass to argsParser. :param args: Extra Args :param kwargs: Extra kwargs"""
indexes = {'oids': ['.1.3.6.1.4.1.2021.10.1.2'], 'values': {'Lo... | the_stack_v2_python_sparse | sondes/check_load.py | aurimukas/icinga2_plugins | train | 3 |
08cfdcc97016edc56b3a099c5f01cd65edbe7b3d | [
"Part = self.old_state.apps.get_model('part', 'part')\nPart.objects.create(name='A', description='My part A')\nPart.objects.create(name='B', description='My part B')\nPart.objects.create(name='C', description='My part C')\nPart.objects.create(name='D', description='My part D')\nPart.objects.create(name='E', descrip... | <|body_start_0|>
Part = self.old_state.apps.get_model('part', 'part')
Part.objects.create(name='A', description='My part A')
Part.objects.create(name='B', description='My part B')
Part.objects.create(name='C', description='My part C')
Part.objects.create(name='D', description='My... | Test entire schema migration sequence for the part app. | TestForwardMigrations | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestForwardMigrations:
"""Test entire schema migration sequence for the part app."""
def prepare(self):
"""Create initial data."""
<|body_0|>
def test_models_exist(self):
"""Test that the Part model can still be accessed at the end of schema migration"""
... | stack_v2_sparse_classes_75kplus_train_068835 | 8,200 | permissive | [
{
"docstring": "Create initial data.",
"name": "prepare",
"signature": "def prepare(self)"
},
{
"docstring": "Test that the Part model can still be accessed at the end of schema migration",
"name": "test_models_exist",
"signature": "def test_models_exist(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015812 | Implement the Python class `TestForwardMigrations` described below.
Class description:
Test entire schema migration sequence for the part app.
Method signatures and docstrings:
- def prepare(self): Create initial data.
- def test_models_exist(self): Test that the Part model can still be accessed at the end of schema ... | Implement the Python class `TestForwardMigrations` described below.
Class description:
Test entire schema migration sequence for the part app.
Method signatures and docstrings:
- def prepare(self): Create initial data.
- def test_models_exist(self): Test that the Part model can still be accessed at the end of schema ... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class TestForwardMigrations:
"""Test entire schema migration sequence for the part app."""
def prepare(self):
"""Create initial data."""
<|body_0|>
def test_models_exist(self):
"""Test that the Part model can still be accessed at the end of schema migration"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestForwardMigrations:
"""Test entire schema migration sequence for the part app."""
def prepare(self):
"""Create initial data."""
Part = self.old_state.apps.get_model('part', 'part')
Part.objects.create(name='A', description='My part A')
Part.objects.create(name='B', desc... | the_stack_v2_python_sparse | InvenTree/part/test_migrations.py | inventree/InvenTree | train | 3,077 |
fad1ff9ab74daf1c0087745344289a879406e3b5 | [
"self.validate_parameters(name=name)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/aml/b2b'\n_query_parameters = {'name': name, 'ssn': ssn, 'birthDate': birth_date, 'nationality': nationality, 'language': language, 'includeReport': include_report, 'mode': mode}\n_query_builder = AP... | <|body_start_0|>
self.validate_parameters(name=name)
_query_builder = Configuration.get_base_uri()
_query_builder += '/information/aml/b2b'
_query_parameters = {'name': name, 'ssn': ssn, 'birthDate': birth_date, 'nationality': nationality, 'language': language, 'includeReport': include_r... | A Controller to access Endpoints in the idfy_rest_client API. | AmlController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AmlController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def b_2_b_identify_and_screening_request(self, name, ssn=None, birth_date=None, nationality=None, language=None, include_report=None, mode=None):
"""Does a GET request to /information/aml/b2b. Person s... | stack_v2_sparse_classes_75kplus_train_068836 | 8,340 | permissive | [
{
"docstring": "Does a GET request to /information/aml/b2b. Person screening with data enhancement enabled for nationalities where data enhancement is provided. For other nationalities the data enhancement will be skipped **Required fields**: Name with either birthDate or ssn. Args: name (string): Complete name... | 2 | null | Implement the Python class `AmlController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def b_2_b_identify_and_screening_request(self, name, ssn=None, birth_date=None, nationality=None, language=None, include_report=None, mode=No... | Implement the Python class `AmlController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def b_2_b_identify_and_screening_request(self, name, ssn=None, birth_date=None, nationality=None, language=None, include_report=None, mode=No... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class AmlController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def b_2_b_identify_and_screening_request(self, name, ssn=None, birth_date=None, nationality=None, language=None, include_report=None, mode=None):
"""Does a GET request to /information/aml/b2b. Person s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AmlController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def b_2_b_identify_and_screening_request(self, name, ssn=None, birth_date=None, nationality=None, language=None, include_report=None, mode=None):
"""Does a GET request to /information/aml/b2b. Person screening with... | the_stack_v2_python_sparse | idfy_rest_client/controllers/aml_controller.py | dealflowteam/Idfy | train | 0 |
11fa30e8782ebdf7a7437bf5c552604d1d6129e1 | [
"video_xml = '<p:video %s>\\n <p:cMediaNode vol=\"80000\">\\n <p:cTn id=\"%d\" fill=\"hold\" display=\"0\">\\n <p:stCondLst>\\n <p:cond delay=\"indefinite\"/>\\n </p:stCondLst>\\n </p:cTn>\\n <p:tgtEl>\\n <p:spTgt spid=\"%d\"/>\\n </p:tgtEl>\\n </p:cMediaNode>\\n</p:video>\\n' % ... | <|body_start_0|>
video_xml = '<p:video %s>\n <p:cMediaNode vol="80000">\n <p:cTn id="%d" fill="hold" display="0">\n <p:stCondLst>\n <p:cond delay="indefinite"/>\n </p:stCondLst>\n </p:cTn>\n <p:tgtEl>\n <p:spTgt spid="%d"/>\n </p:tgtEl>\n </p:cMediaNode>\n</p:video>\n' % (nsd... | `p:tnLst` or `p:childTnList` element. | CT_TimeNodeList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CT_TimeNodeList:
"""`p:tnLst` or `p:childTnList` element."""
def add_video(self, shape_id):
"""Add a new `p:video` child element for movie having *shape_id*."""
<|body_0|>
def _next_cTn_id(self):
"""Return the next available unique ID (int) for p:cTn element."""
... | stack_v2_sparse_classes_75kplus_train_068837 | 10,213 | permissive | [
{
"docstring": "Add a new `p:video` child element for movie having *shape_id*.",
"name": "add_video",
"signature": "def add_video(self, shape_id)"
},
{
"docstring": "Return the next available unique ID (int) for p:cTn element.",
"name": "_next_cTn_id",
"signature": "def _next_cTn_id(self... | 2 | stack_v2_sparse_classes_30k_train_014671 | Implement the Python class `CT_TimeNodeList` described below.
Class description:
`p:tnLst` or `p:childTnList` element.
Method signatures and docstrings:
- def add_video(self, shape_id): Add a new `p:video` child element for movie having *shape_id*.
- def _next_cTn_id(self): Return the next available unique ID (int) f... | Implement the Python class `CT_TimeNodeList` described below.
Class description:
`p:tnLst` or `p:childTnList` element.
Method signatures and docstrings:
- def add_video(self, shape_id): Add a new `p:video` child element for movie having *shape_id*.
- def _next_cTn_id(self): Return the next available unique ID (int) f... | 61257cdf1a3bc79534e88d1f50a0885a688f04c2 | <|skeleton|>
class CT_TimeNodeList:
"""`p:tnLst` or `p:childTnList` element."""
def add_video(self, shape_id):
"""Add a new `p:video` child element for movie having *shape_id*."""
<|body_0|>
def _next_cTn_id(self):
"""Return the next available unique ID (int) for p:cTn element."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CT_TimeNodeList:
"""`p:tnLst` or `p:childTnList` element."""
def add_video(self, shape_id):
"""Add a new `p:video` child element for movie having *shape_id*."""
video_xml = '<p:video %s>\n <p:cMediaNode vol="80000">\n <p:cTn id="%d" fill="hold" display="0">\n <p:stCondLst>\n ... | the_stack_v2_python_sparse | pptx/oxml/slide.py | AndreasSteiner/python-pptx | train | 2 |
f28f0c799a5c3d0091ac1eac01602e14c81571bc | [
"self.lr = lr\nself.beta1 = beta1\nself.beta2 = beta2\nself.iter = 0\nself.m = None\nself.v = None",
"if self.m is None:\n self.m, self.v = ({}, {})\n for key, val in params.items():\n self.m[key] = np.zeros_like(val)\n self.v[key] = np.zeros_like(val)\nself.iter += 1\nlr_t = self.lr * np.sqrt... | <|body_start_0|>
self.lr = lr
self.beta1 = beta1
self.beta2 = beta2
self.iter = 0
self.m = None
self.v = None
<|end_body_0|>
<|body_start_1|>
if self.m is None:
self.m, self.v = ({}, {})
for key, val in params.items():
self... | Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py | Adam | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Adam:
"""Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py"""
def __init__(self, lr=0.001, beta1=0.9, beta2=0.999):
""">>> opt = Adam(lr=1.0, beta1=2.0, beta2=3.0) >>> opt.lr 1.0 >>> opt.bet... | stack_v2_sparse_classes_75kplus_train_068838 | 5,460 | no_license | [
{
"docstring": ">>> opt = Adam(lr=1.0, beta1=2.0, beta2=3.0) >>> opt.lr 1.0 >>> opt.beta1 2.0 >>> opt.beta2 3.0",
"name": "__init__",
"signature": "def __init__(self, lr=0.001, beta1=0.9, beta2=0.999)"
},
{
"docstring": ">>> params = {\"test\": np.array([[2.0, 1.0], [-2.0, 0.5]]), \"test2\": np.... | 2 | stack_v2_sparse_classes_30k_train_030938 | Implement the Python class `Adam` described below.
Class description:
Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py
Method signatures and docstrings:
- def __init__(self, lr=0.001, beta1=0.9, beta2=0.999): >>> opt = Adam... | Implement the Python class `Adam` described below.
Class description:
Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py
Method signatures and docstrings:
- def __init__(self, lr=0.001, beta1=0.9, beta2=0.999): >>> opt = Adam... | c6765b1d976a747fefd53f67fe69ccb4ce436e08 | <|skeleton|>
class Adam:
"""Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py"""
def __init__(self, lr=0.001, beta1=0.9, beta2=0.999):
""">>> opt = Adam(lr=1.0, beta1=2.0, beta2=3.0) >>> opt.lr 1.0 >>> opt.bet... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Adam:
"""Adam (http://arxiv.org/abs/1412.6980v8) Copied from https://github.com/oreilly-japan/deep-learning-from-scratch/blob/master/common/optimizer.py"""
def __init__(self, lr=0.001, beta1=0.9, beta2=0.999):
""">>> opt = Adam(lr=1.0, beta1=2.0, beta2=3.0) >>> opt.lr 1.0 >>> opt.beta1 2.0 >>> op... | the_stack_v2_python_sparse | van/src/chap6/optimizers.py | sh0nk/zero-deeplearning | train | 2 |
a69841c6f3d8d7535cd32ac056029ea5752f9a7f | [
"for obj in obj_list['hits']['hits']:\n obj[self.context['object_key']] = self.context['object_schema_cls']().dump(obj)\nreturn obj_list['hits']",
"aggs = obj_list.get('aggregations')\nif not aggs:\n return missing\nfor name, agg in aggs.items():\n vocab = Vocabularies.get_vocabulary(name)\n if not vo... | <|body_start_0|>
for obj in obj_list['hits']['hits']:
obj[self.context['object_key']] = self.context['object_schema_cls']().dump(obj)
return obj_list['hits']
<|end_body_0|>
<|body_start_1|>
aggs = obj_list.get('aggregations')
if not aggs:
return missing
f... | Schema for dumping extra information in the UI. | UIListSchema | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UIListSchema:
"""Schema for dumping extra information in the UI."""
def get_hits(self, obj_list):
"""Apply hits transformation."""
<|body_0|>
def get_aggs(self, obj_list):
"""Apply aggregations transformation."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_068839 | 6,926 | permissive | [
{
"docstring": "Apply hits transformation.",
"name": "get_hits",
"signature": "def get_hits(self, obj_list)"
},
{
"docstring": "Apply aggregations transformation.",
"name": "get_aggs",
"signature": "def get_aggs(self, obj_list)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018423 | Implement the Python class `UIListSchema` described below.
Class description:
Schema for dumping extra information in the UI.
Method signatures and docstrings:
- def get_hits(self, obj_list): Apply hits transformation.
- def get_aggs(self, obj_list): Apply aggregations transformation. | Implement the Python class `UIListSchema` described below.
Class description:
Schema for dumping extra information in the UI.
Method signatures and docstrings:
- def get_hits(self, obj_list): Apply hits transformation.
- def get_aggs(self, obj_list): Apply aggregations transformation.
<|skeleton|>
class UIListSchema... | 78ad536dbb95494967bf8de248cf922e5040e844 | <|skeleton|>
class UIListSchema:
"""Schema for dumping extra information in the UI."""
def get_hits(self, obj_list):
"""Apply hits transformation."""
<|body_0|>
def get_aggs(self, obj_list):
"""Apply aggregations transformation."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UIListSchema:
"""Schema for dumping extra information in the UI."""
def get_hits(self, obj_list):
"""Apply hits transformation."""
for obj in obj_list['hits']['hits']:
obj[self.context['object_key']] = self.context['object_schema_cls']().dump(obj)
return obj_list['hits... | the_stack_v2_python_sparse | invenio_rdm_records/resources/serializers/ui/schema.py | tu-graz-library/invenio-rdm-records | train | 0 |
6bcc797ab3904867b96140962a88f38e5ee3c632 | [
"if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nn = data.shape[1]\nd = data.shape[0]\nself.mean = np.mean(data, axis=1).reshape(d, 1)\ndeviation = np.tile(sel... | <|body_start_0|>
if not isinstance(data, np.ndarray) or len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
if data.shape[1] < 2:
raise ValueError('data must contain multiple data points')
n = data.shape[1]
d = data.shape[0]
self.mean ... | represents a Multivariate Normal distribution | MultiNormal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiNormal:
"""represents a Multivariate Normal distribution"""
def __init__(self, data):
"""- data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, rais... | stack_v2_sparse_classes_75kplus_train_068840 | 2,578 | no_license | [
{
"docstring": "- data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError with the message: \"data must be a 2D numpy.ndarray\" If n is less than 2, raise a ValueErro... | 2 | stack_v2_sparse_classes_30k_train_052021 | Implement the Python class `MultiNormal` described below.
Class description:
represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): - data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions i... | Implement the Python class `MultiNormal` described below.
Class description:
represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): - data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions i... | e10b4e9b6f3fa00639e6e9e5b35f0cdb43a339a3 | <|skeleton|>
class MultiNormal:
"""represents a Multivariate Normal distribution"""
def __init__(self, data):
"""- data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, rais... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiNormal:
"""represents a Multivariate Normal distribution"""
def __init__(self, data):
"""- data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError... | the_stack_v2_python_sparse | math/0x06-multivariate_prob/multinormal.py | HeimerR/holbertonschool-machine_learning | train | 0 |
3181c3d4a4a125da45019ec18a6ff7501e077d8d | [
"self.value = value\nself.inner_error = inner_error\n' :type: Exception '",
"if self.inner_error is None:\n return repr(self.value)\nelse:\n return repr(self.value) + 'Inner exception:' + repr(self.inner_error)"
] | <|body_start_0|>
self.value = value
self.inner_error = inner_error
' :type: Exception '
<|end_body_0|>
<|body_start_1|>
if self.inner_error is None:
return repr(self.value)
else:
return repr(self.value) + 'Inner exception:' + repr(self.inner_error)
<|end_... | 本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。 | ServerError | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServerError:
"""本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。"""
def __init__(self, value, inner_error=None):
"""创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其他异常。"""
<|body_0|>
def __str__(self):
... | stack_v2_sparse_classes_75kplus_train_068841 | 1,715 | no_license | [
{
"docstring": "创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其他异常。",
"name": "__init__",
"signature": "def __init__(self, value, inner_error=None)"
},
{
"docstring": "Python内置方法__str__的实现。返回一个描述本异常的字符串。 :rtype basestring",
"name": "__s... | 2 | null | Implement the Python class `ServerError` described below.
Class description:
本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。
Method signatures and docstrings:
- def __init__(self, value, inner_error=None): 创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其... | Implement the Python class `ServerError` described below.
Class description:
本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。
Method signatures and docstrings:
- def __init__(self, value, inner_error=None): 创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其... | e7677e9bcab13104461677478b24dc26e1984e39 | <|skeleton|>
class ServerError:
"""本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。"""
def __init__(self, value, inner_error=None):
"""创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其他异常。"""
<|body_0|>
def __str__(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServerError:
"""本异常继承Exception,可包含其他异常。 本异常被各Web服务器抛出,表示服务器处理请求中出现的异常情况。"""
def __init__(self, value, inner_error=None):
"""创建一个ServerError。向inner_error传入其他异常以包含它。 :param value: 本异常包含的文本信息。 :param Exception inner_error: 本异常包含的其他异常。"""
self.value = value
self.inner_error = inner_er... | the_stack_v2_python_sparse | project/pinic/util.py | Michaelmilk/rasp | train | 0 |
702b34944562dbc65a2c9dcd72dee5bedd4377fe | [
"super().__init__()\nself.pool = torch.nn.ModuleList()\nfor i in range(0, samplingTimes):\n self.pool.append(torch.nn.AvgPool2d(3, stride=2, padding=1))",
"for pool in self.pool:\n input = pool(input)\nreturn input"
] | <|body_start_0|>
super().__init__()
self.pool = torch.nn.ModuleList()
for i in range(0, samplingTimes):
self.pool.append(torch.nn.AvgPool2d(3, stride=2, padding=1))
<|end_body_0|>
<|body_start_1|>
for pool in self.pool:
input = pool(input)
return input
<|... | This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3 | Downsampling_avg | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Downsampling_avg:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3"""
def __init__(self, sampling... | stack_v2_sparse_classes_75kplus_train_068842 | 17,999 | no_license | [
{
"docstring": ":param samplingTimes: The rate at which you want to down-sample the image",
"name": "__init__",
"signature": "def __init__(self, samplingTimes)"
},
{
"docstring": ":param input: Input RGB Image :return: down-sampled image (pyramid-based approach)",
"name": "forward",
"sig... | 2 | stack_v2_sparse_classes_30k_train_047636 | Implement the Python class `Downsampling_avg` described below.
Class description:
This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x5... | Implement the Python class `Downsampling_avg` described below.
Class description:
This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x5... | 2eac7c9f525e6052cda694abdcf62d9fa1bdb0fa | <|skeleton|>
class Downsampling_avg:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3"""
def __init__(self, sampling... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Downsampling_avg:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3"""
def __init__(self, samplingTimes):
... | the_stack_v2_python_sparse | trainers/vos_trainer.py | HYOJINPARK/TTVOS | train | 10 |
cd8cb61d87d5d9f666f96650a816508ae54a1845 | [
"payload = {'token': self._token}\nif batch_presence_aware is not None:\n payload['batch_presence_aware'] = batch_presence_aware\nif presence_sub is not None:\n payload['presence_sub'] = presence_sub\nreturn self._get('rtm.connect', payload=payload, **kwargs)",
"payload = {'token': self._token}\nif batch_pr... | <|body_start_0|>
payload = {'token': self._token}
if batch_presence_aware is not None:
payload['batch_presence_aware'] = batch_presence_aware
if presence_sub is not None:
payload['presence_sub'] = presence_sub
return self._get('rtm.connect', payload=payload, **kwa... | Rtm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rtm:
def connect(self, batch_presence_aware: int=None, presence_sub: bool=None, **kwargs) -> Response:
"""Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxxxxxxxx-xxxx :param... | stack_v2_sparse_classes_75kplus_train_068843 | 4,268 | permissive | [
{
"docstring": "Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxxxxxxxx-xxxx :param batch_presence_aware: Batch presence deliveries via subscription. Enabling changes the shape of presence_change e... | 2 | stack_v2_sparse_classes_30k_train_053347 | Implement the Python class `Rtm` described below.
Class description:
Implement the Rtm class.
Method signatures and docstrings:
- def connect(self, batch_presence_aware: int=None, presence_sub: bool=None, **kwargs) -> Response: Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param tok... | Implement the Python class `Rtm` described below.
Class description:
Implement the Rtm class.
Method signatures and docstrings:
- def connect(self, batch_presence_aware: int=None, presence_sub: bool=None, **kwargs) -> Response: Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param tok... | c40be4854a26084e1a368a975e220d613c14d8d8 | <|skeleton|>
class Rtm:
def connect(self, batch_presence_aware: int=None, presence_sub: bool=None, **kwargs) -> Response:
"""Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxxxxxxxx-xxxx :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rtm:
def connect(self, batch_presence_aware: int=None, presence_sub: bool=None, **kwargs) -> Response:
"""Starts a Real Time Messaging session. https://api.slack.com/methods/rtm.connect :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxxxxxxxx-xxxx :param batch_presenc... | the_stack_v2_python_sparse | slack_time/methods/rtm.py | jackwardell/SlackTime | train | 2 | |
77825902e31b4bfc1f4ac1898d638db067123821 | [
"for c in capabilities.split():\n c = ircdb.makeChannelCapability(channel, c)\n user.addCapability(c)\nircdb.users.setUser(user)\nirc.replySuccess()",
"fail = []\nfor c in capabilities.split():\n cap = ircdb.makeChannelCapability(channel, c)\n try:\n user.removeCapability(cap)\n except KeyEr... | <|body_start_0|>
for c in capabilities.split():
c = ircdb.makeChannelCapability(channel, c)
user.addCapability(c)
ircdb.users.setUser(user)
irc.replySuccess()
<|end_body_0|>
<|body_start_1|>
fail = []
for c in capabilities.split():
cap = ircdb... | capability | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class capability:
def add(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give the user <name> (or the user to whom <nick> maps) the capability <capability> in the channel. <cha... | stack_v2_sparse_classes_75kplus_train_068844 | 35,475 | permissive | [
{
"docstring": "[<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give the user <name> (or the user to whom <nick> maps) the capability <capability> in the channel. <channel> is only necessary if the message isn't sent in the channel itself.",
"nam... | 6 | stack_v2_sparse_classes_30k_train_008333 | Implement the Python class `capability` described below.
Class description:
Implement the capability class.
Method signatures and docstrings:
- def add(self, irc, msg, args, channel, user, capabilities): [<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give... | Implement the Python class `capability` described below.
Class description:
Implement the capability class.
Method signatures and docstrings:
- def add(self, irc, msg, args, channel, user, capabilities): [<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give... | 656f42f8d6b3fe4544a5270e0dab816fd3603118 | <|skeleton|>
class capability:
def add(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give the user <name> (or the user to whom <nick> maps) the capability <capability> in the channel. <cha... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class capability:
def add(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <nick|username> <capability> [<capability> ...] If you have the #channel,op capability, this will give the user <name> (or the user to whom <nick> maps) the capability <capability> in the channel. <channel> is only ... | the_stack_v2_python_sparse | plugins/Channel/plugin.py | kblin/supybot-gsoc | train | 2 | |
6391dba06eb59e2a90a61607a6f024caeada8140 | [
"Thread.__init__(self)\nself.fona_lock = fona_lock\nself.call_lock = call_lock\nself.delay = delay\nlogging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(module)s::%(funcName)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S %Z')\nself.logger = logging.getLogger(__name__)",
"while True:\n self... | <|body_start_0|>
Thread.__init__(self)
self.fona_lock = fona_lock
self.call_lock = call_lock
self.delay = delay
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(module)s::%(funcName)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S %Z')
self.logger =... | Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is signalled of this new call by writing to the file call_signal.txt in the call appl... | Call_Thread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Call_Thread:
"""Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is signalled of this new call by writing to th... | stack_v2_sparse_classes_75kplus_train_068845 | 4,774 | no_license | [
{
"docstring": "Constructor for Call_Thread object. Class which inherits from threading.Thread. Constructor to setup class variables and open call_signal.txt file for communication between the Call_Thread and the Global_Thread classes. Args: fona_lock (threading.Lock): lock in order to write commands to the FON... | 2 | stack_v2_sparse_classes_30k_train_039056 | Implement the Python class `Call_Thread` described below.
Class description:
Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is sign... | Implement the Python class `Call_Thread` described below.
Class description:
Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is sign... | 18c54d6c9c116ea65c50b2c867808d9d018673dc | <|skeleton|>
class Call_Thread:
"""Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is signalled of this new call by writing to th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Call_Thread:
"""Thread to continually poll the FONA device for incoming phone calls. Whenever the fona_commands.phone_status returns the string '3', this indicates that the status of the phone is call incoming. Whenever this occurs, the signal thread is signalled of this new call by writing to the file call_s... | the_stack_v2_python_sparse | src/os/inc/call_thread.py | Rajminster/RaspberryPiPhone | train | 0 |
f314177c47823ffd5f8de792a1633527e319af27 | [
"query = 'SELECT item, score FROM ratings WHERE user = %(user)s AND item IN (' + ', '.join([str(film.film_id) for film in films]) + ')'\nparameters = {'user': self.user.id}\nwith CassandraConnection() as db:\n ratings = db.execute(query, parameters)\nratings_dict = {item: score for item, score in ratings}\nfor f... | <|body_start_0|>
query = 'SELECT item, score FROM ratings WHERE user = %(user)s AND item IN (' + ', '.join([str(film.film_id) for film in films]) + ')'
parameters = {'user': self.user.id}
with CassandraConnection() as db:
ratings = db.execute(query, parameters)
ratings_dict =... | MyUser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUser:
def get_preferences_for_films(self, films):
"""Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set"""
<|body_0|>
def get_rated_films(self, last=None, count=12):
"""Gets a list of rated fi... | stack_v2_sparse_classes_75kplus_train_068846 | 9,791 | permissive | [
{
"docstring": "Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set",
"name": "get_preferences_for_films",
"signature": "def get_preferences_for_films(self, films)"
},
{
"docstring": "Gets a list of rated films by self. :par... | 3 | null | Implement the Python class `MyUser` described below.
Class description:
Implement the MyUser class.
Method signatures and docstrings:
- def get_preferences_for_films(self, films): Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set
- def get_rate... | Implement the Python class `MyUser` described below.
Class description:
Implement the MyUser class.
Method signatures and docstrings:
- def get_preferences_for_films(self, films): Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set
- def get_rate... | c989207268397777a1e8791b73263281effa1588 | <|skeleton|>
class MyUser:
def get_preferences_for_films(self, films):
"""Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set"""
<|body_0|>
def get_rated_films(self, last=None, count=12):
"""Gets a list of rated fi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUser:
def get_preferences_for_films(self, films):
"""Get the ratings for the given films :param films: list of Film objects :return: list of films with preference attribute set"""
query = 'SELECT item, score FROM ratings WHERE user = %(user)s AND item IN (' + ', '.join([str(film.film_id) for... | the_stack_v2_python_sparse | src/apps/films/models.py | dvalcarce/filmyou-web | train | 0 | |
7050232e10778ce64fa8e2d01ca53b627caf067b | [
"if len(height) == 2:\n return min(height[1], height[0])\nmax_area = 0\nfor i in range(len(height)):\n for j in range(1, len(height)):\n max_area = max(max_area, min(height[i], height[j]) * abs(j - i))\nreturn max_area",
"if len(height) == 2:\n return min(height[1], height[0])\nleft = 0\nright = l... | <|body_start_0|>
if len(height) == 2:
return min(height[1], height[0])
max_area = 0
for i in range(len(height)):
for j in range(1, len(height)):
max_area = max(max_area, min(height[i], height[j]) * abs(j - i))
return max_area
<|end_body_0|>
<|body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(height) == 2:
return m... | stack_v2_sparse_classes_75kplus_train_068847 | 1,903 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea_TLE",
"signature": "def maxArea_TLE(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011000 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea(self, height): :type height: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def maxArea_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxArea_TLE(self, height):
""":type height: List[int] :rtype: int"""
if len(height) == 2:
return min(height[1], height[0])
max_area = 0
for i in range(len(height)):
for j in range(1, len(height)):
max_area = max(max_area, mi... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00011.Container With Most Water.py | roger6blog/LeetCode | train | 0 | |
698375ae9a0c2b5c64bcab8d29aa3ee993e7fd78 | [
"self.assert_returns_code_200('/static/easyMode.js')\nself.assert_returns_code_200('/static/results.js')\nself.assert_returns_code_200('/static/main.js')\nself.assert_returns_code_200('/static/custom.css')",
"self.assert_returns_code_200('/static/site/')\nself.assert_returns_code_200('static/site/tests/')\nself.a... | <|body_start_0|>
self.assert_returns_code_200('/static/easyMode.js')
self.assert_returns_code_200('/static/results.js')
self.assert_returns_code_200('/static/main.js')
self.assert_returns_code_200('/static/custom.css')
<|end_body_0|>
<|body_start_1|>
self.assert_returns_code_200... | StaticResourcesAcceptanceTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StaticResourcesAcceptanceTest:
def test_static_resources(self):
"""Tests if the used static resources are found"""
<|body_0|>
def test_documentation_reports(self):
"""Test if the documentation pages are found"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_068848 | 7,305 | no_license | [
{
"docstring": "Tests if the used static resources are found",
"name": "test_static_resources",
"signature": "def test_static_resources(self)"
},
{
"docstring": "Test if the documentation pages are found",
"name": "test_documentation_reports",
"signature": "def test_documentation_reports... | 2 | stack_v2_sparse_classes_30k_train_007251 | Implement the Python class `StaticResourcesAcceptanceTest` described below.
Class description:
Implement the StaticResourcesAcceptanceTest class.
Method signatures and docstrings:
- def test_static_resources(self): Tests if the used static resources are found
- def test_documentation_reports(self): Test if the docume... | Implement the Python class `StaticResourcesAcceptanceTest` described below.
Class description:
Implement the StaticResourcesAcceptanceTest class.
Method signatures and docstrings:
- def test_static_resources(self): Tests if the used static resources are found
- def test_documentation_reports(self): Test if the docume... | 1135f93ee9f89911308ba1ed3d14dda660892f59 | <|skeleton|>
class StaticResourcesAcceptanceTest:
def test_static_resources(self):
"""Tests if the used static resources are found"""
<|body_0|>
def test_documentation_reports(self):
"""Test if the documentation pages are found"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StaticResourcesAcceptanceTest:
def test_static_resources(self):
"""Tests if the used static resources are found"""
self.assert_returns_code_200('/static/easyMode.js')
self.assert_returns_code_200('/static/results.js')
self.assert_returns_code_200('/static/main.js')
self... | the_stack_v2_python_sparse | test_acceptance.py | gianlucafrei/StockSearch | train | 0 | |
1a4fcfbc2af81d0722cb695cfefe25bddde9d8ad | [
"fields = super(HistoricalRecords, self).copy_fields(model)\nfor name, field in self.additional_fields.items():\n assert name not in fields\n assert hasattr(self, 'get_%s_value' % name)\n fields[name] = field\nreturn fields",
"extra_fields = super(HistoricalRecords, self).get_extra_fields(model, fields)\... | <|body_start_0|>
fields = super(HistoricalRecords, self).copy_fields(model)
for name, field in self.additional_fields.items():
assert name not in fields
assert hasattr(self, 'get_%s_value' % name)
fields[name] = field
return fields
<|end_body_0|>
<|body_start... | simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user | HistoricalRecords | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields... | stack_v2_sparse_classes_75kplus_train_068849 | 7,986 | no_license | [
{
"docstring": "Add additional_fields to the historic model.",
"name": "copy_fields",
"signature": "def copy_fields(self, model)"
},
{
"docstring": "Remove fields moved to changeset.",
"name": "get_extra_fields",
"signature": "def get_extra_fields(self, model, fields)"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_train_002609 | Implement the Python class `HistoricalRecords` described below.
Class description:
simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user
Method signatures and docstrin... | Implement the Python class `HistoricalRecords` described below.
Class description:
simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user
Method signatures and docstrin... | bc092964153b03381aaff74a4d80f43a2b2dec19 | <|skeleton|>
class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields to the histo... | the_stack_v2_python_sparse | browsercompat/webplatformcompat/history.py | WeilerWebServices/MDN-Web-Docs | train | 1 |
9b0a0b29c9a52cc114884253e312199cb9a80493 | [
"key = 'vldt:year_add'\nneed_validation = EntityModel._validate_term_model_cache.get(key, True)\nif need_validation:\n EntityModel._validate_term_model_cache[key] = False\n system_flags = _default_system_flags_restriction\n with transaction.atomic():\n try:\n TermModel.objects.get(slug=cl... | <|body_start_0|>
key = 'vldt:year_add'
need_validation = EntityModel._validate_term_model_cache.get(key, True)
if need_validation:
EntityModel._validate_term_model_cache[key] = False
system_flags = _default_system_flags_restriction
with transaction.atomic():
... | AddedYearTermsValidationMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddedYearTermsValidationMixin:
def validate_term_model(cls):
"""RUS: Добавляет год в модель терминов TermModel."""
<|body_0|>
def validate_terms(self, origin, **kwargs):
"""RUS: Проставляет по данным объектам соответствующий термин Год создания."""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_068850 | 14,512 | permissive | [
{
"docstring": "RUS: Добавляет год в модель терминов TermModel.",
"name": "validate_term_model",
"signature": "def validate_term_model(cls)"
},
{
"docstring": "RUS: Проставляет по данным объектам соответствующий термин Год создания.",
"name": "validate_terms",
"signature": "def validate_... | 3 | null | Implement the Python class `AddedYearTermsValidationMixin` described below.
Class description:
Implement the AddedYearTermsValidationMixin class.
Method signatures and docstrings:
- def validate_term_model(cls): RUS: Добавляет год в модель терминов TermModel.
- def validate_terms(self, origin, **kwargs): RUS: Простав... | Implement the Python class `AddedYearTermsValidationMixin` described below.
Class description:
Implement the AddedYearTermsValidationMixin class.
Method signatures and docstrings:
- def validate_term_model(cls): RUS: Добавляет год в модель терминов TermModel.
- def validate_terms(self, origin, **kwargs): RUS: Простав... | 2f7c535cb9f91d6bcb2f1e91b58edebc01255612 | <|skeleton|>
class AddedYearTermsValidationMixin:
def validate_term_model(cls):
"""RUS: Добавляет год в модель терминов TermModel."""
<|body_0|>
def validate_terms(self, origin, **kwargs):
"""RUS: Проставляет по данным объектам соответствующий термин Год создания."""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddedYearTermsValidationMixin:
def validate_term_model(cls):
"""RUS: Добавляет год в модель терминов TermModel."""
key = 'vldt:year_add'
need_validation = EntityModel._validate_term_model_cache.get(key, True)
if need_validation:
EntityModel._validate_term_model_cach... | the_stack_v2_python_sparse | backend/edw/models/mixins/entity/add_date_terms_validation.py | infolabs/django-edw | train | 5 | |
0482a9173c0c173ee52a2fd642ada380eb149069 | [
"logger.info('Call api known_digests, to see all digest')\nlist_digest = KnownDigest.objects.all()\nserializer = DigestSerializer(list_digest, many=True)\nreturn Response(serializer.data)",
"logger.info('Call post method of KnownDigest to added new digest')\nserializer = DigestSerializer(data=request.data)\nif se... | <|body_start_0|>
logger.info('Call api known_digests, to see all digest')
list_digest = KnownDigest.objects.all()
serializer = DigestSerializer(list_digest, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
logger.info('Call post method of KnownDigest t... | List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest. | Known_Digest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Known_Digest:
"""List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest."""
def get(self, request, format=None... | stack_v2_sparse_classes_75kplus_train_068851 | 21,399 | permissive | [
{
"docstring": "This method return a list of all known digest. Example of use of this method is: Call basic-url/known_digests Args: Return: - List of all known digest",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "This method return a Response that can inc... | 3 | null | Implement the Python class `Known_Digest` described below.
Class description:
List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest.
Me... | Implement the Python class `Known_Digest` described below.
Class description:
List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest.
Me... | 03e036b1d0433a31bf34da9ff4a2aac56e1b2f26 | <|skeleton|>
class Known_Digest:
"""List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest."""
def get(self, request, format=None... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Known_Digest:
"""List of all known digest used to complete the attestation process. Three methods: get method used to get the list of known digest post method used to add new known digest and delete method used to delete a digest on list of known digest."""
def get(self, request, format=None):
""... | the_stack_v2_python_sparse | trustMonitor/trust_monitor/views.py | shield-h2020/trust-monitor | train | 2 |
441f89298b13bb0c31797197fa30fb941cb26afa | [
"assert colors1() == ('white', 'white', 'white', 'white')\nassert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse')\nassert colors1(link_color='red', back_color='blue') == ('white', 'blue', 'red', 'white')\nassert colors1('purple', link_color='red', back_color='blue') == ('pu... | <|body_start_0|>
assert colors1() == ('white', 'white', 'white', 'white')
assert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse')
assert colors1(link_color='red', back_color='blue') == ('white', 'blue', 'red', 'white')
assert colors1('purple', lin... | Class to test args_kwargs_lab | ArgsKwargsTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgsKwargsTest:
"""Class to test args_kwargs_lab"""
def test_colors1(self):
"""Test assertions for colors1 function"""
<|body_0|>
def test_colors2(self):
"""Test assertions for colors2 function"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ass... | stack_v2_sparse_classes_75kplus_train_068852 | 1,798 | no_license | [
{
"docstring": "Test assertions for colors1 function",
"name": "test_colors1",
"signature": "def test_colors1(self)"
},
{
"docstring": "Test assertions for colors2 function",
"name": "test_colors2",
"signature": "def test_colors2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023066 | Implement the Python class `ArgsKwargsTest` described below.
Class description:
Class to test args_kwargs_lab
Method signatures and docstrings:
- def test_colors1(self): Test assertions for colors1 function
- def test_colors2(self): Test assertions for colors2 function | Implement the Python class `ArgsKwargsTest` described below.
Class description:
Class to test args_kwargs_lab
Method signatures and docstrings:
- def test_colors1(self): Test assertions for colors1 function
- def test_colors2(self): Test assertions for colors2 function
<|skeleton|>
class ArgsKwargsTest:
"""Class... | 661903cd9dc49b294fb9a0c905133a4c3f9d8d0f | <|skeleton|>
class ArgsKwargsTest:
"""Class to test args_kwargs_lab"""
def test_colors1(self):
"""Test assertions for colors1 function"""
<|body_0|>
def test_colors2(self):
"""Test assertions for colors2 function"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArgsKwargsTest:
"""Class to test args_kwargs_lab"""
def test_colors1(self):
"""Test assertions for colors1 function"""
assert colors1() == ('white', 'white', 'white', 'white')
assert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse')
... | the_stack_v2_python_sparse | students/douglas_klos/session6/lab/test_args_kwargs_lab.py | pauleclifton/GP_Python210B_Winter_2019 | train | 0 |
ed41bfc5515008d62eee2b4e11ec55f39c8710c4 | [
"query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nasearch = Asignacion.objects.filter(id=kwargs['id']).first()\nform = AsignacionForm(instance=asearch)\nlist_assign = None\nif query:\n list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__ico... | <|body_start_0|>
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
asearch = Asignacion.objects.filter(id=kwargs['id']).first()
form = AsignacionForm(instance=asearch)
list_assign = None
if query:
list_assign = Asignacion.objects.filter(Q(ser... | Clase para editar las asignaciones | AssignEditView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = reques... | stack_v2_sparse_classes_75kplus_train_068853 | 22,221 | no_license | [
{
"docstring": "Método get",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Método post",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_036408 | Implement the Python class `AssignEditView` described below.
Class description:
Clase para editar las asignaciones
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post | Implement the Python class `AssignEditView` described below.
Class description:
Clase para editar las asignaciones
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post
<|skeleton|>
class AssignEditView:
"""Clase para edita... | e28e2d968372609ad396c42fb572a00c2410a117 | <|skeleton|>
class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AssignEditView:
"""Clase para editar las asignaciones"""
def get(self, request, *args, **kwargs):
"""Método get"""
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
asearch = Asignacion.objects.filter(id=kwargs['id']).first()
form = AsignacionForm... | the_stack_v2_python_sparse | list/views.py | damaos/server_list2 | train | 0 |
0ba1d62f727c9bd6de6e829835306a5c37c4caf5 | [
"vrs_session = session.VerseSession.instance()\nscene = context.scene\nscene_item = scene.verse_scenes[scene.cur_verse_scene_index]\ntry:\n verse_scene_data = vrs_session.nodes[scene_item.data_node_id]\nexcept KeyError:\n return {'CANCELLED'}\nelse:\n verse_scene_data.unsubscribe()\nreturn {'FINISHED'}",
... | <|body_start_0|>
vrs_session = session.VerseSession.instance()
scene = context.scene
scene_item = scene.verse_scenes[scene.cur_verse_scene_index]
try:
verse_scene_data = vrs_session.nodes[scene_item.data_node_id]
except KeyError:
return {'CANCELLED'}
... | This operator unsubscribes from scene node. | VERSE_SCENE_OT_unsubscribe | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VERSE_SCENE_OT_unsubscribe:
"""This operator unsubscribes from scene node."""
def invoke(self, context, event):
"""Operator for unsubscribing from Verse scene node"""
<|body_0|>
def poll(cls, context):
"""This class method is used, when Blender check, if this ope... | stack_v2_sparse_classes_75kplus_train_068854 | 9,072 | no_license | [
{
"docstring": "Operator for unsubscribing from Verse scene node",
"name": "invoke",
"signature": "def invoke(self, context, event)"
},
{
"docstring": "This class method is used, when Blender check, if this operator can be executed",
"name": "poll",
"signature": "def poll(cls, context)"
... | 2 | stack_v2_sparse_classes_30k_train_033868 | Implement the Python class `VERSE_SCENE_OT_unsubscribe` described below.
Class description:
This operator unsubscribes from scene node.
Method signatures and docstrings:
- def invoke(self, context, event): Operator for unsubscribing from Verse scene node
- def poll(cls, context): This class method is used, when Blend... | Implement the Python class `VERSE_SCENE_OT_unsubscribe` described below.
Class description:
This operator unsubscribes from scene node.
Method signatures and docstrings:
- def invoke(self, context, event): Operator for unsubscribing from Verse scene node
- def poll(cls, context): This class method is used, when Blend... | 7b796d30dfd22b7706a93e4419ed913d18d29a44 | <|skeleton|>
class VERSE_SCENE_OT_unsubscribe:
"""This operator unsubscribes from scene node."""
def invoke(self, context, event):
"""Operator for unsubscribing from Verse scene node"""
<|body_0|>
def poll(cls, context):
"""This class method is used, when Blender check, if this ope... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VERSE_SCENE_OT_unsubscribe:
"""This operator unsubscribes from scene node."""
def invoke(self, context, event):
"""Operator for unsubscribing from Verse scene node"""
vrs_session = session.VerseSession.instance()
scene = context.scene
scene_item = scene.verse_scenes[scene.... | the_stack_v2_python_sparse | All_In_One/addons/io_verse/ui_scene.py | 2434325680/Learnbgame | train | 0 |
1cff5fc2691427898dd8c88225c0d526885ef052 | [
"if not url:\n raise ValueError(\"url can't be empty\")\nif not monitor_name:\n raise ValueError(\"monitor_name can't be empty\")\nself.url = url\nself.api_key = api_key\nself.monitor_name = monitor_name\nself.uptime_ratio = None\nself.response_time = None",
"if not self.api_key:\n logger.warning('no API... | <|body_start_0|>
if not url:
raise ValueError("url can't be empty")
if not monitor_name:
raise ValueError("monitor_name can't be empty")
self.url = url
self.api_key = api_key
self.monitor_name = monitor_name
self.uptime_ratio = None
self.re... | Uptime Robot provider. | UptimeRobotProvider | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UptimeRobotProvider:
"""Uptime Robot provider."""
def __init__(self, url, api_key, monitor_name):
"""Uptime Robot provider initialization."""
<|body_0|>
def collect(self):
"""Get data from Uptime Robot."""
<|body_1|>
def _update_data(self, resp):
... | stack_v2_sparse_classes_75kplus_train_068855 | 2,914 | permissive | [
{
"docstring": "Uptime Robot provider initialization.",
"name": "__init__",
"signature": "def __init__(self, url, api_key, monitor_name)"
},
{
"docstring": "Get data from Uptime Robot.",
"name": "collect",
"signature": "def collect(self)"
},
{
"docstring": "Update uptime and resp... | 4 | stack_v2_sparse_classes_30k_train_003819 | Implement the Python class `UptimeRobotProvider` described below.
Class description:
Uptime Robot provider.
Method signatures and docstrings:
- def __init__(self, url, api_key, monitor_name): Uptime Robot provider initialization.
- def collect(self): Get data from Uptime Robot.
- def _update_data(self, resp): Update ... | Implement the Python class `UptimeRobotProvider` described below.
Class description:
Uptime Robot provider.
Method signatures and docstrings:
- def __init__(self, url, api_key, monitor_name): Uptime Robot provider initialization.
- def collect(self): Get data from Uptime Robot.
- def _update_data(self, resp): Update ... | 4b9c16f5dfac026ee0e6515e399e25f827dcba74 | <|skeleton|>
class UptimeRobotProvider:
"""Uptime Robot provider."""
def __init__(self, url, api_key, monitor_name):
"""Uptime Robot provider initialization."""
<|body_0|>
def collect(self):
"""Get data from Uptime Robot."""
<|body_1|>
def _update_data(self, resp):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UptimeRobotProvider:
"""Uptime Robot provider."""
def __init__(self, url, api_key, monitor_name):
"""Uptime Robot provider initialization."""
if not url:
raise ValueError("url can't be empty")
if not monitor_name:
raise ValueError("monitor_name can't be emp... | the_stack_v2_python_sparse | kpiit/providers/uptime_robot.py | inveniosoftware-contrib/kpiit | train | 0 |
d92ab1de6ef77d4b45aa812543a1c7cb896a94a8 | [
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_dataStage02QuantificationAnalysis(data.data)\ndata.clear_data()",
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.update_dataStage02QuantificationAnalysis(data.data)\ndata.clear_data()"
] | <|body_start_0|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_dataStage02QuantificationAnalysis(data.data)
data.clear_data()
<|end_body_0|>
<|body_start_1|>
data = base_importData()
data.read_csv(filename)
data.format_data(... | stage02_quantification_analysis_io | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stage02_quantification_analysis_io:
def import_dataStage02QuantificationAnalysis_add(self, filename):
"""table adds"""
<|body_0|>
def import_dataStage02QuantificationAnalysis_update(self, filename):
"""table adds"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_068856 | 1,035 | permissive | [
{
"docstring": "table adds",
"name": "import_dataStage02QuantificationAnalysis_add",
"signature": "def import_dataStage02QuantificationAnalysis_add(self, filename)"
},
{
"docstring": "table adds",
"name": "import_dataStage02QuantificationAnalysis_update",
"signature": "def import_dataSta... | 2 | stack_v2_sparse_classes_30k_train_017882 | Implement the Python class `stage02_quantification_analysis_io` described below.
Class description:
Implement the stage02_quantification_analysis_io class.
Method signatures and docstrings:
- def import_dataStage02QuantificationAnalysis_add(self, filename): table adds
- def import_dataStage02QuantificationAnalysis_up... | Implement the Python class `stage02_quantification_analysis_io` described below.
Class description:
Implement the stage02_quantification_analysis_io class.
Method signatures and docstrings:
- def import_dataStage02QuantificationAnalysis_add(self, filename): table adds
- def import_dataStage02QuantificationAnalysis_up... | cb380c01d2425d0db7e305cad8bad2b3fb38cd9d | <|skeleton|>
class stage02_quantification_analysis_io:
def import_dataStage02QuantificationAnalysis_add(self, filename):
"""table adds"""
<|body_0|>
def import_dataStage02QuantificationAnalysis_update(self, filename):
"""table adds"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stage02_quantification_analysis_io:
def import_dataStage02QuantificationAnalysis_add(self, filename):
"""table adds"""
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_dataStage02QuantificationAnalysis(data.data)
data.clear_data()
... | the_stack_v2_python_sparse | SBaaS_statistics/stage02_quantification_analysis_io.py | dmccloskey/SBaaS_statistics | train | 0 | |
aae85eac3a15170d92a11f5675a5ede6b325cb2a | [
"self.arr_set = set(arr)\nself.arr_hash_prefixt = {}\nfor ele in self.arr_set:\n self.arr_hash_prefixt[ele] = [0] * (len(arr) + 1)\nfor i in range(len(arr)):\n for key, val in self.arr_hash_prefixt.items():\n if key == arr[i]:\n val[i + 1] += val[i] + 1\n else:\n val[i + 1]... | <|body_start_0|>
self.arr_set = set(arr)
self.arr_hash_prefixt = {}
for ele in self.arr_set:
self.arr_hash_prefixt[ele] = [0] * (len(arr) + 1)
for i in range(len(arr)):
for key, val in self.arr_hash_prefixt.items():
if key == arr[i]:
... | MajorityChecker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MajorityChecker:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.arr_se... | stack_v2_sparse_classes_75kplus_train_068857 | 1,324 | no_license | [
{
"docstring": ":type arr: List[int]",
"name": "__init__",
"signature": "def __init__(self, arr)"
},
{
"docstring": ":type left: int :type right: int :type threshold: int :rtype: int",
"name": "query",
"signature": "def query(self, left, right, threshold)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035744 | Implement the Python class `MajorityChecker` described below.
Class description:
Implement the MajorityChecker class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int | Implement the Python class `MajorityChecker` described below.
Class description:
Implement the MajorityChecker class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
<|skelet... | 9b38a7742a819ac3795ea295e371e26bb5bfc28c | <|skeleton|>
class MajorityChecker:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MajorityChecker:
def __init__(self, arr):
""":type arr: List[int]"""
self.arr_set = set(arr)
self.arr_hash_prefixt = {}
for ele in self.arr_set:
self.arr_hash_prefixt[ele] = [0] * (len(arr) + 1)
for i in range(len(arr)):
for key, val in self.arr_... | the_stack_v2_python_sparse | 1157. Online Majority Element In Subarray.py | dundunmao/LeetCode2019 | train | 0 | |
7517ec09d8eb16ca8ec082707dcaa6ef3ac8d9e2 | [
"self.default_prepend = default_prepend\nself.process_default = process_default\nif not paths:\n raise ValueError('One or more rcfile paths must be specified')\nif isinstance(paths, Compatibility.string):\n paths = [paths]\nself.paths = [os.path.expanduser(path) for path in paths]",
"args = args[:]\nif RcFi... | <|body_start_0|>
self.default_prepend = default_prepend
self.process_default = process_default
if not paths:
raise ValueError('One or more rcfile paths must be specified')
if isinstance(paths, Compatibility.string):
paths = [paths]
self.paths = [os.path.ex... | Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right. | RcFile | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RcFile:
"""Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right."""
def __init__(self, paths, default_prepend=True, process_default=False... | stack_v2_sparse_classes_75kplus_train_068858 | 3,125 | permissive | [
{
"docstring": ":param paths: The rcfiles to apply default subcommand options from. :param default_prepend: Whether to prepend (the default) or append if default options are specified with the ``options`` key. :param process_default: True to process options in the [DEFAULT] section and apply regardless of goal.... | 2 | stack_v2_sparse_classes_30k_train_020887 | Implement the Python class `RcFile` described below.
Class description:
Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right.
Method signatures and docstrings:
- d... | Implement the Python class `RcFile` described below.
Class description:
Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right.
Method signatures and docstrings:
- d... | b24251be7de01bf0e8a9ff14176472a13f89b805 | <|skeleton|>
class RcFile:
"""Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right."""
def __init__(self, paths, default_prepend=True, process_default=False... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RcFile:
"""Handles rcfile-style configuration files. Precedence is given to rcfiles that come last in the given sequence of paths. The effect is as if each rcfile in paths overlays the next in a walk from left to right."""
def __init__(self, paths, default_prepend=True, process_default=False):
""... | the_stack_v2_python_sparse | src/python/pants/base/rcfile.py | sarvex/pants | train | 0 |
54ac2e5bc9ae8d48b98b2d59e47134e45b5050f6 | [
"self._train_api = train_api\nself._from_station = from_station\nself._to_station = to_station\nself._weekday = weekday\nself._time = departuretime\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, entry_id)}, manufacturer='Trafikverket', model='v2.0', name=name, configu... | <|body_start_0|>
self._train_api = train_api
self._from_station = from_station
self._to_station = to_station
self._weekday = weekday
self._time = departuretime
self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, entry_id)}, manufa... | Contains data about a train depature. | TrainSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainSensor:
"""Contains data about a train depature."""
def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None:
"""Initialize the sensor."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_068859 | 7,335 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None"
},
{
"docstring": "Retrieve latest state."... | 3 | stack_v2_sparse_classes_30k_train_026475 | Implement the Python class `TrainSensor` described below.
Class description:
Contains data about a train depature.
Method signatures and docstrings:
- def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: st... | Implement the Python class `TrainSensor` described below.
Class description:
Contains data about a train depature.
Method signatures and docstrings:
- def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: st... | 2e65b77b2b5c17919939481f327963abdfdc53f0 | <|skeleton|>
class TrainSensor:
"""Contains data about a train depature."""
def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None:
"""Initialize the sensor."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrainSensor:
"""Contains data about a train depature."""
def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None:
"""Initialize the sensor."""
self._train_api = train_... | the_stack_v2_python_sparse | homeassistant/components/trafikverket_train/sensor.py | konnected-io/home-assistant | train | 24 |
8211441fb4e45aa9ac15262669276332bbdc6d0b | [
"Line.__init__(self, point1, point2, styles, arcthrupoint, is3D, arrows, labels)\nself.n = n\nself.dist = dist",
"dist = self.dist\nn = self.n\npath = pyx.deformer.parallel(-n / 2.0 * dist).deform(self.getPath())\npaths = [path]\ndefo = pyx.deformer.parallel(dist)\nfor m in range(0, n):\n path = defo.deform(pa... | <|body_start_0|>
Line.__init__(self, point1, point2, styles, arcthrupoint, is3D, arrows, labels)
self.n = n
self.dist = dist
<|end_body_0|>
<|body_start_1|>
dist = self.dist
n = self.n
path = pyx.deformer.parallel(-n / 2.0 * dist).deform(self.getPath())
paths = [... | A class for drawing multiple parallel straight lines. | MultiLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiLine:
"""A class for drawing multiple parallel straight lines."""
def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs):
"""Constructor."""
<|body_0|>
def draw(self, canvas):
"""Draw this ... | stack_v2_sparse_classes_75kplus_train_068860 | 36,283 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs)"
},
{
"docstring": "Draw this multiline on the supplied canvas.",
"name": "draw",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_004850 | Implement the Python class `MultiLine` described below.
Class description:
A class for drawing multiple parallel straight lines.
Method signatures and docstrings:
- def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs): Constructor.
- def draw(self... | Implement the Python class `MultiLine` described below.
Class description:
A class for drawing multiple parallel straight lines.
Method signatures and docstrings:
- def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs): Constructor.
- def draw(self... | 62f64e33d900280b26a6de5bbd9ee86c38c69cd0 | <|skeleton|>
class MultiLine:
"""A class for drawing multiple parallel straight lines."""
def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs):
"""Constructor."""
<|body_0|>
def draw(self, canvas):
"""Draw this ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiLine:
"""A class for drawing multiple parallel straight lines."""
def __init__(self, point1, point2, n=5, dist=0.2, styles=[], arcthrupoint=None, is3D=False, arrows=[], labels=[], **kwargs):
"""Constructor."""
Line.__init__(self, point1, point2, styles, arcthrupoint, is3D, arrows, la... | the_stack_v2_python_sparse | pyfeyn/lines.py | kpedro88/pyfeyn | train | 0 |
5ab9d65e6ca1b72b2a485763ee4a015f5db71c3f | [
"super(MoveBaseGoal, self).__init__()\nself.header = std_msgs.msg.Header()\nself.header.frame_id = 'base_link_path'\nself.duration = duration\nself.n_steps = n_steps\nself.gait_type = gait_type\nself.base_goal = geometry_msgs.msg.Pose()\nself.base_goal.position.x = 0.3\nself.base_goal.position.y = 0.0\nself.base_go... | <|body_start_0|>
super(MoveBaseGoal, self).__init__()
self.header = std_msgs.msg.Header()
self.header.frame_id = 'base_link_path'
self.duration = duration
self.n_steps = n_steps
self.gait_type = gait_type
self.base_goal = geometry_msgs.msg.Pose()
self.base... | Extends sweetie_bot_clop_generator.msg.MoveBaseGoal. | MoveBaseGoal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoveBaseGoal:
"""Extends sweetie_bot_clop_generator.msg.MoveBaseGoal."""
def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025):
"""Create MoveBaseGoal message with default field values."""
<|body_0|>
def setTargetBaseShift(self, x, y,... | stack_v2_sparse_classes_75kplus_train_068861 | 6,478 | no_license | [
{
"docstring": "Create MoveBaseGoal message with default field values.",
"name": "__init__",
"signature": "def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025)"
},
{
"docstring": "Set target base pose in path coordinate system (\"base_link_path\" frame). The... | 5 | stack_v2_sparse_classes_30k_val_000550 | Implement the Python class `MoveBaseGoal` described below.
Class description:
Extends sweetie_bot_clop_generator.msg.MoveBaseGoal.
Method signatures and docstrings:
- def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025): Create MoveBaseGoal message with default field values.
- de... | Implement the Python class `MoveBaseGoal` described below.
Class description:
Extends sweetie_bot_clop_generator.msg.MoveBaseGoal.
Method signatures and docstrings:
- def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025): Create MoveBaseGoal message with default field values.
- de... | f15f9cb01f2763d0b9d62624a400a01961609762 | <|skeleton|>
class MoveBaseGoal:
"""Extends sweetie_bot_clop_generator.msg.MoveBaseGoal."""
def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025):
"""Create MoveBaseGoal message with default field values."""
<|body_0|>
def setTargetBaseShift(self, x, y,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MoveBaseGoal:
"""Extends sweetie_bot_clop_generator.msg.MoveBaseGoal."""
def __init__(self, gait_type='walk_overlap', n_steps=4, duration=4, nominal_height=0.2025):
"""Create MoveBaseGoal message with default field values."""
super(MoveBaseGoal, self).__init__()
self.header = std_... | the_stack_v2_python_sparse | behavior/sweetie_bot_clop_generator/pysrc/sweetie_bot_clop_generator/clopper.py | sweetie-bot-project/sweetie_bot | train | 9 |
e707d66d98c713abda5d642d1686f9acdc37d67d | [
"if key is None or item is None:\n return\nself.cache_data[key] = item",
"if key is None:\n return\nreturn self.cache_data.get(key, None)"
] | <|body_start_0|>
if key is None or item is None:
return
self.cache_data[key] = item
<|end_body_0|>
<|body_start_1|>
if key is None:
return
return self.cache_data.get(key, None)
<|end_body_1|>
| Inherits from BaseCaching and is a caching system | BasicCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
<|body_0|>
def get(self, key):
"""Return value of cache_data linked to key"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_068862 | 576 | no_license | [
{
"docstring": "Assign item for key of cache_data",
"name": "put",
"signature": "def put(self, key, item)"
},
{
"docstring": "Return value of cache_data linked to key",
"name": "get",
"signature": "def get(self, key)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002400 | Implement the Python class `BasicCache` described below.
Class description:
Inherits from BaseCaching and is a caching system
Method signatures and docstrings:
- def put(self, key, item): Assign item for key of cache_data
- def get(self, key): Return value of cache_data linked to key | Implement the Python class `BasicCache` described below.
Class description:
Inherits from BaseCaching and is a caching system
Method signatures and docstrings:
- def put(self, key, item): Assign item for key of cache_data
- def get(self, key): Return value of cache_data linked to key
<|skeleton|>
class BasicCache:
... | 151c5c063b15c8474c1fa4ab5ce27f94f36c42b5 | <|skeleton|>
class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
<|body_0|>
def get(self, key):
"""Return value of cache_data linked to key"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
if key is None or item is None:
return
self.cache_data[key] = item
def get(self, key):
"""Return value of cache_data linke... | the_stack_v2_python_sparse | 0x03-caching/0-basic_cache.py | Gzoref/holbertonschool-web_back_end | train | 0 |
b6c6d9c6c0350a8cf5e1027aa8c843127d9c157e | [
"logs.log_info('You are using the vgCa channel type: Ca_L3')\nself.time_unit = 1000.0\nself.vrev = 131.0\nTexpt = 36.0\nself.qt = 1.0\nV = V - 15\nself.m = 1.0 / (1 + np.exp((V - -30.0) / -6))\nself.h = 1.0 / (1 + np.exp((V - -80.0) / 6.4))\nself._mpower = 2\nself._hpower = 1",
"V = V - 15\nself._mInf = 1.0 / (1 ... | <|body_start_0|>
logs.log_info('You are using the vgCa channel type: Ca_L3')
self.time_unit = 1000.0
self.vrev = 131.0
Texpt = 36.0
self.qt = 1.0
V = V - 15
self.m = 1.0 / (1 + np.exp((V - -30.0) / -6))
self.h = 1.0 / (1 + np.exp((V - -80.0) / 6.4))
... | L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neural stimulation. This channel has been modified to activate at more depol... | Ca_L3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ca_L3:
"""L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neural stimulation. This channel has been m... | stack_v2_sparse_classes_75kplus_train_068863 | 22,487 | no_license | [
{
"docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.",
"name": "_init_state",
"signature": "def _init_state(self, V)"
},
{
"docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.",
... | 2 | null | Implement the Python class `Ca_L3` described below.
Class description:
L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neur... | Implement the Python class `Ca_L3` described below.
Class description:
L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neur... | dd03ff5e3df3ef48d887a6566a6286fcd168880b | <|skeleton|>
class Ca_L3:
"""L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neural stimulation. This channel has been m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ca_L3:
"""L-type calcium channel model Avery et al. L-type channels are higher-voltage activating and very persistent. They are commonly found in muscle or glands, where they induce activities such as hormone release or muscle contraction in response to neural stimulation. This channel has been modified to ac... | the_stack_v2_python_sparse | betse/science/channels/vg_ca.py | R-Stefano/betse-ml | train | 0 |
32b6de486afefd7a73feece8ef8ba6a7ecf7ec6f | [
"params = base.get_params(None, locals())\nrequest = http.Request('GET', self.get_url(), params)\nreturn (request, parsers.parse_json)",
"params = base.get_params(None, locals())\nurl = '{0}/{1}'.format(self.get_url(), 'search')\nreturn (http.Request('GET', url, params), parsers.parse_json)"
] | <|body_start_0|>
params = base.get_params(None, locals())
request = http.Request('GET', self.get_url(), params)
return (request, parsers.parse_json)
<|end_body_0|>
<|body_start_1|>
params = base.get_params(None, locals())
url = '{0}/{1}'.format(self.get_url(), 'search')
... | ForumSuggestions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForumSuggestions:
def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None):
"""Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many... | stack_v2_sparse_classes_75kplus_train_068864 | 8,533 | permissive | [
{
"docstring": "Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many objects sould be returned. If left as `None`, 10 objects are returned. :vartype per_page: int :var category: Either a category ID, `a... | 2 | stack_v2_sparse_classes_30k_test_003032 | Implement the Python class `ForumSuggestions` described below.
Class description:
Implement the ForumSuggestions class.
Method signatures and docstrings:
- def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): Fetch suggestions from this forum. :var page: Where shoul... | Implement the Python class `ForumSuggestions` described below.
Class description:
Implement the ForumSuggestions class.
Method signatures and docstrings:
- def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None): Fetch suggestions from this forum. :var page: Where shoul... | 25caa745a104c8dc209584fa359294c65dbf88bb | <|skeleton|>
class ForumSuggestions:
def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None):
"""Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ForumSuggestions:
def get(self, page=None, per_page=None, category=None, filter=None, sort=None, updated_after_date=None):
"""Fetch suggestions from this forum. :var page: Where should paging start. If left as `None`, the first page is returned. :vartype page: int :var per_page: How many objects sould... | the_stack_v2_python_sparse | libsaas/services/uservoice/suggestions.py | piplcom/libsaas | train | 1 | |
4bb4ae370500f23661d775f26b317f948d101dba | [
"frequencies = PrepData.prep(file[0], scrape_type)\ninitialize_status = Status('Generated wordcloud.', 'Generating wordcloud.', 'white')\ninitialize_status.start()\nwordcloud = WordCloud(height=1200, max_font_size=400, width=1600).generate_from_frequencies(frequencies)\ninitialize_status.succeed()\nreturn wordcloud... | <|body_start_0|>
frequencies = PrepData.prep(file[0], scrape_type)
initialize_status = Status('Generated wordcloud.', 'Generating wordcloud.', 'white')
initialize_status.start()
wordcloud = WordCloud(height=1200, max_font_size=400, width=1600).generate_from_frequencies(frequencies)
... | Methods for setting up the wordcloud. | SetUpWordcloud | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetUpWordcloud:
"""Methods for setting up the wordcloud."""
def initialize_wordcloud(file, scrape_type):
"""Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public method from an external module: PrepData.prep() Parameters --... | stack_v2_sparse_classes_75kplus_train_068865 | 5,148 | permissive | [
{
"docstring": "Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public method from an external module: PrepData.prep() Parameters ---------- file: list List containing scrape files and file formats to generate wordcloud with scrape_type: str String den... | 2 | stack_v2_sparse_classes_30k_train_040703 | Implement the Python class `SetUpWordcloud` described below.
Class description:
Methods for setting up the wordcloud.
Method signatures and docstrings:
- def initialize_wordcloud(file, scrape_type): Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public meth... | Implement the Python class `SetUpWordcloud` described below.
Class description:
Methods for setting up the wordcloud.
Method signatures and docstrings:
- def initialize_wordcloud(file, scrape_type): Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public meth... | 9f8cf3a3adb9aa5079dfc7bfd7832b53358ee40f | <|skeleton|>
class SetUpWordcloud:
"""Methods for setting up the wordcloud."""
def initialize_wordcloud(file, scrape_type):
"""Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public method from an external module: PrepData.prep() Parameters --... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SetUpWordcloud:
"""Methods for setting up the wordcloud."""
def initialize_wordcloud(file, scrape_type):
"""Initialize wordcloud by setting dimensions, max font size, and generating it from word frequencies. Calls a public method from an external module: PrepData.prep() Parameters ---------- file... | the_stack_v2_python_sparse | urs/analytics/Wordcloud.py | shilezi/URS | train | 0 |
cef60fd4ba8cfacbde5250863002e2f5baea7091 | [
"def dist(p1, p2):\n return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])\nheap = []\ngraph = {}\nfor i in range(len(points)):\n for j in range(i + 1, len(points)):\n d = dist(points[i], points[j])\n graph.setdefault(i, {})[j] = graph.setdefault(j, {})[i] = d\n heappush(heap, (d, i, j))\n\nclas... | <|body_start_0|>
def dist(p1, p2):
return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])
heap = []
graph = {}
for i in range(len(points)):
for j in range(i + 1, len(points)):
d = dist(points[i], points[j])
graph.setdefault(i, {})[j] = grap... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minCostConnectPoints(self, points: List[List[int]]) -> int:
"""Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)"""
<|body_0|>
def minCostConnectPoints(self, points: List[List[int]]) -> int:
"""Time complexity: O(n^2) Space complexity: O(n^2)"""... | stack_v2_sparse_classes_75kplus_train_068866 | 6,484 | no_license | [
{
"docstring": "Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)",
"name": "minCostConnectPoints",
"signature": "def minCostConnectPoints(self, points: List[List[int]]) -> int"
},
{
"docstring": "Time complexity: O(n^2) Space complexity: O(n^2)",
"name": "minCostConnectPoints",
... | 3 | stack_v2_sparse_classes_30k_train_032189 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostConnectPoints(self, points: List[List[int]]) -> int: Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)
- def minCostConnectPoints(self, points: List[List[int]]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostConnectPoints(self, points: List[List[int]]) -> int: Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)
- def minCostConnectPoints(self, points: List[List[int]]... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minCostConnectPoints(self, points: List[List[int]]) -> int:
"""Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)"""
<|body_0|>
def minCostConnectPoints(self, points: List[List[int]]) -> int:
"""Time complexity: O(n^2) Space complexity: O(n^2)"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minCostConnectPoints(self, points: List[List[int]]) -> int:
"""Time complexity: O(n^2*log(n^2)) Space complexity: O(n^2)"""
def dist(p1, p2):
return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])
heap = []
graph = {}
for i in range(len(points)):
... | the_stack_v2_python_sparse | leetcode/solved/1706_Min_Cost_to_Connect_All_Points/solution.py | sungminoh/algorithms | train | 0 | |
8a86ad5425b0f50787cd0e7effd4891f2b04cea2 | [
"ret_list = [start_node.value]\nstart_node.visited = True\nedges_out = [e for e in start_node.edges if e.node_to.value != start_node.value]\nfor edge in edges_out:\n if not edge.node_to.visited:\n ret_list.extend(self.dfs_helper(edge.node_to))\nreturn ret_list",
"node = self.find_node(start_node_num)\ns... | <|body_start_0|>
ret_list = [start_node.value]
start_node.visited = True
edges_out = [e for e in start_node.edges if e.node_to.value != start_node.value]
for edge in edges_out:
if not edge.node_to.visited:
ret_list.extend(self.dfs_helper(edge.node_to))
... | Graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ... | stack_v2_sparse_classes_75kplus_train_068867 | 5,068 | no_license | [
{
"docstring": "The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._clear_visited() to be called before MOD... | 2 | stack_v2_sparse_classes_30k_train_003631 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr... | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr... | 8ae0db8508dc5e75a5bf45659debaedf22c72b1f | <|skeleton|>
class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._c... | the_stack_v2_python_sparse | review/graph/dijkstraDistance.py | khezam/algos_ds | train | 0 | |
bc8a90a6d596fd8c8c4c9964076a79dfd8239ec6 | [
"self.id = id\nself._rk = RedisKeyWrapper(self.id)\nself.rdb = redis.StrictRedis(host=redis_address[0], port=redis_address[1], db=redis_db, decode_responses=True)",
"assert isinstance(file_path, str)\nd = {'FILE_PATH': file_path, 'TTL': ttl}\nd.update(kwargs)\ntry:\n task = json.dumps(d)\n self.rdb.rpush(se... | <|body_start_0|>
self.id = id
self._rk = RedisKeyWrapper(self.id)
self.rdb = redis.StrictRedis(host=redis_address[0], port=redis_address[1], db=redis_db, decode_responses=True)
<|end_body_0|>
<|body_start_1|>
assert isinstance(file_path, str)
d = {'FILE_PATH': file_path, 'TTL': ... | This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read the file locally by provided file's directory)to the queue, and then our zmq ... | FileManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileManager:
"""This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read the file locally by provided file's di... | stack_v2_sparse_classes_75kplus_train_068868 | 24,489 | permissive | [
{
"docstring": ":param id: publisher's id",
"name": "__init__",
"signature": "def __init__(self, id, redis_address=('127.0.0.1', 6379), redis_db=0)"
},
{
"docstring": ":param ttl: if ttl is 0, then it will live forever in boxes, otherwise time unit is sec :param kwargs: other headers",
"name... | 3 | stack_v2_sparse_classes_30k_train_025154 | Implement the Python class `FileManager` described below.
Class description:
This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read... | Implement the Python class `FileManager` described below.
Class description:
This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read... | 01c92ae15a12ddce2fe61348a829f77a5e02bb41 | <|skeleton|>
class FileManager:
"""This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read the file locally by provided file's di... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileManager:
"""This class is an api for other users to connect to Publisher. The basic usage for now is that users should push their file's name or directory, (assuming that user's process and Publisher are running on the same machine, so that we could read the file locally by provided file's directory)to th... | the_stack_v2_python_sparse | dandelion/httpclient.py | ktshen/Dandelion | train | 0 |
11747bc1a04d1b655d93eaf14d514e8294fe2f47 | [
"if n <= 2:\n return n\na, b = (1, 2)\nwhile n > 2:\n a, b = (b, a + b)\n n -= 1\nreturn b",
"def helper(n):\n if n <= 2:\n return n\n return helper(n - 1) + helper(n - 2)\nreturn helper(n)",
"if n <= 2:\n return n\ndp = [0] * n\ndp[0] = 1\ndp[1] = 2\nfor i in range(2, n):\n dp[i] = ... | <|body_start_0|>
if n <= 2:
return n
a, b = (1, 2)
while n > 2:
a, b = (b, a + b)
n -= 1
return b
<|end_body_0|>
<|body_start_1|>
def helper(n):
if n <= 2:
return n
return helper(n - 1) + helper(n - 2)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def climbStairs(self, n: int) -> int:
"""执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:"""
<|body_0|>
def climbStairs(self, n: int) -> int:
"""思路:递归超时 :param n: :ret... | stack_v2_sparse_classes_75kplus_train_068869 | 1,955 | no_license | [
{
"docstring": "执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:",
"name": "climbStairs",
"signature": "def climbStairs(self, n: int) -> int"
},
{
"docstring": "思路:递归超时 :param n: :return:",
"name": "cli... | 3 | stack_v2_sparse_classes_30k_train_019655 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n: int) -> int: 执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n: int) -> int: 执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:
-... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def climbStairs(self, n: int) -> int:
"""执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:"""
<|body_0|>
def climbStairs(self, n: int) -> int:
"""思路:递归超时 :param n: :ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def climbStairs(self, n: int) -> int:
"""执行用时 :56 ms, 在所有 Python3 提交中击败了8.78%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.58%的用户 思路:f(n)=f(n-1)+f(n-2),所以只需要保存最近的两个数即可 :param n: :return:"""
if n <= 2:
return n
a, b = (1, 2)
while n > 2:
a, b = (b, a +... | the_stack_v2_python_sparse | LeetCode/递归/70. Climbing Stairs.py | yiming1012/MyLeetCode | train | 2 | |
3cfd3f8b1100bbd314dcec5a7a899154e5f32a45 | [
"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... | ////////////////////////////////////////// ////////////////////////////////////////// ////////////////////////////////////////// | IMDBServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IMDBServicer:
"""////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////"""
def GetIMDBs(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def Search... | stack_v2_sparse_classes_75kplus_train_068870 | 9,858 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetIMDBs",
"signature": "def GetIMDBs(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SearchById",
"signature": "def SearchById(self, reques... | 6 | null | Implement the Python class `IMDBServicer` described below.
Class description:
////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////
Method signatures and docstrings:
- def GetIMDBs(self, request, context): Missing associated documentation comm... | Implement the Python class `IMDBServicer` described below.
Class description:
////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////
Method signatures and docstrings:
- def GetIMDBs(self, request, context): Missing associated documentation comm... | 4f51e5c6ed34c31053d9183da152eac843e7ea96 | <|skeleton|>
class IMDBServicer:
"""////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////"""
def GetIMDBs(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def Search... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IMDBServicer:
"""////////////////////////////////////////// ////////////////////////////////////////// //////////////////////////////////////////"""
def GetIMDBs(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPL... | the_stack_v2_python_sparse | app/protobufs/library/imdb_pb2_grpc.py | JotaFilip/cn-g | train | 1 |
211130f1946dbf917139e0161863d3e5616dfaec | [
"StochasticGradientDescent.__init__(self, loss)\nself.gamma = gamma\nself.epsilon = epsilon\nself.alpha = alpha\nself.mean_dw = [[[0 for i in range(self.Q.model.nodes[l])] for j in range(self.Q.model.nodes[l + 1])] for l in range(self.Q.model.total_layers - 1)]\nself.mean_db = [[0 for j in range(self.Q.model.nodes[... | <|body_start_0|>
StochasticGradientDescent.__init__(self, loss)
self.gamma = gamma
self.epsilon = epsilon
self.alpha = alpha
self.mean_dw = [[[0 for i in range(self.Q.model.nodes[l])] for j in range(self.Q.model.nodes[l + 1])] for l in range(self.Q.model.total_layers - 1)]
... | AdaDeltaSGD strategy. Better than vanilla, but still not that good | AdaDeltaSGD | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaDeltaSGD:
"""AdaDeltaSGD strategy. Better than vanilla, but still not that good"""
def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1):
"""loss: the loss function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) alpha: learning rate"""
... | stack_v2_sparse_classes_75kplus_train_068871 | 3,423 | permissive | [
{
"docstring": "loss: the loss function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) alpha: learning rate",
"name": "__init__",
"signature": "def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1)"
},
{
"docstring": "during the update step, you calcula... | 2 | null | Implement the Python class `AdaDeltaSGD` described below.
Class description:
AdaDeltaSGD strategy. Better than vanilla, but still not that good
Method signatures and docstrings:
- def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1): loss: the loss function gamma: the decaying parameter epsilon: safety para... | Implement the Python class `AdaDeltaSGD` described below.
Class description:
AdaDeltaSGD strategy. Better than vanilla, but still not that good
Method signatures and docstrings:
- def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1): loss: the loss function gamma: the decaying parameter epsilon: safety para... | e12ea464e7845793c88adfff6da4c8454099c03b | <|skeleton|>
class AdaDeltaSGD:
"""AdaDeltaSGD strategy. Better than vanilla, but still not that good"""
def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1):
"""loss: the loss function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) alpha: learning rate"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdaDeltaSGD:
"""AdaDeltaSGD strategy. Better than vanilla, but still not that good"""
def __init__(self, loss, gamma=0.995, epsilon=0.0001, alpha=1):
"""loss: the loss function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) alpha: learning rate"""
Stochas... | the_stack_v2_python_sparse | Artificial_Neural_Networks/python/FeedForwardANN/FFANN_AdaDeltaSGD.py | dkaramit/ASAP | train | 2 |
2f7eb5bee6559a8193e34ed596a25ba4c7b9f839 | [
"params = super().get_default_params(with_multi_layer_perceptron=True)\nparams['mlp_num_units'] = 256\nparams.get('mlp_num_units').hyper_space = engine.hyper_spaces.quniform(16, 512)\nparams.get('mlp_num_layers').hyper_space = engine.hyper_spaces.quniform(1, 5)\nreturn params",
"x_in = self._make_inputs()\nx = ke... | <|body_start_0|>
params = super().get_default_params(with_multi_layer_perceptron=True)
params['mlp_num_units'] = 256
params.get('mlp_num_units').hyper_space = engine.hyper_spaces.quniform(16, 512)
params.get('mlp_num_layers').hyper_space = engine.hyper_spaces.quniform(1, 5)
retur... | A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'] = 'relu' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() ... | DenseBaseline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DenseBaseline:
"""A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'] = 'relu' >>> model.guess_and_fill_mis... | stack_v2_sparse_classes_75kplus_train_068872 | 1,335 | permissive | [
{
"docstring": ":return: model default parameters.",
"name": "get_default_params",
"signature": "def get_default_params(cls) -> engine.ParamTable"
},
{
"docstring": "Model structure.",
"name": "build",
"signature": "def build(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053197 | Implement the Python class `DenseBaseline` described below.
Class description:
A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'... | Implement the Python class `DenseBaseline` described below.
Class description:
A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'... | 1fe2afca7bc2aa0fd8af8f80df84a2665367d13c | <|skeleton|>
class DenseBaseline:
"""A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'] = 'relu' >>> model.guess_and_fill_mis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DenseBaseline:
"""A simple densely connected baseline model. Examples: >>> model = DenseBaseline() >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'] = 'relu' >>> model.guess_and_fill_missing_params(v... | the_stack_v2_python_sparse | matchzoo/models/dense_baseline.py | zhanzecheng/MatchZoo | train | 2 |
6e2ac25b762ac8828dc4343102238a06ea25fed9 | [
"self.miningStatus = miningStatus\nself.lock = lock\nlogging.basicConfig()\nThread.__init__(self)",
"server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))\nTransaction_pb2_grpc.add_TransactionServicer_to_server(TransactionService(self.miningStatus), server)\nBlockMining_pb2_grpc.add_BlockMiningServicer... | <|body_start_0|>
self.miningStatus = miningStatus
self.lock = lock
logging.basicConfig()
Thread.__init__(self)
<|end_body_0|>
<|body_start_1|>
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
Transaction_pb2_grpc.add_TransactionServicer_to_server(Transact... | Class that handle grpc server It receive transactions, block mining requests, ... | GrpcServerHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GrpcServerHandler:
"""Class that handle grpc server It receive transactions, block mining requests, ..."""
def __init__(self, miningStatus, lock):
"""Constructor with parameters :param miningStatus: Shared current status of mining :param lock: Re entrant lock used to handle shared da... | stack_v2_sparse_classes_75kplus_train_068873 | 1,678 | no_license | [
{
"docstring": "Constructor with parameters :param miningStatus: Shared current status of mining :param lock: Re entrant lock used to handle shared data",
"name": "__init__",
"signature": "def __init__(self, miningStatus, lock)"
},
{
"docstring": "Start server and waiting for transactions",
... | 2 | stack_v2_sparse_classes_30k_train_030950 | Implement the Python class `GrpcServerHandler` described below.
Class description:
Class that handle grpc server It receive transactions, block mining requests, ...
Method signatures and docstrings:
- def __init__(self, miningStatus, lock): Constructor with parameters :param miningStatus: Shared current status of min... | Implement the Python class `GrpcServerHandler` described below.
Class description:
Class that handle grpc server It receive transactions, block mining requests, ...
Method signatures and docstrings:
- def __init__(self, miningStatus, lock): Constructor with parameters :param miningStatus: Shared current status of min... | f5df62e34265ce5185031ebc7c694b759c2a73a2 | <|skeleton|>
class GrpcServerHandler:
"""Class that handle grpc server It receive transactions, block mining requests, ..."""
def __init__(self, miningStatus, lock):
"""Constructor with parameters :param miningStatus: Shared current status of mining :param lock: Re entrant lock used to handle shared da... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GrpcServerHandler:
"""Class that handle grpc server It receive transactions, block mining requests, ..."""
def __init__(self, miningStatus, lock):
"""Constructor with parameters :param miningStatus: Shared current status of mining :param lock: Re entrant lock used to handle shared data"""
... | the_stack_v2_python_sparse | blockchain/comunication/grpc_comunication_handlers/GrpcServerHandler.py | packo97/Blockchain_Project | train | 1 |
d9c12bdcf6992b7bd5a6ebd3cbe24f52eb4c0f74 | [
"with self.assertRaises(Exception):\n url_utils.create_filepath_url('http://1.2.3.4/path')\nself.assertEquals(url_utils.create_filepath_url('%sdir%sfile' % (os.path.sep, os.path.sep)), 'file:///dir/file')\nself.assertEquals(url_utils.create_filepath_url(os.path.join('dir', 'file')), 'file://%s/dir/file' % urllib... | <|body_start_0|>
with self.assertRaises(Exception):
url_utils.create_filepath_url('http://1.2.3.4/path')
self.assertEquals(url_utils.create_filepath_url('%sdir%sfile' % (os.path.sep, os.path.sep)), 'file:///dir/file')
self.assertEquals(url_utils.create_filepath_url(os.path.join('dir'... | UrlUtilsTest | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UrlUtilsTest:
def test_create_filepath_url(self):
"""Tests create_filepath_url()."""
<|body_0|>
def test_copy_contents(self):
"""Tests copy_contents()."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
with self.assertRaises(Exception):
ur... | stack_v2_sparse_classes_75kplus_train_068874 | 1,986 | permissive | [
{
"docstring": "Tests create_filepath_url().",
"name": "test_create_filepath_url",
"signature": "def test_create_filepath_url(self)"
},
{
"docstring": "Tests copy_contents().",
"name": "test_copy_contents",
"signature": "def test_copy_contents(self)"
}
] | 2 | null | Implement the Python class `UrlUtilsTest` described below.
Class description:
Implement the UrlUtilsTest class.
Method signatures and docstrings:
- def test_create_filepath_url(self): Tests create_filepath_url().
- def test_copy_contents(self): Tests copy_contents(). | Implement the Python class `UrlUtilsTest` described below.
Class description:
Implement the UrlUtilsTest class.
Method signatures and docstrings:
- def test_create_filepath_url(self): Tests create_filepath_url().
- def test_copy_contents(self): Tests copy_contents().
<|skeleton|>
class UrlUtilsTest:
def test_cr... | 47dbb2ff9ae01305b190f409ccea00b3b4f0bc79 | <|skeleton|>
class UrlUtilsTest:
def test_create_filepath_url(self):
"""Tests create_filepath_url()."""
<|body_0|>
def test_copy_contents(self):
"""Tests copy_contents()."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UrlUtilsTest:
def test_create_filepath_url(self):
"""Tests create_filepath_url()."""
with self.assertRaises(Exception):
url_utils.create_filepath_url('http://1.2.3.4/path')
self.assertEquals(url_utils.create_filepath_url('%sdir%sfile' % (os.path.sep, os.path.sep)), 'file://... | the_stack_v2_python_sparse | externals/skia/common/py/utils/url_utils_test.py | mono/linux-packaging-skiasharp | train | 1 | |
5b5f7d155e0187329a63a2074340f7e4b6fa484f | [
"super().__init__()\nself.colors = colors\nself.nb_points = len(colors)\nself.size = size\nsmallest_height = size.height() / (2 * self.nb_points + 4)\nself.size_text = QSize(self.size.width(), smallest_height)\nself.size_edit_text = QSize(self.size.width() / 4, smallest_height)\nself.size_edit = QSize(self.size.wid... | <|body_start_0|>
super().__init__()
self.colors = colors
self.nb_points = len(colors)
self.size = size
smallest_height = size.height() / (2 * self.nb_points + 4)
self.size_text = QSize(self.size.width(), smallest_height)
self.size_edit_text = QSize(self.size.width... | QGridLayout class that displays QTextEdit objects. | CalibrationPoints | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalibrationPoints:
"""QGridLayout class that displays QTextEdit objects."""
def __init__(self, size, colors, points):
"""Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. colors (list of Qt.Color): the colors of the points. points... | stack_v2_sparse_classes_75kplus_train_068875 | 2,916 | no_license | [
{
"docstring": "Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. colors (list of Qt.Color): the colors of the points. points (array, shape = (len(colors), 2)): the points on which the information will be registered.",
"name": "__init__",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_021048 | Implement the Python class `CalibrationPoints` described below.
Class description:
QGridLayout class that displays QTextEdit objects.
Method signatures and docstrings:
- def __init__(self, size, colors, points): Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. co... | Implement the Python class `CalibrationPoints` described below.
Class description:
QGridLayout class that displays QTextEdit objects.
Method signatures and docstrings:
- def __init__(self, size, colors, points): Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. co... | 237ca81580db43525d8945017c0565b9722046ad | <|skeleton|>
class CalibrationPoints:
"""QGridLayout class that displays QTextEdit objects."""
def __init__(self, size, colors, points):
"""Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. colors (list of Qt.Color): the colors of the points. points... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CalibrationPoints:
"""QGridLayout class that displays QTextEdit objects."""
def __init__(self, size, colors, points):
"""Construct the objects to manage the QTextEdit objects. Args: size (QSize): the size of the QGridLayout. colors (list of Qt.Color): the colors of the points. points (array, shap... | the_stack_v2_python_sparse | src/d0_utils/point_selection/information_points/calibration_points.py | remingtonCarmi/TrackingSwimmingENPC | train | 0 |
b80a62e3d9cf9b64f7eea7804561c77a30029a91 | [
"result = [0 for _ in range(len(nums))]\nlow = 0\nhigh = len(result) - 1\nfor x in nums:\n if x & 1 == 1:\n result[low] = x\n low += 1\n else:\n result[high] = x\n high -= 1\nreturn result",
"low = 0\nhigh = len(nums) - 1\nwhile low < high:\n if nums[low] & 1 == 0 and nums[hig... | <|body_start_0|>
result = [0 for _ in range(len(nums))]
low = 0
high = len(result) - 1
for x in nums:
if x & 1 == 1:
result[low] = x
low += 1
else:
result[high] = x
high -= 1
return result
<|e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exchange(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def exchange2(self, nums):
"""双端指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = [0 for _ in range(len(nums))]
low = 0
high = len... | stack_v2_sparse_classes_75kplus_train_068876 | 1,548 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "exchange",
"signature": "def exchange(self, nums)"
},
{
"docstring": "双端指针",
"name": "exchange2",
"signature": "def exchange2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037623 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exchange(self, nums): :type nums: List[int] :rtype: List[int]
- def exchange2(self, nums): 双端指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exchange(self, nums): :type nums: List[int] :rtype: List[int]
- def exchange2(self, nums): 双端指针
<|skeleton|>
class Solution:
def exchange(self, nums):
""":type ... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def exchange(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def exchange2(self, nums):
"""双端指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def exchange(self, nums):
""":type nums: List[int] :rtype: List[int]"""
result = [0 for _ in range(len(nums))]
low = 0
high = len(result) - 1
for x in nums:
if x & 1 == 1:
result[low] = x
low += 1
else:
... | the_stack_v2_python_sparse | 剑指/二刷/调整数组顺序使奇数位于偶数前面_S.py | 2226171237/Algorithmpractice | train | 0 | |
c0b05c2a0f8bcf0a678f65b56cf671df51ac7ed0 | [
"value_lines = []\ntry:\n file = open(file_name + '\\\\' + file_path, 'r')\n try:\n print('读取的文件为:%s' % file_name + '\\\\' + file_path)\n value_lines = file.readlines()\n for line in value_lines:\n text_line = line.split('\\n')\n value_lines.append(text_line[0])\n ... | <|body_start_0|>
value_lines = []
try:
file = open(file_name + '\\' + file_path, 'r')
try:
print('读取的文件为:%s' % file_name + '\\' + file_path)
value_lines = file.readlines()
for line in value_lines:
text_line = lin... | UseText | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UseText:
def read_text(file_name, file_path):
"""读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容"""
<|body_0|>
def write_text(file_name, text_value):
"""写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容... | stack_v2_sparse_classes_75kplus_train_068877 | 1,728 | no_license | [
{
"docstring": "读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容",
"name": "read_text",
"signature": "def read_text(file_name, file_path)"
},
{
"docstring": "写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容(值) :return:",
"name"... | 2 | stack_v2_sparse_classes_30k_train_034987 | Implement the Python class `UseText` described below.
Class description:
Implement the UseText class.
Method signatures and docstrings:
- def read_text(file_name, file_path): 读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容
- def write_text(file_name, text_value): 写入Text... | Implement the Python class `UseText` described below.
Class description:
Implement the UseText class.
Method signatures and docstrings:
- def read_text(file_name, file_path): 读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容
- def write_text(file_name, text_value): 写入Text... | e09df64a0b19ad128152a9fb6c9e73e6271207bb | <|skeleton|>
class UseText:
def read_text(file_name, file_path):
"""读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容"""
<|body_0|>
def write_text(file_name, text_value):
"""写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UseText:
def read_text(file_name, file_path):
"""读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容"""
value_lines = []
try:
file = open(file_name + '\\' + file_path, 'r')
try:
print('读取的文件为:%s' % file... | the_stack_v2_python_sparse | common/use_text.py | wallaceok/GoldGarden | train | 0 | |
a11508cd7324225c094f1ce3e8107b6738c29731 | [
"self.data_dictionary = {year: pd.read_csv(self.data_path + data_type_string + f'Piped{year}.csv') for year in range(2015, 2020)}\nself.data_df = pd.concat(list(self.data_dictionary.values()))\nself.data_df = self.clean_correct_data(self.data_df)",
"data_df['SR CREATE DATE'] = data_df['SR CREATE DATE'].apply(lamb... | <|body_start_0|>
self.data_dictionary = {year: pd.read_csv(self.data_path + data_type_string + f'Piped{year}.csv') for year in range(2015, 2020)}
self.data_df = pd.concat(list(self.data_dictionary.values()))
self.data_df = self.clean_correct_data(self.data_df)
<|end_body_0|>
<|body_start_1|>
... | Container class for loading flooding data. | Houston311Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Houston311Data:
"""Container class for loading flooding data."""
def __init__(self, data_type_string):
"""Loads dataframe and merge in the station data for each reading. :param data_type_string:"""
<|body_0|>
def clean_correct_data(self, data_df):
"""Clean origin... | stack_v2_sparse_classes_75kplus_train_068878 | 5,972 | no_license | [
{
"docstring": "Loads dataframe and merge in the station data for each reading. :param data_type_string:",
"name": "__init__",
"signature": "def __init__(self, data_type_string)"
},
{
"docstring": "Clean original df to have usable objects :param data_df: :return: cleaned DataFrame",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_054059 | Implement the Python class `Houston311Data` described below.
Class description:
Container class for loading flooding data.
Method signatures and docstrings:
- def __init__(self, data_type_string): Loads dataframe and merge in the station data for each reading. :param data_type_string:
- def clean_correct_data(self, d... | Implement the Python class `Houston311Data` described below.
Class description:
Container class for loading flooding data.
Method signatures and docstrings:
- def __init__(self, data_type_string): Loads dataframe and merge in the station data for each reading. :param data_type_string:
- def clean_correct_data(self, d... | 0edb39b017db858bad73aa018516fee51942f212 | <|skeleton|>
class Houston311Data:
"""Container class for loading flooding data."""
def __init__(self, data_type_string):
"""Loads dataframe and merge in the station data for each reading. :param data_type_string:"""
<|body_0|>
def clean_correct_data(self, data_df):
"""Clean origin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Houston311Data:
"""Container class for loading flooding data."""
def __init__(self, data_type_string):
"""Loads dataframe and merge in the station data for each reading. :param data_type_string:"""
self.data_dictionary = {year: pd.read_csv(self.data_path + data_type_string + f'Piped{year}... | the_stack_v2_python_sparse | runtime/dataloader/Houston311Data.py | Denizhan-Yigitbas/PotHoles_DSCI400 | train | 0 |
76fcb7fdf27f51b397c28d669e9d8780e56baff3 | [
"self.F_np = faces.data.cpu().numpy()\nself.F = faces.data\nself.L = None",
"V_np = V.cpu().numpy()\nbatchV = V_np.reshape(-1, 3)\nif self.L is None:\n print('Computing the Laplacian!')\n C = cotangent(V, self.F)\n C_np = C.cpu().numpy()\n batchC = C_np.reshape(-1, 3)\n offset = np.arange(0, V.size... | <|body_start_0|>
self.F_np = faces.data.cpu().numpy()
self.F = faces.data
self.L = None
<|end_body_0|>
<|body_start_1|>
V_np = V.cpu().numpy()
batchV = V_np.reshape(-1, 3)
if self.L is None:
print('Computing the Laplacian!')
C = cotangent(V, self.... | Laplacian | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Laplacian:
def __init__(self, faces):
"""Faces is B x F x 3, cuda torch Variabe. Reuse faces."""
<|body_0|>
def forward(self, V):
"""If forward is explicitly called, V is still a Parameter or Variable But if called through __call__ it's a tensor. This assumes __call_... | stack_v2_sparse_classes_75kplus_train_068879 | 8,026 | permissive | [
{
"docstring": "Faces is B x F x 3, cuda torch Variabe. Reuse faces.",
"name": "__init__",
"signature": "def __init__(self, faces)"
},
{
"docstring": "If forward is explicitly called, V is still a Parameter or Variable But if called through __call__ it's a tensor. This assumes __call__ was used.... | 3 | null | Implement the Python class `Laplacian` described below.
Class description:
Implement the Laplacian class.
Method signatures and docstrings:
- def __init__(self, faces): Faces is B x F x 3, cuda torch Variabe. Reuse faces.
- def forward(self, V): If forward is explicitly called, V is still a Parameter or Variable But ... | Implement the Python class `Laplacian` described below.
Class description:
Implement the Laplacian class.
Method signatures and docstrings:
- def __init__(self, faces): Faces is B x F x 3, cuda torch Variabe. Reuse faces.
- def forward(self, V): If forward is explicitly called, V is still a Parameter or Variable But ... | 7b28f2736edaaa1b2e6471d2acdc23e7e53de39c | <|skeleton|>
class Laplacian:
def __init__(self, faces):
"""Faces is B x F x 3, cuda torch Variabe. Reuse faces."""
<|body_0|>
def forward(self, V):
"""If forward is explicitly called, V is still a Parameter or Variable But if called through __call__ it's a tensor. This assumes __call_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Laplacian:
def __init__(self, faces):
"""Faces is B x F x 3, cuda torch Variabe. Reuse faces."""
self.F_np = faces.data.cpu().numpy()
self.F = faces.data
self.L = None
def forward(self, V):
"""If forward is explicitly called, V is still a Parameter or Variable But ... | the_stack_v2_python_sparse | unsup_legacy/laplacian.py | ThibaultGROUEIX/3D-CODED | train | 328 | |
b886f5d535557723c034f85a2c3c13023a8afc75 | [
"print('ApiStatistics . GET . 1')\nprint('ApiStatistics . GET . 1 . request = {0}'.format(request))\nprint('ApiStatistics . GET . 1 . request.GET = {0}'.format(request.GET))\ndynamodb = boto3.resource('dynamodb', region_name='us-east-1')\ntable = dynamodb.Table('STATISTICS')\npost_id = request.GET.get('post_id')\np... | <|body_start_0|>
print('ApiStatistics . GET . 1')
print('ApiStatistics . GET . 1 . request = {0}'.format(request))
print('ApiStatistics . GET . 1 . request.GET = {0}'.format(request.GET))
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table = dynamodb.Table('STATI... | Statistics API | ApiStatistics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiStatistics:
"""Statistics API"""
def get(self, request, format=None):
"""Return a list of User Stats"""
<|body_0|>
def post(self, request, format=None):
"""PUBLISH COMMENT"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
print('ApiStatistics .... | stack_v2_sparse_classes_75kplus_train_068880 | 11,563 | no_license | [
{
"docstring": "Return a list of User Stats",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "PUBLISH COMMENT",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008444 | Implement the Python class `ApiStatistics` described below.
Class description:
Statistics API
Method signatures and docstrings:
- def get(self, request, format=None): Return a list of User Stats
- def post(self, request, format=None): PUBLISH COMMENT | Implement the Python class `ApiStatistics` described below.
Class description:
Statistics API
Method signatures and docstrings:
- def get(self, request, format=None): Return a list of User Stats
- def post(self, request, format=None): PUBLISH COMMENT
<|skeleton|>
class ApiStatistics:
"""Statistics API"""
de... | fc1de65cf3420e06c6e3b6ba0d00bc29ffde6fbe | <|skeleton|>
class ApiStatistics:
"""Statistics API"""
def get(self, request, format=None):
"""Return a list of User Stats"""
<|body_0|>
def post(self, request, format=None):
"""PUBLISH COMMENT"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiStatistics:
"""Statistics API"""
def get(self, request, format=None):
"""Return a list of User Stats"""
print('ApiStatistics . GET . 1')
print('ApiStatistics . GET . 1 . request = {0}'.format(request))
print('ApiStatistics . GET . 1 . request.GET = {0}'.format(request.G... | the_stack_v2_python_sparse | papr_be/api/api_statistics/views_api_statistics.py | jebudas/papr_be-1 | train | 0 |
a8fd8388eb5c14ea67d0fab815be2483836985ff | [
"self.aDJM = aDJM\nself.order = len(aDJM)\nself.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)]",
"result = []\nfor v in vs:\n if v.label == self.no_labeling_num:\n result.append(v)\nreturn result",
"label = 0\nv = self.vs[0]\nv.label = label\nif v.adjacentVs() == []:\n ... | <|body_start_0|>
self.aDJM = aDJM
self.order = len(aDJM)
self.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)]
<|end_body_0|>
<|body_start_1|>
result = []
for v in vs:
if v.label == self.no_labeling_num:
result.append(v)
... | Graph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def __init__(self, aDJM):
""":param aDJM:隣接行列"""
<|body_0|>
def no_labelingVs(self, vs):
"""渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:"""
<|body_1|>
def isconnected(self):
"""このグラフが連結グラフであるかどうかを判定する :return:"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus_train_068881 | 4,624 | permissive | [
{
"docstring": ":param aDJM:隣接行列",
"name": "__init__",
"signature": "def __init__(self, aDJM)"
},
{
"docstring": "渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:",
"name": "no_labelingVs",
"signature": "def no_labelingVs(self, vs)"
},
{
"docstring": "このグラフが連結グラフであるかどうかを判定する :return... | 3 | stack_v2_sparse_classes_30k_train_041766 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, aDJM): :param aDJM:隣接行列
- def no_labelingVs(self, vs): 渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:
- def isconnected(self): このグラフが連結グラフであるかどうかを判定する :return: | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, aDJM): :param aDJM:隣接行列
- def no_labelingVs(self, vs): 渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:
- def isconnected(self): このグラフが連結グラフであるかどうかを判定する :return:
<|ske... | 50f6d5c92a01792552c31ac912ce1cd557b06fb0 | <|skeleton|>
class Graph:
def __init__(self, aDJM):
""":param aDJM:隣接行列"""
<|body_0|>
def no_labelingVs(self, vs):
"""渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:"""
<|body_1|>
def isconnected(self):
"""このグラフが連結グラフであるかどうかを判定する :return:"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Graph:
def __init__(self, aDJM):
""":param aDJM:隣接行列"""
self.aDJM = aDJM
self.order = len(aDJM)
self.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)]
def no_labelingVs(self, vs):
"""渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:"""
... | the_stack_v2_python_sparse | airoiro/iro4.py | yosho-18/AtCoder | train | 0 | |
8ced66a5eeeccd440a2755785013acdc5201f45b | [
"self.nprocs = numpy.array(nprocs)\nself.series_list = self.get_series(directories, descriptions)\nself.description = description",
"series_list = []\nfor i, directory in enumerate(directories):\n series_list.append(Series(directory, self.nprocs, description=None if not descriptions else descriptions[i]))\nret... | <|body_start_0|>
self.nprocs = numpy.array(nprocs)
self.series_list = self.get_series(directories, descriptions)
self.description = description
<|end_body_0|>
<|body_start_1|>
series_list = []
for i, directory in enumerate(directories):
series_list.append(Series(dire... | GroupSeries | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupSeries:
def __init__(self, directories, nprocs, descriptions=None, description='no description'):
"""Registers of group of Series. Parameters ---------- directories: list of strings Directory of each series to consider. nprocs: list of integers Number of processes used for each simu... | stack_v2_sparse_classes_75kplus_train_068882 | 17,403 | permissive | [
{
"docstring": "Registers of group of Series. Parameters ---------- directories: list of strings Directory of each series to consider. nprocs: list of integers Number of processes used for each simulation of a series. descriptions: list of strings, optional Description of each series; default: None. description... | 3 | stack_v2_sparse_classes_30k_train_053773 | Implement the Python class `GroupSeries` described below.
Class description:
Implement the GroupSeries class.
Method signatures and docstrings:
- def __init__(self, directories, nprocs, descriptions=None, description='no description'): Registers of group of Series. Parameters ---------- directories: list of strings D... | Implement the Python class `GroupSeries` described below.
Class description:
Implement the GroupSeries class.
Method signatures and docstrings:
- def __init__(self, directories, nprocs, descriptions=None, description='no description'): Registers of group of Series. Parameters ---------- directories: list of strings D... | 091524e680e313878f7a1444df4bd42dedb5f615 | <|skeleton|>
class GroupSeries:
def __init__(self, directories, nprocs, descriptions=None, description='no description'):
"""Registers of group of Series. Parameters ---------- directories: list of strings Directory of each series to consider. nprocs: list of integers Number of processes used for each simu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupSeries:
def __init__(self, directories, nprocs, descriptions=None, description='no description'):
"""Registers of group of Series. Parameters ---------- directories: list of strings Directory of each series to consider. nprocs: list of integers Number of processes used for each simulation of a se... | the_stack_v2_python_sparse | snake/petibm/logSummaryReader.py | mesnardo/snake | train | 3 | |
ed2b359a78c6163bd99601c5339ba90c1c742142 | [
"if not email:\n raise ValueError(_('The Email must be set'))\nemail = self.normalize_email(email)\nuser = self.model(email=email, first_name=first_name, last_name=last_name, gender=gender, sport=sport, state=state, age=age, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user",
"extra_fields... | <|body_start_0|>
if not email:
raise ValueError(_('The Email must be set'))
email = self.normalize_email(email)
user = self.model(email=email, first_name=first_name, last_name=last_name, gender=gender, sport=sport, state=state, age=age, **extra_fields)
user.set_password(passw... | Custom user model manager where email is the unique identifiers for authentication instead of usernames. | CustomUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomUserManager:
"""Custom user model manager where email is the unique identifiers for authentication instead of usernames."""
def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **extra_fields):
"""Create and save a User with the given email, ... | stack_v2_sparse_classes_75kplus_train_068883 | 7,737 | no_license | [
{
"docstring": "Create and save a User with the given email, password and given details",
"name": "create_user",
"signature": "def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **extra_fields)"
},
{
"docstring": "Create and save a SuperUser with the given e... | 2 | null | Implement the Python class `CustomUserManager` described below.
Class description:
Custom user model manager where email is the unique identifiers for authentication instead of usernames.
Method signatures and docstrings:
- def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **ext... | Implement the Python class `CustomUserManager` described below.
Class description:
Custom user model manager where email is the unique identifiers for authentication instead of usernames.
Method signatures and docstrings:
- def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **ext... | ca869a18e31939c4ca3e8573e1834e283e25a097 | <|skeleton|>
class CustomUserManager:
"""Custom user model manager where email is the unique identifiers for authentication instead of usernames."""
def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **extra_fields):
"""Create and save a User with the given email, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomUserManager:
"""Custom user model manager where email is the unique identifiers for authentication instead of usernames."""
def create_user(self, email, first_name, last_name, gender, age, sport, state, password, **extra_fields):
"""Create and save a User with the given email, password and ... | the_stack_v2_python_sparse | verification/models.py | spiderxm/sports_app | train | 20 |
e4e0d0cbdd1cb405f32d798e7eb51e9d4727b7e8 | [
"super().__init__(**kwargs)\nif not test:\n LibLustreApi.init_once()\nself.abspath = abspath\nself.mode = int(mode, 8)\nself.uid = uid\nself.gid = gid\nself.size = size\nself.mtime = CTimespec(int(mtime), 0)\nself.hsmimport = HSMImport(abspath=self.abspath, mode=self.mode, uid=self.uid, gid=self.gid, size=self.s... | <|body_start_0|>
super().__init__(**kwargs)
if not test:
LibLustreApi.init_once()
self.abspath = abspath
self.mode = int(mode, 8)
self.uid = uid
self.gid = gid
self.size = size
self.mtime = CTimespec(int(mtime), 0)
self.hsmimport = HSMI... | Test application to import a single file. | HSMImportFile | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HSMImportFile:
"""Test application to import a single file."""
def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs):
"""Constructor."""
<|body_0|>
def main_add_pa... | stack_v2_sparse_classes_75kplus_train_068884 | 5,200 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs)"
},
{
"docstring": "Inherited from Application class. Add parser args... | 3 | stack_v2_sparse_classes_30k_train_039357 | Implement the Python class `HSMImportFile` described below.
Class description:
Test application to import a single file.
Method signatures and docstrings:
- def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs)... | Implement the Python class `HSMImportFile` described below.
Class description:
Test application to import a single file.
Method signatures and docstrings:
- def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs)... | e56a9d20aea2b51b70bae52113e60e28b43440c8 | <|skeleton|>
class HSMImportFile:
"""Test application to import a single file."""
def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs):
"""Constructor."""
<|body_0|>
def main_add_pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HSMImportFile:
"""Test application to import a single file."""
def __init__(self, abspath, mode=oct(HSMDefaults.MODE), uid=HSMDefaults.UID, gid=HSMDefaults.GID, size=HSMDefaults.SIZE, mtime=time.time(), test=False, **kwargs):
"""Constructor."""
super().__init__(**kwargs)
if not te... | the_stack_v2_python_sparse | laaso/hsmimport.py | standardgalactic/amlFilesystem-hydrator | train | 0 |
f291c6a9acc67ff2db4467b2d085399de415edb8 | [
"args = reqparse.RequestParser().add_argument('school_id', type=int, location='args', required=True, help='学校id不能为空').parse_args()\nconfig = {'status': Shop_Config(school_id=args['school_id']).status, 'status_remark': Shop_Config(school_id=args['school_id']).status_remark}\nreturn Response(data=config)",
"args = ... | <|body_start_0|>
args = reqparse.RequestParser().add_argument('school_id', type=int, location='args', required=True, help='学校id不能为空').parse_args()
config = {'status': Shop_Config(school_id=args['school_id']).status, 'status_remark': Shop_Config(school_id=args['school_id']).status_remark}
return ... | Status | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Status:
def get(self):
"""获取学校状态 :return:"""
<|body_0|>
def put(self):
"""设置学校状态 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
args = reqparse.RequestParser().add_argument('school_id', type=int, location='args', required=True, help='学校id不... | stack_v2_sparse_classes_75kplus_train_068885 | 5,904 | no_license | [
{
"docstring": "获取学校状态 :return:",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "设置学校状态 :return:",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019722 | Implement the Python class `Status` described below.
Class description:
Implement the Status class.
Method signatures and docstrings:
- def get(self): 获取学校状态 :return:
- def put(self): 设置学校状态 :return: | Implement the Python class `Status` described below.
Class description:
Implement the Status class.
Method signatures and docstrings:
- def get(self): 获取学校状态 :return:
- def put(self): 设置学校状态 :return:
<|skeleton|>
class Status:
def get(self):
"""获取学校状态 :return:"""
<|body_0|>
def put(self):
... | 34a2bf4a51cc40a22dd43cb5eb88af7c2f2c5120 | <|skeleton|>
class Status:
def get(self):
"""获取学校状态 :return:"""
<|body_0|>
def put(self):
"""设置学校状态 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Status:
def get(self):
"""获取学校状态 :return:"""
args = reqparse.RequestParser().add_argument('school_id', type=int, location='args', required=True, help='学校id不能为空').parse_args()
config = {'status': Shop_Config(school_id=args['school_id']).status, 'status_remark': Shop_Config(school_id=arg... | the_stack_v2_python_sparse | App/Shop/Controller/SchoolResource.py | Vulcanhy/api.grooo-master | train | 0 | |
191b9e21b7f3847c70459f2e0de20b290836713e | [
"_url_path = '/v1.1/login'\n_query_builder = Configuration.get_base_uri()\n_query_builder += _url_path\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json', 'content-type': 'application/json; charset=utf-8'}\n_request = self.http_client.post(_query_url, headers=_headers, param... | <|body_start_0|>
_url_path = '/v1.1/login'
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
_headers = {'accept': 'application/json', 'content-type': 'application/json; charset=utf-8'}
_request = se... | A Controller to access Endpoints in the bouncerapi API. | UsersLoginRegistrationController | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsersLoginRegistrationController:
"""A Controller to access Endpoints in the bouncerapi API."""
def login_to_bouncer_api(self, body):
"""Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (LoginToBouncerAPIRequest): TODO: type description here. Exam... | stack_v2_sparse_classes_75kplus_train_068886 | 4,169 | permissive | [
{
"docstring": "Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (LoginToBouncerAPIRequest): TODO: type description here. Example: Returns: LoginToBouncerAPIResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote AP... | 2 | stack_v2_sparse_classes_30k_train_031506 | Implement the Python class `UsersLoginRegistrationController` described below.
Class description:
A Controller to access Endpoints in the bouncerapi API.
Method signatures and docstrings:
- def login_to_bouncer_api(self, body): Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (Log... | Implement the Python class `UsersLoginRegistrationController` described below.
Class description:
A Controller to access Endpoints in the bouncerapi API.
Method signatures and docstrings:
- def login_to_bouncer_api(self, body): Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (Log... | a178244dbf0b8a165aabc02a5d1ba05006f9ec22 | <|skeleton|>
class UsersLoginRegistrationController:
"""A Controller to access Endpoints in the bouncerapi API."""
def login_to_bouncer_api(self, body):
"""Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (LoginToBouncerAPIRequest): TODO: type description here. Exam... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UsersLoginRegistrationController:
"""A Controller to access Endpoints in the bouncerapi API."""
def login_to_bouncer_api(self, body):
"""Does a POST request to /v1.1/login. Authenticate to this Bouncer instance. Args: body (LoginToBouncerAPIRequest): TODO: type description here. Example: Returns:... | the_stack_v2_python_sparse | sdk/python/bouncerapi/controllers/users_login_registration_controller.py | nmfta-repo/nmfta-bouncer | train | 1 |
bc4e8379c4714b82b0b04c2cec8eed23b0daf369 | [
"step_names = subcomponents[self.name]\nnodes = [subcomponents[step] for step in step_names]\nself.branchify(nodes=nodes)\nreturn self",
"if len(self.contents) > 1 and project.parallelize:\n project = self._implement_in_parallel(project=project, **kwargs)\nelse:\n project = self._implement_in_serial(project... | <|body_start_0|>
step_names = subcomponents[self.name]
nodes = [subcomponents[step] for step in step_names]
self.branchify(nodes=nodes)
return self
<|end_body_0|>
<|body_start_1|>
if len(self.contents) > 1 and project.parallelize:
project = self._implement_in_paralle... | Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' should match the appropriate section name in a Settings instance. Defaults ... | Manager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Manager:
"""Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' should match the appropriate section nam... | stack_v2_sparse_classes_75kplus_train_068887 | 43,953 | permissive | [
{
"docstring": "[summary] Args: subcomponents (Dict[str, List[str]]): [description]",
"name": "organize",
"signature": "def organize(self, subcomponents: Dict[str, List[str]]) -> None"
},
{
"docstring": "Applies 'contents' to 'project'. Args: project (amicus.Project): instance from which data ne... | 3 | stack_v2_sparse_classes_30k_train_019365 | Implement the Python class `Manager` described below.
Class description:
Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' s... | Implement the Python class `Manager` described below.
Class description:
Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' s... | 0de6d90c34b8402f4464dcba784349514b3b8e42 | <|skeleton|>
class Manager:
"""Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' should match the appropriate section nam... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Manager:
"""Base class for branching and parallel Workers. Args: name (str): designates the name of a class instance that is used for internal referencing throughout amicus. For example, if an amicus instance needs settings from a Settings instance, 'name' should match the appropriate section name in a Settin... | the_stack_v2_python_sparse | amicus/project/nodes.py | WithPrecedent/amicus | train | 1 |
c9e9de04bf7de53ae1e655e6eaef9934e20bfc40 | [
"l = len(triangle)\nws = [len(i) for i in triangle]\nmemo = {}\n\ndef f(x, y):\n if (x, y) in memo:\n return memo[x, y]\n if x >= l or y >= ws[x]:\n memo[x, y] = 0\n return 0\n memo[x, y] = triangle[x][y] + min(f(x + 1, y), f(x + 1, y + 1))\n return memo[x, y]\nreturn f(0, 0)",
"l... | <|body_start_0|>
l = len(triangle)
ws = [len(i) for i in triangle]
memo = {}
def f(x, y):
if (x, y) in memo:
return memo[x, y]
if x >= l or y >= ws[x]:
memo[x, y] = 0
return 0
memo[x, y] = triangle[x][y]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumTotalRecursive(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def minimumTotalDP(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotalDPCompress(self, triangle):... | stack_v2_sparse_classes_75kplus_train_068888 | 2,092 | no_license | [
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "minimumTotalRecursive",
"signature": "def minimumTotalRecursive(self, triangle)"
},
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "minimumTotalDP",
"signature": "def minimumTotalDP(self, triang... | 4 | stack_v2_sparse_classes_30k_test_002813 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumTotalRecursive(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTotalDP(self, triangle): :type triangle: List[List[int]] :rtype: int
- def min... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumTotalRecursive(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTotalDP(self, triangle): :type triangle: List[List[int]] :rtype: int
- def min... | fabe435f366477ec3526add84accec0b4ac38919 | <|skeleton|>
class Solution:
def minimumTotalRecursive(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def minimumTotalDP(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotalDPCompress(self, triangle):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minimumTotalRecursive(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
l = len(triangle)
ws = [len(i) for i in triangle]
memo = {}
def f(x, y):
if (x, y) in memo:
return memo[x, y]
if x >= l or y >... | the_stack_v2_python_sparse | algorithm/leetcode/150_triangle.py | icejoywoo/toys | train | 1 | |
32782efa9947842511be3bc886cf221e7372ca55 | [
"json_dict = json.loads(request.body.decode())\nsku_id = json_dict.get('sku_id')\ntry:\n SKU.objects.get(id=sku_id)\nexcept SKU.DoesNotExist:\n return http.HttpResponseForbidden('sku不存在')\nredis_conn = get_redis_connection('history')\npl = redis_conn.pipeline()\nuser_id = request.user.id\npl.lrem('history_{}'... | <|body_start_0|>
json_dict = json.loads(request.body.decode())
sku_id = json_dict.get('sku_id')
try:
SKU.objects.get(id=sku_id)
except SKU.DoesNotExist:
return http.HttpResponseForbidden('sku不存在')
redis_conn = get_redis_connection('history')
pl = r... | 用户浏览记录 | UserBrowseHistory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def post(self, request):
"""保存用户浏览记录"""
<|body_0|>
def get(self, request):
"""获取用户浏览记录"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
json_dict = json.loads(request.body.decode())
sku_id = json_dict.get('... | stack_v2_sparse_classes_75kplus_train_068889 | 26,474 | no_license | [
{
"docstring": "保存用户浏览记录",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "获取用户浏览记录",
"name": "get",
"signature": "def get(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047746 | Implement the Python class `UserBrowseHistory` described below.
Class description:
用户浏览记录
Method signatures and docstrings:
- def post(self, request): 保存用户浏览记录
- def get(self, request): 获取用户浏览记录 | Implement the Python class `UserBrowseHistory` described below.
Class description:
用户浏览记录
Method signatures and docstrings:
- def post(self, request): 保存用户浏览记录
- def get(self, request): 获取用户浏览记录
<|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def post(self, request):
"""保存用户浏览记录"""
<|body... | e3976cbb9e96a1558f4e00abed1c61d887f915b1 | <|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def post(self, request):
"""保存用户浏览记录"""
<|body_0|>
def get(self, request):
"""获取用户浏览记录"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserBrowseHistory:
"""用户浏览记录"""
def post(self, request):
"""保存用户浏览记录"""
json_dict = json.loads(request.body.decode())
sku_id = json_dict.get('sku_id')
try:
SKU.objects.get(id=sku_id)
except SKU.DoesNotExist:
return http.HttpResponseForbidden... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/users/views.py | yi0506/meiduo | train | 0 |
8d74211a93a897cb91c7b74138170917e9240673 | [
"if BusSingleton.__instance__ is None:\n BusSingleton.__instance__ = bootstrap.bootstrap()\nelse:\n raise Exception('You cannot create another BusSingleton class')",
"if not BusSingleton.__instance__:\n BusSingleton()\nreturn BusSingleton.__instance__"
] | <|body_start_0|>
if BusSingleton.__instance__ is None:
BusSingleton.__instance__ = bootstrap.bootstrap()
else:
raise Exception('You cannot create another BusSingleton class')
<|end_body_0|>
<|body_start_1|>
if not BusSingleton.__instance__:
BusSingleton()
... | BusSingleton | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BusSingleton:
def __init__(self):
"""Constructor."""
<|body_0|>
def get_instance():
"""Static method to fetch the current instance."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if BusSingleton.__instance__ is None:
BusSingleton.__inst... | stack_v2_sparse_classes_75kplus_train_068890 | 545 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Static method to fetch the current instance.",
"name": "get_instance",
"signature": "def get_instance()"
}
] | 2 | stack_v2_sparse_classes_30k_train_026299 | Implement the Python class `BusSingleton` described below.
Class description:
Implement the BusSingleton class.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def get_instance(): Static method to fetch the current instance. | Implement the Python class `BusSingleton` described below.
Class description:
Implement the BusSingleton class.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def get_instance(): Static method to fetch the current instance.
<|skeleton|>
class BusSingleton:
def __init__(self):
"""... | 1f7f98953a46eb490a5fe8b427371d343f8b0bf6 | <|skeleton|>
class BusSingleton:
def __init__(self):
"""Constructor."""
<|body_0|>
def get_instance():
"""Static method to fetch the current instance."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BusSingleton:
def __init__(self):
"""Constructor."""
if BusSingleton.__instance__ is None:
BusSingleton.__instance__ = bootstrap.bootstrap()
else:
raise Exception('You cannot create another BusSingleton class')
def get_instance():
"""Static method t... | the_stack_v2_python_sparse | src/user-management/utils/bus_singleton.py | asamehinmobly/User-Management | train | 0 | |
c9a16030b0037a99318feea30e03d63da1cbee9b | [
"cantidad = request.args.get('cantidad')\npagina = request.args.get('pagina')\nultimos_dias_a_obtener = request.args.get('ultimos_dias_a_obtener')\ntry:\n if cantidad is not None and pagina is not None and (ultimos_dias_a_obtener is not None):\n cantidad = int(cantidad)\n pagina = int(pagina)\n ... | <|body_start_0|>
cantidad = request.args.get('cantidad')
pagina = request.args.get('pagina')
ultimos_dias_a_obtener = request.args.get('ultimos_dias_a_obtener')
try:
if cantidad is not None and pagina is not None and (ultimos_dias_a_obtener is not None):
canti... | HistorialCancionControlador | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistorialCancionControlador:
def get(self, usuario_actual):
"""Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :param usuario_actual: El usuario logeado :return: Una lista de diccionarios y un codigo de estado"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_068891 | 2,449 | no_license | [
{
"docstring": "Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :param usuario_actual: El usuario logeado :return: Una lista de diccionarios y un codigo de estado",
"name": "get",
"signature": "def get(self, usuario_actual)"
},
{
"docstring... | 2 | null | Implement the Python class `HistorialCancionControlador` described below.
Class description:
Implement the HistorialCancionControlador class.
Method signatures and docstrings:
- def get(self, usuario_actual): Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :para... | Implement the Python class `HistorialCancionControlador` described below.
Class description:
Implement the HistorialCancionControlador class.
Method signatures and docstrings:
- def get(self, usuario_actual): Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :para... | 49bbaaf0bd4d1bec2d81eb35882e5f073b1c149f | <|skeleton|>
class HistorialCancionControlador:
def get(self, usuario_actual):
"""Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :param usuario_actual: El usuario logeado :return: Una lista de diccionarios y un codigo de estado"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HistorialCancionControlador:
def get(self, usuario_actual):
"""Se encarga de procesar una solicitud GET al devolver las canciones que ha reproducido el usuario actual :param usuario_actual: El usuario logeado :return: Una lista de diccionarios y un codigo de estado"""
cantidad = request.args.g... | the_stack_v2_python_sparse | app/administracion_de_contenido/controlador/v1/HistorialControlador.py | codeChinoUV/EspotifeiAPI | train | 0 | |
7a3003be9c0008659caec22411e0539486fde7e3 | [
"redis_conn = get_redis_connection('history')\nsku_ids = redis_conn.lrange('history_%s' % request.user.id, 0, -1)\nskus = []\nfor sku_id in sku_ids:\n sku = SKU.objects.get(id=sku_id)\n skus.append({'id': sku.id, 'name': sku.name, 'default_image_url': sku.default_image_url, 'price': sku.price})\nreturn JsonRe... | <|body_start_0|>
redis_conn = get_redis_connection('history')
sku_ids = redis_conn.lrange('history_%s' % request.user.id, 0, -1)
skus = []
for sku_id in sku_ids:
sku = SKU.objects.get(id=sku_id)
skus.append({'id': sku.id, 'name': sku.name, 'default_image_url': sku... | 用户浏览记录 | UserBrowseHistory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def get(self, request):
"""获取用户浏览记录"""
<|body_0|>
def post(self, request):
"""保存用户浏览记录"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
redis_conn = get_redis_connection('history')
sku_ids = redis_conn.lran... | stack_v2_sparse_classes_75kplus_train_068892 | 22,804 | permissive | [
{
"docstring": "获取用户浏览记录",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "保存用户浏览记录",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007848 | Implement the Python class `UserBrowseHistory` described below.
Class description:
用户浏览记录
Method signatures and docstrings:
- def get(self, request): 获取用户浏览记录
- def post(self, request): 保存用户浏览记录 | Implement the Python class `UserBrowseHistory` described below.
Class description:
用户浏览记录
Method signatures and docstrings:
- def get(self, request): 获取用户浏览记录
- def post(self, request): 保存用户浏览记录
<|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def get(self, request):
"""获取用户浏览记录"""
<|body_... | adf41e6fcff081e054f547dc6570c421d2c844c2 | <|skeleton|>
class UserBrowseHistory:
"""用户浏览记录"""
def get(self, request):
"""获取用户浏览记录"""
<|body_0|>
def post(self, request):
"""保存用户浏览记录"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserBrowseHistory:
"""用户浏览记录"""
def get(self, request):
"""获取用户浏览记录"""
redis_conn = get_redis_connection('history')
sku_ids = redis_conn.lrange('history_%s' % request.user.id, 0, -1)
skus = []
for sku_id in sku_ids:
sku = SKU.objects.get(id=sku_id)
... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/users/views.py | Gdavid123/md_project | train | 0 |
b857476639ef0ac8ca0491a37d66847f879f9549 | [
"super(Encoder, self).__init__()\nself.layers = clone(layer, n_layers)\nself.norm = LayerNormalization(layer.size)",
"for i, layer in enumerate(self.layers):\n if verbose:\n print('Going into layer {}'.format(i + 1))\n src = layer(src, mask)\nreturn self.norm(src)"
] | <|body_start_0|>
super(Encoder, self).__init__()
self.layers = clone(layer, n_layers)
self.norm = LayerNormalization(layer.size)
<|end_body_0|>
<|body_start_1|>
for i, layer in enumerate(self.layers):
if verbose:
print('Going into layer {}'.format(i + 1))
... | Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers. | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers."""
def __init__(self, layer: nn.Module, n_layers: int):
"""Constructor for the global Encoder. :param layer: layer type to use. :param n_layers: Number of layers to use."... | stack_v2_sparse_classes_75kplus_train_068893 | 3,499 | no_license | [
{
"docstring": "Constructor for the global Encoder. :param layer: layer type to use. :param n_layers: Number of layers to use.",
"name": "__init__",
"signature": "def __init__(self, layer: nn.Module, n_layers: int)"
},
{
"docstring": "Implements the forward pass: relays the output of layer `i` t... | 2 | stack_v2_sparse_classes_30k_val_002085 | Implement the Python class `Encoder` described below.
Class description:
Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers.
Method signatures and docstrings:
- def __init__(self, layer: nn.Module, n_layers: int): Constructor for the global Encoder. :param layer: laye... | Implement the Python class `Encoder` described below.
Class description:
Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers.
Method signatures and docstrings:
- def __init__(self, layer: nn.Module, n_layers: int): Constructor for the global Encoder. :param layer: laye... | 6be6d8d181457a9306b751de4c92b9ae844cdda0 | <|skeleton|>
class Encoder:
"""Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers."""
def __init__(self, layer: nn.Module, n_layers: int):
"""Constructor for the global Encoder. :param layer: layer type to use. :param n_layers: Number of layers to use."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""Implementation of the Encoder of the Transformer model. Constituted of a stack of N identical layers."""
def __init__(self, layer: nn.Module, n_layers: int):
"""Constructor for the global Encoder. :param layer: layer type to use. :param n_layers: Number of layers to use."""
su... | the_stack_v2_python_sparse | transformer/encoder.py | AlexisDrch/Transformer | train | 2 |
101d6f89dee488d6fe8cdbc642de6ca149f0f1dd | [
"def _create_char_arrmap(string: str) -> List:\n num_chars = ord('z') - ord('a')\n map_arr = [0 for i in range(num_chars + 1)]\n for char in string:\n map_arr[ord(char) - ord('a')] += 1\n return map_arr\n\ndef _get_index(char_id: int) -> int:\n idx = char_id - ord('a')\n return idx\ngot_odd... | <|body_start_0|>
def _create_char_arrmap(string: str) -> List:
num_chars = ord('z') - ord('a')
map_arr = [0 for i in range(num_chars + 1)]
for char in string:
map_arr[ord(char) - ord('a')] += 1
return map_arr
def _get_index(char_id: int) -... | There can be only one char in the string with odd frequency for it to be palindrome | PalinChecker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PalinChecker:
"""There can be only one char in the string with odd frequency for it to be palindrome"""
def check(self, string: str) -> bool:
"""Uses a array as map"""
<|body_0|>
def check2(self, string: str) -> bool:
"""Uses a dict to map"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_068894 | 2,441 | permissive | [
{
"docstring": "Uses a array as map",
"name": "check",
"signature": "def check(self, string: str) -> bool"
},
{
"docstring": "Uses a dict to map",
"name": "check2",
"signature": "def check2(self, string: str) -> bool"
},
{
"docstring": "Some optimzation",
"name": "check3",
... | 3 | stack_v2_sparse_classes_30k_train_035118 | Implement the Python class `PalinChecker` described below.
Class description:
There can be only one char in the string with odd frequency for it to be palindrome
Method signatures and docstrings:
- def check(self, string: str) -> bool: Uses a array as map
- def check2(self, string: str) -> bool: Uses a dict to map
- ... | Implement the Python class `PalinChecker` described below.
Class description:
There can be only one char in the string with odd frequency for it to be palindrome
Method signatures and docstrings:
- def check(self, string: str) -> bool: Uses a array as map
- def check2(self, string: str) -> bool: Uses a dict to map
- ... | bf3098dbeb502cab2e22ce7ea73c2aa05a3caf80 | <|skeleton|>
class PalinChecker:
"""There can be only one char in the string with odd frequency for it to be palindrome"""
def check(self, string: str) -> bool:
"""Uses a array as map"""
<|body_0|>
def check2(self, string: str) -> bool:
"""Uses a dict to map"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PalinChecker:
"""There can be only one char in the string with odd frequency for it to be palindrome"""
def check(self, string: str) -> bool:
"""Uses a array as map"""
def _create_char_arrmap(string: str) -> List:
num_chars = ord('z') - ord('a')
map_arr = [0 for i ... | the_stack_v2_python_sparse | arrays_and_strings/palin_permutation.py | cozek/code-practice | train | 0 |
00b06d626e8768b4cda841a2f036170728b9f491 | [
"from openedx.core.djangoapps.credit.api.eligibility import is_credit_course\ncourse_key = _get_course_key(course_key_or_id)\nreturn is_credit_course(course_key)",
"from openedx.core.djangoapps.credit.api.eligibility import is_credit_course, get_credit_requirement_status\ntry:\n user = User.objects.select_rela... | <|body_start_0|>
from openedx.core.djangoapps.credit.api.eligibility import is_credit_course
course_key = _get_course_key(course_key_or_id)
return is_credit_course(course_key)
<|end_body_0|>
<|body_start_1|>
from openedx.core.djangoapps.credit.api.eligibility import is_credit_course, ge... | Course Credit XBlock service | CreditService | [
"MIT",
"AGPL-3.0-only",
"AGPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreditService:
"""Course Credit XBlock service"""
def is_credit_course(self, course_key_or_id):
"""Returns boolean if the passed in course_id (string) or course_key is a credit_course"""
<|body_0|>
def get_credit_state(self, user_id, course_key_or_id, return_course_info=... | stack_v2_sparse_classes_75kplus_train_068895 | 7,489 | permissive | [
{
"docstring": "Returns boolean if the passed in course_id (string) or course_key is a credit_course",
"name": "is_credit_course",
"signature": "def is_credit_course(self, course_key_or_id)"
},
{
"docstring": "Return all information about the user's credit state inside of a given course. ARGS: -... | 4 | null | Implement the Python class `CreditService` described below.
Class description:
Course Credit XBlock service
Method signatures and docstrings:
- def is_credit_course(self, course_key_or_id): Returns boolean if the passed in course_id (string) or course_key is a credit_course
- def get_credit_state(self, user_id, cours... | Implement the Python class `CreditService` described below.
Class description:
Course Credit XBlock service
Method signatures and docstrings:
- def is_credit_course(self, course_key_or_id): Returns boolean if the passed in course_id (string) or course_key is a credit_course
- def get_credit_state(self, user_id, cours... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class CreditService:
"""Course Credit XBlock service"""
def is_credit_course(self, course_key_or_id):
"""Returns boolean if the passed in course_id (string) or course_key is a credit_course"""
<|body_0|>
def get_credit_state(self, user_id, course_key_or_id, return_course_info=... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreditService:
"""Course Credit XBlock service"""
def is_credit_course(self, course_key_or_id):
"""Returns boolean if the passed in course_id (string) or course_key is a credit_course"""
from openedx.core.djangoapps.credit.api.eligibility import is_credit_course
course_key = _get_... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/credit/services.py | luque/better-ways-of-thinking-about-software | train | 3 |
848925bbf296e78bdf4005d59e7b43854e9d837c | [
"super(AboutDialog, self).__init__(parent)\nself.SetTitle(_('About'))\nself.m_bitmap = wx.StaticBitmap(self.m_about_panel, wx.ID_ANY, rum_64.GetBitmap(), wx.DefaultPosition, wx.Size(64, 64), 0)\nself.m_app_label.SetLabel(version.app)\nself.m_version_label.SetLabel(_('Version: %s %s') % (version.version, version.sta... | <|body_start_0|>
super(AboutDialog, self).__init__(parent)
self.SetTitle(_('About'))
self.m_bitmap = wx.StaticBitmap(self.m_about_panel, wx.ID_ANY, rum_64.GetBitmap(), wx.DefaultPosition, wx.Size(64, 64), 0)
self.m_app_label.SetLabel(version.app)
self.m_version_label.SetLabel(_('... | AboutDialog | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AboutDialog:
def __init__(self, parent):
"""Initialize the AboutDialog object"""
<|body_0|>
def on_toggle(self, event):
"""Show\\hide contact info on when contact button is toggled"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(AboutDialog, s... | stack_v2_sparse_classes_75kplus_train_068896 | 2,424 | permissive | [
{
"docstring": "Initialize the AboutDialog object",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Show\\\\hide contact info on when contact button is toggled",
"name": "on_toggle",
"signature": "def on_toggle(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027912 | Implement the Python class `AboutDialog` described below.
Class description:
Implement the AboutDialog class.
Method signatures and docstrings:
- def __init__(self, parent): Initialize the AboutDialog object
- def on_toggle(self, event): Show\\hide contact info on when contact button is toggled | Implement the Python class `AboutDialog` described below.
Class description:
Implement the AboutDialog class.
Method signatures and docstrings:
- def __init__(self, parent): Initialize the AboutDialog object
- def on_toggle(self, event): Show\\hide contact info on when contact button is toggled
<|skeleton|>
class Ab... | 860c0ad79df78fdc92984970cb88cb4b671ce4e5 | <|skeleton|>
class AboutDialog:
def __init__(self, parent):
"""Initialize the AboutDialog object"""
<|body_0|>
def on_toggle(self, event):
"""Show\\hide contact info on when contact button is toggled"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AboutDialog:
def __init__(self, parent):
"""Initialize the AboutDialog object"""
super(AboutDialog, self).__init__(parent)
self.SetTitle(_('About'))
self.m_bitmap = wx.StaticBitmap(self.m_about_panel, wx.ID_ANY, rum_64.GetBitmap(), wx.DefaultPosition, wx.Size(64, 64), 0)
... | the_stack_v2_python_sparse | _gui/about_dialog.py | alrusdi/Rummage | train | 0 | |
991ae1e64d7a1b0740730eefb16d9db97e5dbdc7 | [
"params = get_params(locals())\nraw_result = await self.api_request('checkPhone', params)\nif return_raw_response:\n return raw_result\nresult = BaseOkResponse(**raw_result)\nreturn result",
"params = get_params(locals())\nraw_result = await self.api_request('restore', params)\nif return_raw_response:\n ret... | <|body_start_0|>
params = get_params(locals())
raw_result = await self.api_request('checkPhone', params)
if return_raw_response:
return raw_result
result = BaseOkResponse(**raw_result)
return result
<|end_body_0|>
<|body_start_1|>
params = get_params(locals()... | Auth | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: typing.Optional[int]=None, client_secret: typing.Optional[str]=None, auth_by_phone: typing.Optional[bool]=None) -> typing.Union[dict, BaseOkResponse]:
""":param phone: - Phone number. :param client_... | stack_v2_sparse_classes_75kplus_train_068897 | 1,501 | permissive | [
{
"docstring": ":param phone: - Phone number. :param client_id: - User ID. :param client_secret: :param auth_by_phone: :param return_raw_response: - return result at dict :return:",
"name": "check_phone",
"signature": "async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: t... | 2 | null | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: typing.Optional[int]=None, client_secret: typing.Optional[str]=None, auth_by_phone: typing.Optional[bo... | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: typing.Optional[int]=None, client_secret: typing.Optional[str]=None, auth_by_phone: typing.Optional[bo... | d88311a680e52faf04f3a18f9c5b381ee9e94a8f | <|skeleton|>
class Auth:
async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: typing.Optional[int]=None, client_secret: typing.Optional[str]=None, auth_by_phone: typing.Optional[bool]=None) -> typing.Union[dict, BaseOkResponse]:
""":param phone: - Phone number. :param client_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Auth:
async def check_phone(self, phone: str, return_raw_response: bool=False, client_id: typing.Optional[int]=None, client_secret: typing.Optional[str]=None, auth_by_phone: typing.Optional[bool]=None) -> typing.Union[dict, BaseOkResponse]:
""":param phone: - Phone number. :param client_id: - User ID.... | the_stack_v2_python_sparse | vkwave/api/methods/auth.py | prog1ckg/vkwave | train | 0 | |
5c85fc922e0059ec27317e1943c1db14c51b2252 | [
"bigger_R = []\nfor i, a in enumerate(A):\n if a > R:\n bigger_R.append(i)\nstart = 0\nsub_range = []\nfor high in bigger_R:\n if high > start:\n sub_range.append((start, high))\n start = high + 1\nif start < len(A):\n sub_range.append((start, len(A)))\nprint(sub_range)\nans = 0\nfor one_r... | <|body_start_0|>
bigger_R = []
for i, a in enumerate(A):
if a > R:
bigger_R.append(i)
start = 0
sub_range = []
for high in bigger_R:
if high > start:
sub_range.append((start, high))
start = high + 1
if st... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSubarrayBoundedMax(self, A, L, R):
""":type A: List[int] :type L: int :type R: int :rtype: int 123ms"""
<|body_0|>
def numSubarrayBoundedMax_1(self, A, L, R):
""":type A: List[int] :type L: int :type R: int :rtype: int 111ms"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus_train_068898 | 2,148 | no_license | [
{
"docstring": ":type A: List[int] :type L: int :type R: int :rtype: int 123ms",
"name": "numSubarrayBoundedMax",
"signature": "def numSubarrayBoundedMax(self, A, L, R)"
},
{
"docstring": ":type A: List[int] :type L: int :type R: int :rtype: int 111ms",
"name": "numSubarrayBoundedMax_1",
... | 2 | stack_v2_sparse_classes_30k_train_024450 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarrayBoundedMax(self, A, L, R): :type A: List[int] :type L: int :type R: int :rtype: int 123ms
- def numSubarrayBoundedMax_1(self, A, L, R): :type A: List[int] :type L:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarrayBoundedMax(self, A, L, R): :type A: List[int] :type L: int :type R: int :rtype: int 123ms
- def numSubarrayBoundedMax_1(self, A, L, R): :type A: List[int] :type L:... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def numSubarrayBoundedMax(self, A, L, R):
""":type A: List[int] :type L: int :type R: int :rtype: int 123ms"""
<|body_0|>
def numSubarrayBoundedMax_1(self, A, L, R):
""":type A: List[int] :type L: int :type R: int :rtype: int 111ms"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSubarrayBoundedMax(self, A, L, R):
""":type A: List[int] :type L: int :type R: int :rtype: int 123ms"""
bigger_R = []
for i, a in enumerate(A):
if a > R:
bigger_R.append(i)
start = 0
sub_range = []
for high in bigger_... | the_stack_v2_python_sparse | NumberOfSubarraysWithBoundedMaximum_MID_795.py | 953250587/leetcode-python | train | 2 | |
46eb234c93b67bcc24e5d9b693190685f12762b6 | [
"self.ps = PastaSauce()\nself.desired_capabilities['name'] = self.id()\nif not LOCAL_RUN:\n self.student = Student(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)\nelse:\n self.student = Student(use_env_vars=True)",
"if not LOCAL_RUN:\n self.ps.update_job(job_id=str(self.st... | <|body_start_0|>
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
if not LOCAL_RUN:
self.student = Student(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
else:
self.student = Student(use_env_vars=True)
<|end_body... | CC1.12 - Delivering Assignments. | TestDeliveringAssignments | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDeliveringAssignments:
"""CC1.12 - Delivering Assignments."""
def setUp(self):
"""Pretest settings."""
<|body_0|>
def tearDown(self):
"""Test destructor."""
<|body_1|>
def test_student_find_the_cc_book_from_an_online_search_7742(self):
""... | stack_v2_sparse_classes_75kplus_train_068899 | 11,532 | no_license | [
{
"docstring": "Pretest settings.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test destructor.",
"name": "tearDown",
"signature": "def tearDown(self)"
},
{
"docstring": "Find the Concept Coach book from an online search. Steps: Search the title of the boo... | 5 | null | Implement the Python class `TestDeliveringAssignments` described below.
Class description:
CC1.12 - Delivering Assignments.
Method signatures and docstrings:
- def setUp(self): Pretest settings.
- def tearDown(self): Test destructor.
- def test_student_find_the_cc_book_from_an_online_search_7742(self): Find the Conce... | Implement the Python class `TestDeliveringAssignments` described below.
Class description:
CC1.12 - Delivering Assignments.
Method signatures and docstrings:
- def setUp(self): Pretest settings.
- def tearDown(self): Test destructor.
- def test_student_find_the_cc_book_from_an_online_search_7742(self): Find the Conce... | 39751799858ac30df90760b8bb753d338e8edc46 | <|skeleton|>
class TestDeliveringAssignments:
"""CC1.12 - Delivering Assignments."""
def setUp(self):
"""Pretest settings."""
<|body_0|>
def tearDown(self):
"""Test destructor."""
<|body_1|>
def test_student_find_the_cc_book_from_an_online_search_7742(self):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDeliveringAssignments:
"""CC1.12 - Delivering Assignments."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
if not LOCAL_RUN:
self.student = Student(use_env_vars=True, pasta_user=self.ps, capab... | the_stack_v2_python_sparse | tutor/OldTests/test_cc1_12_DeliveringAssignments.py.old | openstax/test-automation | train | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.