blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
d4928861fb5d5990736b7a24e35853e177d2d222
[ "section = {'serialNumber': self.serial_number, 'lengthFeet': self.length_feet, 'widthFeet': self.width_feet}\nif self.length_inches:\n section['lengthInches'] = self.length_inches\nif self.width_inches:\n section['widthInches'] = self.width_inches\nreturn section", "section = None\nif section_id:\n sect...
<|body_start_0|> section = {'serialNumber': self.serial_number, 'lengthFeet': self.length_feet, 'widthFeet': self.width_feet} if self.length_inches: section['lengthInches'] = self.length_inches if self.width_inches: section['widthInches'] = self.width_inches retur...
This class manages all of the MH section information.
MhrSection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MhrSection: """This class manages all of the MH section information.""" def json(self) -> dict: """Return the section as a json object.""" <|body_0|> def find_by_id(cls, section_id: int=None): """Return a section object by section ID.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_013200
5,130
permissive
[ { "docstring": "Return the section as a json object.", "name": "json", "signature": "def json(self) -> dict" }, { "docstring": "Return a section object by section ID.", "name": "find_by_id", "signature": "def find_by_id(cls, section_id: int=None)" }, { "docstring": "Return a list...
6
null
Implement the Python class `MhrSection` described below. Class description: This class manages all of the MH section information. Method signatures and docstrings: - def json(self) -> dict: Return the section as a json object. - def find_by_id(cls, section_id: int=None): Return a section object by section ID. - def f...
Implement the Python class `MhrSection` described below. Class description: This class manages all of the MH section information. Method signatures and docstrings: - def json(self) -> dict: Return the section as a json object. - def find_by_id(cls, section_id: int=None): Return a section object by section ID. - def f...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class MhrSection: """This class manages all of the MH section information.""" def json(self) -> dict: """Return the section as a json object.""" <|body_0|> def find_by_id(cls, section_id: int=None): """Return a section object by section ID.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MhrSection: """This class manages all of the MH section information.""" def json(self) -> dict: """Return the section as a json object.""" section = {'serialNumber': self.serial_number, 'lengthFeet': self.length_feet, 'widthFeet': self.width_feet} if self.length_inches: ...
the_stack_v2_python_sparse
mhr_api/src/mhr_api/models/mhr_section.py
bcgov/ppr
train
4
dcc10fed9f7619ff264c9026366aec95116d1125
[ "logs = None\nlogsDao = LogsDao()\ntry:\n logs = logsDao.add(args)\nexcept Exception as e:\n abort(500, e)\nreturn logs", "record = None\nlogsDao = LogsDao()\ntry:\n record = logsDao.edit(args)\nexcept Exception as e:\n abort(500, e)\nreturn record", "record = None\nlogsDao = LogsDao()\nid = args.ge...
<|body_start_0|> logs = None logsDao = LogsDao() try: logs = logsDao.add(args) except Exception as e: abort(500, e) return logs <|end_body_0|> <|body_start_1|> record = None logsDao = LogsDao() try: record = logsDao.edi...
LogsAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogsAPI: def post(self, args): """add""" <|body_0|> def put(self, args): """edit""" <|body_1|> def get(self, args): """view""" <|body_2|> def delete(self, args): """del""" <|body_3|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_013201
5,130
permissive
[ { "docstring": "add", "name": "post", "signature": "def post(self, args)" }, { "docstring": "edit", "name": "put", "signature": "def put(self, args)" }, { "docstring": "view", "name": "get", "signature": "def get(self, args)" }, { "docstring": "del", "name": "...
4
stack_v2_sparse_classes_30k_train_002327
Implement the Python class `LogsAPI` described below. Class description: Implement the LogsAPI class. Method signatures and docstrings: - def post(self, args): add - def put(self, args): edit - def get(self, args): view - def delete(self, args): del
Implement the Python class `LogsAPI` described below. Class description: Implement the LogsAPI class. Method signatures and docstrings: - def post(self, args): add - def put(self, args): edit - def get(self, args): view - def delete(self, args): del <|skeleton|> class LogsAPI: def post(self, args): """a...
0fb1b604185a8bd8b72c1d2d527fb94bbaf46a86
<|skeleton|> class LogsAPI: def post(self, args): """add""" <|body_0|> def put(self, args): """edit""" <|body_1|> def get(self, args): """view""" <|body_2|> def delete(self, args): """del""" <|body_3|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogsAPI: def post(self, args): """add""" logs = None logsDao = LogsDao() try: logs = logsDao.add(args) except Exception as e: abort(500, e) return logs def put(self, args): """edit""" record = None logsDao = L...
the_stack_v2_python_sparse
app/modules/logs/resource.py
daitouli/baoaiback
train
0
eb0acf0cd12c4616c27329221ee9b286456240bd
[ "request = apiai.ApiAI('9b5ef6f406254c3e8e38908ae1196e29').text_request()\nrequest.lang = 'ru'\nrequest.session_id = 'small-talk-bmnycd'\nrequest.query = message.text\nresponse_json = json.loads(request.getresponse().read().decode('utf-8'))\nreturn response_json['result']['fulfillment']['speech']", "weather_phras...
<|body_start_0|> request = apiai.ApiAI('9b5ef6f406254c3e8e38908ae1196e29').text_request() request.lang = 'ru' request.session_id = 'small-talk-bmnycd' request.query = message.text response_json = json.loads(request.getresponse().read().decode('utf-8')) return response_jso...
Класс для общения с людьми
CommunicationManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommunicationManager: """Класс для общения с людьми""" def get_bot_answer(self, message): """Метод отвечает на сообщение пользователя :param message - сообщение пользователя""" <|body_0|> def is_weather_question(self, message): """Метод проверяет, не о погоде ли ...
stack_v2_sparse_classes_36k_train_013202
4,756
no_license
[ { "docstring": "Метод отвечает на сообщение пользователя :param message - сообщение пользователя", "name": "get_bot_answer", "signature": "def get_bot_answer(self, message)" }, { "docstring": "Метод проверяет, не о погоде ли спросили бота :param message сообщение боту", "name": "is_weather_q...
2
stack_v2_sparse_classes_30k_train_002736
Implement the Python class `CommunicationManager` described below. Class description: Класс для общения с людьми Method signatures and docstrings: - def get_bot_answer(self, message): Метод отвечает на сообщение пользователя :param message - сообщение пользователя - def is_weather_question(self, message): Метод прове...
Implement the Python class `CommunicationManager` described below. Class description: Класс для общения с людьми Method signatures and docstrings: - def get_bot_answer(self, message): Метод отвечает на сообщение пользователя :param message - сообщение пользователя - def is_weather_question(self, message): Метод прове...
13ca8263a927b7a8533c97227cf51e7b223843c5
<|skeleton|> class CommunicationManager: """Класс для общения с людьми""" def get_bot_answer(self, message): """Метод отвечает на сообщение пользователя :param message - сообщение пользователя""" <|body_0|> def is_weather_question(self, message): """Метод проверяет, не о погоде ли ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommunicationManager: """Класс для общения с людьми""" def get_bot_answer(self, message): """Метод отвечает на сообщение пользователя :param message - сообщение пользователя""" request = apiai.ApiAI('9b5ef6f406254c3e8e38908ae1196e29').text_request() request.lang = 'ru' req...
the_stack_v2_python_sparse
bot_skills.py
KobanBanan/TelegramBot
train
0
1f1eb53ff2be75d30c1ed9ff5eca038b4785926f
[ "if field_names is None:\n assert not as_array\n return super(DefaultSerialize, cls).object2dict(obj, **kwargs)\nelse:\n out = serialize.list2dict(obj, names=field_names)\nreturn out", "if as_array:\n assert field_names is not None\n out = serialize.list2numpy(obj, names=field_names)\nelse:\n ou...
<|body_start_0|> if field_names is None: assert not as_array return super(DefaultSerialize, cls).object2dict(obj, **kwargs) else: out = serialize.list2dict(obj, names=field_names) return out <|end_body_0|> <|body_start_1|> if as_array: ass...
Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class.
DefaultSerialize
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultSerialize: """Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class.""" def object2dict(cls, obj, as_array=False, field_names=None, **kwargs): """Convert a message object in...
stack_v2_sparse_classes_36k_train_013203
4,911
permissive
[ { "docstring": "Convert a message object into a dictionary. Args: obj (object): Object that would be serialized by this class and should be returned in a dictionary form. as_array (bool, optional): If True, the objects in the list are complete columns in a table and as_format is set to True. Defaults to False. ...
5
stack_v2_sparse_classes_30k_val_000080
Implement the Python class `DefaultSerialize` described below. Class description: Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class. Method signatures and docstrings: - def object2dict(cls, obj, as_array=False,...
Implement the Python class `DefaultSerialize` described below. Class description: Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class. Method signatures and docstrings: - def object2dict(cls, obj, as_array=False,...
dcc4d75a4d2c6aaa7e50e75095a16df1df6b2b0a
<|skeleton|> class DefaultSerialize: """Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class.""" def object2dict(cls, obj, as_array=False, field_names=None, **kwargs): """Convert a message object in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultSerialize: """Default class for serializing/deserializing a python object into/from a bytes message. Args: **kwargs: Additional keyword args are passed to the parent class.""" def object2dict(cls, obj, as_array=False, field_names=None, **kwargs): """Convert a message object into a dictiona...
the_stack_v2_python_sparse
yggdrasil/serialize/DefaultSerialize.py
leighmatth/yggdrasil
train
0
66e571493190da606ece35a454bbdd1308ff823f
[ "query_list = ['Parameters.Fields.all=', 'Parameters.Fields.all-target=', 'Parameters.Fields.phrase=', 'Parameters.Fields.phrase-target=', 'Parameters.Fields.any=', 'Parameters.Fields.any-target=', 'Parameters.Fields.exclude=', 'Parameters.Fields.exclude-target=', 'Parameters.Fields.type=Bills', 'Parameters.Fields....
<|body_start_0|> query_list = ['Parameters.Fields.all=', 'Parameters.Fields.all-target=', 'Parameters.Fields.phrase=', 'Parameters.Fields.phrase-target=', 'Parameters.Fields.any=', 'Parameters.Fields.any-target=', 'Parameters.Fields.exclude=', 'Parameters.Fields.exclude-target=', 'Parameters.Fields.type=Bills',...
ParliamentSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParliamentSpider: def start_requests(self): """This sets up the initial urls.""" <|body_0|> def parse(self, response): """Parse the articles listing page and go to the next one.""" <|body_1|> def parse_others(self, response): """Try to retrieve a...
stack_v2_sparse_classes_36k_train_013204
4,140
permissive
[ { "docstring": "This sets up the initial urls.", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "Parse the articles listing page and go to the next one.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Try to retr...
3
stack_v2_sparse_classes_30k_train_008697
Implement the Python class `ParliamentSpider` described below. Class description: Implement the ParliamentSpider class. Method signatures and docstrings: - def start_requests(self): This sets up the initial urls. - def parse(self, response): Parse the articles listing page and go to the next one. - def parse_others(s...
Implement the Python class `ParliamentSpider` described below. Class description: Implement the ParliamentSpider class. Method signatures and docstrings: - def start_requests(self): This sets up the initial urls. - def parse(self, response): Parse the articles listing page and go to the next one. - def parse_others(s...
1aa42c7d8aaf0a91d033af8448a33f37563b0365
<|skeleton|> class ParliamentSpider: def start_requests(self): """This sets up the initial urls.""" <|body_0|> def parse(self, response): """Parse the articles listing page and go to the next one.""" <|body_1|> def parse_others(self, response): """Try to retrieve a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParliamentSpider: def start_requests(self): """This sets up the initial urls.""" query_list = ['Parameters.Fields.all=', 'Parameters.Fields.all-target=', 'Parameters.Fields.phrase=', 'Parameters.Fields.phrase-target=', 'Parameters.Fields.any=', 'Parameters.Fields.any-target=', 'Parameters.Fiel...
the_stack_v2_python_sparse
pipeline/reach-scraper/wsf_scraping/spiders/parliament_spider.py
wellcometrust/reach
train
12
270667c8344007bf1c748b61cd25b1bf35adcbe9
[ "has_class_permission = super(EntryAdmin, self).has_change_permission(request, obj)\nif not has_class_permission:\n return False\nif obj is not None and (not request.user.is_superuser) and (request.user.id != obj.author.id):\n return False\nreturn True", "if request.user.is_superuser:\n return Entry.obje...
<|body_start_0|> has_class_permission = super(EntryAdmin, self).has_change_permission(request, obj) if not has_class_permission: return False if obj is not None and (not request.user.is_superuser) and (request.user.id != obj.author.id): return False return True <|...
EntryAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_013205
2,721
no_license
[ { "docstring": "Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.", "name": "has_change_permission", "signature": "def has_change_permission(self, request, obj=...
3
stack_v2_sparse_classes_30k_train_008121
Implement the Python class `EntryAdmin` described below. Class description: Implement the EntryAdmin class. Method signatures and docstrings: - def has_change_permission(self, request, obj=None): Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the...
Implement the Python class `EntryAdmin` described below. Class description: Implement the EntryAdmin class. Method signatures and docstrings: - def has_change_permission(self, request, obj=None): Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the...
a835b4e2de6e961e46ec68d3edda98530cbcf4c6
<|skeleton|> class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntryAdmin: def has_change_permission(self, request, obj=None): """Called from the individual object editing page, to ensure the user is allowed to edit that object. Returns ``True`` if the user has permission for change the entry, otherwise returns ``False``.""" has_class_permission = super(E...
the_stack_v2_python_sparse
diario/admin.py
sahwar/souschef
train
0
19397c86fc47d3b7898c6c19774b885bbc921971
[ "self.surface = surface\nself.pos = pos\nself.direction = direction\nself.size = size\nself.color = color\nself.gravity = pygame.Vector2(0, 9.81 / FPS)\nself.drag = pygame.Vector2(1.0, 0.999)", "right = self.surface.get_width() - self.size\nleft = self.size\ntop = self.size\nbottom = self.surface.get_height() - s...
<|body_start_0|> self.surface = surface self.pos = pos self.direction = direction self.size = size self.color = color self.gravity = pygame.Vector2(0, 9.81 / FPS) self.drag = pygame.Vector2(1.0, 0.999) <|end_body_0|> <|body_start_1|> right = self.surface....
Paticle in 2D space
Particle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Particle: """Paticle in 2D space""" def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): """a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:...
stack_v2_sparse_classes_36k_train_013206
5,061
no_license
[ { "docstring": "a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of particle :param color: color of particle :param direction: initial direction of particle in m/s aka pixel/frame :param gravity: gravity vector 9.81 m/s aka 9.81...
4
stack_v2_sparse_classes_30k_train_001998
Implement the Python class `Particle` described below. Class description: Paticle in 2D space Method signatures and docstrings: - def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ...
Implement the Python class `Particle` described below. Class description: Paticle in 2D space Method signatures and docstrings: - def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class Particle: """Paticle in 2D space""" def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): """a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Particle: """Paticle in 2D space""" def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): """a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of part...
the_stack_v2_python_sparse
effects/Particle.py
gunny26/pygame
train
5
809b2fa568dc46cd920fb9ffa9c3159a494f9622
[ "self.values = values\nself.source = None\nself.xdr = None\nself.ydr = None\nself.groups = []\nself.data = dict()\nself.attr = []\nself.index = index\nsuper(TimeSeries, self).__init__(title, xlabel, ylabel, legend, xscale, yscale, width, height, tools, filename, server, notebook, facet, xgrid, ygrid)", "self.data...
<|body_start_0|> self.values = values self.source = None self.xdr = None self.ydr = None self.groups = [] self.data = dict() self.attr = [] self.index = index super(TimeSeries, self).__init__(title, xlabel, ylabel, legend, xscale, yscale, width, he...
This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed lines tak...
TimeSeries
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSeries: """This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges...
stack_v2_sparse_classes_36k_train_013207
8,855
no_license
[ { "docstring": "Args: values (iterable): iterable 2d representing the data series values matrix. index (str|1d iterable, optional): can be used to specify a common custom index for all data series as follows: - As a 1d iterable of any sort (of datetime values) that will be used as series common index - As a str...
4
stack_v2_sparse_classes_30k_train_020663
Implement the Python class `TimeSeries` described below. Class description: This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additi...
Implement the Python class `TimeSeries` described below. Class description: This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additi...
6cecb7211277b9d838039d0eb15e50a10f9ac3d1
<|skeleton|> class TimeSeries: """This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeSeries: """This is the TimeSeries class and it is in charge of plotting TimeSeries charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally...
the_stack_v2_python_sparse
bokeh/charts/timeseries.py
brian15co/bokeh
train
2
99965fb78ed65b5e8eb72500fedfe4844f100ad4
[ "app = Application.objects.as_owner(self.request.user, app_id)\nusers = AccessToken.objects.values('user').filter(application=app).distinct().count()\nreturn super(ApplicationSettings, self).get_context_data(application=app, users=users, **kwargs)", "context = self.get_context_data(app_id)\napp = context.pop('app...
<|body_start_0|> app = Application.objects.as_owner(self.request.user, app_id) users = AccessToken.objects.values('user').filter(application=app).distinct().count() return super(ApplicationSettings, self).get_context_data(application=app, users=users, **kwargs) <|end_body_0|> <|body_start_1|> ...
Displays the Application Settings page. `/admin/apps/settings`
ApplicationSettings
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identi...
stack_v2_sparse_classes_36k_train_013208
8,135
permissive
[ { "docstring": "Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identifying the the app in the database. Returns ------- dict context", "name": "get_context_data", "signature": "def get_context_data(self, app_id, ...
2
stack_v2_sparse_classes_30k_train_014775
Implement the Python class `ApplicationSettings` described below. Class description: Displays the Application Settings page. `/admin/apps/settings` Method signatures and docstrings: - def get_context_data(self, app_id, **kwargs): Returns the context to render the view. Overwrites the method to add the application to ...
Implement the Python class `ApplicationSettings` described below. Class description: Displays the Application Settings page. `/admin/apps/settings` Method signatures and docstrings: - def get_context_data(self, app_id, **kwargs): Returns the context to render the view. Overwrites the method to add the application to ...
16d31b5207de9f699fc01054baad1fe65ad1c3ca
<|skeleton|> class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationSettings: """Displays the Application Settings page. `/admin/apps/settings`""" def get_context_data(self, app_id, **kwargs): """Returns the context to render the view. Overwrites the method to add the application to the context. Parameters ---------- app_id : int ID identifying the the...
the_stack_v2_python_sparse
geokey/applications/views.py
NeolithEra/geokey
train
0
84a38212379348fe98beb1223f21410f2b874bc4
[ "divisors = []\nsqrt_n = int(n ** 0.5)\nfor x in range(1, sqrt_n + 1):\n if n % x == 0:\n k -= 1\n divisors.append(x)\n if k == 0:\n return x\nif sqrt_n * sqrt_n == n:\n k += 1\nreturn n // divisors[len(divisors) - k] if k <= len(divisors) else -1", "def heappush_k(num):\n ...
<|body_start_0|> divisors = [] sqrt_n = int(n ** 0.5) for x in range(1, sqrt_n + 1): if n % x == 0: k -= 1 divisors.append(x) if k == 0: return x if sqrt_n * sqrt_n == n: k += 1 return n /...
KthFactor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthFactor: def _of_n(self, n: int, k: int) -> int: """Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return:""" <|body_0|> def of_n_(self, n: int, k: int) -> int: """Approach: Heap Time Complexity:...
stack_v2_sparse_classes_36k_train_013209
1,846
no_license
[ { "docstring": "Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return:", "name": "_of_n", "signature": "def _of_n(self, n: int, k: int) -> int" }, { "docstring": "Approach: Heap Time Complexity: O(sqrt(N) * log k) Space Comple...
3
null
Implement the Python class `KthFactor` described below. Class description: Implement the KthFactor class. Method signatures and docstrings: - def _of_n(self, n: int, k: int) -> int: Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return: - def of_n_...
Implement the Python class `KthFactor` described below. Class description: Implement the KthFactor class. Method signatures and docstrings: - def _of_n(self, n: int, k: int) -> int: Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return: - def of_n_...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class KthFactor: def _of_n(self, n: int, k: int) -> int: """Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return:""" <|body_0|> def of_n_(self, n: int, k: int) -> int: """Approach: Heap Time Complexity:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthFactor: def _of_n(self, n: int, k: int) -> int: """Approach: Math, O(sqrt(N)) time Time Complexity: O(sqrt(N)) Space Complexity: O(min(k, sqrt(N)) :param n: :param k: :return:""" divisors = [] sqrt_n = int(n ** 0.5) for x in range(1, sqrt_n + 1): if n % x == 0: ...
the_stack_v2_python_sparse
expedia/kth_factor_of_n.py
Shiv2157k/leet_code
train
1
f11df20e7a7a7fc5b38551b7af63f12bd4424fb5
[ "self.length = 0\nself.lst = []\nself.dt = {}", "pos = self.dt.get(val, -1)\nif pos == -1:\n self.lst.append(val)\n self.length += 1\n self.dt[val] = self.length - 1\n return True\nelse:\n return False", "pos = self.dt.get(val, -1)\nif pos == -1:\n return False\nelse:\n tmp = self.lst[-1]\n...
<|body_start_0|> self.length = 0 self.lst = [] self.dt = {} <|end_body_0|> <|body_start_1|> pos = self.dt.get(val, -1) if pos == -1: self.lst.append(val) self.length += 1 self.dt[val] = self.length - 1 return True else: ...
RandomizedSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_013210
1,861
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool", "name": "insert", "signature": ...
4
null
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.length = 0 self.lst = [] self.dt = {} def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rty...
the_stack_v2_python_sparse
leetcode/380.py
liuweilin17/algorithm
train
3
bee5bb7528216f52d5a7cb3ea19a030df36bfd69
[ "self.search_space = search_space\nsuper(PBTHpo, self).__init__(search_space, **kwargs)\nself.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count)\nself.hpo = PBT(self.config.policy.config_count, self.config.policy.each_epochs, self.config.policy.total_rungs, self.local_base_path, paras_l...
<|body_start_0|> self.search_space = search_space super(PBTHpo, self).__init__(search_space, **kwargs) self.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count) self.hpo = PBT(self.config.policy.config_count, self.config.policy.each_epochs, self.config.policy.t...
An Hpo of PBT.
PBTHpo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PBTHpo: """An Hpo of PBT.""" def __init__(self, search_space=None, **kwargs): """Init PBTHpo.""" <|body_0|> def get_hyperparameters(self, num): """Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyp...
stack_v2_sparse_classes_36k_train_013211
3,870
permissive
[ { "docstring": "Init PBTHpo.", "name": "__init__", "signature": "def __init__(self, search_space=None, **kwargs)" }, { "docstring": "Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyperparameter space. :return: list of random samp...
4
null
Implement the Python class `PBTHpo` described below. Class description: An Hpo of PBT. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init PBTHpo. - def get_hyperparameters(self, num): Use the trained model to propose a set of params from SearchSpace. :param int num: number of ra...
Implement the Python class `PBTHpo` described below. Class description: An Hpo of PBT. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init PBTHpo. - def get_hyperparameters(self, num): Use the trained model to propose a set of params from SearchSpace. :param int num: number of ra...
8e0af84a57eca5745fe2db3d13075393838036bb
<|skeleton|> class PBTHpo: """An Hpo of PBT.""" def __init__(self, search_space=None, **kwargs): """Init PBTHpo.""" <|body_0|> def get_hyperparameters(self, num): """Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PBTHpo: """An Hpo of PBT.""" def __init__(self, search_space=None, **kwargs): """Init PBTHpo.""" self.search_space = search_space super(PBTHpo, self).__init__(search_space, **kwargs) self.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count) ...
the_stack_v2_python_sparse
vega/algorithms/hpo/pbt_hpo.py
fmsnew/vega
train
0
6df04805f2d8924ff79c70d929227625c713262b
[ "self.built_fc_name: Optional[str] = None\nself.fc_name = fc_name\nself.label = label\nself.serial_stl: Optional[str] = None\nself.serial_stp: Optional[str] = None\nself.virtual = virtual", "if file_path is None:\n file_path = f'{self.label}.stp'\nwrite_deserialised(self.serial_stp, file_path)\nreturn file_pat...
<|body_start_0|> self.built_fc_name: Optional[str] = None self.fc_name = fc_name self.label = label self.serial_stl: Optional[str] = None self.serial_stp: Optional[str] = None self.virtual = virtual <|end_body_0|> <|body_start_1|> if file_path is None: ...
Geo3DPart
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geo3DPart: def __init__(self, label: str, fc_name: Optional[str], virtual: bool=False): """Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this new part. fc_name : str The name of the 2D/3D freeCAD object that this is built from. Note that if...
stack_v2_sparse_classes_36k_train_013212
8,703
permissive
[ { "docstring": "Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this new part. fc_name : str The name of the 2D/3D freeCAD object that this is built from. Note that if the label used for the 3D part is the same as the freeCAD label, and that label is unique, None ma...
3
stack_v2_sparse_classes_30k_train_000296
Implement the Python class `Geo3DPart` described below. Class description: Implement the Geo3DPart class. Method signatures and docstrings: - def __init__(self, label: str, fc_name: Optional[str], virtual: bool=False): Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this ...
Implement the Python class `Geo3DPart` described below. Class description: Implement the Geo3DPart class. Method signatures and docstrings: - def __init__(self, label: str, fc_name: Optional[str], virtual: bool=False): Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this ...
68f781ff489fd9f5ddc817dacfc8ff3a8fdeb2b4
<|skeleton|> class Geo3DPart: def __init__(self, label: str, fc_name: Optional[str], virtual: bool=False): """Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this new part. fc_name : str The name of the 2D/3D freeCAD object that this is built from. Note that if...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geo3DPart: def __init__(self, label: str, fc_name: Optional[str], virtual: bool=False): """Base class for a 3D geometric part. Parameters ---------- label : str The descriptive name of this new part. fc_name : str The name of the 2D/3D freeCAD object that this is built from. Note that if the label use...
the_stack_v2_python_sparse
qmt/geometry/part_3d.py
basnijholt/qmt
train
0
4211993dbb9dc89e20131e559867f3d771633577
[ "super().__init__()\nself.lim_low = lim_low\nself.lim_high = lim_high", "if np.max(np.abs(wake_delta)) < 1e-14:\n wake_delta[:] = 1\nwake_delta[sel_sp] *= 1 + wake_model_result\nreturn wake_delta", "w = amb_results * (wake_delta - 1)\nif self.lim_low is not None and variable in self.lim_low:\n w = np.maxi...
<|body_start_0|> super().__init__() self.lim_low = lim_low self.lim_high = lim_high <|end_body_0|> <|body_start_1|> if np.max(np.abs(wake_delta)) < 1e-14: wake_delta[:] = 1 wake_delta[sel_sp] *= 1 + wake_model_result return wake_delta <|end_body_1|> <|body_s...
Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.03873.pdf Equation (8) Attributes ---------- lim_low: dict Lower limits of the final wake ...
ProductSuperposition
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductSuperposition: """Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.03873.pdf Equation (8) Attributes --------...
stack_v2_sparse_classes_36k_train_013213
4,054
permissive
[ { "docstring": "Constructor. Parameters ---------- lim_low: dict, optional Lower limits of the final wake deltas. Key: variable str, value: float lim_high: dict, optional Higher limits of the final wake deltas. Key: variable str, value: float", "name": "__init__", "signature": "def __init__(self, lim_lo...
3
stack_v2_sparse_classes_30k_train_011152
Implement the Python class `ProductSuperposition` described below. Class description: Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.038...
Implement the Python class `ProductSuperposition` described below. Class description: Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.038...
65b01a4d33c40065d1b19900d8238b173700653c
<|skeleton|> class ProductSuperposition: """Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.03873.pdf Equation (8) Attributes --------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductSuperposition: """Product wind wake superposition. This is based on the idea that the dimensionless wind deficit should be rescaled with the wake corrected wind field, rather than the rotor equivalent wind speed. Source: https://arxiv.org/pdf/2010.03873.pdf Equation (8) Attributes ---------- lim_low: d...
the_stack_v2_python_sparse
foxes/models/wake_superpositions/product.py
FraunhoferIWES/foxes
train
14
665dd9192d661e63d20536ceb26e0710f096b8ad
[ "self.start1 = start1\nself.start2 = start2\nself.w = w\nself.h = h\nself.rot_x = 0\nself.rot_y = 0\nself.rot_z = 0\nself.scale = 1\nself.delta = GraphicsPoint3d(0, 0, 0)", "def apply_transforms(p):\n p.move(self.delta)\n p.scale(GraphicsPoint3d(self.scale, self.scale, self.scale))\n p.rotate_x(self.rot_...
<|body_start_0|> self.start1 = start1 self.start2 = start2 self.w = w self.h = h self.rot_x = 0 self.rot_y = 0 self.rot_z = 0 self.scale = 1 self.delta = GraphicsPoint3d(0, 0, 0) <|end_body_0|> <|body_start_1|> def apply_transforms(p): ...
parallelepiped
Parallelepiped
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parallelepiped: """parallelepiped""" def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float): """start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h -> O_z""" <|body_0|> def paint(self, canvas: Q...
stack_v2_sparse_classes_36k_train_013214
2,527
no_license
[ { "docstring": "start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h -> O_z", "name": "__init__", "signature": "def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float)" }, { "docstring": "Paints this Parallelepiped onto c...
2
stack_v2_sparse_classes_30k_train_019476
Implement the Python class `Parallelepiped` described below. Class description: parallelepiped Method signatures and docstrings: - def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float): start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h ->...
Implement the Python class `Parallelepiped` described below. Class description: parallelepiped Method signatures and docstrings: - def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float): start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h ->...
fbfb1f81936e748eaa4ba5b304ff52f9961e06b6
<|skeleton|> class Parallelepiped: """parallelepiped""" def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float): """start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h -> O_z""" <|body_0|> def paint(self, canvas: Q...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parallelepiped: """parallelepiped""" def __init__(self, start1: Point3d, start2: Point3d, w: float, h: float): """start1 & start2 - starting points for bases (that are connected by single edge) w, h - size of base w -> O_x h -> O_z""" self.start1 = start1 self.start2 = start2 ...
the_stack_v2_python_sparse
3/src/parallelepiped.py
dazzlemon/diit_121-ipz_y2_cg
train
0
3b8231be445fa85dd315458023a3c3d35041fa24
[ "a = ListNode(-1)\nb = a\nwhile l1 and l2:\n if l1.val <= l2.val:\n a.next = l1\n l1 = l1.next\n a = a.next\n else:\n a.next = l2\n l2 = l2.next\n a = a.next\nif l1:\n a.next = l1\nelif l2:\n a.next = l2\nreturn b.next", "if l1 == None:\n return l2\nif l2 =...
<|body_start_0|> a = ListNode(-1) b = a while l1 and l2: if l1.val <= l2.val: a.next = l1 l1 = l1.next a = a.next else: a.next = l2 l2 = l2.next a = a.next if l1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013215
1,328
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1...
2
stack_v2_sparse_classes_30k_train_003702
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
40bca64cf3ed2fbc670b9e2cdf4f88d6c7b68134
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" a = ListNode(-1) b = a while l1 and l2: if l1.val <= l2.val: a.next = l1 l1 = l1.next a = a.next else:...
the_stack_v2_python_sparse
Linked List/Merge-Two-Sorted-Lists (four).py
okliou/lcode
train
0
4afe2aadaf6fd5086ee7d9f4150e74021ce8f682
[ "self.compute = characterizer\nif completer is not None:\n self.to_complete_measure = completer\nself._format_extra_functions(out_formatter, featurenames)\nself._assert_correctness()", "if out_formatter is None:\n self._out_formatter = null_out_formatter\nelse:\n self._out_formatter = out_formatter\nif f...
<|body_start_0|> self.compute = characterizer if completer is not None: self.to_complete_measure = completer self._format_extra_functions(out_formatter, featurenames) self._assert_correctness() <|end_body_0|> <|body_start_1|> if out_formatter is None: sel...
General descriptor model totally personalizable.
GeneralDescriptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralDescriptor: """General descriptor model totally personalizable.""" def __init__(self, characterizer, completer=None, out_formatter=None, featurenames=None): """A general descriptor container. You can set the class by giving it the functions needed to work. Parameters ---------...
stack_v2_sparse_classes_36k_train_013216
11,653
permissive
[ { "docstring": "A general descriptor container. You can set the class by giving it the functions needed to work. Parameters ---------- characterizer: function the function which acts as the core-characterizer. completer: function the function which corrects the final output of the whole measure. out_formatter: ...
2
stack_v2_sparse_classes_30k_train_007502
Implement the Python class `GeneralDescriptor` described below. Class description: General descriptor model totally personalizable. Method signatures and docstrings: - def __init__(self, characterizer, completer=None, out_formatter=None, featurenames=None): A general descriptor container. You can set the class by giv...
Implement the Python class `GeneralDescriptor` described below. Class description: General descriptor model totally personalizable. Method signatures and docstrings: - def __init__(self, characterizer, completer=None, out_formatter=None, featurenames=None): A general descriptor container. You can set the class by giv...
e028008f9750521bf7d311f7cd3323c88d621ea4
<|skeleton|> class GeneralDescriptor: """General descriptor model totally personalizable.""" def __init__(self, characterizer, completer=None, out_formatter=None, featurenames=None): """A general descriptor container. You can set the class by giving it the functions needed to work. Parameters ---------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneralDescriptor: """General descriptor model totally personalizable.""" def __init__(self, characterizer, completer=None, out_formatter=None, featurenames=None): """A general descriptor container. You can set the class by giving it the functions needed to work. Parameters ---------- characteriz...
the_stack_v2_python_sparse
pySpatialTools/FeatureManagement/Descriptors/descriptormodel.py
tgquintela/pySpatialTools
train
8
ce6ea196bc0450ee5d284cee0046a395c36214d6
[ "self.player = player\nself.team = team\ntry:\n self.page = wikipedia.page(player)\n self.soup = BeautifulSoup(self.page.html())\nexcept wikipedia.exceptions.DisambiguationError as e:\n self._get_correct_page(e.options, team)\nself._gen_table()", "best_candidate = None\nbest_yob = None\nfor option in opt...
<|body_start_0|> self.player = player self.team = team try: self.page = wikipedia.page(player) self.soup = BeautifulSoup(self.page.html()) except wikipedia.exceptions.DisambiguationError as e: self._get_correct_page(e.options, team) self._gen_t...
WikipediaPlayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikipediaPlayer: def __init__(self, player, team): """initializes self.page to the correct wikipedia resource""" <|body_0|> def _get_correct_page(self, options, team): """gets appropiate wikipedia among options considering wether team is in html and age""" <|...
stack_v2_sparse_classes_36k_train_013217
12,481
permissive
[ { "docstring": "initializes self.page to the correct wikipedia resource", "name": "__init__", "signature": "def __init__(self, player, team)" }, { "docstring": "gets appropiate wikipedia among options considering wether team is in html and age", "name": "_get_correct_page", "signature": ...
2
stack_v2_sparse_classes_30k_train_012620
Implement the Python class `WikipediaPlayer` described below. Class description: Implement the WikipediaPlayer class. Method signatures and docstrings: - def __init__(self, player, team): initializes self.page to the correct wikipedia resource - def _get_correct_page(self, options, team): gets appropiate wikipedia am...
Implement the Python class `WikipediaPlayer` described below. Class description: Implement the WikipediaPlayer class. Method signatures and docstrings: - def __init__(self, player, team): initializes self.page to the correct wikipedia resource - def _get_correct_page(self, options, team): gets appropiate wikipedia am...
e3951450713f7cfaead070998e1b84d392114283
<|skeleton|> class WikipediaPlayer: def __init__(self, player, team): """initializes self.page to the correct wikipedia resource""" <|body_0|> def _get_correct_page(self, options, team): """gets appropiate wikipedia among options considering wether team is in html and age""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WikipediaPlayer: def __init__(self, player, team): """initializes self.page to the correct wikipedia resource""" self.player = player self.team = team try: self.page = wikipedia.page(player) self.soup = BeautifulSoup(self.page.html()) except wiki...
the_stack_v2_python_sparse
basketball_reference/utils.py
nbaprediction/nba_prediction
train
3
ee554dc4293d42926a2c638b9567e5448090ac38
[ "QtGui.QAction.__init__(self, QtGui.QIcon(':/images/rotate.png'), '&Rotate CW...', parent)\nself.setStatusTip('Rotate 90 degrees CW')\nself.rotationMatrix = QtGui.QMatrix(0, 1, -1, 0, 0, 0)", "cellWidget = self.toolBar.getSnappedWidget()\nif not cellWidget.label.pixmap() or cellWidget.label.pixmap().isNull():\n ...
<|body_start_0|> QtGui.QAction.__init__(self, QtGui.QIcon(':/images/rotate.png'), '&Rotate CW...', parent) self.setStatusTip('Rotate 90 degrees CW') self.rotationMatrix = QtGui.QMatrix(0, 1, -1, 0, 0, 0) <|end_body_0|> <|body_start_1|> cellWidget = self.toolBar.getSnappedWidget() ...
ImageViewerRotateAction is the action to rotate the image
ImageViewerRotateAction
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewerRotateAction: """ImageViewerRotateAction is the action to rotate the image""" def __init__(self, parent=None): """ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. of the action""" <|body_0|> def triggeredSlo...
stack_v2_sparse_classes_36k_train_013218
14,880
permissive
[ { "docstring": "ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. of the action", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "toggledSlot(checked: boolean) -> None Execute the action when the button is ...
2
null
Implement the Python class `ImageViewerRotateAction` described below. Class description: ImageViewerRotateAction is the action to rotate the image Method signatures and docstrings: - def __init__(self, parent=None): ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. ...
Implement the Python class `ImageViewerRotateAction` described below. Class description: ImageViewerRotateAction is the action to rotate the image Method signatures and docstrings: - def __init__(self, parent=None): ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. ...
23ef56ec24b85c82416e1437a08381635328abe5
<|skeleton|> class ImageViewerRotateAction: """ImageViewerRotateAction is the action to rotate the image""" def __init__(self, parent=None): """ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. of the action""" <|body_0|> def triggeredSlo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageViewerRotateAction: """ImageViewerRotateAction is the action to rotate the image""" def __init__(self, parent=None): """ImageViewerRotateAction(parent: QWidget) -> ImageViewerRotateAction Setup the image, status tip, etc. of the action""" QtGui.QAction.__init__(self, QtGui.QIcon(':/i...
the_stack_v2_python_sparse
vistrails_current/vistrails/packages/spreadsheet/widgets/imageviewer/imageviewer.py
lumig242/VisTrailsRecommendation
train
3
b1bd6aa74abc3aefcb2d31a88c7f69e2ff49dc61
[ "super().__init__(**kwargs)\nself.encoder = encoder\nself.decoder = decoder", "z = self.encoder(x, **kwargs)\nx_hat = self.decoder(z, **kwargs)\nreturn x_hat" ]
<|body_start_0|> super().__init__(**kwargs) self.encoder = encoder self.decoder = decoder <|end_body_0|> <|body_start_1|> z = self.encoder(x, **kwargs) x_hat = self.decoder(z, **kwargs) return x_hat <|end_body_1|>
Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decoder. The abstraction can be used for multiple data modalities.
AE
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AE: """Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decoder. The abstraction can be used for mult...
stack_v2_sparse_classes_36k_train_013219
3,378
permissive
[ { "docstring": "Constructor. Combine encoder and decoder in AE Parameters ---------- encoder Encoder network. decoder Decoder network.", "name": "__init__", "signature": "def __init__(self, encoder: keras.Model, decoder: keras.Model, **kwargs) -> None" }, { "docstring": "Forward pass. Parameters...
2
null
Implement the Python class `AE` described below. Class description: Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decode...
Implement the Python class `AE` described below. Class description: Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decode...
54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718
<|skeleton|> class AE: """Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decoder. The abstraction can be used for mult...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AE: """Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consists of passing the input to the encoder, obtain the input embedding and pass the embedding through the decoder. The abstraction can be used for multiple data mod...
the_stack_v2_python_sparse
alibi/models/tensorflow/autoencoder.py
SeldonIO/alibi
train
2,143
19489dc7818e7cd86c07d1bd1bd7eca7d6df53f0
[ "profile = self.user.get_profile()\nself.set_initial({'first_name': self.user.first_name, 'last_name': self.user.last_name, 'email': self.user.email, 'profile_private': profile.is_private})\nbackend = get_enabled_auth_backends()[0]\nif not backend.supports_change_name:\n del self.fields['first_name']\n del se...
<|body_start_0|> profile = self.user.get_profile() self.set_initial({'first_name': self.user.first_name, 'last_name': self.user.last_name, 'email': self.user.email, 'profile_private': profile.is_private}) backend = get_enabled_auth_backends()[0] if not backend.supports_change_name: ...
Form for the Profile page for an account.
ProfileForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileForm: """Form for the Profile page for an account.""" def load(self): """Load data for the form.""" <|body_0|> def save(self): """Save the form.""" <|body_1|> <|end_skeleton|> <|body_start_0|> profile = self.user.get_profile() sel...
stack_v2_sparse_classes_36k_train_013220
23,770
permissive
[ { "docstring": "Load data for the form.", "name": "load", "signature": "def load(self)" }, { "docstring": "Save the form.", "name": "save", "signature": "def save(self)" } ]
2
null
Implement the Python class `ProfileForm` described below. Class description: Form for the Profile page for an account. Method signatures and docstrings: - def load(self): Load data for the form. - def save(self): Save the form.
Implement the Python class `ProfileForm` described below. Class description: Form for the Profile page for an account. Method signatures and docstrings: - def load(self): Load data for the form. - def save(self): Save the form. <|skeleton|> class ProfileForm: """Form for the Profile page for an account.""" ...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class ProfileForm: """Form for the Profile page for an account.""" def load(self): """Load data for the form.""" <|body_0|> def save(self): """Save the form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileForm: """Form for the Profile page for an account.""" def load(self): """Load data for the form.""" profile = self.user.get_profile() self.set_initial({'first_name': self.user.first_name, 'last_name': self.user.last_name, 'email': self.user.email, 'profile_private': profile...
the_stack_v2_python_sparse
reviewboard/accounts/forms/pages.py
reviewboard/reviewboard
train
1,141
682254421905ea22ba187f9b2c48f2f88701294a
[ "while sx < tx and sy < ty:\n tx, ty = (tx % ty, ty % tx)\nreturn sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - sx) % sy == 0))", "while sx < tx and sy < ty:\n tx, ty = (tx % ty, ty % tx)\nreturn sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx...
<|body_start_0|> while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) return sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - sx) % sy == 0)) <|end_body_0|> <|body_start_1|> while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" <|body_0|> def rewrite(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of tak...
stack_v2_sparse_classes_36k_train_013221
2,133
no_license
[ { "docstring": ":type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool", "name": "reachingPoints", "signature": "def reachingPoints(self, sx, sy, tx, ty)" }, { "docstring": ":type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of taking a point (x, y...
2
stack_v2_sparse_classes_30k_train_019772
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reachingPoints(self, sx, sy, tx, ty): :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool - def rewrite(self, sx, sy, tx, ty): :type sx: int :type sy: int :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reachingPoints(self, sx, sy, tx, ty): :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool - def rewrite(self, sx, sy, tx, ty): :type sx: int :type sy: int :t...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" <|body_0|> def rewrite(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of tak...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) return sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - ...
the_stack_v2_python_sparse
math/780_Reaching_Points.py
vsdrun/lc_public
train
6
fcb0ca9a957d88b00c8b1c42f3cb1488b4255b3f
[ "if not isinstance(value, QuantDescriptor):\n raise ValueError('{} is not an instance of QuantDescriptor!')\ncls.default_quant_desc_input = copy.deepcopy(value)", "if not isinstance(value, QuantDescriptor):\n raise ValueError('{} is not an instance of QuantDescriptor!')\ncls.default_quant_desc_kernel = copy...
<|body_start_0|> if not isinstance(value, QuantDescriptor): raise ValueError('{} is not an instance of QuantDescriptor!') cls.default_quant_desc_input = copy.deepcopy(value) <|end_body_0|> <|body_start_1|> if not isinstance(value, QuantDescriptor): raise ValueError('{} i...
Mixin class for adding basic quantization logic to quantized modules
QuantMixin
[ "Apache-2.0", "CAL-1.0-Combined-Work-Exception", "CAL-1.0", "MIT", "CC-BY-SA-4.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantMixin: """Mixin class for adding basic quantization logic to quantized modules""" def set_default_quant_desc_input(cls, value): """Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>`""" <|body_0|> def set_default_quant_desc_kernel(cls,...
stack_v2_sparse_classes_36k_train_013222
2,612
permissive
[ { "docstring": "Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>`", "name": "set_default_quant_desc_input", "signature": "def set_default_quant_desc_input(cls, value)" }, { "docstring": "Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescri...
2
stack_v2_sparse_classes_30k_train_007418
Implement the Python class `QuantMixin` described below. Class description: Mixin class for adding basic quantization logic to quantized modules Method signatures and docstrings: - def set_default_quant_desc_input(cls, value): Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>` - def se...
Implement the Python class `QuantMixin` described below. Class description: Mixin class for adding basic quantization logic to quantized modules Method signatures and docstrings: - def set_default_quant_desc_input(cls, value): Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>` - def se...
c50cd2b9154c83c3db5e4a11b9e8874f7fb8afa2
<|skeleton|> class QuantMixin: """Mixin class for adding basic quantization logic to quantized modules""" def set_default_quant_desc_input(cls, value): """Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>`""" <|body_0|> def set_default_quant_desc_kernel(cls,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuantMixin: """Mixin class for adding basic quantization logic to quantized modules""" def set_default_quant_desc_input(cls, value): """Args: value: An instance of :func:`QuantDescriptor <quantization.QuantDescriptor>`""" if not isinstance(value, QuantDescriptor): raise ValueE...
the_stack_v2_python_sparse
developer/lab/tools/NVIDIA/FasterTransformer/bert-quantization/bert-tf-quantization/ft-tensorflow-quantization/ft-tensorflow-quantization/python/layers/utils.py
arXiv-research/DevLab-III-1
train
2
42914637a58c9b2509dc8d1e541b0a1aee3af026
[ "self.mhdr = mhdr\nself.appeui = appeui\nself.deveui = deveui\nself.devnonce = devnonce\nself.mic = mic", "if len(data) != 23:\n raise DecodeError()\nappeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:])\nm = JoinRequestMessage(mhdr, appeui, deveui, devnonce, mic)\nreturn m", "data = self.mhdr.enc...
<|body_start_0|> self.mhdr = mhdr self.appeui = appeui self.deveui = deveui self.devnonce = devnonce self.mic = mic <|end_body_0|> <|body_start_1|> if len(data) != 23: raise DecodeError() appeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:]...
A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): Device nonce. mic (int): Message ...
JoinRequestMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_36k_train_013223
26,915
permissive
[ { "docstring": "JoinRequestMessage initialisation method.", "name": "__init__", "signature": "def __init__(self, mhdr, appeui, deveui, devnonce, mic)" }, { "docstring": "Create a MACJoinRequestMessage object from binary representation. Args: mhdr (MACHeader): MAC header object. data (str): UDP p...
3
stack_v2_sparse_classes_30k_train_016870
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
add5a1129296dca6db55b7980c0c1091f1ca80aa
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): ...
the_stack_v2_python_sparse
floranet/lora/mac.py
chengzhongkai/floranet
train
0
588b1e7ec922834ad5143bae0e228b55142a06a4
[ "self.dimension = dimension\nself.a1 = np.array(a1)\nself.a2 = np.array(a2)\nself.a3 = np.array(a3)\nself.sites = []\nself.bonds = []\nself.Nsites = 0\nself.Nbonds = 0", "if site.label == None:\n site.label = site_label_dir[str(self.Nsites)]\nif site.color == None:\n site.color = site_color_dir[str(self.Nsi...
<|body_start_0|> self.dimension = dimension self.a1 = np.array(a1) self.a2 = np.array(a2) self.a3 = np.array(a3) self.sites = [] self.bonds = [] self.Nsites = 0 self.Nbonds = 0 <|end_body_0|> <|body_start_1|> if site.label == None: sit...
Primitive cell of the lattice
Cell
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cell: """Primitive cell of the lattice""" def __init__(self, dimension, a1, a2, a3): """Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component of primitive vector a2 : list second component of primitiv...
stack_v2_sparse_classes_36k_train_013224
7,577
permissive
[ { "docstring": "Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component of primitive vector a2 : list second component of primitive vector a3 : list third component of primitive vector", "name": "__init__", "signature": "d...
3
stack_v2_sparse_classes_30k_train_011770
Implement the Python class `Cell` described below. Class description: Primitive cell of the lattice Method signatures and docstrings: - def __init__(self, dimension, a1, a2, a3): Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component o...
Implement the Python class `Cell` described below. Class description: Primitive cell of the lattice Method signatures and docstrings: - def __init__(self, dimension, a1, a2, a3): Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component o...
9b6323857fc27b17056ad6c8520d4a10a23dad4b
<|skeleton|> class Cell: """Primitive cell of the lattice""" def __init__(self, dimension, a1, a2, a3): """Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component of primitive vector a2 : list second component of primitiv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cell: """Primitive cell of the lattice""" def __init__(self, dimension, a1, a2, a3): """Initialize of cell instance Parameters ---------- dimension : int dimension of the cell, which can be 1, 2 or 3 a1 : list first component of primitive vector a2 : list second component of primitive vector a3 :...
the_stack_v2_python_sparse
moha/modelsystem/lattice.py
xujunyao0928/moha
train
0
b6c642a38f53a4c0f9aef62694734b79d707a1a0
[ "low = start\nhig = len(matrix) - 1 if vertical else len(matrix[0]) - 1\nwhile low <= hig:\n mid = (low + hig) // 2\n if vertical:\n if matrix[start][mid] > target:\n hig = mid - 1\n elif matrix[start][mid] < target:\n low = mid + 1\n else:\n return True\n...
<|body_start_0|> low = start hig = len(matrix) - 1 if vertical else len(matrix[0]) - 1 while low <= hig: mid = (low + hig) // 2 if vertical: if matrix[start][mid] > target: hig = mid - 1 elif matrix[start][mid] < target:...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool: """垂直或水平二分搜索矩阵。""" <|body_0|> def search_matrix(self, matrix: List[List[int]], target: int) -> bool: """二分搜索。""" <|body_1|> def search_ma...
stack_v2_sparse_classes_36k_train_013225
4,126
no_license
[ { "docstring": "垂直或水平二分搜索矩阵。", "name": "binary_search", "signature": "def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool" }, { "docstring": "二分搜索。", "name": "search_matrix", "signature": "def search_matrix(self, matrix: List[List[int]], targ...
3
null
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool: 垂直或水平二分搜索矩阵。 - def search_matrix(self, matrix: List[List[int]],...
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool: 垂直或水平二分搜索矩阵。 - def search_matrix(self, matrix: List[List[int]],...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool: """垂直或水平二分搜索矩阵。""" <|body_0|> def search_matrix(self, matrix: List[List[int]], target: int) -> bool: """二分搜索。""" <|body_1|> def search_ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def binary_search(self, matrix: List[List[int]], target: int, start: int, vertical: bool) -> bool: """垂直或水平二分搜索矩阵。""" low = start hig = len(matrix) - 1 if vertical else len(matrix[0]) - 1 while low <= hig: mid = (low + hig) // 2 if vert...
the_stack_v2_python_sparse
0240_search-a-2d-matrix-ii.py
Nigirimeshi/leetcode
train
0
ff0a6c140c9347b698c5ad7c9dd3590642033ea0
[ "win_reward = 0.0\nheart_cards = {c for c in cards if c.suit == Suit.HEARTS}\nwin_reward += len(heart_cards) * cls._HEART_REWARD\nif cls._QUEEN_OF_SPADES in cards:\n win_reward += cls._QUEEN_REWARD\nreturn win_reward", "if len(next_state.agent_hand) != 0 or len(next_state.opponent_hand) != 0:\n return 0.0\n...
<|body_start_0|> win_reward = 0.0 heart_cards = {c for c in cards if c.suit == Suit.HEARTS} win_reward += len(heart_cards) * cls._HEART_REWARD if cls._QUEEN_OF_SPADES in cards: win_reward += cls._QUEEN_REWARD return win_reward <|end_body_0|> <|body_start_1|> ...
A reward model for the game.
RewardModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RewardModel: """A reward model for the game.""" def __trick_reward(cls, cards: AbstractSet[Card]) -> float: """Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward.""" <|body_0|> def __check_moonshot_reward(cls, n...
stack_v2_sparse_classes_36k_train_013226
3,277
permissive
[ { "docstring": "Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward.", "name": "__trick_reward", "signature": "def __trick_reward(cls, cards: AbstractSet[Card]) -> float" }, { "docstring": "Checks if a player shot the moon and gets the r...
3
stack_v2_sparse_classes_30k_train_005061
Implement the Python class `RewardModel` described below. Class description: A reward model for the game. Method signatures and docstrings: - def __trick_reward(cls, cards: AbstractSet[Card]) -> float: Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward. - de...
Implement the Python class `RewardModel` described below. Class description: A reward model for the game. Method signatures and docstrings: - def __trick_reward(cls, cards: AbstractSet[Card]) -> float: Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward. - de...
b8a3de10c7961d1328ee0273fdde8b444070dc24
<|skeleton|> class RewardModel: """A reward model for the game.""" def __trick_reward(cls, cards: AbstractSet[Card]) -> float: """Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward.""" <|body_0|> def __check_moonshot_reward(cls, n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RewardModel: """A reward model for the game.""" def __trick_reward(cls, cards: AbstractSet[Card]) -> float: """Calculates the reward for winning a particular trick. Args: cards: The cards in the trick. Returns: The reward.""" win_reward = 0.0 heart_cards = {c for c in cards if c.s...
the_stack_v2_python_sparse
hearts_pomdp/models/reward.py
djpetti/hearts_pomdp
train
0
76d61f95b2f041bdddabff067593ee2c7547499a
[ "super().__init__()\nself.averaging = averaging.lower()\nif 'group' in self.averaging:\n self.n = int(self.averaging[5:])\nelse:\n assert self.averaging in ['all', 'flat', 'spatial', 'none', 'gpool'], 'Invalid averaging mode %s' % self.averaging\nself.adjusted_std = lambda x, **kwargs: th.sqrt(th.mean((x - th...
<|body_start_0|> super().__init__() self.averaging = averaging.lower() if 'group' in self.averaging: self.n = int(self.averaging[5:]) else: assert self.averaging in ['all', 'flat', 'spatial', 'none', 'gpool'], 'Invalid averaging mode %s' % self.averaging s...
MinibatchStdDev
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinibatchStdDev: def __init__(self, averaging='all'): """constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev""" <|body_0|> def forward(self, x): """forward pass of the Layer :param x: input :return: y => output""" ...
stack_v2_sparse_classes_36k_train_013227
14,685
no_license
[ { "docstring": "constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev", "name": "__init__", "signature": "def __init__(self, averaging='all')" }, { "docstring": "forward pass of the Layer :param x: input :return: y => output", "name": "forwar...
2
stack_v2_sparse_classes_30k_train_005189
Implement the Python class `MinibatchStdDev` described below. Class description: Implement the MinibatchStdDev class. Method signatures and docstrings: - def __init__(self, averaging='all'): constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev - def forward(self, x):...
Implement the Python class `MinibatchStdDev` described below. Class description: Implement the MinibatchStdDev class. Method signatures and docstrings: - def __init__(self, averaging='all'): constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev - def forward(self, x):...
428abe1fefe5ea4ef00290155e7e59657bc83444
<|skeleton|> class MinibatchStdDev: def __init__(self, averaging='all'): """constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev""" <|body_0|> def forward(self, x): """forward pass of the Layer :param x: input :return: y => output""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinibatchStdDev: def __init__(self, averaging='all'): """constructor for the class :param averaging: the averaging mode used for calculating the MinibatchStdDev""" super().__init__() self.averaging = averaging.lower() if 'group' in self.averaging: self.n = int(self....
the_stack_v2_python_sparse
src/msg_stylegan2.py
blakecheng/lafin
train
0
8656ab61848f42281d4317e17a09a0fe007eded4
[ "try:\n try:\n return ipaddress.ip_address(self.idna_subject).version == 6\n except ValueError:\n try:\n return ipaddress.ip_interface(self.idna_subject).version == 6\n except ValueError:\n return ipaddress.ip_network(self.idna_subject, strict=False).version == 6\nex...
<|body_start_0|> try: try: return ipaddress.ip_address(self.idna_subject).version == 6 except ValueError: try: return ipaddress.ip_interface(self.idna_subject).version == 6 except ValueError: return i...
Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with.
IPv6SyntaxChecker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPv6SyntaxChecker: """Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with.""" def is_valid(self) -> bool: """Validate the given subject.""" <|body_0|> def is_valid_range(self) -> bool: """Checks if the give...
stack_v2_sparse_classes_36k_train_013228
4,395
permissive
[ { "docstring": "Validate the given subject.", "name": "is_valid", "signature": "def is_valid(self) -> bool" }, { "docstring": "Checks if the given subject is an IPv6 range.", "name": "is_valid_range", "signature": "def is_valid_range(self) -> bool" }, { "docstring": "Checks if th...
3
null
Implement the Python class `IPv6SyntaxChecker` described below. Class description: Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with. Method signatures and docstrings: - def is_valid(self) -> bool: Validate the given subject. - def is_valid_range(self) -> boo...
Implement the Python class `IPv6SyntaxChecker` described below. Class description: Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with. Method signatures and docstrings: - def is_valid(self) -> bool: Validate the given subject. - def is_valid_range(self) -> boo...
214a57d0eca3df7c4ed3421937aaff9998452ba6
<|skeleton|> class IPv6SyntaxChecker: """Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with.""" def is_valid(self) -> bool: """Validate the given subject.""" <|body_0|> def is_valid_range(self) -> bool: """Checks if the give...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPv6SyntaxChecker: """Provides an interface to check the syntax of an IPv6. :param str subject: Optional, The subject to work with.""" def is_valid(self) -> bool: """Validate the given subject.""" try: try: return ipaddress.ip_address(self.idna_subject).version...
the_stack_v2_python_sparse
PyFunceble/checker/syntax/ipv6.py
funilrys/PyFunceble
train
267
44c08862f267a5a8b97d5a398194554db1382c01
[ "body = self.client.create_floating_ip(pool=CONF.network.floating_network_name)['floating_ip']\nfloating_ip_id_allocated = body['id']\nself.addCleanup(self.client.delete_floating_ip, floating_ip_id_allocated)\nfloating_ip_details = self.client.show_floating_ip(floating_ip_id_allocated)['floating_ip']\nbody = self.c...
<|body_start_0|> body = self.client.create_floating_ip(pool=CONF.network.floating_network_name)['floating_ip'] floating_ip_id_allocated = body['id'] self.addCleanup(self.client.delete_floating_ip, floating_ip_id_allocated) floating_ip_details = self.client.show_floating_ip(floating_ip_id...
Test floating ips API with compute microversion less than 2.36
FloatingIPsTestJSON
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FloatingIPsTestJSON: """Test floating ips API with compute microversion less than 2.36""" def test_allocate_floating_ip(self): """Test allocating a floating ip to a project""" <|body_0|> def test_delete_floating_ip(self): """Test deleting a valid floating ip from...
stack_v2_sparse_classes_36k_train_013229
5,898
permissive
[ { "docstring": "Test allocating a floating ip to a project", "name": "test_allocate_floating_ip", "signature": "def test_allocate_floating_ip(self)" }, { "docstring": "Test deleting a valid floating ip from project", "name": "test_delete_floating_ip", "signature": "def test_delete_floati...
2
stack_v2_sparse_classes_30k_train_020921
Implement the Python class `FloatingIPsTestJSON` described below. Class description: Test floating ips API with compute microversion less than 2.36 Method signatures and docstrings: - def test_allocate_floating_ip(self): Test allocating a floating ip to a project - def test_delete_floating_ip(self): Test deleting a v...
Implement the Python class `FloatingIPsTestJSON` described below. Class description: Test floating ips API with compute microversion less than 2.36 Method signatures and docstrings: - def test_allocate_floating_ip(self): Test allocating a floating ip to a project - def test_delete_floating_ip(self): Test deleting a v...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class FloatingIPsTestJSON: """Test floating ips API with compute microversion less than 2.36""" def test_allocate_floating_ip(self): """Test allocating a floating ip to a project""" <|body_0|> def test_delete_floating_ip(self): """Test deleting a valid floating ip from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FloatingIPsTestJSON: """Test floating ips API with compute microversion less than 2.36""" def test_allocate_floating_ip(self): """Test allocating a floating ip to a project""" body = self.client.create_floating_ip(pool=CONF.network.floating_network_name)['floating_ip'] floating_ip...
the_stack_v2_python_sparse
tempest/api/compute/floating_ips/test_floating_ips_actions.py
openstack/tempest
train
270
558fafbfdeaf967c101e2685d9dce79aea5a5ecc
[ "if data is not None:\n if not isinstance(data, list):\n raise TypeError('data must be a list')\n if len(data) <= 2:\n raise ValueError('data must contain multiple values')\n self.lambtha = float(sum(data) / len(data))\nelse:\n if lambtha <= 0:\n raise ValueError('lambtha must be a ...
<|body_start_0|> if data is not None: if not isinstance(data, list): raise TypeError('data must be a list') if len(data) <= 2: raise ValueError('data must contain multiple values') self.lambtha = float(sum(data) / len(data)) else: ...
Class Poisson
Poisson
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Poisson: """Class Poisson""" def __init__(self, data=None, lambtha=1.0): """Constructor""" <|body_0|> def pmf(self, k): """Calculates the value of the PMF for a given number of successes""" <|body_1|> def cdf(self, k): """Calculates the value...
stack_v2_sparse_classes_36k_train_013230
1,340
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "Calculates the value of the PMF for a given number of successes", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "Calculates the value ...
3
stack_v2_sparse_classes_30k_train_016958
Implement the Python class `Poisson` described below. Class description: Class Poisson Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Constructor - def pmf(self, k): Calculates the value of the PMF for a given number of successes - def cdf(self, k): Calculates the value of the CDF for...
Implement the Python class `Poisson` described below. Class description: Class Poisson Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Constructor - def pmf(self, k): Calculates the value of the PMF for a given number of successes - def cdf(self, k): Calculates the value of the CDF for...
f83a60babb1d2a510a4a0e0f58aa3880fd9f93a7
<|skeleton|> class Poisson: """Class Poisson""" def __init__(self, data=None, lambtha=1.0): """Constructor""" <|body_0|> def pmf(self, k): """Calculates the value of the PMF for a given number of successes""" <|body_1|> def cdf(self, k): """Calculates the value...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Poisson: """Class Poisson""" def __init__(self, data=None, lambtha=1.0): """Constructor""" if data is not None: if not isinstance(data, list): raise TypeError('data must be a list') if len(data) <= 2: raise ValueError('data must cont...
the_stack_v2_python_sparse
math/0x03-probability/poisson.py
jalondono/holbertonschool-machine_learning
train
2
16f9f1e8880f2224d95e06113601ceb529e55b72
[ "xyz = _handle_input(x, y, z, dtype, device, 'scale', allow_singleton=True)\nsuper().__init__(device=xyz.device, dtype=dtype)\nN = xyz.shape[0]\nmat = torch.eye(4, dtype=dtype, device=self.device)\nmat = mat.view(1, 4, 4).repeat(N, 1, 1)\nmat[:, 0, 0] = xyz[:, 0]\nmat[:, 1, 1] = xyz[:, 1]\nmat[:, 2, 2] = xyz[:, 2]\...
<|body_start_0|> xyz = _handle_input(x, y, z, dtype, device, 'scale', allow_singleton=True) super().__init__(device=xyz.device, dtype=dtype) N = xyz.shape[0] mat = torch.eye(4, dtype=dtype, device=self.device) mat = mat.view(1, 4, 4).repeat(N, 1, 1) mat[:, 0, 0] = xyz[:, ...
Scale
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scale: def __init__(self, x, y=None, z=None, dtype: torch.dtype=torch.float32, device: Optional[Device]=None) -> None: """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can b...
stack_v2_sparse_classes_36k_train_013231
30,693
permissive
[ { "docstring": "A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Python scalar or torch scalar: Single uniform scale - 1D torch tensor of shape (N,): A batch of uniform scale - 2D torc...
2
stack_v2_sparse_classes_30k_val_000374
Implement the Python class `Scale` described below. Class description: Implement the Scale class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype: torch.dtype=torch.float32, device: Optional[Device]=None) -> None: A Transform3d representing a scaling operation, with different scale fac...
Implement the Python class `Scale` described below. Class description: Implement the Scale class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype: torch.dtype=torch.float32, device: Optional[Device]=None) -> None: A Transform3d representing a scaling operation, with different scale fac...
a3d99cab6bf5eb69be8d5eb48895da6edd859565
<|skeleton|> class Scale: def __init__(self, x, y=None, z=None, dtype: torch.dtype=torch.float32, device: Optional[Device]=None) -> None: """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scale: def __init__(self, x, y=None, z=None, dtype: torch.dtype=torch.float32, device: Optional[Device]=None) -> None: """A Transform3d representing a scaling operation, with different scale factors along each coordinate axis. Option I: Scale(s, dtype=torch.float32, device='cpu') s can be one of - Pyt...
the_stack_v2_python_sparse
pytorch3d/transforms/transform3d.py
facebookresearch/pytorch3d
train
7,964
4e11c631748b22e690812ceaec6da6e614889ae4
[ "if not head or not head.next:\n return head\npre = None\nwhile head:\n cur = head\n head = head.next\n cur.next = pre\n pre = cur\nreturn pre", "if not head or not head.next:\n return head\nlast = self.reverseList1(head.next)\nhead.next.next = head\nhead.next = None\nreturn last" ]
<|body_start_0|> if not head or not head.next: return head pre = None while head: cur = head head = head.next cur.next = pre pre = cur return pre <|end_body_0|> <|body_start_1|> if not head or not head.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList(self, head): """递归""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not head.next: return head pre = Non...
stack_v2_sparse_classes_36k_train_013232
1,145
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList1", "signature": "def reverseList1(self, head)" }, { "docstring": "递归", "name": "reverseList", "signature": "def reverseList(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList1(self, head): :type head: ListNode :rtype: ListNode - def reverseList(self, head): 递归
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList1(self, head): :type head: ListNode :rtype: ListNode - def reverseList(self, head): 递归 <|skeleton|> class Solution: def reverseList1(self, head): """...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList(self, head): """递归""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" if not head or not head.next: return head pre = None while head: cur = head head = head.next cur.next = pre pre = cur return p...
the_stack_v2_python_sparse
out/production/leetcode/206.反转链表.py
yangyuxiang1996/leetcode
train
0
f7eed9e0508c1d20da8203762f8580bc0e01a85d
[ "normalizer = self._get_normalizer(extension)\na_norm = normalizer(a)\nb_norm = normalizer(b)\nif a_params is None or b_params is None:\n outdated_params = False\nelse:\n a_params_ = remove_non_serializable_top_keys(a_params)\n b_params_ = remove_non_serializable_top_keys(b_params)\n outdated_params = a...
<|body_start_0|> normalizer = self._get_normalizer(extension) a_norm = normalizer(a) b_norm = normalizer(b) if a_params is None or b_params is None: outdated_params = False else: a_params_ = remove_non_serializable_top_keys(a_params) b_params_ ...
CodeDiffer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeDiffer: def is_different(self, a, b, a_params, b_params, extension=None): """Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're no JSON serializable. Parameters ---------- a : str Code to compare b : str Code to compare a_params...
stack_v2_sparse_classes_36k_train_013233
5,084
permissive
[ { "docstring": "Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're no JSON serializable. Parameters ---------- a : str Code to compare b : str Code to compare a_params : dict Params passed to a b_params : dict Params passed to b extension : str, default=No...
3
stack_v2_sparse_classes_30k_train_020980
Implement the Python class `CodeDiffer` described below. Class description: Implement the CodeDiffer class. Method signatures and docstrings: - def is_different(self, a, b, a_params, b_params, extension=None): Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're n...
Implement the Python class `CodeDiffer` described below. Class description: Implement the CodeDiffer class. Method signatures and docstrings: - def is_different(self, a, b, a_params, b_params, extension=None): Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're n...
516b64e531b13eeda36b747a268506fa8dd4dc98
<|skeleton|> class CodeDiffer: def is_different(self, a, b, a_params, b_params, extension=None): """Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're no JSON serializable. Parameters ---------- a : str Code to compare b : str Code to compare a_params...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeDiffer: def is_different(self, a, b, a_params, b_params, extension=None): """Compares code and params to determine if it's changed. Ignores top-keys in a_params or b_params if they're no JSON serializable. Parameters ---------- a : str Code to compare b : str Code to compare a_params : dict Params...
the_stack_v2_python_sparse
src/ploomber/codediffer.py
ploomber/ploomber
train
3,076
19568443677c3027c374d0c301402dbc65662e91
[ "session = db.session()\nrepo = self._exists(session, reponame)\nif not repo:\n yield ('A repository by the name of %s was not found.' % reponame)\n return\nif not self.check_perms(session, repo):\n yield \"%(LR)Error:%(RST)s You don't have the required permissions.\"\n return\nlog.debug(repo)\nyield '%...
<|body_start_0|> session = db.session() repo = self._exists(session, reponame) if not repo: yield ('A repository by the name of %s was not found.' % reponame) return if not self.check_perms(session, repo): yield "%(LR)Error:%(RST)s You don't have the r...
Repository managers commands.
RepositoryManagersCommands
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepositoryManagersCommands: """Repository managers commands.""" def do_list(self, reponame): """List repository users.""" <|body_0|> def do_add(self, reponame, username): """Add username as a manager of the repository.""" <|body_1|> def do_delete(sel...
stack_v2_sparse_classes_36k_train_013234
6,649
no_license
[ { "docstring": "List repository users.", "name": "do_list", "signature": "def do_list(self, reponame)" }, { "docstring": "Add username as a manager of the repository.", "name": "do_add", "signature": "def do_add(self, reponame, username)" }, { "docstring": "Add username as a mana...
3
stack_v2_sparse_classes_30k_train_020141
Implement the Python class `RepositoryManagersCommands` described below. Class description: Repository managers commands. Method signatures and docstrings: - def do_list(self, reponame): List repository users. - def do_add(self, reponame, username): Add username as a manager of the repository. - def do_delete(self, r...
Implement the Python class `RepositoryManagersCommands` described below. Class description: Repository managers commands. Method signatures and docstrings: - def do_list(self, reponame): List repository users. - def do_add(self, reponame, username): Add username as a manager of the repository. - def do_delete(self, r...
75f0c76f67ad4d98f83645a1ae05980dd5aa28e6
<|skeleton|> class RepositoryManagersCommands: """Repository managers commands.""" def do_list(self, reponame): """List repository users.""" <|body_0|> def do_add(self, reponame, username): """Add username as a manager of the repository.""" <|body_1|> def do_delete(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepositoryManagersCommands: """Repository managers commands.""" def do_list(self, reponame): """List repository users.""" session = db.session() repo = self._exists(session, reponame) if not repo: yield ('A repository by the name of %s was not found.' % reponam...
the_stack_v2_python_sparse
sshg/terminal/commands/repositories.py
UfSoft/SSHg
train
0
36d3ba64d94d0abda5ce0ae3926ac99dc9290e1c
[ "if values and values[0].upper() not in VALID_CURRENCIES:\n error = {'currency': f'\"{values[0]}\" is not a valid choice.'}\n raise serializers.ValidationError(error)\nlookup = '__'.join([name, 'iexact'])\nqueries = [Q(**{lookup: val}) for val in values]\nreturn qs.filter(reduce(and_, queries))", "lookup = ...
<|body_start_0|> if values and values[0].upper() not in VALID_CURRENCIES: error = {'currency': f'"{values[0]}" is not a valid choice.'} raise serializers.ValidationError(error) lookup = '__'.join([name, 'iexact']) queries = [Q(**{lookup: val}) for val in values] r...
Cost model custom filters.
CostModelsFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CostModelsFilter: """Cost model custom filters.""" def currency_filter(self, qs, name, values): """Filter currency if a valid currency is passed in""" <|body_0|> def list_contain_filter(self, qs, name, values): """Filter items that contain values in their name.""...
stack_v2_sparse_classes_36k_train_013235
7,177
permissive
[ { "docstring": "Filter currency if a valid currency is passed in", "name": "currency_filter", "signature": "def currency_filter(self, qs, name, values)" }, { "docstring": "Filter items that contain values in their name.", "name": "list_contain_filter", "signature": "def list_contain_filt...
2
null
Implement the Python class `CostModelsFilter` described below. Class description: Cost model custom filters. Method signatures and docstrings: - def currency_filter(self, qs, name, values): Filter currency if a valid currency is passed in - def list_contain_filter(self, qs, name, values): Filter items that contain va...
Implement the Python class `CostModelsFilter` described below. Class description: Cost model custom filters. Method signatures and docstrings: - def currency_filter(self, qs, name, values): Filter currency if a valid currency is passed in - def list_contain_filter(self, qs, name, values): Filter items that contain va...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class CostModelsFilter: """Cost model custom filters.""" def currency_filter(self, qs, name, values): """Filter currency if a valid currency is passed in""" <|body_0|> def list_contain_filter(self, qs, name, values): """Filter items that contain values in their name.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CostModelsFilter: """Cost model custom filters.""" def currency_filter(self, qs, name, values): """Filter currency if a valid currency is passed in""" if values and values[0].upper() not in VALID_CURRENCIES: error = {'currency': f'"{values[0]}" is not a valid choice.'} ...
the_stack_v2_python_sparse
koku/cost_models/view.py
project-koku/koku
train
225
6614603460b8fd51230e57809d6de1dbd62674fb
[ "super(ConvModule, self).__init__()\nself.activation = activation\nself.inplace = inplace\nself.activate_last = activate_last\nself.with_norm = True\nself.with_activatation = activation is not None\nif bias == 'auto':\n bias = False if self.with_norm else True\nself.with_bias = bias\nself.conv = ops.Conv2d(in_ch...
<|body_start_0|> super(ConvModule, self).__init__() self.activation = activation self.inplace = inplace self.activate_last = activate_last self.with_norm = True self.with_activatation = activation is not None if bias == 'auto': bias = False if self.wit...
Conv Module with Normalization.
ConvModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvModule: """Conv Module with Normalization.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True): """Init Conv Module with Normalization.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_013236
12,928
permissive
[ { "docstring": "Init Conv Module with Normalization.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True)" }, { "docstring": "Forward compute of ...
2
null
Implement the Python class `ConvModule` described below. Class description: Conv Module with Normalization. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True): Init ...
Implement the Python class `ConvModule` described below. Class description: Conv Module with Normalization. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True): Init ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ConvModule: """Conv Module with Normalization.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True): """Init Conv Module with Normalization.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvModule: """Conv Module with Normalization.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias='auto', activation='relu', inplace=True, activate_last=True): """Init Conv Module with Normalization.""" super(ConvModule, self).__i...
the_stack_v2_python_sparse
zeus/networks/necks.py
huawei-noah/xingtian
train
308
e7489c44e03af5e6654bd85d1647009e2303461e
[ "self.Ch2P2_19a = 10\nself.Ch2P2_19b = 17\nself.Ch2P2_19c = 6\nself.Ch2P2_19d = 8\nself.Ch2P2_20a = 14\nself.Ch2P2_20b = 8\nself.Ch2P2_20c = 13\nself.Ch2P2_20d = 6\nself.Ch2P2_22a = '00010001 11101010 00100010 00001110'\nself.Ch2P2_22b = '00001110 00111000 11101010 00111000'\nself.Ch2P2_22c = '01101110 00001110 001...
<|body_start_0|> self.Ch2P2_19a = 10 self.Ch2P2_19b = 17 self.Ch2P2_19c = 6 self.Ch2P2_19d = 8 self.Ch2P2_20a = 14 self.Ch2P2_20b = 8 self.Ch2P2_20c = 13 self.Ch2P2_20d = 6 self.Ch2P2_22a = '00010001 11101010 00100010 00001110' self.Ch2P2_2...
HW02
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 Ch3 : 第三章 P3_28a: 第三章...
stack_v2_sparse_classes_36k_train_013237
2,811
no_license
[ { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = \"xxx\" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 \"xxx\" : 你要填入你的答地方。", "name": "ch2", "signature": "def ch2(self)" }, { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = \"xxx\" 意思是 Ch3 : 第三章 P3_28a: 第...
2
null
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 - def ch3(self): 請將你計算出來的答案填入以下變...
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 - def ch3(self): 請將你計算出來的答案填入以下變...
008575d161d48672f906bdaec130f0c5060cd36d
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 Ch3 : 第三章 P3_28a: 第三章...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" self.Ch2P2_19a = 10 self.Ch2P2_19b = 17 self.Ch2P2_19c = 6 self.Ch2P2_19d = 8 self.Ch2P2_20a = 1...
the_stack_v2_python_sparse
homework02_b05505009.py
PeterWolf-tw/ESOE-CS101-2016
train
21
91425a498569e7a7513dbf0e04d734cbc4aff1bb
[ "dict.__init__(data)\nself.data = data\nfor cate in data:\n for arg in cate:\n if not isinstance(data[cate][arg], types.ListType):\n continue\n if not (isinstance(data[cate][arg][1], IntVar) or isinstance(data[cate][arg][1], StringVar)):\n continue\n value = data[cate][...
<|body_start_0|> dict.__init__(data) self.data = data for cate in data: for arg in cate: if not isinstance(data[cate][arg], types.ListType): continue if not (isinstance(data[cate][arg][1], IntVar) or isinstance(data[cate][arg][1], S...
dataStream
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" <|body_0|> def synchro(self): """synchro the dataStream from Tkinter *Var to string/int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict.__init__(data) ...
stack_v2_sparse_classes_36k_train_013238
1,263
no_license
[ { "docstring": "a datastream manager depend on python's dict", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "synchro the dataStream from Tkinter *Var to string/int", "name": "synchro", "signature": "def synchro(self)" } ]
2
stack_v2_sparse_classes_30k_train_010660
Implement the Python class `dataStream` described below. Class description: Implement the dataStream class. Method signatures and docstrings: - def __init__(self, data): a datastream manager depend on python's dict - def synchro(self): synchro the dataStream from Tkinter *Var to string/int
Implement the Python class `dataStream` described below. Class description: Implement the dataStream class. Method signatures and docstrings: - def __init__(self, data): a datastream manager depend on python's dict - def synchro(self): synchro the dataStream from Tkinter *Var to string/int <|skeleton|> class dataStr...
8f2af73f6bfe0c6d4d1d0d9a8572b31e4f91e66c
<|skeleton|> class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" <|body_0|> def synchro(self): """synchro the dataStream from Tkinter *Var to string/int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" dict.__init__(data) self.data = data for cate in data: for arg in cate: if not isinstance(data[cate][arg], types.ListType): continue ...
the_stack_v2_python_sparse
dataStream.py
humanfans/ncep-displayer
train
0
9a56836f04f96f0e729ca4ddec3c4afe18a53ec3
[ "self.engine = engine\nself.naming = naming\nself.metadata = metadata or MetaData(engine)\nself.inspector = reflection.Inspector.from_engine(engine)", "schema = self.naming.fact_schema or self.naming.schema\nnames = self.inspector.get_table_names(schema)\nreturn self.naming.facts(names)", "schema = self.naming....
<|body_start_0|> self.engine = engine self.naming = naming self.metadata = metadata or MetaData(engine) self.inspector = reflection.Inspector.from_engine(engine) <|end_body_0|> <|body_start_1|> schema = self.naming.fact_schema or self.naming.schema names = self.inspector...
Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental.
SQLSchemaInspector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLSchemaInspector: """Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental.""" def __init__(self, engine, naming, metadata=None): """Creates an inspector that discovers tables in a database acco...
stack_v2_sparse_classes_36k_train_013239
24,951
no_license
[ { "docstring": "Creates an inspector that discovers tables in a database according to specified configuration and naming conventions.", "name": "__init__", "signature": "def __init__(self, engine, naming, metadata=None)" }, { "docstring": "discovers tables that might be fact tables by name.", ...
3
stack_v2_sparse_classes_30k_test_000410
Implement the Python class `SQLSchemaInspector` described below. Class description: Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental. Method signatures and docstrings: - def __init__(self, engine, naming, metadata=None): Crea...
Implement the Python class `SQLSchemaInspector` described below. Class description: Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental. Method signatures and docstrings: - def __init__(self, engine, naming, metadata=None): Crea...
067f502154eefc4199ad3f3e0d54fad4acd2d274
<|skeleton|> class SQLSchemaInspector: """Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental.""" def __init__(self, engine, naming, metadata=None): """Creates an inspector that discovers tables in a database acco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLSchemaInspector: """Object that discovers fact and dimension tables in a database according to specified configuration and naming conventions. Note: expreimental.""" def __init__(self, engine, naming, metadata=None): """Creates an inspector that discovers tables in a database according to spec...
the_stack_v2_python_sparse
env/Lib/site-packages/cubes/sql/store.py
wgiovanni/teg-backend-integration
train
0
23d4df17f53012939c8366f6cd89a53e62280bbd
[ "known_menu = ' Select one of the actions below:\\n\\n 1. Send a Thank You\\n 2. Create a Report\\n 3. Send letters to everyone\\n 4. Quit\\n\\n '\nexpected_result = mailroom.display_menu()\nself.assertEqual(expected_result, known_menu)\nself.assertIsNotNone(expected_result)\nself.assertIsInstance(ex...
<|body_start_0|> known_menu = ' Select one of the actions below:\n\n 1. Send a Thank You\n 2. Create a Report\n 3. Send letters to everyone\n 4. Quit\n\n ' expected_result = mailroom.display_menu() self.assertEqual(expected_result, known_menu) self.assertIsNotNone(expected...
TestMailroom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMailroom: def test_display_menu(self): """test display_menu function of mailroom.py""" <|body_0|> def test_convert_to_float(self): """test convert_to_float function of mailroom.py""" <|body_1|> def test_generate_email_template(self): """test ...
stack_v2_sparse_classes_36k_train_013240
3,546
no_license
[ { "docstring": "test display_menu function of mailroom.py", "name": "test_display_menu", "signature": "def test_display_menu(self)" }, { "docstring": "test convert_to_float function of mailroom.py", "name": "test_convert_to_float", "signature": "def test_convert_to_float(self)" }, { ...
6
null
Implement the Python class `TestMailroom` described below. Class description: Implement the TestMailroom class. Method signatures and docstrings: - def test_display_menu(self): test display_menu function of mailroom.py - def test_convert_to_float(self): test convert_to_float function of mailroom.py - def test_generat...
Implement the Python class `TestMailroom` described below. Class description: Implement the TestMailroom class. Method signatures and docstrings: - def test_display_menu(self): test display_menu function of mailroom.py - def test_convert_to_float(self): test convert_to_float function of mailroom.py - def test_generat...
e298b1151dab639659d8dfa56f47bcb43dd3438f
<|skeleton|> class TestMailroom: def test_display_menu(self): """test display_menu function of mailroom.py""" <|body_0|> def test_convert_to_float(self): """test convert_to_float function of mailroom.py""" <|body_1|> def test_generate_email_template(self): """test ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMailroom: def test_display_menu(self): """test display_menu function of mailroom.py""" known_menu = ' Select one of the actions below:\n\n 1. Send a Thank You\n 2. Create a Report\n 3. Send letters to everyone\n 4. Quit\n\n ' expected_result = mailroom.display_menu()...
the_stack_v2_python_sparse
students/tri_nguyen/lesson06/test_mailroom.py
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
train
13
c658f939293fd0572f917083841dc6384a5fb20e
[ "data = ImgShard(index=index, uuid=uuid, imgString=imgString)\ndbSession.add(data)\nreturn dbSession.commit()", "obj = dbSession.query(ImgShard).filter_by(uuid=uuid).order_by('index').all()\ndata = Utils.db_to_d(obj)\nreturn data" ]
<|body_start_0|> data = ImgShard(index=index, uuid=uuid, imgString=imgString) dbSession.add(data) return dbSession.commit() <|end_body_0|> <|body_start_1|> obj = dbSession.query(ImgShard).filter_by(uuid=uuid).order_by('index').all() data = Utils.db_to_d(obj) return data ...
ImgShard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImgShard: def add(index, uuid, imgString): """增加分片数据 :param index: :param uuid: :param imgString: :return:""" <|body_0|> def get_data(uuid): """根据uuid获取分片数据 :param uuid: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = ImgShard(index=...
stack_v2_sparse_classes_36k_train_013241
949
no_license
[ { "docstring": "增加分片数据 :param index: :param uuid: :param imgString: :return:", "name": "add", "signature": "def add(index, uuid, imgString)" }, { "docstring": "根据uuid获取分片数据 :param uuid: :return:", "name": "get_data", "signature": "def get_data(uuid)" } ]
2
stack_v2_sparse_classes_30k_train_000862
Implement the Python class `ImgShard` described below. Class description: Implement the ImgShard class. Method signatures and docstrings: - def add(index, uuid, imgString): 增加分片数据 :param index: :param uuid: :param imgString: :return: - def get_data(uuid): 根据uuid获取分片数据 :param uuid: :return:
Implement the Python class `ImgShard` described below. Class description: Implement the ImgShard class. Method signatures and docstrings: - def add(index, uuid, imgString): 增加分片数据 :param index: :param uuid: :param imgString: :return: - def get_data(uuid): 根据uuid获取分片数据 :param uuid: :return: <|skeleton|> class ImgShar...
59c61f94c469038f641b451cb3f5d1adabdfe6a9
<|skeleton|> class ImgShard: def add(index, uuid, imgString): """增加分片数据 :param index: :param uuid: :param imgString: :return:""" <|body_0|> def get_data(uuid): """根据uuid获取分片数据 :param uuid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImgShard: def add(index, uuid, imgString): """增加分片数据 :param index: :param uuid: :param imgString: :return:""" data = ImgShard(index=index, uuid=uuid, imgString=imgString) dbSession.add(data) return dbSession.commit() def get_data(uuid): """根据uuid获取分片数据 :param uuid:...
the_stack_v2_python_sparse
app/Models/ImgShard.py
FreeGodCode/flask-restful-api
train
0
9d23470887d73755c46c900dd53009a8fa564faf
[ "if verbosity == 1:\n return '{}'.format(self.terse_message)\nelif verbosity == 2:\n return '{}: {}'.format(self.general_message, self.terse_message)\nelse:\n raise Exception('Unrecognized verbosity setting, {}.'.format(verbosity))", "self.function = function\nif line_numbers:\n self.line_numbers = li...
<|body_start_0|> if verbosity == 1: return '{}'.format(self.terse_message) elif verbosity == 2: return '{}: {}'.format(self.general_message, self.terse_message) else: raise Exception('Unrecognized verbosity setting, {}.'.format(verbosity)) <|end_body_0|> <|bo...
The base error class for any darglint error.
DarglintError
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises...
stack_v2_sparse_classes_36k_train_013242
19,613
permissive
[ { "docstring": "Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises: Exception: If the verbosity level is not recognized. Returns: An error message.", "name": "message", "s...
2
stack_v2_sparse_classes_30k_train_020701
Implement the Python class `DarglintError` described below. Class description: The base error class for any darglint error. Method signatures and docstrings: - def message(self, verbosity=1): Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more te...
Implement the Python class `DarglintError` described below. Class description: The base error class for any darglint error. Method signatures and docstrings: - def message(self, verbosity=1): Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more te...
abc26b768cd7135d848223ba53f68323593c33d5
<|skeleton|> class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DarglintError: """The base error class for any darglint error.""" def message(self, verbosity=1): """Get the message for this error, according to the verbosity. Args: verbosity: An integer in the set {1,2}, where 1 is a more terse message, and 2 includes a general description. Raises: Exception: ...
the_stack_v2_python_sparse
darglint/errors.py
terrencepreilly/darglint
train
487
90072b0f890b561817b80cd21124fff2a744ba31
[ "rows = queryset.update(reportable=False)\nif rows == 1:\n bit = '1 harvest'\nelse:\n bit = '%s harvests' % rows\nself.message_user(request, '%s marked as unreportable' % bit)", "rows = queryset.update(reportable=True)\nif rows == 1:\n bit = '1 harvest'\nelse:\n bit = '%s harvests' % rows\nself.messag...
<|body_start_0|> rows = queryset.update(reportable=False) if rows == 1: bit = '1 harvest' else: bit = '%s harvests' % rows self.message_user(request, '%s marked as unreportable' % bit) <|end_body_0|> <|body_start_1|> rows = queryset.update(reportable=True...
HarvestAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" <|body_0|> def mark_as_reportable(self, request, queryset): """mark a set of varieties as reportable""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_013243
1,476
no_license
[ { "docstring": "mark a set of varieties as unreportable", "name": "mark_as_unreportable", "signature": "def mark_as_unreportable(self, request, queryset)" }, { "docstring": "mark a set of varieties as reportable", "name": "mark_as_reportable", "signature": "def mark_as_reportable(self, r...
2
stack_v2_sparse_classes_30k_train_017584
Implement the Python class `HarvestAdmin` described below. Class description: Implement the HarvestAdmin class. Method signatures and docstrings: - def mark_as_unreportable(self, request, queryset): mark a set of varieties as unreportable - def mark_as_reportable(self, request, queryset): mark a set of varieties as r...
Implement the Python class `HarvestAdmin` described below. Class description: Implement the HarvestAdmin class. Method signatures and docstrings: - def mark_as_unreportable(self, request, queryset): mark a set of varieties as unreportable - def mark_as_reportable(self, request, queryset): mark a set of varieties as r...
ce964d52c3565de45611537f606a4bccc88cae2f
<|skeleton|> class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" <|body_0|> def mark_as_reportable(self, request, queryset): """mark a set of varieties as reportable""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HarvestAdmin: def mark_as_unreportable(self, request, queryset): """mark a set of varieties as unreportable""" rows = queryset.update(reportable=False) if rows == 1: bit = '1 harvest' else: bit = '%s harvests' % rows self.message_user(request, '%...
the_stack_v2_python_sparse
barn/metrics/harvestcount/admin.py
ebrelsford/Farming-Concrete
train
4
cd1dcc7943b5b0910611c7826539ded39b3590c2
[ "if self.request.user.is_authenticated and self.request.user.deck.count() > 50:\n try:\n return self.request.user.has_active_subscription or self.request.user.subscription.type.product.attr.access_cards\n except:\n return False\nif not hasattr(self, 'get_object'):\n if self.request.user.is_au...
<|body_start_0|> if self.request.user.is_authenticated and self.request.user.deck.count() > 50: try: return self.request.user.has_active_subscription or self.request.user.subscription.type.product.attr.access_cards except: return False if not hasat...
RevisionPermissionMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevisionPermissionMixin: def test_func(self): """Check if trial period is over and if user is allowed to access requested object.""" <|body_0|> def handle_no_permission(self): """Ask user to login or to subscribe to a cards plan.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_013244
26,085
permissive
[ { "docstring": "Check if trial period is over and if user is allowed to access requested object.", "name": "test_func", "signature": "def test_func(self)" }, { "docstring": "Ask user to login or to subscribe to a cards plan.", "name": "handle_no_permission", "signature": "def handle_no_p...
2
stack_v2_sparse_classes_30k_train_006304
Implement the Python class `RevisionPermissionMixin` described below. Class description: Implement the RevisionPermissionMixin class. Method signatures and docstrings: - def test_func(self): Check if trial period is over and if user is allowed to access requested object. - def handle_no_permission(self): Ask user to ...
Implement the Python class `RevisionPermissionMixin` described below. Class description: Implement the RevisionPermissionMixin class. Method signatures and docstrings: - def test_func(self): Check if trial period is over and if user is allowed to access requested object. - def handle_no_permission(self): Ask user to ...
461de3ba011c0aaed3f0014136c4497b6890d086
<|skeleton|> class RevisionPermissionMixin: def test_func(self): """Check if trial period is over and if user is allowed to access requested object.""" <|body_0|> def handle_no_permission(self): """Ask user to login or to subscribe to a cards plan.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RevisionPermissionMixin: def test_func(self): """Check if trial period is over and if user is allowed to access requested object.""" if self.request.user.is_authenticated and self.request.user.deck.count() > 50: try: return self.request.user.has_active_subscription ...
the_stack_v2_python_sparse
blousebrothers/cards/views.py
sladinji/blousebrothers
train
1
d6325cd677c5b59d8134c8604008ddef2de4177f
[ "try:\n subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id)\nexcept MailChimpError as api_error:\n response = {'errors': {}}\n error_details = api_error.args[0]\n response['errors']['title'] = error_details['title']\n response['errors']['detail'] = error_details['detail']\n ...
<|body_start_0|> try: subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id) except MailChimpError as api_error: response = {'errors': {}} error_details = api_error.args[0] response['errors']['title'] = error_details['title'] ...
View to retrieve all of the subscribers in a list and add a subscriber to a list.
SubscribersAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscribersAPI: """View to retrieve all of the subscribers in a list and add a subscriber to a list.""" def get(self, list_id): """Return all subscribers that are in the given list.""" <|body_0|> def post(self, list_id): """Add a new subscriber to the given list....
stack_v2_sparse_classes_36k_train_013245
3,667
no_license
[ { "docstring": "Return all subscribers that are in the given list.", "name": "get", "signature": "def get(self, list_id)" }, { "docstring": "Add a new subscriber to the given list.", "name": "post", "signature": "def post(self, list_id)" } ]
2
stack_v2_sparse_classes_30k_val_000759
Implement the Python class `SubscribersAPI` described below. Class description: View to retrieve all of the subscribers in a list and add a subscriber to a list. Method signatures and docstrings: - def get(self, list_id): Return all subscribers that are in the given list. - def post(self, list_id): Add a new subscrib...
Implement the Python class `SubscribersAPI` described below. Class description: View to retrieve all of the subscribers in a list and add a subscriber to a list. Method signatures and docstrings: - def get(self, list_id): Return all subscribers that are in the given list. - def post(self, list_id): Add a new subscrib...
d5ae552d383f5f971e29a38055c518fc68172f32
<|skeleton|> class SubscribersAPI: """View to retrieve all of the subscribers in a list and add a subscriber to a list.""" def get(self, list_id): """Return all subscribers that are in the given list.""" <|body_0|> def post(self, list_id): """Add a new subscriber to the given list....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscribersAPI: """View to retrieve all of the subscribers in a list and add a subscriber to a list.""" def get(self, list_id): """Return all subscribers that are in the given list.""" try: subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id) e...
the_stack_v2_python_sparse
server/app/mailchimp/resources/subscribers.py
EricMontague/MailChimp-Newsletter-Project
train
0
86bb6d28cb5113a1ce461c504b61d7d931813846
[ "fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3])\nu = points.x * fx + cx\nv = points.y * fy + cy\nreturn Vector2.from_coords(u, v)", "fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3])\nx = (points.x - cx) / fx\ny = (points.y - cy) / fy\nreturn Vect...
<|body_start_0|> fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3]) u = points.x * fx + cx v = points.y * fy + cy return Vector2.from_coords(u, v) <|end_body_0|> <|body_start_1|> fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], par...
AffineTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 repres...
stack_v2_sparse_classes_36k_train_013246
2,163
permissive
[ { "docstring": "Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 representing the distorted points. Example: >>> params = Tensor([1., 2., 3., 4.]) >>> points = Ve...
2
stack_v2_sparse_classes_30k_train_004353
Implement the Python class `AffineTransform` described below. Class description: Implement the AffineTransform class. Method signatures and docstrings: - def distort(self, params: Tensor, points: Vector2) -> Vector2: Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the ...
Implement the Python class `AffineTransform` described below. Class description: Implement the AffineTransform class. Method signatures and docstrings: - def distort(self, params: Tensor, points: Vector2) -> Vector2: Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the ...
1e0f8baa7318c05b17ea6dbb48605691bca8972f
<|skeleton|> class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 repres...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 representing the dis...
the_stack_v2_python_sparse
kornia/sensors/camera/distortion_model.py
kornia/kornia
train
7,351
43d55ab51133c0af8cccc5c42c97e2115b715a3a
[ "assert isinstance(root, Node), 'Invalid node %s' % root\nassert isinstance(invoker, Invoker), 'Invalid invoker %s' % invoker\nif invoker.method != GET:\n return False\nif isinstance(invoker.output, Iter):\n assert isinstance(invoker.output, Iter)\n output = invoker.output.itemType\n isList = True\nelse...
<|body_start_0|> assert isinstance(root, Node), 'Invalid node %s' % root assert isinstance(invoker, Invoker), 'Invalid invoker %s' % invoker if invoker.method != GET: return False if isinstance(invoker.output, Iter): assert isinstance(invoker.output, Iter) ...
Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is crucial since based on that the call is placed in the REST Node tree.
AssembleGet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssembleGet: """Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is crucial since based on that the call is ...
stack_v2_sparse_classes_36k_train_013247
24,625
no_license
[ { "docstring": "@see: AssembleOneByOne.assembleInvoker", "name": "assembleInvoker", "signature": "def assembleInvoker(self, root, invoker)" }, { "docstring": "Provides all the nodes for the provided model obtained by combining the mandatory and extra types. @param root: Node The root node to ass...
2
stack_v2_sparse_classes_30k_train_001944
Implement the Python class `AssembleGet` described below. Class description: Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is c...
Implement the Python class `AssembleGet` described below. Class description: Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is c...
a10cb774c8cbc5010950eed9342413846734fea7
<|skeleton|> class AssembleGet: """Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is crucial since based on that the call is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssembleGet: """Resolving the GET method invokers. Method signature needs to be flagged with GET and look like: AnyEntity|AnyEntity.Property|Iter(AnyEntity)|Iter(AnyEntity.Id) % ([...AnyEntity.Property]) !!!Attention the order of the mandatory arguments is crucial since based on that the call is placed in the...
the_stack_v2_python_sparse
components/ally-core/ally/core/impl/assembler.py
bonomali/Ally-Py
train
0
aeb28f9474baed3998ba0b34f4a76adb72b1161a
[ "if obj.declined_at and action != 'decline':\n messages.error(request, f'Declined offer can not be {action}ed.')\nelif obj.accepted_at and action != 'accept':\n messages.error(request, f'Accepted offer can not be {action}ed.')\nelif obj.accepted_at and action == 'accept' or (obj.declined_at and action == 'dec...
<|body_start_0|> if obj.declined_at and action != 'decline': messages.error(request, f'Declined offer can not be {action}ed.') elif obj.accepted_at and action != 'accept': messages.error(request, f'Accepted offer can not be {action}ed.') elif obj.accepted_at and action ==...
Offer admin. Admin class definitions for ``Offer`` model.
OfferAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferAdmin: """Offer admin. Admin class definitions for ``Offer`` model.""" def _check_change_ability(self, request, obj, action): """Check if offer can be changed and create message error if not. action can be any of these (accept, decline, change)""" <|body_0|> def acc...
stack_v2_sparse_classes_36k_train_013248
2,523
no_license
[ { "docstring": "Check if offer can be changed and create message error if not. action can be any of these (accept, decline, change)", "name": "_check_change_ability", "signature": "def _check_change_ability(self, request, obj, action)" }, { "docstring": "Accept the offer.", "name": "accept",...
4
stack_v2_sparse_classes_30k_train_016463
Implement the Python class `OfferAdmin` described below. Class description: Offer admin. Admin class definitions for ``Offer`` model. Method signatures and docstrings: - def _check_change_ability(self, request, obj, action): Check if offer can be changed and create message error if not. action can be any of these (ac...
Implement the Python class `OfferAdmin` described below. Class description: Offer admin. Admin class definitions for ``Offer`` model. Method signatures and docstrings: - def _check_change_ability(self, request, obj, action): Check if offer can be changed and create message error if not. action can be any of these (ac...
45bae96b64f022a50dd8cdb3460b47ae062748ed
<|skeleton|> class OfferAdmin: """Offer admin. Admin class definitions for ``Offer`` model.""" def _check_change_ability(self, request, obj, action): """Check if offer can be changed and create message error if not. action can be any of these (accept, decline, change)""" <|body_0|> def acc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfferAdmin: """Offer admin. Admin class definitions for ``Offer`` model.""" def _check_change_ability(self, request, obj, action): """Check if offer can be changed and create message error if not. action can be any of these (accept, decline, change)""" if obj.declined_at and action != 'de...
the_stack_v2_python_sparse
apps/offers/admin.py
An931/artist-orders
train
0
6e40ab65e6c723c297cbb73d41d4e047ae834f04
[ "if not cls.INSERT_AFTER_FIELD:\n raise ValueError(f'Class {cls} is missing INSERT_AFTER_FIELD value')\ntry:\n cls.get_field_by_fieldname(attr_name)\nexcept InvalidField:\n pass\nelse:\n raise ValueError(f\"'attr_name' {attr_name!r} is already registered\")\nif not issubclass(attr_cls, ExtendedProperty)...
<|body_start_0|> if not cls.INSERT_AFTER_FIELD: raise ValueError(f'Class {cls} is missing INSERT_AFTER_FIELD value') try: cls.get_field_by_fieldname(attr_name) except InvalidField: pass else: raise ValueError(f"'attr_name' {attr_name!r} is ...
Base class for classes that can change their list of supported fields dynamically.
RegisterMixIn
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterMixIn: """Base class for classes that can change their list of supported fields dynamically.""" def register(cls, attr_name, attr_cls): """Register a custom extended property in this item class so they can be accessed just like any other attribute :param attr_name: :param att...
stack_v2_sparse_classes_36k_train_013249
9,898
permissive
[ { "docstring": "Register a custom extended property in this item class so they can be accessed just like any other attribute :param attr_name: :param attr_cls: :return:", "name": "register", "signature": "def register(cls, attr_name, attr_cls)" }, { "docstring": "De-register an extended property...
2
null
Implement the Python class `RegisterMixIn` described below. Class description: Base class for classes that can change their list of supported fields dynamically. Method signatures and docstrings: - def register(cls, attr_name, attr_cls): Register a custom extended property in this item class so they can be accessed j...
Implement the Python class `RegisterMixIn` described below. Class description: Base class for classes that can change their list of supported fields dynamically. Method signatures and docstrings: - def register(cls, attr_name, attr_cls): Register a custom extended property in this item class so they can be accessed j...
b6d9e82f1698ebd2e0234ab72678ecd210876667
<|skeleton|> class RegisterMixIn: """Base class for classes that can change their list of supported fields dynamically.""" def register(cls, attr_name, attr_cls): """Register a custom extended property in this item class so they can be accessed just like any other attribute :param attr_name: :param att...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterMixIn: """Base class for classes that can change their list of supported fields dynamically.""" def register(cls, attr_name, attr_cls): """Register a custom extended property in this item class so they can be accessed just like any other attribute :param attr_name: :param attr_cls: :retur...
the_stack_v2_python_sparse
exchangelib/items/base.py
ecederstrand/exchangelib
train
1,169
dabb4b405eb88bdbb1304adde116f707797e5bc8
[ "super(TextSubNet, self).__init__()\nself.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)\nself.dropout = nn.Dropout(dropout)\nself.linear_1 = nn.Linear(hidden_size, out_size)", "_, final_states = self.rnn(x)\nh = self.dropout(final_states...
<|body_start_0|> super(TextSubNet, self).__init__() self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True) self.dropout = nn.Dropout(dropout) self.linear_1 = nn.Linear(hidden_size, out_size) <|end_body_0|> <|body_s...
The LSTM-based subnetwork that is used in LMF for text
TextSubNet
[ "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_36k_train_013250
7,292
permissive
[ { "docstring": "Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usage of bidirectional LSTM Output: (return value in forward) a tensor of shape (batch_size, out_size)", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_017533
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in LMF for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in LMF for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dro...
the_stack_v2_python_sparse
PyTorch/contrib/others/Low-rank-Multimodal-Fusion_ID2983_for_Pytorch/model.py
Ascend/ModelZoo-PyTorch
train
23
7880ff5909acaf97cca2c01e0eb6c92056a5296c
[ "self.result = 0\nself.dfs(root)\nreturn self.result", "if not node:\n return 0\nleft = self.dfs(node.left)\nright = self.dfs(node.right)\ndiam = 0\nif left:\n diam += left\nif right:\n diam += right\nself.result = max(self.result, diam)\nreturn max(left, right) + 1" ]
<|body_start_0|> self.result = 0 self.dfs(root) return self.result <|end_body_0|> <|body_start_1|> if not node: return 0 left = self.dfs(node.left) right = self.dfs(node.right) diam = 0 if left: diam += left if right: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def diameterOfBinaryTree(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def dfs(self, node): """Returns the node's maximum depth and updates our result for longest diameter""" <|body_1|> <|end_skeleton|> <|body_start_0|> se...
stack_v2_sparse_classes_36k_train_013251
1,795
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "diameterOfBinaryTree", "signature": "def diameterOfBinaryTree(self, root)" }, { "docstring": "Returns the node's maximum depth and updates our result for longest diameter", "name": "dfs", "signature": "def dfs(self, node)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diameterOfBinaryTree(self, root): :type root: TreeNode :rtype: int - def dfs(self, node): Returns the node's maximum depth and updates our result for longest diameter
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diameterOfBinaryTree(self, root): :type root: TreeNode :rtype: int - def dfs(self, node): Returns the node's maximum depth and updates our result for longest diameter <|skel...
f4cd43f082b58d4410008af49325770bc84d3aba
<|skeleton|> class Solution: def diameterOfBinaryTree(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def dfs(self, node): """Returns the node's maximum depth and updates our result for longest diameter""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def diameterOfBinaryTree(self, root): """:type root: TreeNode :rtype: int""" self.result = 0 self.dfs(root) return self.result def dfs(self, node): """Returns the node's maximum depth and updates our result for longest diameter""" if not node: ...
the_stack_v2_python_sparse
543.Diameter_of_a_Binary_Tree.py
welsny/solutions
train
1
b3e8d06edbdc1787508044b8ea0f953a1da380d8
[ "product.TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)\nself.title = f'Unknown (AWIPSID: {self.afos})'\nif len(self.sections) >= 2:\n self.title = self.sections[2].split('\\n')[0]", "url = f'{uri}?pid={self.get_product_id()}'\nxtra = {'channels': f'WNP,{self.afos}', 'twitter': f'SWPC i...
<|body_start_0|> product.TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.title = f'Unknown (AWIPSID: {self.afos})' if len(self.sections) >= 2: self.title = self.sections[2].split('\n')[0] <|end_body_0|> <|body_start_1|> url = f'{uri}?pid={self.get...
Class for parsing and representing Space Wx Products
SpaceWxProduct
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpaceWxProduct: """Class for parsing and representing Space Wx Products""" def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """constructor""" <|body_0|> def get_jabbers(self, uri, _uri2=None): """Custom Implementation of the TextProd...
stack_v2_sparse_classes_36k_train_013252
1,280
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None)" }, { "docstring": "Custom Implementation of the TextProduct#get_jabbers", "name": "get_jabbers", "signature": "def get_jabbers(self, uri, _uri2=N...
2
null
Implement the Python class `SpaceWxProduct` described below. Class description: Class for parsing and representing Space Wx Products Method signatures and docstrings: - def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor - def get_jabbers(self, uri, _uri2=None): Custom Implement...
Implement the Python class `SpaceWxProduct` described below. Class description: Class for parsing and representing Space Wx Products Method signatures and docstrings: - def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): constructor - def get_jabbers(self, uri, _uri2=None): Custom Implement...
460f44394be05e1b655111595a3d7de3f7e47757
<|skeleton|> class SpaceWxProduct: """Class for parsing and representing Space Wx Products""" def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """constructor""" <|body_0|> def get_jabbers(self, uri, _uri2=None): """Custom Implementation of the TextProd...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpaceWxProduct: """Class for parsing and representing Space Wx Products""" def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """constructor""" product.TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.title = f'Unknown (AWIPSI...
the_stack_v2_python_sparse
src/pyiem/nws/products/spacewx.py
akrherz/pyIEM
train
38
2874baaa24f1c2cdafe8577cd7b68d50be0329b1
[ "l = [1, 2, 3]\ni = iter_except(l.pop, IndexError)\neq_(list(i), [3, 2, 1])", "l = [1, 2]\ni = iter_except(l.pop, Exception)\neq_(list(i), [2, 1])", "l = [1, 2, 3]\ni = iter_except(l.pop, KeyError)\nassert_raises(IndexError, list, i)", "l = [1, 2, 3]\nf = lambda: 25\ni = iter_except(l.pop, IndexError, f)\neq_...
<|body_start_0|> l = [1, 2, 3] i = iter_except(l.pop, IndexError) eq_(list(i), [3, 2, 1]) <|end_body_0|> <|body_start_1|> l = [1, 2] i = iter_except(l.pop, Exception) eq_(list(i), [2, 1]) <|end_body_1|> <|body_start_2|> l = [1, 2, 3] i = iter_except(l.po...
Tests for ``iter_except()``
IterExceptTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterExceptTests: """Tests for ``iter_except()``""" def test_exact_exception(self): """ensure the exact specified exception is caught""" <|body_0|> def test_generic_exception(self): """ensure the generic exception can be caught""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_013253
47,145
no_license
[ { "docstring": "ensure the exact specified exception is caught", "name": "test_exact_exception", "signature": "def test_exact_exception(self)" }, { "docstring": "ensure the generic exception can be caught", "name": "test_generic_exception", "signature": "def test_generic_exception(self)"...
4
null
Implement the Python class `IterExceptTests` described below. Class description: Tests for ``iter_except()`` Method signatures and docstrings: - def test_exact_exception(self): ensure the exact specified exception is caught - def test_generic_exception(self): ensure the generic exception can be caught - def test_unca...
Implement the Python class `IterExceptTests` described below. Class description: Tests for ``iter_except()`` Method signatures and docstrings: - def test_exact_exception(self): ensure the exact specified exception is caught - def test_generic_exception(self): ensure the generic exception can be caught - def test_unca...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class IterExceptTests: """Tests for ``iter_except()``""" def test_exact_exception(self): """ensure the exact specified exception is caught""" <|body_0|> def test_generic_exception(self): """ensure the generic exception can be caught""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IterExceptTests: """Tests for ``iter_except()``""" def test_exact_exception(self): """ensure the exact specified exception is caught""" l = [1, 2, 3] i = iter_except(l.pop, IndexError) eq_(list(i), [3, 2, 1]) def test_generic_exception(self): """ensure the gen...
the_stack_v2_python_sparse
repoData/erikrose-more-itertools/allPythonContent.py
aCoffeeYin/pyreco
train
0
427f962d1ef8fda42158e3e0181a1d133310b6db
[ "self.dict = {}\nfor string in dictionary:\n if string:\n abbr = string[0] + str(len(string)) + string[-1]\n if abbr not in self.dict:\n self.dict[abbr] = set([])\n if len(self.dict[abbr]) < 2:\n self.dict[abbr].add(string)", "if not string:\n return True\nabbr = s...
<|body_start_0|> self.dict = {} for string in dictionary: if string: abbr = string[0] + str(len(string)) + string[-1] if abbr not in self.dict: self.dict[abbr] = set([]) if len(self.dict[abbr]) < 2: self....
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, string): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dict = {} for string in dictionary: ...
stack_v2_sparse_classes_36k_train_013254
991
no_license
[ { "docstring": ":type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": ":type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, string)" } ]
2
stack_v2_sparse_classes_30k_train_018118
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, string): :type word: str :rtype: bool
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, string): :type word: str :rtype: bool <|skeleton|> class ValidWordAbbr: def __ini...
cd0341341a0216ac39850727804411e4cf5e4a67
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, string): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" self.dict = {} for string in dictionary: if string: abbr = string[0] + str(len(string)) + string[-1] if abbr not in self.dict: self.dict[abbr...
the_stack_v2_python_sparse
288. Unique Word Abbreviation.py
cclain/LeetCode-Problem-Solution
train
0
eb940d7968a26c15f63422af7e98fc1387db718c
[ "if not root:\n return 0\nleft = self.maxDepth(root.left)\nright = self.maxDepth(root.right)\nreturn max(left, right) + 1", "if not root:\n return True\nif abs(self.maxDepth(root.left) - self.maxDepth(root.right)) > 1:\n return False\nreturn self.isBalanced(root.left) and self.isBalanced(root.right)" ]
<|body_start_0|> if not root: return 0 left = self.maxDepth(root.left) right = self.maxDepth(root.right) return max(left, right) + 1 <|end_body_0|> <|body_start_1|> if not root: return True if abs(self.maxDepth(root.left) - self.maxDepth(root.righ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 left = s...
stack_v2_sparse_classes_36k_train_013255
1,516
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_007425
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def isBalanced(self, root): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def isBalanced(self, root): :type root: TreeNode :rtype: bool <|skeleton|> class Solution: def maxDepth(self, r...
31ea52ed20a29b9e65a1aafb6dfcfd3b25c42c72
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 left = self.maxDepth(root.left) right = self.maxDepth(root.right) return max(left, right) + 1 def isBalanced(self, root): """:type root: TreeNode :r...
the_stack_v2_python_sparse
二叉树/平衡二叉树.py
gjogjreiogjwer/jzoffer
train
0
9a60e13980198932dc581b643b2823fc64d77d97
[ "g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US07', 'US07_Over_150.ged')])\ncapturedOutput = io.StringIO()\nsys.stdout = capturedOutput\ng.user_story_07()\nsys.stdout = sys.__stdout__\noutput_str1 = 'US07 - Redmond /Mann3/ is age 159, which is over 150 years old, on line 24\\n'\nself.assertEqual(capt...
<|body_start_0|> g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US07', 'US07_Over_150.ged')]) capturedOutput = io.StringIO() sys.stdout = capturedOutput g.user_story_07() sys.stdout = sys.__stdout__ output_str1 = 'US07 - Redmond /Mann3/ is age 159, which is ov...
Tests that the set_ages function throws when person is over 150.
Test_US07
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_US07: """Tests that the set_ages function throws when person is over 150.""" def test_set_age1(self): """Tests that set_age rejects illegitimate ages by throwing a ValueError.""" <|body_0|> def test_set_age2(self): """Tests that set_age rejects illegitimate ...
stack_v2_sparse_classes_36k_train_013256
1,404
no_license
[ { "docstring": "Tests that set_age rejects illegitimate ages by throwing a ValueError.", "name": "test_set_age1", "signature": "def test_set_age1(self)" }, { "docstring": "Tests that set_age rejects illegitimate ages by throwing a ValueError.", "name": "test_set_age2", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_000221
Implement the Python class `Test_US07` described below. Class description: Tests that the set_ages function throws when person is over 150. Method signatures and docstrings: - def test_set_age1(self): Tests that set_age rejects illegitimate ages by throwing a ValueError. - def test_set_age2(self): Tests that set_age ...
Implement the Python class `Test_US07` described below. Class description: Tests that the set_ages function throws when person is over 150. Method signatures and docstrings: - def test_set_age1(self): Tests that set_age rejects illegitimate ages by throwing a ValueError. - def test_set_age2(self): Tests that set_age ...
ccfc3b5e11a48a93c53ff745cb254c4c79fab95f
<|skeleton|> class Test_US07: """Tests that the set_ages function throws when person is over 150.""" def test_set_age1(self): """Tests that set_age rejects illegitimate ages by throwing a ValueError.""" <|body_0|> def test_set_age2(self): """Tests that set_age rejects illegitimate ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_US07: """Tests that the set_ages function throws when person is over 150.""" def test_set_age1(self): """Tests that set_age rejects illegitimate ages by throwing a ValueError.""" g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US07', 'US07_Over_150.ged')]) captured...
the_stack_v2_python_sparse
test_directory/US07/US07_Test.py
AkshayLavhagale/SSW555A_GEDCOM_analyzer
train
0
2c3a4db4bc0909b813986905b1e0b9743e4885d3
[ "try:\n from tensorflow.keras.models import load_model\n inference_model = load_model(model_path)\n print('Deep Learning Model found and loaded')\nexcept AssertionError as error:\n print(error)\n print('Model not found at this path ', model_path, ' Update path in config file if required')\nreturn inf...
<|body_start_0|> try: from tensorflow.keras.models import load_model inference_model = load_model(model_path) print('Deep Learning Model found and loaded') except AssertionError as error: print(error) print('Model not found at this path ', mode...
The Deploy Model class is used to import a trained model and use it to infer on unknown data
DeployModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployModel: """The Deploy Model class is used to import a trained model and use it to infer on unknown data""" def get_model(self, model_path): """get_model method is is used to retrieve the trained model from a given path :param model_path: Path to the trained model, ideally it sho...
stack_v2_sparse_classes_36k_train_013257
12,463
permissive
[ { "docstring": "get_model method is is used to retrieve the trained model from a given path :param model_path: Path to the trained model, ideally it should be same as the train model path output :type model_path: str (required)", "name": "get_model", "signature": "def get_model(self, model_path)" }, ...
2
stack_v2_sparse_classes_30k_train_017922
Implement the Python class `DeployModel` described below. Class description: The Deploy Model class is used to import a trained model and use it to infer on unknown data Method signatures and docstrings: - def get_model(self, model_path): get_model method is is used to retrieve the trained model from a given path :pa...
Implement the Python class `DeployModel` described below. Class description: The Deploy Model class is used to import a trained model and use it to infer on unknown data Method signatures and docstrings: - def get_model(self, model_path): get_model method is is used to retrieve the trained model from a given path :pa...
a84022aded545f8bc6fd9d5c7e00987448f2d98e
<|skeleton|> class DeployModel: """The Deploy Model class is used to import a trained model and use it to infer on unknown data""" def get_model(self, model_path): """get_model method is is used to retrieve the trained model from a given path :param model_path: Path to the trained model, ideally it sho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeployModel: """The Deploy Model class is used to import a trained model and use it to infer on unknown data""" def get_model(self, model_path): """get_model method is is used to retrieve the trained model from a given path :param model_path: Path to the trained model, ideally it should be same a...
the_stack_v2_python_sparse
core/model_deploy_visual.py
sumitsinha/Deep_Learning_for_Manufacturing
train
43
dc47224edef7408ade15b1304499c57a32673f45
[ "persist_attr = handler_input.attributes_manager.persistent_attributes\nsesh_attr = handler_input.attributes_manager.session_attributes\nsesh_attr['logins'] = persist_attr.get('logins', 0)\nsesh_attr['players_dict'] = persist_attr.get('players_dict', {})\nsesh_attr['current_player'] = persist_attr.get('current_play...
<|body_start_0|> persist_attr = handler_input.attributes_manager.persistent_attributes sesh_attr = handler_input.attributes_manager.session_attributes sesh_attr['logins'] = persist_attr.get('logins', 0) sesh_attr['players_dict'] = persist_attr.get('players_dict', {}) sesh_attr['c...
Methods to save and load persistent attributes.
PersistAttrMnger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersistAttrMnger: """Methods to save and load persistent attributes.""" def load_persist_attr(handler_input): """Loads persistent attributes from s3 bucket.""" <|body_0|> def save_persist_attr(handler_input): """Saves persistent attributes to s3 bucket.""" ...
stack_v2_sparse_classes_36k_train_013258
1,806
permissive
[ { "docstring": "Loads persistent attributes from s3 bucket.", "name": "load_persist_attr", "signature": "def load_persist_attr(handler_input)" }, { "docstring": "Saves persistent attributes to s3 bucket.", "name": "save_persist_attr", "signature": "def save_persist_attr(handler_input)" ...
2
null
Implement the Python class `PersistAttrMnger` described below. Class description: Methods to save and load persistent attributes. Method signatures and docstrings: - def load_persist_attr(handler_input): Loads persistent attributes from s3 bucket. - def save_persist_attr(handler_input): Saves persistent attributes to...
Implement the Python class `PersistAttrMnger` described below. Class description: Methods to save and load persistent attributes. Method signatures and docstrings: - def load_persist_attr(handler_input): Loads persistent attributes from s3 bucket. - def save_persist_attr(handler_input): Saves persistent attributes to...
1072dea1a5be0b339211ff39db6a89a90aca64c1
<|skeleton|> class PersistAttrMnger: """Methods to save and load persistent attributes.""" def load_persist_attr(handler_input): """Loads persistent attributes from s3 bucket.""" <|body_0|> def save_persist_attr(handler_input): """Saves persistent attributes to s3 bucket.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersistAttrMnger: """Methods to save and load persistent attributes.""" def load_persist_attr(handler_input): """Loads persistent attributes from s3 bucket.""" persist_attr = handler_input.attributes_manager.persistent_attributes sesh_attr = handler_input.attributes_manager.sessio...
the_stack_v2_python_sparse
1_code/attr_mngment/persist_attr_manager.py
jaimiles23/Multiplication-Medley
train
0
d1f6321444eebb293c4c5b7e242eeb6170c23217
[ "response = self.client.get(reverse('polls:index'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No polls are available.')", "create_question(question_text='Past Question Text', days=-30)\nresponse = self.client.get(reverse('polls:index'))\nself.assertQuerysetEqual(response.context...
<|body_start_0|> response = self.client.get(reverse('polls:index')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'No polls are available.') <|end_body_0|> <|body_start_1|> create_question(question_text='Past Question Text', days=-30) response = self....
QuestionIndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionIndexViewTests: def test_index_view_with_no_questions(self): """If no questions exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_a_past_question(self): """Qustions with a pub_date in the past should be displayed on the...
stack_v2_sparse_classes_36k_train_013259
7,438
no_license
[ { "docstring": "If no questions exist, an appropriate message should be displayed.", "name": "test_index_view_with_no_questions", "signature": "def test_index_view_with_no_questions(self)" }, { "docstring": "Qustions with a pub_date in the past should be displayed on the index page.", "name"...
5
stack_v2_sparse_classes_30k_val_000103
Implement the Python class `QuestionIndexViewTests` described below. Class description: Implement the QuestionIndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_questions(self): If no questions exist, an appropriate message should be displayed. - def test_index_view_with_a_past_ques...
Implement the Python class `QuestionIndexViewTests` described below. Class description: Implement the QuestionIndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_questions(self): If no questions exist, an appropriate message should be displayed. - def test_index_view_with_a_past_ques...
a7e7fc72abe357172f5aa49b03c5b9298d92d6e8
<|skeleton|> class QuestionIndexViewTests: def test_index_view_with_no_questions(self): """If no questions exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_a_past_question(self): """Qustions with a pub_date in the past should be displayed on the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionIndexViewTests: def test_index_view_with_no_questions(self): """If no questions exist, an appropriate message should be displayed.""" response = self.client.get(reverse('polls:index')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'No polls a...
the_stack_v2_python_sparse
firstdjango/polls/tests.py
thewritingstew/lpthw
train
0
def5449a62b3078fff8934896ff9cc0e00b9b081
[ "self.pos = pos[:]\nself.size = size[:]\nself.active = 0\nself.onClick = None\nself.onMottion = None\nself.onUnder = None", "mx, my = pygame.mouse.get_pos()\nif self.IsUnder((mx, my)) == True:\n if self.onUnder != None:\n self.onUnder(self)\n if self.onClick != None and event.type == pygame.MOUSEBUTT...
<|body_start_0|> self.pos = pos[:] self.size = size[:] self.active = 0 self.onClick = None self.onMottion = None self.onUnder = None <|end_body_0|> <|body_start_1|> mx, my = pygame.mouse.get_pos() if self.IsUnder((mx, my)) == True: if self.onU...
base class for all widgets
Widget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Widget: """base class for all widgets""" def __init__(self, parent, pos=[0, 0], size=[10, 10]): """init widget""" <|body_0|> def Update(self, event): """update widget (send events)""" <|body_1|> def IsUnder(self, point): """check is point is ...
stack_v2_sparse_classes_36k_train_013260
1,376
no_license
[ { "docstring": "init widget", "name": "__init__", "signature": "def __init__(self, parent, pos=[0, 0], size=[10, 10])" }, { "docstring": "update widget (send events)", "name": "Update", "signature": "def Update(self, event)" }, { "docstring": "check is point is under widget retur...
4
stack_v2_sparse_classes_30k_train_019425
Implement the Python class `Widget` described below. Class description: base class for all widgets Method signatures and docstrings: - def __init__(self, parent, pos=[0, 0], size=[10, 10]): init widget - def Update(self, event): update widget (send events) - def IsUnder(self, point): check is point is under widget re...
Implement the Python class `Widget` described below. Class description: base class for all widgets Method signatures and docstrings: - def __init__(self, parent, pos=[0, 0], size=[10, 10]): init widget - def Update(self, event): update widget (send events) - def IsUnder(self, point): check is point is under widget re...
6fce940a4ca3ad51aa62aa48067d41d39c5a75a2
<|skeleton|> class Widget: """base class for all widgets""" def __init__(self, parent, pos=[0, 0], size=[10, 10]): """init widget""" <|body_0|> def Update(self, event): """update widget (send events)""" <|body_1|> def IsUnder(self, point): """check is point is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Widget: """base class for all widgets""" def __init__(self, parent, pos=[0, 0], size=[10, 10]): """init widget""" self.pos = pos[:] self.size = size[:] self.active = 0 self.onClick = None self.onMottion = None self.onUnder = None def Update(sel...
the_stack_v2_python_sparse
src/widget.py
sugar-activities/4721-activity
train
0
1a74f4b6e124eb2ea5541eec9c2829484c8cd99f
[ "email = self.cleaned_data['email']\ntry:\n get_user_model()._default_manager.get(email=email)\nexcept get_user_model().DoesNotExist:\n return email\nraise forms.ValidationError(self.error_messages['duplicate_email'], code='duplicate_email')", "password1 = self.cleaned_data.get('password1')\npassword2 = sel...
<|body_start_0|> email = self.cleaned_data['email'] try: get_user_model()._default_manager.get(email=email) except get_user_model().DoesNotExist: return email raise forms.ValidationError(self.error_messages['duplicate_email'], code='duplicate_email') <|end_body_0|...
A form for creating new users. Includes all the required fields, plus a repeated password.
EmailUserCreationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailUserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" <|body_0|> def clean_...
stack_v2_sparse_classes_36k_train_013261
6,443
no_license
[ { "docstring": "Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Check that the two password entries match. :return str password2: cleaned password2 :raise forms.V...
3
stack_v2_sparse_classes_30k_test_000948
Implement the Python class `EmailUserCreationForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_email(self): Clean form email. :return str email: cleaned email :raise forms.ValidationError: ...
Implement the Python class `EmailUserCreationForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_email(self): Clean form email. :return str email: cleaned email :raise forms.ValidationError: ...
d0f30a3156307249a04c4ffaa0eea83b4512b9cd
<|skeleton|> class EmailUserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" <|body_0|> def clean_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailUserCreationForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_email(self): """Clean form email. :return str email: cleaned email :raise forms.ValidationError: Email is duplicated""" email = self.cleaned_data['email'] ...
the_stack_v2_python_sparse
apps/user/forms.py
RossLote/propertymanager
train
0
770e5dbb3e94b2627264708d7cfbc209d5ce48fd
[ "if root:\n left = self.invertTree(root.left)\n right = self.invertTree(root.right)\n root.left = right\n root.right = left\nreturn root", "if root:\n left = root.left\n root.left = root.right\n root.right = left\n self.invertTree2(root.left)\n self.invertTree2(root.right)\nreturn root"...
<|body_start_0|> if root: left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right root.right = left return root <|end_body_0|> <|body_start_1|> if root: left = root.left root.left = root.righ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root: left = self.inver...
stack_v2_sparse_classes_36k_train_013262
675
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree", "signature": "def invertTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree2", "signature": "def invertTree2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_018911
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class Solution: def inve...
0428189510b0742c7270ffbe73f71ba165b0ad42
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" if root: left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right root.right = left return root def invertTree2(self, ro...
the_stack_v2_python_sparse
bst/InvertBinaryTree.py
munkhtsogt/algorithms
train
0
64d49d82533b7dfbbe2cc9ad0469dce989018224
[ "current_user = get_jwt_identity()\nif current_user is None:\n msg = 'Please login to access to access this resource'\n return ({'status': 'Failed!', 'message': msg}, 400)\njson_data = request.get_json(force=True)\nres = product_validator(json_data)\nif not res:\n store_id = get_store_id(get_jwt_identity()...
<|body_start_0|> current_user = get_jwt_identity() if current_user is None: msg = 'Please login to access to access this resource' return ({'status': 'Failed!', 'message': msg}, 400) json_data = request.get_json(force=True) res = product_validator(json_data) ...
Products
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Products: def post(self): """Add a product to the manager""" <|body_0|> def get(self): """Get all products""" <|body_1|> <|end_skeleton|> <|body_start_0|> current_user = get_jwt_identity() if current_user is None: msg = 'Please l...
stack_v2_sparse_classes_36k_train_013263
8,995
permissive
[ { "docstring": "Add a product to the manager", "name": "post", "signature": "def post(self)" }, { "docstring": "Get all products", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_016678
Implement the Python class `Products` described below. Class description: Implement the Products class. Method signatures and docstrings: - def post(self): Add a product to the manager - def get(self): Get all products
Implement the Python class `Products` described below. Class description: Implement the Products class. Method signatures and docstrings: - def post(self): Add a product to the manager - def get(self): Get all products <|skeleton|> class Products: def post(self): """Add a product to the manager""" ...
89e9573543e32de2e8503dc1440b4ad907bb10b5
<|skeleton|> class Products: def post(self): """Add a product to the manager""" <|body_0|> def get(self): """Get all products""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Products: def post(self): """Add a product to the manager""" current_user = get_jwt_identity() if current_user is None: msg = 'Please login to access to access this resource' return ({'status': 'Failed!', 'message': msg}, 400) json_data = request.get_jso...
the_stack_v2_python_sparse
app/api/v2/views/products.py
kwanj-k/storemanager-v2
train
1
99e795009b80a64a729c3884b487c1440dd383c0
[ "db_session = get_db_session(db_session)\nif status is UserStatuses.Pending:\n return db_session.query(UserPending)\nif status is None:\n return db_session.query(cls.model)\nquery = db_session.query(cls.model)\nusers = []\nif UserStatuses.Pending in status:\n users = list(db_session.query(UserPending))\n ...
<|body_start_0|> db_session = get_db_session(db_session) if status is UserStatuses.Pending: return db_session.query(UserPending) if status is None: return db_session.query(cls.model) query = db_session.query(cls.model) users = [] if UserStatuses.Pe...
Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, or through the *all* representation, the retu...
UserSearchService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, ...
stack_v2_sparse_classes_36k_train_013264
42,346
permissive
[ { "docstring": "Search for appropriate :class:`User` and/or :class:`UserPending` according to specified :class:`UserStatuses`. When the :paramref:`status` is ``None``, *normal* retrieval of all non-pending :class:`User` is executed, as if directly using the :class:`UserService` implementation. Otherwise, a comb...
3
stack_v2_sparse_classes_30k_val_000939
Implement the Python class `UserSearchService` described below. Class description: Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with an...
Implement the Python class `UserSearchService` described below. Class description: Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with an...
f9b00c6142372aff96fd0edf0537c8b383fd5ee9
<|skeleton|> class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, or through th...
the_stack_v2_python_sparse
magpie/models.py
Ouranosinc/Magpie
train
2
555defb54d3aaada0ea0b19119587ecbe109da06
[ "def rec(root: TreeNode) -> None:\n if not root:\n ans.append(None)\n return\n ans.append(root.val)\n rec(root.left)\n rec(root.right)\nans = list()\nrec(root)\nreturn ans", "if not data or data[0] == None:\n return None\nreversed_data = data[::-1]\n\ndef rec() -> TreeNode:\n poppe...
<|body_start_0|> def rec(root: TreeNode) -> None: if not root: ans.append(None) return ans.append(root.val) rec(root.left) rec(root.right) ans = list() rec(root) return ans <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root) -> list: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data) -> TreeNode: """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_013265
1,473
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root) -> list" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def de...
2
stack_v2_sparse_classes_30k_train_006081
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root) -> list: Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data) -> TreeNode: Decodes your encoded data to tree. :ty...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root) -> list: Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data) -> TreeNode: Decodes your encoded data to tree. :ty...
3a653a1d8cc6e1438cab47a427ccd0b421a10010
<|skeleton|> class Codec: def serialize(self, root) -> list: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data) -> TreeNode: """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root) -> list: """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def rec(root: TreeNode) -> None: if not root: ans.append(None) return ans.append(root.val) rec(root.left) ...
the_stack_v2_python_sparse
Minseo-Kim/leetcode/297_Serialize_and_deserialize_binary_tree.py
mintheon/Practice-Algorithm
train
0
500cad510c1774e236f51681a70eb769a038f9c1
[ "for subkey in application_identifiers_key.GetSubkeys():\n name = subkey.name.lower()\n if len(name) == 38 and name[0] == '{' and (name[37] == '}'):\n description = self._GetValueFromKey(subkey, '')\n yield ApplicationIdentifier(name, description)", "application_identifiers_key = registry.GetK...
<|body_start_0|> for subkey in application_identifiers_key.GetSubkeys(): name = subkey.name.lower() if len(name) == 38 and name[0] == '{' and (name[37] == '}'): description = self._GetValueFromKey(subkey, '') yield ApplicationIdentifier(name, description) ...
Windows application identifiers collector.
ApplicationIdentifiersCollector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationIdentifiersCollector: """Windows application identifiers collector.""" def _CollectApplicationIdentifiers(self, application_identifiers_key): """Collects Windows application identifiers (AppID). Args: application_identifiers_key (dfwinreg.WinRegistryKey): application ident...
stack_v2_sparse_classes_36k_train_013266
1,906
permissive
[ { "docstring": "Collects Windows application identifiers (AppID). Args: application_identifiers_key (dfwinreg.WinRegistryKey): application identifiers Windows Registry key. Yields: ApplicationIdentifier: an application identifier.", "name": "_CollectApplicationIdentifiers", "signature": "def _CollectApp...
2
stack_v2_sparse_classes_30k_train_018789
Implement the Python class `ApplicationIdentifiersCollector` described below. Class description: Windows application identifiers collector. Method signatures and docstrings: - def _CollectApplicationIdentifiers(self, application_identifiers_key): Collects Windows application identifiers (AppID). Args: application_ide...
Implement the Python class `ApplicationIdentifiersCollector` described below. Class description: Windows application identifiers collector. Method signatures and docstrings: - def _CollectApplicationIdentifiers(self, application_identifiers_key): Collects Windows application identifiers (AppID). Args: application_ide...
d149aff1b8ff97e1cc8d7416fc583b964bad4ccd
<|skeleton|> class ApplicationIdentifiersCollector: """Windows application identifiers collector.""" def _CollectApplicationIdentifiers(self, application_identifiers_key): """Collects Windows application identifiers (AppID). Args: application_identifiers_key (dfwinreg.WinRegistryKey): application ident...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationIdentifiersCollector: """Windows application identifiers collector.""" def _CollectApplicationIdentifiers(self, application_identifiers_key): """Collects Windows application identifiers (AppID). Args: application_identifiers_key (dfwinreg.WinRegistryKey): application identifiers Window...
the_stack_v2_python_sparse
winregrc/application_identifiers.py
libyal/winreg-kb
train
129
ce5cd6f4ec2bd1b01e4faf0b8d85f580f809266b
[ "self.firstname = firstname\nself.middlename = middlename\nself.lastname = lastname\nself.date_of_birth = date_of_birth\nself.address = address\nself.zip_code = zip_code\nself.city = city\nself.mobile = mobile\nself.phone = phone\nself.gender = gender\nself.raw_json = raw_json\nself.request_id = request_id\nself.de...
<|body_start_0|> self.firstname = firstname self.middlename = middlename self.lastname = lastname self.date_of_birth = date_of_birth self.address = address self.zip_code = zip_code self.city = city self.mobile = mobile self.phone = phone se...
Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: type description here. date_of_birth (string): TODO: type description here. address (string):...
PersonPersonInformation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonPersonInformation: """Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: type description here. date_of_birth (stri...
stack_v2_sparse_classes_36k_train_013267
4,980
permissive
[ { "docstring": "Constructor for the PersonPersonInformation class", "name": "__init__", "signature": "def __init__(self, firstname=None, middlename=None, lastname=None, date_of_birth=None, address=None, zip_code=None, city=None, mobile=None, phone=None, gender=None, raw_json=None, request_id=None, dead=...
2
stack_v2_sparse_classes_30k_train_005293
Implement the Python class `PersonPersonInformation` described below. Class description: Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: typ...
Implement the Python class `PersonPersonInformation` described below. Class description: Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: typ...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PersonPersonInformation: """Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: type description here. date_of_birth (stri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonPersonInformation: """Implementation of the 'Person.PersonInformation' model. TODO: type model description here. Attributes: firstname (string): TODO: type description here. middlename (string): TODO: type description here. lastname (string): TODO: type description here. date_of_birth (string): TODO: ty...
the_stack_v2_python_sparse
idfy_rest_client/models/person_person_information.py
dealflowteam/Idfy
train
0
d8e9b6086de818727c7ca7326f27cf4aa72ed83e
[ "result = []\nfor i in nums1:\n if i in nums2:\n result.append(i)\n nums2.remove(i)\nreturn result", "result = []\nn1 = len(nums1)\nn2 = len(nums2)\np1 = 0\np2 = 0\nwhile p1 < n1 and p2 < n2:\n if nums1[p1] > nums2[p2]:\n p2 += 1\n elif nums1[p1] < nums2[p2]:\n p1 += 1\n el...
<|body_start_0|> result = [] for i in nums1: if i in nums2: result.append(i) nums2.remove(i) return result <|end_body_0|> <|body_start_1|> result = [] n1 = len(nums1) n2 = len(nums2) p1 = 0 p2 = 0 while ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect_sorted(self, nums1, nums2): """nums1 and nums2 are sorted ascending""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013268
2,194
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": "nums1 and nums2 are sorted ascending", "name": "intersect_sorted", "signature": "def intersect_sorted(self, nums1, nu...
2
stack_v2_sparse_classes_30k_train_002336
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect_sorted(self, nums1, nums2): nums1 and nums2 are sorted ascendin...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect_sorted(self, nums1, nums2): nums1 and nums2 are sorted ascendin...
1ed22267156fb968671731c2e983b0e65f670750
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect_sorted(self, nums1, nums2): """nums1 and nums2 are sorted ascending""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" result = [] for i in nums1: if i in nums2: result.append(i) nums2.remove(i) return result def intersect_sorted(sel...
the_stack_v2_python_sparse
leetcode/350.py
pingrunhuang/CodeChallenge
train
0
41e81f0d4e6290f56e3765904c5251992c1eeb2b
[ "data = request.data\nserializer = self.get_serializer(data=data)\nif not serializer.is_valid():\n return Response({'errors': serializer.errors}, status=status.HTTP_400_BAD_REQUEST)\nserializer.save()\nreturn Response(serializer.data, status=status.HTTP_201_CREATED)", "instance = self.get_object()\ninstance.is...
<|body_start_0|> data = request.data serializer = self.get_serializer(data=data) if not serializer.is_valid(): return Response({'errors': serializer.errors}, status=status.HTTP_400_BAD_REQUEST) serializer.save() return Response(serializer.data, status=status.HTTP_201_...
API endpoints for listing/inserting/updating email templates data
EmailTemplatesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailTemplatesView: """API endpoints for listing/inserting/updating email templates data""" def create(self, request): """Create/Update email template details""" <|body_0|> def delete(self, request, pk=None): """Delete a email template details""" <|body_1...
stack_v2_sparse_classes_36k_train_013269
1,478
no_license
[ { "docstring": "Create/Update email template details", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Delete a email template details", "name": "delete", "signature": "def delete(self, request, pk=None)" } ]
2
null
Implement the Python class `EmailTemplatesView` described below. Class description: API endpoints for listing/inserting/updating email templates data Method signatures and docstrings: - def create(self, request): Create/Update email template details - def delete(self, request, pk=None): Delete a email template detail...
Implement the Python class `EmailTemplatesView` described below. Class description: API endpoints for listing/inserting/updating email templates data Method signatures and docstrings: - def create(self, request): Create/Update email template details - def delete(self, request, pk=None): Delete a email template detail...
5d5bc4c1eecbf627d38260e4d314d8451d67a4f5
<|skeleton|> class EmailTemplatesView: """API endpoints for listing/inserting/updating email templates data""" def create(self, request): """Create/Update email template details""" <|body_0|> def delete(self, request, pk=None): """Delete a email template details""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailTemplatesView: """API endpoints for listing/inserting/updating email templates data""" def create(self, request): """Create/Update email template details""" data = request.data serializer = self.get_serializer(data=data) if not serializer.is_valid(): retur...
the_stack_v2_python_sparse
curation-api/src/patients/views/email_templates.py
mohanj1919/django_app_test
train
0
c3a6ca64f933d03a2deb5162d8b20cdb71dd0bb4
[ "self.clfs = []\nself.betas = []\nself.numBoostingIters = numBoostingIters\nself.maxTreeDepth = maxTreeDepth\nself.K = None\nself.classes = None", "X = X.to_numpy()\ny = y.to_numpy()\nn, d = X.shape\ny = y.reshape(-1, 1)\nself.classes = np.unique(y)\nself.K = len(self.classes)\nweights = np.full(n, 1 / n).reshape...
<|body_start_0|> self.clfs = [] self.betas = [] self.numBoostingIters = numBoostingIters self.maxTreeDepth = maxTreeDepth self.K = None self.classes = None <|end_body_0|> <|body_start_1|> X = X.to_numpy() y = y.to_numpy() n, d = X.shape y ...
BoostedDT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoostedDT: def __init__(self, numBoostingIters=100, maxTreeDepth=3): """Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation during boosting betas : List of beta values, in order of creation during boosting""" <|body_0|>...
stack_v2_sparse_classes_36k_train_013270
2,622
no_license
[ { "docstring": "Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation during boosting betas : List of beta values, in order of creation during boosting", "name": "__init__", "signature": "def __init__(self, numBoostingIters=100, maxTreeDepth=3)"...
3
stack_v2_sparse_classes_30k_train_006538
Implement the Python class `BoostedDT` described below. Class description: Implement the BoostedDT class. Method signatures and docstrings: - def __init__(self, numBoostingIters=100, maxTreeDepth=3): Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation durin...
Implement the Python class `BoostedDT` described below. Class description: Implement the BoostedDT class. Method signatures and docstrings: - def __init__(self, numBoostingIters=100, maxTreeDepth=3): Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation durin...
fa7c71a8cd8ca9d12260dbc6a737f34715fe3b87
<|skeleton|> class BoostedDT: def __init__(self, numBoostingIters=100, maxTreeDepth=3): """Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation during boosting betas : List of beta values, in order of creation during boosting""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoostedDT: def __init__(self, numBoostingIters=100, maxTreeDepth=3): """Constructor Class Fields clfs : List object containing individual DecisionTree classifiers, in order of creation during boosting betas : List of beta values, in order of creation during boosting""" self.clfs = [] s...
the_stack_v2_python_sparse
HW4/HW4_code/cis519_hw4_solution.py
JiatongSun/CIS-519-Applied-Machine-Learning
train
0
87c96c93b13de9db39b5a66a08e488104d1da050
[ "self.block_name = block_name\nself.macro_root = macro_root\nself.extra_context = extra_context", "block = self.macro_root.find(self.block_name)\nif not block:\n raise TemplateSyntaxError(\"cannot repeat '%s': block or macro not found\" % self.block_name)\nelse:\n resolved_context = {}\n for key, value i...
<|body_start_0|> self.block_name = block_name self.macro_root = macro_root self.extra_context = extra_context <|end_body_0|> <|body_start_1|> block = self.macro_root.find(self.block_name) if not block: raise TemplateSyntaxError("cannot repeat '%s': block or macro not...
Nœud de répétition d'un nœud block ou macro
RepeatNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepeatNode: """Nœud de répétition d'un nœud block ou macro""" def __init__(self, block_name, macro_root, extra_context): """Initialiser le nœud""" <|body_0|> def render(self, context): """Rendre le nœud""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013271
5,624
no_license
[ { "docstring": "Initialiser le nœud", "name": "__init__", "signature": "def __init__(self, block_name, macro_root, extra_context)" }, { "docstring": "Rendre le nœud", "name": "render", "signature": "def render(self, context)" } ]
2
null
Implement the Python class `RepeatNode` described below. Class description: Nœud de répétition d'un nœud block ou macro Method signatures and docstrings: - def __init__(self, block_name, macro_root, extra_context): Initialiser le nœud - def render(self, context): Rendre le nœud
Implement the Python class `RepeatNode` described below. Class description: Nœud de répétition d'un nœud block ou macro Method signatures and docstrings: - def __init__(self, block_name, macro_root, extra_context): Initialiser le nœud - def render(self, context): Rendre le nœud <|skeleton|> class RepeatNode: """...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class RepeatNode: """Nœud de répétition d'un nœud block ou macro""" def __init__(self, block_name, macro_root, extra_context): """Initialiser le nœud""" <|body_0|> def render(self, context): """Rendre le nœud""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepeatNode: """Nœud de répétition d'un nœud block ou macro""" def __init__(self, block_name, macro_root, extra_context): """Initialiser le nœud""" self.block_name = block_name self.macro_root = macro_root self.extra_context = extra_context def render(self, context): ...
the_stack_v2_python_sparse
scoop/core/templatetags/repeat.py
artscoop/scoop
train
0
a1ab49b617b35e658049b1aa3b882a5281537b8b
[ "super().define(spec)\nspec.input('parent_folder', valid_type=orm.RemoteData, required=True)\nspec.input('core_wfc_data', valid_type=SinglefileData, required=True, help='Core wavefunction data, generated by the upf2plotcore.sh utility')\nspec.input('kpoints', valid_type=KpointsData, required=True, help='The K-point...
<|body_start_0|> super().define(spec) spec.input('parent_folder', valid_type=orm.RemoteData, required=True) spec.input('core_wfc_data', valid_type=SinglefileData, required=True, help='Core wavefunction data, generated by the upf2plotcore.sh utility') spec.input('kpoints', valid_type=Kpoi...
CalcJob implementation for the xspectra.x code of Quantum ESPRESSO.
XspectraCalculation
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XspectraCalculation: """CalcJob implementation for the xspectra.x code of Quantum ESPRESSO.""" def define(cls, spec): """Define the process specification.""" <|body_0|> def generate_input_file(self, parameters): """Add kpoint handling to the inherited method. Thi...
stack_v2_sparse_classes_36k_train_013272
5,746
permissive
[ { "docstring": "Define the process specification.", "name": "define", "signature": "def define(cls, spec)" }, { "docstring": "Add kpoint handling to the inherited method. This checks that the offset for the mesh is in a valid format, converts the offset from AiiDA format to QE format, and adds t...
3
stack_v2_sparse_classes_30k_train_003037
Implement the Python class `XspectraCalculation` described below. Class description: CalcJob implementation for the xspectra.x code of Quantum ESPRESSO. Method signatures and docstrings: - def define(cls, spec): Define the process specification. - def generate_input_file(self, parameters): Add kpoint handling to the ...
Implement the Python class `XspectraCalculation` described below. Class description: CalcJob implementation for the xspectra.x code of Quantum ESPRESSO. Method signatures and docstrings: - def define(cls, spec): Define the process specification. - def generate_input_file(self, parameters): Add kpoint handling to the ...
7263f92ccabcfc9f828b9da5473e1aefbc4b8eca
<|skeleton|> class XspectraCalculation: """CalcJob implementation for the xspectra.x code of Quantum ESPRESSO.""" def define(cls, spec): """Define the process specification.""" <|body_0|> def generate_input_file(self, parameters): """Add kpoint handling to the inherited method. Thi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XspectraCalculation: """CalcJob implementation for the xspectra.x code of Quantum ESPRESSO.""" def define(cls, spec): """Define the process specification.""" super().define(spec) spec.input('parent_folder', valid_type=orm.RemoteData, required=True) spec.input('core_wfc_dat...
the_stack_v2_python_sparse
src/aiida_quantumespresso/calculations/xspectra.py
aiidateam/aiida-quantumespresso
train
56
f61d3d87c94d46411c629cb52f3f87da0502821e
[ "self.logger = logging.getLogger(__name__)\nself.engine = engine\nself.prof_obj = None\nself.df = None\nself.students = None\nself.student_to_course = None\nself.professors = None\nself.teacher_to_course = None\nself.courses = None\nself.tests = None", "try:\n username = settings.username[1:].capitalize()\n ...
<|body_start_0|> self.logger = logging.getLogger(__name__) self.engine = engine self.prof_obj = None self.df = None self.students = None self.student_to_course = None self.professors = None self.teacher_to_course = None self.courses = None ...
Performs database and dataframe queries
DatabaseQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseQuery: """Performs database and dataframe queries""" def __init__(self, engine): """:params engine:sqlalchemy.engine() :return:Professor model object""" <|body_0|> def get_prof(self, settings): """Query database for professor information""" <|body...
stack_v2_sparse_classes_36k_train_013273
3,984
permissive
[ { "docstring": ":params engine:sqlalchemy.engine() :return:Professor model object", "name": "__init__", "signature": "def __init__(self, engine)" }, { "docstring": "Query database for professor information", "name": "get_prof", "signature": "def get_prof(self, settings)" }, { "do...
4
stack_v2_sparse_classes_30k_train_015362
Implement the Python class `DatabaseQuery` described below. Class description: Performs database and dataframe queries Method signatures and docstrings: - def __init__(self, engine): :params engine:sqlalchemy.engine() :return:Professor model object - def get_prof(self, settings): Query database for professor informat...
Implement the Python class `DatabaseQuery` described below. Class description: Performs database and dataframe queries Method signatures and docstrings: - def __init__(self, engine): :params engine:sqlalchemy.engine() :return:Professor model object - def get_prof(self, settings): Query database for professor informat...
0b7ea3c885322631d6dd3ef7ee96b6a98ba2392e
<|skeleton|> class DatabaseQuery: """Performs database and dataframe queries""" def __init__(self, engine): """:params engine:sqlalchemy.engine() :return:Professor model object""" <|body_0|> def get_prof(self, settings): """Query database for professor information""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseQuery: """Performs database and dataframe queries""" def __init__(self, engine): """:params engine:sqlalchemy.engine() :return:Professor model object""" self.logger = logging.getLogger(__name__) self.engine = engine self.prof_obj = None self.df = None ...
the_stack_v2_python_sparse
src/utils/DatabaseQuery.py
tinfins/CMSC495-Group-3
train
3
da4b0c4c9bdb0fd012ca268a1a2b37051b7592ae
[ "unlabelled = self.labels.mask.nonzero()[0]\nif len(unlabelled):\n index = numpy.random.choice(unlabelled)\n return index\nreturn 0", "indices = set()\nunlabelled = self.labels.mask.nonzero()[0]\nif len(unlabelled) < n:\n return unlabelled\nwhile len(indices) < n:\n index = numpy.random.choice(unlabel...
<|body_start_0|> unlabelled = self.labels.mask.nonzero()[0] if len(unlabelled): index = numpy.random.choice(unlabelled) return index return 0 <|end_body_0|> <|body_start_1|> indices = set() unlabelled = self.labels.mask.nonzero()[0] if len(unlabel...
Pool-based learning with random sampling.
RandomSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomSampler: """Pool-based learning with random sampling.""" def sample_index(self): """Finds index of a random unlabelled point.""" <|body_0|> def sample_indices(self, n): """Finds indices of n random unlabelled points.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_013274
2,413
permissive
[ { "docstring": "Finds index of a random unlabelled point.", "name": "sample_index", "signature": "def sample_index(self)" }, { "docstring": "Finds indices of n random unlabelled points.", "name": "sample_indices", "signature": "def sample_indices(self, n)" } ]
2
null
Implement the Python class `RandomSampler` described below. Class description: Pool-based learning with random sampling. Method signatures and docstrings: - def sample_index(self): Finds index of a random unlabelled point. - def sample_indices(self, n): Finds indices of n random unlabelled points.
Implement the Python class `RandomSampler` described below. Class description: Pool-based learning with random sampling. Method signatures and docstrings: - def sample_index(self): Finds index of a random unlabelled point. - def sample_indices(self, n): Finds indices of n random unlabelled points. <|skeleton|> class...
ce14432c36de0574b73d813304365b74446a61f8
<|skeleton|> class RandomSampler: """Pool-based learning with random sampling.""" def sample_index(self): """Finds index of a random unlabelled point.""" <|body_0|> def sample_indices(self, n): """Finds indices of n random unlabelled points.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomSampler: """Pool-based learning with random sampling.""" def sample_index(self): """Finds index of a random unlabelled point.""" unlabelled = self.labels.mask.nonzero()[0] if len(unlabelled): index = numpy.random.choice(unlabelled) return index ...
the_stack_v2_python_sparse
crowdastro/active_learning/random_sampler.py
vishalbelsare/crowdastro
train
0
8ecf5add67c60fb59576011ce325313965eb470d
[ "full_path = os.path.join(cls.sql_rules_path, filename + '.sql')\nwith open(full_path, 'r') as f:\n return f.read()", "with create_app().app_context():\n sess = GlobalDB.db().session\n filename = os.path.join(cls.sql_rules_path, filename)\n sql_data = pd.read_csv(filename, dtype=str, usecols=cls.heade...
<|body_start_0|> full_path = os.path.join(cls.sql_rules_path, filename + '.sql') with open(full_path, 'r') as f: return f.read() <|end_body_0|> <|body_start_1|> with create_app().app_context(): sess = GlobalDB.db().session filename = os.path.join(cls.sql_rule...
SQLLoader
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" <|body_0|> def load_sql(cls, filename): """Load SQL-based validation rules to db.""" <|body_1|> <|end_skeleton|> <|body_start_0|> full_path = os.path.join(cls.sq...
stack_v2_sparse_classes_36k_train_013275
4,204
permissive
[ { "docstring": "Read and clean lines from a .sql file", "name": "read_sql_str", "signature": "def read_sql_str(cls, filename)" }, { "docstring": "Load SQL-based validation rules to db.", "name": "load_sql", "signature": "def load_sql(cls, filename)" } ]
2
null
Implement the Python class `SQLLoader` described below. Class description: Implement the SQLLoader class. Method signatures and docstrings: - def read_sql_str(cls, filename): Read and clean lines from a .sql file - def load_sql(cls, filename): Load SQL-based validation rules to db.
Implement the Python class `SQLLoader` described below. Class description: Implement the SQLLoader class. Method signatures and docstrings: - def read_sql_str(cls, filename): Read and clean lines from a .sql file - def load_sql(cls, filename): Load SQL-based validation rules to db. <|skeleton|> class SQLLoader: ...
b12c73976fd7eb5728eda90e56e053759c733c35
<|skeleton|> class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" <|body_0|> def load_sql(cls, filename): """Load SQL-based validation rules to db.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" full_path = os.path.join(cls.sql_rules_path, filename + '.sql') with open(full_path, 'r') as f: return f.read() def load_sql(cls, filename): """Load SQL-based validation rul...
the_stack_v2_python_sparse
dataactvalidator/filestreaming/sqlLoader.py
fedspendingtransparency/data-act-broker-backend
train
55
7acd232d92de0770395fea7265cbb4028c011344
[ "self.log_file = log_file\nself.data = []\nself.ip_regex = {}", "self.data = []\ntry:\n with open(self.log_file, encoding='utf-8') as file_data:\n self.data = self.ip_regex[jail].findall(file_data.read())\nexcept (IndexError, FileNotFoundError, IsADirectoryError, UnboundLocalError):\n _LOGGER.warning...
<|body_start_0|> self.log_file = log_file self.data = [] self.ip_regex = {} <|end_body_0|> <|body_start_1|> self.data = [] try: with open(self.log_file, encoding='utf-8') as file_data: self.data = self.ip_regex[jail].findall(file_data.read()) ...
Class to parse fail2ban logs.
BanLogParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BanLogParser: """Class to parse fail2ban logs.""" def __init__(self, log_file): """Initialize the parser.""" <|body_0|> def read_log(self, jail): """Read the fail2ban log and find entries for jail.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013276
4,292
permissive
[ { "docstring": "Initialize the parser.", "name": "__init__", "signature": "def __init__(self, log_file)" }, { "docstring": "Read the fail2ban log and find entries for jail.", "name": "read_log", "signature": "def read_log(self, jail)" } ]
2
stack_v2_sparse_classes_30k_val_000348
Implement the Python class `BanLogParser` described below. Class description: Class to parse fail2ban logs. Method signatures and docstrings: - def __init__(self, log_file): Initialize the parser. - def read_log(self, jail): Read the fail2ban log and find entries for jail.
Implement the Python class `BanLogParser` described below. Class description: Class to parse fail2ban logs. Method signatures and docstrings: - def __init__(self, log_file): Initialize the parser. - def read_log(self, jail): Read the fail2ban log and find entries for jail. <|skeleton|> class BanLogParser: """Cla...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BanLogParser: """Class to parse fail2ban logs.""" def __init__(self, log_file): """Initialize the parser.""" <|body_0|> def read_log(self, jail): """Read the fail2ban log and find entries for jail.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BanLogParser: """Class to parse fail2ban logs.""" def __init__(self, log_file): """Initialize the parser.""" self.log_file = log_file self.data = [] self.ip_regex = {} def read_log(self, jail): """Read the fail2ban log and find entries for jail.""" sel...
the_stack_v2_python_sparse
homeassistant/components/fail2ban/sensor.py
home-assistant/core
train
35,501
215b74cafe6e62706a6365c119a6769207ae42ce
[ "super(JointHead, self).__init__(name=name)\nassert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections'\nd_joint = vid_to_aud_txt_kwargs['d_model']\nself...
<|body_start_0|> super(JointHead, self).__init__(name=name) assert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections' d_joint = vid_...
MLP-based Head to bridge audio, text and video with a Joint style.
JointHead
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JointHead: """MLP-based Head to bridge audio, text and video with a Joint style.""" def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs): """Initialize the Fine-to-Coarse head class. Args: b...
stack_v2_sparse_classes_36k_train_013277
6,829
permissive
[ { "docstring": "Initialize the Fine-to-Coarse head class. Args: bn_config: batchnorm configuration args use_xreplica_bn: whether to use cross-replica bn stats or not vid_to_aud_txt_kwargs: vid2rest MLP args aud_to_vid_txt_kwargs: aud2rest MLP args txt_to_vid_aud_kwargs: txt2rest MLP args name: graph name. **kwa...
2
stack_v2_sparse_classes_30k_train_010130
Implement the Python class `JointHead` described below. Class description: MLP-based Head to bridge audio, text and video with a Joint style. Method signatures and docstrings: - def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k...
Implement the Python class `JointHead` described below. Class description: MLP-based Head to bridge audio, text and video with a Joint style. Method signatures and docstrings: - def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class JointHead: """MLP-based Head to bridge audio, text and video with a Joint style.""" def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs): """Initialize the Fine-to-Coarse head class. Args: b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JointHead: """MLP-based Head to bridge audio, text and video with a Joint style.""" def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs): """Initialize the Fine-to-Coarse head class. Args: bn_config: bat...
the_stack_v2_python_sparse
vatt/modeling/heads/bridge.py
Jimmy-INL/google-research
train
1
ce44f5bb659d7d76128e639b92731aeef8a4cabc
[ "log = GaussianLog(os.path.join(os.path.dirname(__file__), 'test', 'ethylene.log'))\nconformer = log.loadConformer()\nE0 = log.loadEnergy()\nself.assertTrue(len([mode for mode in conformer.modes if isinstance(mode, IdealGasTranslation)]) == 1)\nself.assertTrue(len([mode for mode in conformer.modes if isinstance(mod...
<|body_start_0|> log = GaussianLog(os.path.join(os.path.dirname(__file__), 'test', 'ethylene.log')) conformer = log.loadConformer() E0 = log.loadEnergy() self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode, IdealGasTranslation)]) == 1) self.assertTrue(len([mo...
Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files.
GaussianTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianTest: """Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files.""" def testLoadEthyleneFromGaussianLog_CBSQB3(self): """Uses a Gaussian03 log file for ethylene (C2H4) to test that its molecular degrees of freedom can be properly re...
stack_v2_sparse_classes_36k_train_013278
5,396
permissive
[ { "docstring": "Uses a Gaussian03 log file for ethylene (C2H4) to test that its molecular degrees of freedom can be properly read.", "name": "testLoadEthyleneFromGaussianLog_CBSQB3", "signature": "def testLoadEthyleneFromGaussianLog_CBSQB3(self)" }, { "docstring": "Uses a Gaussian03 log file for...
3
stack_v2_sparse_classes_30k_train_005440
Implement the Python class `GaussianTest` described below. Class description: Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files. Method signatures and docstrings: - def testLoadEthyleneFromGaussianLog_CBSQB3(self): Uses a Gaussian03 log file for ethylene (C2H4) to test...
Implement the Python class `GaussianTest` described below. Class description: Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files. Method signatures and docstrings: - def testLoadEthyleneFromGaussianLog_CBSQB3(self): Uses a Gaussian03 log file for ethylene (C2H4) to test...
0937b2e0a955dcf21b79674a4e89f43941c0dd85
<|skeleton|> class GaussianTest: """Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files.""" def testLoadEthyleneFromGaussianLog_CBSQB3(self): """Uses a Gaussian03 log file for ethylene (C2H4) to test that its molecular degrees of freedom can be properly re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianTest: """Contains unit tests for the chempy.io.gaussian module, used for reading and writing Gaussian files.""" def testLoadEthyleneFromGaussianLog_CBSQB3(self): """Uses a Gaussian03 log file for ethylene (C2H4) to test that its molecular degrees of freedom can be properly read.""" ...
the_stack_v2_python_sparse
rmgpy/cantherm/gaussianTest.py
vrlambert/RMG-Py
train
1
3c5bf30b5bbdb835f7ff43cc14ba962b329aa01c
[ "self.ensure_one()\nif self.product_id:\n self.price = self.product_id.standard_price\nelif self.product_tmpl_id:\n self.price = self.product_tmpl_id.standard_price", "for record in self.search([]):\n if record.product_id:\n record.price = record.product_id.standard_price\n elif record.product_...
<|body_start_0|> self.ensure_one() if self.product_id: self.price = self.product_id.standard_price elif self.product_tmpl_id: self.price = self.product_tmpl_id.standard_price <|end_body_0|> <|body_start_1|> for record in self.search([]): if record.pro...
SupplierInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplierInfo: def onchange_product_id(self): """for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019""" <|body_0|> def update_variant_product_price_cron(self): """for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019""" ...
stack_v2_sparse_classes_36k_train_013279
964
no_license
[ { "docstring": "for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019", "name": "onchange_product_id", "signature": "def onchange_product_id(self)" }, { "docstring": "for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019", "name": "update_variant_product...
2
null
Implement the Python class `SupplierInfo` described below. Class description: Implement the SupplierInfo class. Method signatures and docstrings: - def onchange_product_id(self): for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019 - def update_variant_product_price_cron(self): for variants produc...
Implement the Python class `SupplierInfo` described below. Class description: Implement the SupplierInfo class. Method signatures and docstrings: - def onchange_product_id(self): for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019 - def update_variant_product_price_cron(self): for variants produc...
58cb304d105bb7332f0a6ab685015f070988ba56
<|skeleton|> class SupplierInfo: def onchange_product_id(self): """for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019""" <|body_0|> def update_variant_product_price_cron(self): """for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupplierInfo: def onchange_product_id(self): """for variants products (rugs) price = cost @author: JB @date: 15-FEB-2019""" self.ensure_one() if self.product_id: self.price = self.product_id.standard_price elif self.product_tmpl_id: self.price = self.pro...
the_stack_v2_python_sparse
product_extended_bytl/models/product_supplierinfo.py
nabiforks/baytonia
train
0
62a74f2569b1818cfd05087b5435e12b75e148a1
[ "terms = re.findall('[^+ ,;]+', str(proposal_id))\nfor term in terms:\n if re.match('[0-9]+[a-z]?', term):\n proposal_id = term\n break\ntry:\n proposal_entry = Proposals.get(Proposals.id == proposal_id)\nexcept DoesNotExist:\n message = 'No Proposal with an ID of {0} was found'.format(propos...
<|body_start_0|> terms = re.findall('[^+ ,;]+', str(proposal_id)) for term in terms: if re.match('[0-9]+[a-z]?', term): proposal_id = term break try: proposal_entry = Proposals.get(Proposals.id == proposal_id) except DoesNotExist: ...
Retrieves a set of proposals for a given keyword set.
ProposalLookup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProposalLookup: """Retrieves a set of proposals for a given keyword set.""" def _get_proposal_details(proposal_id): """Return a formatted dictionary containing the details of a given Proposal entry.""" <|body_0|> def GET(proposal_id=None): """CherryPy GET method....
stack_v2_sparse_classes_36k_train_013280
2,925
no_license
[ { "docstring": "Return a formatted dictionary containing the details of a given Proposal entry.", "name": "_get_proposal_details", "signature": "def _get_proposal_details(proposal_id)" }, { "docstring": "CherryPy GET method.", "name": "GET", "signature": "def GET(proposal_id=None)" } ]
2
stack_v2_sparse_classes_30k_train_000129
Implement the Python class `ProposalLookup` described below. Class description: Retrieves a set of proposals for a given keyword set. Method signatures and docstrings: - def _get_proposal_details(proposal_id): Return a formatted dictionary containing the details of a given Proposal entry. - def GET(proposal_id=None):...
Implement the Python class `ProposalLookup` described below. Class description: Retrieves a set of proposals for a given keyword set. Method signatures and docstrings: - def _get_proposal_details(proposal_id): Return a formatted dictionary containing the details of a given Proposal entry. - def GET(proposal_id=None):...
dd9dbc8ea508e5412b9b9803805a1cb12f8cfc2e
<|skeleton|> class ProposalLookup: """Retrieves a set of proposals for a given keyword set.""" def _get_proposal_details(proposal_id): """Return a formatted dictionary containing the details of a given Proposal entry.""" <|body_0|> def GET(proposal_id=None): """CherryPy GET method....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProposalLookup: """Retrieves a set of proposals for a given keyword set.""" def _get_proposal_details(proposal_id): """Return a formatted dictionary containing the details of a given Proposal entry.""" terms = re.findall('[^+ ,;]+', str(proposal_id)) for term in terms: ...
the_stack_v2_python_sparse
metadata/rest/proposal_queries/proposal_lookup.py
markborkum/pacifica-metadata
train
0
0a7311f93f581348a4db94580f25bf57ec7f0624
[ "self._qb = qb\nself._flux = np.linspace(0, 1.0, n_steps) if flux is None else flux\nself._data_points = []\nself.update_frequency_points()\nself.model = interp1d(self._flux, self._data_points, kind=kw.pop('kind', 'cubic'), copy=False, **kw)", "if flux is not None:\n self._flux = flux\nself._data_points = self...
<|body_start_0|> self._qb = qb self._flux = np.linspace(0, 1.0, n_steps) if flux is None else flux self._data_points = [] self.update_frequency_points() self.model = interp1d(self._flux, self._data_points, kind=kw.pop('kind', 'cubic'), copy=False, **kw) <|end_body_0|> <|body_sta...
Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, this class is meant to be used by manually initiallizing an instance and manually calling the ins...
InterpolatedHamiltonianModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterpolatedHamiltonianModel: """Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, this class is meant to be used by manuall...
stack_v2_sparse_classes_36k_train_013281
5,029
permissive
[ { "docstring": "Args: qb (QuDev_transmon): Qb to which the Hamiltonian model corresponds n_steps (int): Number of linear spaced points within [0, 1] to be used as flux points for the interpolation data points. Defaults to 1001. flux (array, optional): Initial flux points to compute the data points used in the i...
3
null
Implement the Python class `InterpolatedHamiltonianModel` described below. Class description: Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, th...
Implement the Python class `InterpolatedHamiltonianModel` described below. Class description: Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, th...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class InterpolatedHamiltonianModel: """Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, this class is meant to be used by manuall...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterpolatedHamiltonianModel: """Provides a simple class to wrap the scipy 1D interpolation method to speed-up the computation of the Hamiltonian model when this is called several times, e.g., when called in a loop as part of a fitting routine. Currently, this class is meant to be used by manually initiallizi...
the_stack_v2_python_sparse
pycqed/simulations/interpolated_hamiltonian_model.py
QudevETH/PycQED_py3
train
8
c0953bc307c4f6953ca957dc9f6461c5c2348bc3
[ "arr1.sort()\narr2.sort()\ni, j, arr = (0, 0, [])\nwhile i < len(arr1) and j < len(arr2):\n if arr1[i] < arr2[j]:\n i += 1\n elif arr1[i] > arr2[j]:\n j += 1\n else:\n arr.append(arr1[i])\n i += 1\n j += 1\nreturn arr", "arr, s1, s2 = ([], set(), set())\nfor ele in arr1...
<|body_start_0|> arr1.sort() arr2.sort() i, j, arr = (0, 0, []) while i < len(arr1) and j < len(arr2): if arr1[i] < arr2[j]: i += 1 elif arr1[i] > arr2[j]: j += 1 else: arr.append(arr1[i]) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]: """两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集""" <|body_0|> def get_intersection2(self, arr1: List[int], arr2: List[int]) -> List[int]: """两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Retu...
stack_v2_sparse_classes_36k_train_013282
1,868
permissive
[ { "docstring": "两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集", "name": "get_intersection", "signature": "def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]" }, { "docstring": "两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集", "name": "get_intersection2", "signat...
3
stack_v2_sparse_classes_30k_train_008773
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]: 两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集 - def get_intersection2(self, arr1: List[int], arr2: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]: 两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集 - def get_intersection2(self, arr1: List[int], arr2: Li...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]: """两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集""" <|body_0|> def get_intersection2(self, arr1: List[int], arr2: List[int]) -> List[int]: """两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def get_intersection(self, arr1: List[int], arr2: List[int]) -> List[int]: """两个数组求交集 Args: arr1: 数组1 arr2: 数组2 Returns: 数组交集""" arr1.sort() arr2.sort() i, j, arr = (0, 0, []) while i < len(arr1) and j < len(arr2): if arr1[i] < arr2[j]: ...
the_stack_v2_python_sparse
src/leetcodepython/array/get_intersection_349.py
zhangyu345293721/leetcode
train
101
295b369c39b68b109475b7869c835ea3a8e960b4
[ "if not matrix:\n return False\ni, j = (0, len(matrix[0]) - 1)\nwhile i < len(matrix) and j >= 0:\n if matrix[i][j] == target:\n return True\n elif matrix[i][j] > target:\n j -= 1\n else:\n i += 1\nreturn False", "if not matrix:\n return False\ni, j = (len(matrix) - 1, 0)\nwhil...
<|body_start_0|> if not matrix: return False i, j = (0, len(matrix[0]) - 1) while i < len(matrix) and j >= 0: if matrix[i][j] == target: return True elif matrix[i][j] > target: j -= 1 else: i += 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: """查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值""" <|body_0|> def search_matrix2(self, matrix: List[List[int]], target: int) -> bool: """查找二维数组 Args: matrix: 二维数组 target: 目标值 R...
stack_v2_sparse_classes_36k_train_013283
2,471
permissive
[ { "docstring": "查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值", "name": "search_matrix", "signature": "def search_matrix(self, matrix: List[List[int]], target: int) -> bool" }, { "docstring": "查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值", "name": "search_matrix2", "si...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_matrix(self, matrix: List[List[int]], target: int) -> bool: 查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值 - def search_matrix2(self, matrix: List[List[int]], ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_matrix(self, matrix: List[List[int]], target: int) -> bool: 查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值 - def search_matrix2(self, matrix: List[List[int]], ...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: """查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值""" <|body_0|> def search_matrix2(self, matrix: List[List[int]], target: int) -> bool: """查找二维数组 Args: matrix: 二维数组 target: 目标值 R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: """查找二维数组 Args: matrix: 二维数组 target: 目标值 Returns: 是否找到那个值""" if not matrix: return False i, j = (0, len(matrix[0]) - 1) while i < len(matrix) and j >= 0: if matrix[i][j] == ...
the_stack_v2_python_sparse
src/leetcodepython/array/search_2d_matrix_240.py
zhangyu345293721/leetcode
train
101
28d8ca8fe401e5e77888d61cdb98f6e9f49fae94
[ "super().__init__()\nself.filename = filename\nself.line_format = '[{0:20s}]\\t\\t[Requested: {1} -- Data: {2}]\\n'", "f = open(self.filename, 'a')\nfor key in data:\n f.write(self.line_format.format(datetime.now().__str__(), key, data[key]))\nf.close()" ]
<|body_start_0|> super().__init__() self.filename = filename self.line_format = '[{0:20s}]\t\t[Requested: {1} -- Data: {2}]\n' <|end_body_0|> <|body_start_1|> f = open(self.filename, 'a') for key in data: f.write(self.line_format.format(datetime.now().__str__(), key,...
Implements an interface to write data to file.
FileWriter
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_36k_train_013284
2,907
permissive
[ { "docstring": "FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Writes a formated dictionary update to file. Keyword Arguments: data -- The data di...
2
stack_v2_sparse_classes_30k_train_006061
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
b5d75cb82e4bc3e9c4e428a288c6ac98a4aa2c52
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" super().__init__() self.filename = filename self.line_format...
the_stack_v2_python_sparse
src/broadcaster/broadcaster.py
vt-sailbot/sailbot-21
train
5
019c9362a9d03118b14561e470d5de8aafeae4aa
[ "threading.Thread.__init__(self)\nself.direction = 'neutral'\nself.id = identity\nself.position = position\nself.move_joint(self.position, 900)", "while self.direction != '':\n if self.direction == 'decrease':\n if self.position > 200:\n self.position -= 15\n elif self.direction == 'increa...
<|body_start_0|> threading.Thread.__init__(self) self.direction = 'neutral' self.id = identity self.position = position self.move_joint(self.position, 900) <|end_body_0|> <|body_start_1|> while self.direction != '': if self.direction == 'decrease': ...
A Joint class representing a moving node on parts of the emubot
Joint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Joint: """A Joint class representing a moving node on parts of the emubot""" def __init__(self, identity, position): """__init__(identity, position): parameters represent identification and position""" <|body_0|> def run(self): """Step through a sequence of moves...
stack_v2_sparse_classes_36k_train_013285
2,748
permissive
[ { "docstring": "__init__(identity, position): parameters represent identification and position", "name": "__init__", "signature": "def __init__(self, identity, position)" }, { "docstring": "Step through a sequence of moves", "name": "run", "signature": "def run(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_004678
Implement the Python class `Joint` described below. Class description: A Joint class representing a moving node on parts of the emubot Method signatures and docstrings: - def __init__(self, identity, position): __init__(identity, position): parameters represent identification and position - def run(self): Step throug...
Implement the Python class `Joint` described below. Class description: A Joint class representing a moving node on parts of the emubot Method signatures and docstrings: - def __init__(self, identity, position): __init__(identity, position): parameters represent identification and position - def run(self): Step throug...
a39dc01f7c1213c8079216d49d376b317efbf5f3
<|skeleton|> class Joint: """A Joint class representing a moving node on parts of the emubot""" def __init__(self, identity, position): """__init__(identity, position): parameters represent identification and position""" <|body_0|> def run(self): """Step through a sequence of moves...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Joint: """A Joint class representing a moving node on parts of the emubot""" def __init__(self, identity, position): """__init__(identity, position): parameters represent identification and position""" threading.Thread.__init__(self) self.direction = 'neutral' self.id = id...
the_stack_v2_python_sparse
Client-Code-2018/CurrentEmuBotCode2/basic_classes.py
maxgodfrey2004/RoboCup-2018-Driving-Code
train
1
3016ba5a42230ec9b57ddb900b25fec87ec6d4b4
[ "self.k = k\nself.queue = []\nheapq.heapify(self.queue)\nfor i, n in enumerate(nums):\n if i < k:\n heapq.heappush(self.queue, n)\n elif n > self.queue[0]:\n heapq.heappop(self.queue)\n heapq.heappush(self.queue, n)", "if not self.queue or len(self.queue) < self.k:\n heapq.heappush(s...
<|body_start_0|> self.k = k self.queue = [] heapq.heapify(self.queue) for i, n in enumerate(nums): if i < k: heapq.heappush(self.queue, n) elif n > self.queue[0]: heapq.heappop(self.queue) heapq.heappush(self.queue, ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.queue = [] heapq.heapify(s...
stack_v2_sparse_classes_36k_train_013286
783
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_016855
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
b4fc2ba621f3484973c0520b02c60e5ed1930722
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.queue = [] heapq.heapify(self.queue) for i, n in enumerate(nums): if i < k: heapq.heappush(self.queue, n) elif n > self.queue[0]: ...
the_stack_v2_python_sparse
703_KthLargest_heap.py
Black-Mamba24/leetcode-python
train
0
9f1db2dd6d6de58d330e836f4524b89aab74fe4f
[ "scan, _ = get_scan_by_uuid(scan_uuid)\nif scan['scheduled_at'] is not None:\n abort(400, 'Scan is already scheduled')\nparams = Parser.ScanSchedulePostRequest.parse_args()\nvalidate_schedule(params['scheduled_at'])\nif len(params['rrule']) > 0:\n scheduled_at = params['scheduled_at'].replace(tzinfo=pytz.utc)...
<|body_start_0|> scan, _ = get_scan_by_uuid(scan_uuid) if scan['scheduled_at'] is not None: abort(400, 'Scan is already scheduled') params = Parser.ScanSchedulePostRequest.parse_args() validate_schedule(params['scheduled_at']) if len(params['rrule']) > 0: ...
ScanSchedule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScanSchedule: def post(self, scan_uuid): """Schedule the specified scan""" <|body_0|> def delete(self, scan_uuid): """Cancel the specified scan schedule""" <|body_1|> <|end_skeleton|> <|body_start_0|> scan, _ = get_scan_by_uuid(scan_uuid) if...
stack_v2_sparse_classes_36k_train_013287
5,703
permissive
[ { "docstring": "Schedule the specified scan", "name": "post", "signature": "def post(self, scan_uuid)" }, { "docstring": "Cancel the specified scan schedule", "name": "delete", "signature": "def delete(self, scan_uuid)" } ]
2
stack_v2_sparse_classes_30k_train_002901
Implement the Python class `ScanSchedule` described below. Class description: Implement the ScanSchedule class. Method signatures and docstrings: - def post(self, scan_uuid): Schedule the specified scan - def delete(self, scan_uuid): Cancel the specified scan schedule
Implement the Python class `ScanSchedule` described below. Class description: Implement the ScanSchedule class. Method signatures and docstrings: - def post(self, scan_uuid): Schedule the specified scan - def delete(self, scan_uuid): Cancel the specified scan schedule <|skeleton|> class ScanSchedule: def post(s...
e034d9db4c3fae697bfa15d4ba3d1475f5dd7e8a
<|skeleton|> class ScanSchedule: def post(self, scan_uuid): """Schedule the specified scan""" <|body_0|> def delete(self, scan_uuid): """Cancel the specified scan schedule""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScanSchedule: def post(self, scan_uuid): """Schedule the specified scan""" scan, _ = get_scan_by_uuid(scan_uuid) if scan['scheduled_at'] is not None: abort(400, 'Scan is already scheduled') params = Parser.ScanSchedulePostRequest.parse_args() validate_schedu...
the_stack_v2_python_sparse
core/apis/scan.py
nishimunea/NT-D
train
2
959d227b2c5b69c438833b7fe0873f6626d94d8d
[ "if dt is not None:\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n dt = str(dt).split('.')[0]\n dt = datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S')\n dt = dt - timedelta\nreturn dt", "if dt is not None:\n dt = str(dt).split('.')[0]\n dt = datetime.datetime.strptime(str...
<|body_start_0|> if dt is not None: timedelta = datetime.datetime.now() - datetime.datetime.utcnow() dt = str(dt).split('.')[0] dt = datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S') dt = dt - timedelta return dt <|end_body_0|> <|body_start_1|> ...
Datetime Utilities
DatetimeUtilities
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatetimeUtilities: """Datetime Utilities""" def ConvertToUTC(dt): """Converts date time to UTC date time""" <|body_0|> def ConvertToDT(dt): """Converts date time to formatted date time""" <|body_1|> def ConvertToSTR(dt): """Converts date to s...
stack_v2_sparse_classes_36k_train_013288
1,331
no_license
[ { "docstring": "Converts date time to UTC date time", "name": "ConvertToUTC", "signature": "def ConvertToUTC(dt)" }, { "docstring": "Converts date time to formatted date time", "name": "ConvertToDT", "signature": "def ConvertToDT(dt)" }, { "docstring": "Converts date to string", ...
4
stack_v2_sparse_classes_30k_val_000508
Implement the Python class `DatetimeUtilities` described below. Class description: Datetime Utilities Method signatures and docstrings: - def ConvertToUTC(dt): Converts date time to UTC date time - def ConvertToDT(dt): Converts date time to formatted date time - def ConvertToSTR(dt): Converts date to string - def IsD...
Implement the Python class `DatetimeUtilities` described below. Class description: Datetime Utilities Method signatures and docstrings: - def ConvertToUTC(dt): Converts date time to UTC date time - def ConvertToDT(dt): Converts date time to formatted date time - def ConvertToSTR(dt): Converts date to string - def IsD...
9ff48f61cfd4e0c5994ad3dabab3987255cea953
<|skeleton|> class DatetimeUtilities: """Datetime Utilities""" def ConvertToUTC(dt): """Converts date time to UTC date time""" <|body_0|> def ConvertToDT(dt): """Converts date time to formatted date time""" <|body_1|> def ConvertToSTR(dt): """Converts date to s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatetimeUtilities: """Datetime Utilities""" def ConvertToUTC(dt): """Converts date time to UTC date time""" if dt is not None: timedelta = datetime.datetime.now() - datetime.datetime.utcnow() dt = str(dt).split('.')[0] dt = datetime.datetime.strptime(dt...
the_stack_v2_python_sparse
EAA_Dataloader/src/AACloudTools/DatetimeUtilities.py
eulertech/backup
train
0
fc885b7bc33ad02d9892bd1116f0d75eb7a698b0
[ "if isinstance(headers, dict) or isinstance(headers, wsgiref.headers.Headers):\n headers = headers.items()\nreturn [(name.lower(), value) for name, value in headers]", "expected = self._normalize_headers(expected)\nactual = self._normalize_headers(actual)\nfor name, value in actual:\n self.assertIsInstance(...
<|body_start_0|> if isinstance(headers, dict) or isinstance(headers, wsgiref.headers.Headers): headers = headers.items() return [(name.lower(), value) for name, value in headers] <|end_body_0|> <|body_start_1|> expected = self._normalize_headers(expected) actual = self._norm...
Base class for tests involving requests to a WSGI application.
WSGITestCase
[ "Apache-2.0", "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "GPL-2.0-or-later", "MPL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted ...
stack_v2_sparse_classes_36k_train_013289
6,329
permissive
[ { "docstring": "Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted to a sequence of pairs (if it was not already), with all of the header names lowercased.", "name": "_normalize_headers", "s...
3
stack_v2_sparse_classes_30k_train_017643
Implement the Python class `WSGITestCase` described below. Class description: Base class for tests involving requests to a WSGI application. Method signatures and docstrings: - def _normalize_headers(headers): Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsg...
Implement the Python class `WSGITestCase` described below. Class description: Base class for tests involving requests to a WSGI application. Method signatures and docstrings: - def _normalize_headers(headers): Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsg...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WSGITestCase: """Base class for tests involving requests to a WSGI application.""" def _normalize_headers(headers): """Normalize a headers set to a list with lowercased names. Args: headers: A sequence of pairs, a dict or a wsgiref.headers.Headers object. Returns: headers, converted to a sequence...
the_stack_v2_python_sparse
AppServer/google/appengine/tools/devappserver2/wsgi_test_utils.py
obino/appscale
train
1
ffeffc1a88b7c63ca777c6c62936f3cd1e974fc0
[ "self._mask_num_classes = num_classes\nself._num_downsample_channels = num_downsample_channels\nself._mask_crop_size = mask_crop_size\nself._use_category_for_mask = use_category_for_mask\nself._num_convs = num_convs\nif not use_category_for_mask:\n assert num_classes == 1", "detection_prior_features = tf.keras...
<|body_start_0|> self._mask_num_classes = num_classes self._num_downsample_channels = num_downsample_channels self._mask_crop_size = mask_crop_size self._use_category_for_mask = use_category_for_mask self._num_convs = num_convs if not use_category_for_mask: as...
ShapemaskCoarsemaskHead head.
ShapemaskCoarsemaskHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask cl...
stack_v2_sparse_classes_36k_train_013290
45,524
permissive
[ { "docstring": "Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask classification categories. num_downsample_channels: `int` number of filters at mask head. mask_crop_size: feature crop size. use_category_for_mask: use class information in mask branch. ...
3
stack_v2_sparse_classes_30k_train_004593
Implement the Python class `ShapemaskCoarsemaskHead` described below. Class description: ShapemaskCoarsemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs): Initialize params to build ShapeMask coarse and fine pr...
Implement the Python class `ShapemaskCoarsemaskHead` described below. Class description: ShapemaskCoarsemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs): Initialize params to build ShapeMask coarse and fine pr...
965cc3eef54a3a173a2347fe0059a35f1e5f2496
<|skeleton|> class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask classification ...
the_stack_v2_python_sparse
official/vision/detection/modeling/architecture/heads.py
ayushmankumar7/models
train
4
55b81c4883ade581c31a887dae5598a71048043c
[ "citations.sort()\nn = len(citations)\nh = 0\nfor i, v in enumerate(citations):\n h = max(h, min(v, n - i))\nreturn h", "N = len(citations)\ncitations.sort()\nl, r = (0, N - 1)\nH = 0\nwhile l <= r:\n mid = r + l >> 1\n H = max(H, min(citations[mid], N - mid))\n if citations[mid] < N - mid:\n l...
<|body_start_0|> citations.sort() n = len(citations) h = 0 for i, v in enumerate(citations): h = max(h, min(v, n - i)) return h <|end_body_0|> <|body_start_1|> N = len(citations) citations.sort() l, r = (0, N - 1) H = 0 while l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hIndex2(self, citations): """直接遍历,每次取其后面的值和索引的差值与本身比较""" <|body_0|> def hIndex(self, citations): """二分法加快遍历的速度 :type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> citations.sort() n = len(cita...
stack_v2_sparse_classes_36k_train_013291
863
no_license
[ { "docstring": "直接遍历,每次取其后面的值和索引的差值与本身比较", "name": "hIndex2", "signature": "def hIndex2(self, citations)" }, { "docstring": "二分法加快遍历的速度 :type citations: List[int] :rtype: int", "name": "hIndex", "signature": "def hIndex(self, citations)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex2(self, citations): 直接遍历,每次取其后面的值和索引的差值与本身比较 - def hIndex(self, citations): 二分法加快遍历的速度 :type citations: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex2(self, citations): 直接遍历,每次取其后面的值和索引的差值与本身比较 - def hIndex(self, citations): 二分法加快遍历的速度 :type citations: List[int] :rtype: int <|skeleton|> class Solution: def hIn...
b99ef39268c5713fae3dbbf0a5548ec1f5a7e434
<|skeleton|> class Solution: def hIndex2(self, citations): """直接遍历,每次取其后面的值和索引的差值与本身比较""" <|body_0|> def hIndex(self, citations): """二分法加快遍历的速度 :type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hIndex2(self, citations): """直接遍历,每次取其后面的值和索引的差值与本身比较""" citations.sort() n = len(citations) h = 0 for i, v in enumerate(citations): h = max(h, min(v, n - i)) return h def hIndex(self, citations): """二分法加快遍历的速度 :type citati...
the_stack_v2_python_sparse
专题训练/树/BST专辑/计算研究人员有至少N篇影响力为N以上的论文.py
sandwu/leetcode_problems
train
1
fa3b375606f3fb400898cea3182cb545597096fb
[ "if self.data.get('hydrogeology', None):\n self.form = self._make_form(self.well.hydrogeology_parameter if self.well.hydrogeology_parameter else HydrogeologyParameter(), HydrogeologyParameterForm, self.data['hydrogeology'])\n if self.data['hydrogeology'].get('pumping_test'):\n self.pumping_test_form = ...
<|body_start_0|> if self.data.get('hydrogeology', None): self.form = self._make_form(self.well.hydrogeology_parameter if self.well.hydrogeology_parameter else HydrogeologyParameter(), HydrogeologyParameterForm, self.data['hydrogeology']) if self.data['hydrogeology'].get('pumping_test'): ...
Collection form for general information section
HydrogeologyCreateForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HydrogeologyCreateForm: """Collection form for general information section""" def create(self): """create form from data""" <|body_0|> def save(self): """save all available data""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.data.get('h...
stack_v2_sparse_classes_36k_train_013292
1,991
no_license
[ { "docstring": "create form from data", "name": "create", "signature": "def create(self)" }, { "docstring": "save all available data", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_007059
Implement the Python class `HydrogeologyCreateForm` described below. Class description: Collection form for general information section Method signatures and docstrings: - def create(self): create form from data - def save(self): save all available data
Implement the Python class `HydrogeologyCreateForm` described below. Class description: Collection form for general information section Method signatures and docstrings: - def create(self): create form from data - def save(self): save all available data <|skeleton|> class HydrogeologyCreateForm: """Collection fo...
fc036f9f8346dee2d40287d08375a6c2af0a1a12
<|skeleton|> class HydrogeologyCreateForm: """Collection form for general information section""" def create(self): """create form from data""" <|body_0|> def save(self): """save all available data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HydrogeologyCreateForm: """Collection form for general information section""" def create(self): """create form from data""" if self.data.get('hydrogeology', None): self.form = self._make_form(self.well.hydrogeology_parameter if self.well.hydrogeology_parameter else Hydrogeolog...
the_stack_v2_python_sparse
views/form_group/hydrogeology.py
Alexia-Water/IGRAC-WellAndMonitoringDatabase
train
0
d5848b2896e240d990bafb61713b179553f5d294
[ "if x_element.get('cm_location') is not None and x_element.get('cm_filename') is None:\n self.cm_filename = x_element.get('name')\nComponent.__init__(self, x_element, typename)", "Component._classLink(self, siteDescription)\nif not hasattr(self, 'cm_repository'):\n self.cm_repository = siteDescription.defau...
<|body_start_0|> if x_element.get('cm_location') is not None and x_element.get('cm_filename') is None: self.cm_filename = x_element.get('name') Component.__init__(self, x_element, typename) <|end_body_0|> <|body_start_1|> Component._classLink(self, siteDescription) if not ha...
A software component managed through a CM repository
CmComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmComponent: """A software component managed through a CM repository""" def __init__(self, x_element, typename): """Initialize the object""" <|body_0|> def _classLink(self, siteDescription): """Initialize references to other component/language objects""" ...
stack_v2_sparse_classes_36k_train_013293
7,139
permissive
[ { "docstring": "Initialize the object", "name": "__init__", "signature": "def __init__(self, x_element, typename)" }, { "docstring": "Initialize references to other component/language objects", "name": "_classLink", "signature": "def _classLink(self, siteDescription)" } ]
2
stack_v2_sparse_classes_30k_train_001041
Implement the Python class `CmComponent` described below. Class description: A software component managed through a CM repository Method signatures and docstrings: - def __init__(self, x_element, typename): Initialize the object - def _classLink(self, siteDescription): Initialize references to other component/languag...
Implement the Python class `CmComponent` described below. Class description: A software component managed through a CM repository Method signatures and docstrings: - def __init__(self, x_element, typename): Initialize the object - def _classLink(self, siteDescription): Initialize references to other component/languag...
c89a683b8cd30b49fcdda92888f82f4dad9b53a0
<|skeleton|> class CmComponent: """A software component managed through a CM repository""" def __init__(self, x_element, typename): """Initialize the object""" <|body_0|> def _classLink(self, siteDescription): """Initialize references to other component/language objects""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmComponent: """A software component managed through a CM repository""" def __init__(self, x_element, typename): """Initialize the object""" if x_element.get('cm_location') is not None and x_element.get('cm_filename') is None: self.cm_filename = x_element.get('name') C...
the_stack_v2_python_sparse
src/sitemgt/software.py
jodysankey/pythonpath
train
0
af788f1b33b24a6c2c3e80cb974c69b73c94106a
[ "request_json = request.get_json()\nvalid_format, errors = schema_utils.validate(request_json, 'affiliation')\nbearer_token = request.headers['Authorization'].replace('Bearer ', '')\nis_new_business = request.args.get('newBusiness', 'false').lower() == 'true'\nif not valid_format:\n return ({'message': schema_ut...
<|body_start_0|> request_json = request.get_json() valid_format, errors = schema_utils.validate(request_json, 'affiliation') bearer_token = request.headers['Authorization'].replace('Bearer ', '') is_new_business = request.args.get('newBusiness', 'false').lower() == 'true' if not ...
Resource for managing affiliations for an org.
OrgAffiliations
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrgAffiliations: """Resource for managing affiliations for an org.""" def post(org_id): """Post a new Affiliation for an org using the request body.""" <|body_0|> def get(org_id): """Get all affiliated entities for the given org.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_013294
30,185
permissive
[ { "docstring": "Post a new Affiliation for an org using the request body.", "name": "post", "signature": "def post(org_id)" }, { "docstring": "Get all affiliated entities for the given org.", "name": "get", "signature": "def get(org_id)" } ]
2
stack_v2_sparse_classes_30k_train_013220
Implement the Python class `OrgAffiliations` described below. Class description: Resource for managing affiliations for an org. Method signatures and docstrings: - def post(org_id): Post a new Affiliation for an org using the request body. - def get(org_id): Get all affiliated entities for the given org.
Implement the Python class `OrgAffiliations` described below. Class description: Resource for managing affiliations for an org. Method signatures and docstrings: - def post(org_id): Post a new Affiliation for an org using the request body. - def get(org_id): Get all affiliated entities for the given org. <|skeleton|...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class OrgAffiliations: """Resource for managing affiliations for an org.""" def post(org_id): """Post a new Affiliation for an org using the request body.""" <|body_0|> def get(org_id): """Get all affiliated entities for the given org.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrgAffiliations: """Resource for managing affiliations for an org.""" def post(org_id): """Post a new Affiliation for an org using the request body.""" request_json = request.get_json() valid_format, errors = schema_utils.validate(request_json, 'affiliation') bearer_token ...
the_stack_v2_python_sparse
auth-api/src/auth_api/resources/org.py
bcgov/sbc-auth
train
13
e8917b7bcabb16ec9c35d4f475362ded7101711d
[ "results = []\nnums.sort()\ni = 0\nwhile i < len(nums):\n j = i + 1\n k = len(nums) - 1\n while j < k:\n v = nums[i] + nums[j] + nums[k] - target\n if v == 0:\n results.append([nums[i], nums[j], nums[k]])\n while j < len(nums) - 2 and nums[j] == nums[j + 1]:\n ...
<|body_start_0|> results = [] nums.sort() i = 0 while i < len(nums): j = i + 1 k = len(nums) - 1 while j < k: v = nums[i] + nums[j] + nums[k] - target if v == 0: results.append([nums[i], nums[j], nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums, target): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013295
1,456
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_test_001013
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums, target): :type nums: List[int] :rtype: List[List[int]] - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums, target): :type nums: List[int] :rtype: List[List[int]] - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]]...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def threeSum(self, nums, target): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums, target): """:type nums: List[int] :rtype: List[List[int]]""" results = [] nums.sort() i = 0 while i < len(nums): j = i + 1 k = len(nums) - 1 while j < k: v = nums[i] + nums[j] + nums[...
the_stack_v2_python_sparse
4sum/solution.py
uxlsl/leetcode_practice
train
0
69a7db37f552a29e804b6bdf8cd3878c590c8602
[ "_LOGGER.debug('Enable sentry mode: %s', self.name)\nawait self.tesla_device.enable_sentry_mode()\nself.async_write_ha_state()", "_LOGGER.debug('Disable sentry mode: %s', self.name)\nawait self.tesla_device.disable_sentry_mode()\nself.async_write_ha_state()", "if self.tesla_device.is_on() is None:\n return N...
<|body_start_0|> _LOGGER.debug('Enable sentry mode: %s', self.name) await self.tesla_device.enable_sentry_mode() self.async_write_ha_state() <|end_body_0|> <|body_start_1|> _LOGGER.debug('Disable sentry mode: %s', self.name) await self.tesla_device.disable_sentry_mode() ...
Representation of a Tesla sentry mode switch.
SentryModeSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentryModeSwitch: """Representation of a Tesla sentry mode switch.""" async def async_turn_on(self, **kwargs): """Send the on command.""" <|body_0|> async def async_turn_off(self, **kwargs): """Send the off command.""" <|body_1|> def is_on(self): ...
stack_v2_sparse_classes_36k_train_013296
4,636
permissive
[ { "docstring": "Send the on command.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs)" }, { "docstring": "Send the off command.", "name": "async_turn_off", "signature": "async def async_turn_off(self, **kwargs)" }, { "docstring": "Get whether the s...
3
stack_v2_sparse_classes_30k_test_000285
Implement the Python class `SentryModeSwitch` described below. Class description: Representation of a Tesla sentry mode switch. Method signatures and docstrings: - async def async_turn_on(self, **kwargs): Send the on command. - async def async_turn_off(self, **kwargs): Send the off command. - def is_on(self): Get whe...
Implement the Python class `SentryModeSwitch` described below. Class description: Representation of a Tesla sentry mode switch. Method signatures and docstrings: - async def async_turn_on(self, **kwargs): Send the on command. - async def async_turn_off(self, **kwargs): Send the off command. - def is_on(self): Get whe...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SentryModeSwitch: """Representation of a Tesla sentry mode switch.""" async def async_turn_on(self, **kwargs): """Send the on command.""" <|body_0|> async def async_turn_off(self, **kwargs): """Send the off command.""" <|body_1|> def is_on(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentryModeSwitch: """Representation of a Tesla sentry mode switch.""" async def async_turn_on(self, **kwargs): """Send the on command.""" _LOGGER.debug('Enable sentry mode: %s', self.name) await self.tesla_device.enable_sentry_mode() self.async_write_ha_state() async ...
the_stack_v2_python_sparse
homeassistant/components/tesla/switch.py
BenWoodford/home-assistant
train
11
3014d540785727401c0609615cbda77230da515e
[ "err_1 = 'data must be a 2D numpy.ndarray'\nif not isinstance(data, np.ndarray):\n raise TypeError(err_1)\nif data.ndim != 2:\n raise TypeError(err_1)\nerr_2 = 'data must contain multiple data points'\nif data.shape[1] < 2:\n raise ValueError(err_2)\nself.mean, self.cov = self.mean_cov(data)", "d = X.sha...
<|body_start_0|> err_1 = 'data must be a 2D numpy.ndarray' if not isinstance(data, np.ndarray): raise TypeError(err_1) if data.ndim != 2: raise TypeError(err_1) err_2 = 'data must contain multiple data points' if data.shape[1] < 2: raise ValueE...
Multivariate Normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """constructor""" <|body_0|> def mean_cov(X): """function that calculates the mean and covariance matrix of a data set""" <|body_1|> def pdf(self, x): """function t...
stack_v2_sparse_classes_36k_train_013297
1,775
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "function that calculates the mean and covariance matrix of a data set", "name": "mean_cov", "signature": "def mean_cov(X)" }, { "docstring": "function that calculates the ...
3
null
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): constructor - def mean_cov(X): function that calculates the mean and covariance matrix of a data set - def pdf(self, x): function that calculates ...
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): constructor - def mean_cov(X): function that calculates the mean and covariance matrix of a data set - def pdf(self, x): function that calculates ...
7d3b348aec3b20da25b162b71f150c87c7c28d71
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """constructor""" <|body_0|> def mean_cov(X): """function that calculates the mean and covariance matrix of a data set""" <|body_1|> def pdf(self, x): """function t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """constructor""" err_1 = 'data must be a 2D numpy.ndarray' if not isinstance(data, np.ndarray): raise TypeError(err_1) if data.ndim != 2: raise TypeError(err_1) e...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
dacastanogo/holbertonschool-machine_learning
train
0
d3ae4ddca53e653fa0b276ce18f5ab0402483e5d
[ "JobRunner.__init__(self)\nself.setParam('inputds', '', 'Input dataset name (for grid jobs)', insertAtFront=True)\nself.setParam('griduser', '', 'User part of grid job name, e.g. JuergBeringer', insertAtFront=True)\nself.setParam('gridsite', 'AUTO', 'Site name where jobs are sent (default:AUTO)', insertAtFront=True...
<|body_start_0|> JobRunner.__init__(self) self.setParam('inputds', '', 'Input dataset name (for grid jobs)', insertAtFront=True) self.setParam('griduser', '', 'User part of grid job name, e.g. JuergBeringer', insertAtFront=True) self.setParam('gridsite', 'AUTO', 'Site name where jobs are...
PandaJobRunner - run jobs on the grid using pathena
PandaJobRunner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandaJobRunner: """PandaJobRunner - run jobs on the grid using pathena""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a grid job.""" ...
stack_v2_sparse_classes_36k_train_013298
2,574
no_license
[ { "docstring": "Constructor (takes any number of parameters as an argument).", "name": "__init__", "signature": "def __init__(self, **params)" }, { "docstring": "Submit a JobRunner job as a grid job.", "name": "submitJob", "signature": "def submitJob(self, jobConfig)" } ]
2
null
Implement the Python class `PandaJobRunner` described below. Class description: PandaJobRunner - run jobs on the grid using pathena Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobRunner job as...
Implement the Python class `PandaJobRunner` described below. Class description: PandaJobRunner - run jobs on the grid using pathena Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobRunner job as...
22df23187ef85e9c3120122c8375ea0e7d8ea440
<|skeleton|> class PandaJobRunner: """PandaJobRunner - run jobs on the grid using pathena""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a grid job.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PandaJobRunner: """PandaJobRunner - run jobs on the grid using pathena""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" JobRunner.__init__(self) self.setParam('inputds', '', 'Input dataset name (for grid jobs)', insertAtFront=True...
the_stack_v2_python_sparse
athena/InnerDetector/InDetExample/InDetBeamSpotExample/python/PandaJobRunner.py
rushioda/PIXELVALID_athena
train
1
b80e52d2f5ae92891d6486075e20d9a98e04a0e0
[ "x, y, z = self.coords\nif self.orientation == '+x':\n yield (x - 1, y, z)\nelif self.orientation == '-x':\n yield (x + 1, y, z)\nelif self.orientation == '+z':\n yield (x, y, z - 1)\nelif self.orientation == '-z':\n yield (x, y, z + 1)\nelif self.orientation == '+y':\n yield (x, y - 1, z)", "x, y,...
<|body_start_0|> x, y, z = self.coords if self.orientation == '+x': yield (x - 1, y, z) elif self.orientation == '-x': yield (x + 1, y, z) elif self.orientation == '+z': yield (x, y, z - 1) elif self.orientation == '-z': yield (x, y...
A redstone torch. Torches do a NOT operation from their input.
Torch
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Torch: """A redstone torch. Torches do a NOT operation from their input.""" def iter_inputs(self): """Provide the input corresponding to the block upon which this torch is mounted.""" <|body_0|> def iter_outputs(self): """Provide the outputs corresponding to the ...
stack_v2_sparse_classes_36k_train_013299
13,022
permissive
[ { "docstring": "Provide the input corresponding to the block upon which this torch is mounted.", "name": "iter_inputs", "signature": "def iter_inputs(self)" }, { "docstring": "Provide the outputs corresponding to the block upon which this torch is mounted.", "name": "iter_outputs", "sign...
2
stack_v2_sparse_classes_30k_train_011929
Implement the Python class `Torch` described below. Class description: A redstone torch. Torches do a NOT operation from their input. Method signatures and docstrings: - def iter_inputs(self): Provide the input corresponding to the block upon which this torch is mounted. - def iter_outputs(self): Provide the outputs ...
Implement the Python class `Torch` described below. Class description: A redstone torch. Torches do a NOT operation from their input. Method signatures and docstrings: - def iter_inputs(self): Provide the input corresponding to the block upon which this torch is mounted. - def iter_outputs(self): Provide the outputs ...
7be5d792871a8447499911fa1502c6a7c1437dc3
<|skeleton|> class Torch: """A redstone torch. Torches do a NOT operation from their input.""" def iter_inputs(self): """Provide the input corresponding to the block upon which this torch is mounted.""" <|body_0|> def iter_outputs(self): """Provide the outputs corresponding to the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Torch: """A redstone torch. Torches do a NOT operation from their input.""" def iter_inputs(self): """Provide the input corresponding to the block upon which this torch is mounted.""" x, y, z = self.coords if self.orientation == '+x': yield (x - 1, y, z) elif s...
the_stack_v2_python_sparse
bravo/utilities/redstone.py
CyberFlameGO/bravo
train
0