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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a9192c0761126ce3b3d564bf31eafb8eb11d1d6d | [
"if self.labGroup is not None:\n self.queryset = PerformedReaction.objects.filter(reaction_ptr__in=self.labGroup.reaction_set.all()) | PerformedReaction.objects.filter(public=True)\nelse:\n self.queryset = PerformedReaction.objects.filter(public=True)\nself.queryset = self.queryset.order_by('-insertedDateTime... | <|body_start_0|>
if self.labGroup is not None:
self.queryset = PerformedReaction.objects.filter(reaction_ptr__in=self.labGroup.reaction_set.all()) | PerformedReaction.objects.filter(public=True)
else:
self.queryset = PerformedReaction.objects.filter(public=True)
self.quer... | Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies. | ListPerformedReactions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListPerformedReactions:
"""Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies."""
def dispatch(self, request, filetype=None, *args, **kwargs):
"""Render the view according to the appropriate filetype."""
<|body_0|>
def get_context_d... | stack_v2_sparse_classes_36k_train_032000 | 11,344 | no_license | [
{
"docstring": "Render the view according to the appropriate filetype.",
"name": "dispatch",
"signature": "def dispatch(self, request, filetype=None, *args, **kwargs)"
},
{
"docstring": "Attach the lab form as additional context; deprecated.",
"name": "get_context_data",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_000745 | Implement the Python class `ListPerformedReactions` described below.
Class description:
Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies.
Method signatures and docstrings:
- def dispatch(self, request, filetype=None, *args, **kwargs): Render the view according to the appropria... | Implement the Python class `ListPerformedReactions` described below.
Class description:
Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies.
Method signatures and docstrings:
- def dispatch(self, request, filetype=None, *args, **kwargs): Render the view according to the appropria... | eae2009eadf87ffd2378233f3e153d385f4654d2 | <|skeleton|>
class ListPerformedReactions:
"""Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies."""
def dispatch(self, request, filetype=None, *args, **kwargs):
"""Render the view according to the appropriate filetype."""
<|body_0|>
def get_context_d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ListPerformedReactions:
"""Standard list view of performed reactions, adjusted to deal with a few DRP idiosyncrasies."""
def dispatch(self, request, filetype=None, *args, **kwargs):
"""Render the view according to the appropriate filetype."""
if self.labGroup is not None:
self... | the_stack_v2_python_sparse | DRP/views/reaction.py | zhaojhao/DRP | train | 0 |
0c54f863cc3b64768c2083b234c2e8d933142fc7 | [
"new_head = ListNode(None)\npointer = new_head\nwhile True:\n if l1 == None and l2 == None:\n break\n elif l1 == None:\n pointer.next = l2\n break\n elif l2 == None:\n pointer.next = l1\n break\n else:\n if l1.val < l2.val:\n pointer.next = l1\n ... | <|body_start_0|>
new_head = ListNode(None)
pointer = new_head
while True:
if l1 == None and l2 == None:
break
elif l1 == None:
pointer.next = l2
break
elif l2 == None:
pointer.next = l1
... | Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNo... | stack_v2_sparse_classes_36k_train_032001 | 2,452 | 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": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, ... | 2 | stack_v2_sparse_classes_30k_train_015439 | Implement the Python class `Solution` described below.
Class description:
Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists.
Method signatures and docstr... | Implement the Python class `Solution` described below.
Class description:
Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists.
Method signatures and docstr... | 844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4 | <|skeleton|>
class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ... | the_stack_v2_python_sparse | 21-merge_two_linked_lists.py | stevestar888/leetcode-problems | train | 2 |
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace | [
"super(InTriggerDistanceToVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._other_actor = other_actor\nself._actor = actor\nself._distance = distance",
"new_status = py_trees.common.Status.RUNNING\nego_location = CarlaDataProvider.get_location(self._actor)\nother_l... | <|body_start_0|>
super(InTriggerDistanceToVehicle, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._other_actor = other_actor
self._actor = actor
self._distance = distance
<|end_body_0|>
<|body_start_1|>
new_status = py_trees.common... | This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two actors in meters The condition terminates with SUCCESS, ... | InTriggerDistanceToVehicle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InTriggerDistanceToVehicle:
"""This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two ac... | stack_v2_sparse_classes_36k_train_032002 | 18,494 | permissive | [
{
"docstring": "Setup trigger distance",
"name": "__init__",
"signature": "def __init__(self, other_actor, actor, distance, name='TriggerDistanceToVehicle')"
},
{
"docstring": "Check if the ego vehicle is within trigger distance to other actor",
"name": "update",
"signature": "def update... | 2 | stack_v2_sparse_classes_30k_train_014747 | Implement the Python class `InTriggerDistanceToVehicle` described below.
Class description:
This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distan... | Implement the Python class `InTriggerDistanceToVehicle` described below.
Class description:
This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distan... | 8ab0894b92e1f994802a218002021ee075c405bf | <|skeleton|>
class InTriggerDistanceToVehicle:
"""This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two ac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InTriggerDistanceToVehicle:
"""This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two actors in meter... | the_stack_v2_python_sparse | carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py | TinaMenke/Deep-Reinforcement-Learning | train | 9 |
77f4b885c34dec43a89b98579f3acba70fc5d839 | [
"responses.add(responses.GET, 'https://textit.in/api/v2/contacts.json?urn=whatsapp%3A27820001001', json={'results': [], 'next': None})\nmcimport = MomConnectImport.objects.create()\nmcimport.rows.create(row_number=2, msisdn='+27820001001', messaging_consent=True, facility_code='123456', edd_year=2021, edd_month=12,... | <|body_start_0|>
responses.add(responses.GET, 'https://textit.in/api/v2/contacts.json?urn=whatsapp%3A27820001001', json={'results': [], 'next': None})
mcimport = MomConnectImport.objects.create()
mcimport.rows.create(row_number=2, msisdn='+27820001001', messaging_consent=True, facility_code='123... | ValidateMomConnectImportTests | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidateMomConnectImportTests:
def test_success(self, upload_momconnect_import):
"""If the validation passes, then should be updated to validation complete"""
<|body_0|>
def test_fail_previously_opted_out(self):
"""If the mother has previously opted out, and hasn't c... | stack_v2_sparse_classes_36k_train_032003 | 31,403 | permissive | [
{
"docstring": "If the validation passes, then should be updated to validation complete",
"name": "test_success",
"signature": "def test_success(self, upload_momconnect_import)"
},
{
"docstring": "If the mother has previously opted out, and hasn't chosen to opt in again, then validation should f... | 4 | stack_v2_sparse_classes_30k_train_009998 | Implement the Python class `ValidateMomConnectImportTests` described below.
Class description:
Implement the ValidateMomConnectImportTests class.
Method signatures and docstrings:
- def test_success(self, upload_momconnect_import): If the validation passes, then should be updated to validation complete
- def test_fai... | Implement the Python class `ValidateMomConnectImportTests` described below.
Class description:
Implement the ValidateMomConnectImportTests class.
Method signatures and docstrings:
- def test_success(self, upload_momconnect_import): If the validation passes, then should be updated to validation complete
- def test_fai... | e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f | <|skeleton|>
class ValidateMomConnectImportTests:
def test_success(self, upload_momconnect_import):
"""If the validation passes, then should be updated to validation complete"""
<|body_0|>
def test_fail_previously_opted_out(self):
"""If the mother has previously opted out, and hasn't c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidateMomConnectImportTests:
def test_success(self, upload_momconnect_import):
"""If the validation passes, then should be updated to validation complete"""
responses.add(responses.GET, 'https://textit.in/api/v2/contacts.json?urn=whatsapp%3A27820001001', json={'results': [], 'next': None})
... | the_stack_v2_python_sparse | eventstore/test_tasks.py | praekeltfoundation/ndoh-hub | train | 0 | |
b12b681a6313ab11bcef6a1a6b762516f17049b9 | [
"self._context = context\nself._request = request\nself._dao = dao()",
"logger.debug('%s: args = %s', func_name(self), ','.join(['{}={}'.format(k, v) for k, v in self._request.params.items()]))\nquery_params = {}\nact_type = self._request.matchdict['type']\nsearch_type = self._request.params['event_type']\nsearch... | <|body_start_0|>
self._context = context
self._request = request
self._dao = dao()
<|end_body_0|>
<|body_start_1|>
logger.debug('%s: args = %s', func_name(self), ','.join(['{}={}'.format(k, v) for k, v in self._request.params.items()]))
query_params = {}
act_type = self.... | View Callable for managing events | EventServiceRest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventServiceRest:
"""View Callable for managing events"""
def __init__(self, context, request, dao=ActDao):
"""DAO dependency will be injected from dao arg"""
<|body_0|>
def get_acts(self):
"""Fetch Acts that match the given query parameters"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_032004 | 5,481 | no_license | [
{
"docstring": "DAO dependency will be injected from dao arg",
"name": "__init__",
"signature": "def __init__(self, context, request, dao=ActDao)"
},
{
"docstring": "Fetch Acts that match the given query parameters",
"name": "get_acts",
"signature": "def get_acts(self)"
}
] | 2 | null | Implement the Python class `EventServiceRest` described below.
Class description:
View Callable for managing events
Method signatures and docstrings:
- def __init__(self, context, request, dao=ActDao): DAO dependency will be injected from dao arg
- def get_acts(self): Fetch Acts that match the given query parameters | Implement the Python class `EventServiceRest` described below.
Class description:
View Callable for managing events
Method signatures and docstrings:
- def __init__(self, context, request, dao=ActDao): DAO dependency will be injected from dao arg
- def get_acts(self): Fetch Acts that match the given query parameters
... | 202f7cc4cae684461f1ec2c2c497ef20211b3e5e | <|skeleton|>
class EventServiceRest:
"""View Callable for managing events"""
def __init__(self, context, request, dao=ActDao):
"""DAO dependency will be injected from dao arg"""
<|body_0|>
def get_acts(self):
"""Fetch Acts that match the given query parameters"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventServiceRest:
"""View Callable for managing events"""
def __init__(self, context, request, dao=ActDao):
"""DAO dependency will be injected from dao arg"""
self._context = context
self._request = request
self._dao = dao()
def get_acts(self):
"""Fetch Acts t... | the_stack_v2_python_sparse | exercises/ex08_multiprocessing/ticketmanor/rest_services/event_service.py | mwoinoski/crs1906 | train | 1 |
20fb6df0ddfd116f9183798b8179acfb48416353 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn')\nurl = 'https://data.boston.gov/datastore/odata3.0/92f18923-d4ec-4c17-9405-4e0da63e1d6c?$format=json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = ... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn')
url = 'https://data.boston.gov/datastore/odata3.0/92f18923-d4ec-4c17-9405-4e0da63e1d6c?$format=json'
response = u... | accidents | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class accidents:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything hap... | stack_v2_sparse_classes_36k_train_032005 | 4,996 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | null | Implement the Python class `accidents` described below.
Class description:
Implement the accidents class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N... | Implement the Python class `accidents` described below.
Class description:
Implement the accidents class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class accidents:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything hap... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class accidents:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn')
... | the_stack_v2_python_sparse | jkmoy_mfflynn/accidents.py | maximega/course-2019-spr-proj | train | 2 | |
40efef0d9fa06f4f4510596938f20e5d60e2b26a | [
"if metric:\n return self.plot(metric)\nreturn self.list_metrics()",
"metrics = cherrypy.engine.publish('metrics:inventory').pop()\nreports = {}\nif pathlib.Path('apps/static/mypy').is_dir():\n reports['MyPy'] = cherrypy.engine.publish('app_url', '/static/mypy/index.html').pop()\nif pathlib.Path('apps/stati... | <|body_start_0|>
if metric:
return self.plot(metric)
return self.list_metrics()
<|end_body_0|>
<|body_start_1|>
metrics = cherrypy.engine.publish('metrics:inventory').pop()
reports = {}
if pathlib.Path('apps/static/mypy').is_dir():
reports['MyPy'] = cherr... | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
def GET(self, metric: str='', **_kwargs: str) -> bytes:
"""Dispatch to a sub-handler."""
<|body_0|>
def list_metrics() -> bytes:
"""Display a list of metrics."""
<|body_1|>
def plot(metric: str) -> bytes:
"""Display a single metric as... | stack_v2_sparse_classes_36k_train_032006 | 3,707 | no_license | [
{
"docstring": "Dispatch to a sub-handler.",
"name": "GET",
"signature": "def GET(self, metric: str='', **_kwargs: str) -> bytes"
},
{
"docstring": "Display a list of metrics.",
"name": "list_metrics",
"signature": "def list_metrics() -> bytes"
},
{
"docstring": "Display a single... | 3 | stack_v2_sparse_classes_30k_val_001045 | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def GET(self, metric: str='', **_kwargs: str) -> bytes: Dispatch to a sub-handler.
- def list_metrics() -> bytes: Display a list of metrics.
- def plot(metric: str) -> bytes:... | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def GET(self, metric: str='', **_kwargs: str) -> bytes: Dispatch to a sub-handler.
- def list_metrics() -> bytes: Display a list of metrics.
- def plot(metric: str) -> bytes:... | 7129415303b94d5d10b2c29ec432f0c7d41cc651 | <|skeleton|>
class Controller:
def GET(self, metric: str='', **_kwargs: str) -> bytes:
"""Dispatch to a sub-handler."""
<|body_0|>
def list_metrics() -> bytes:
"""Display a list of metrics."""
<|body_1|>
def plot(metric: str) -> bytes:
"""Display a single metric as... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
def GET(self, metric: str='', **_kwargs: str) -> bytes:
"""Dispatch to a sub-handler."""
if metric:
return self.plot(metric)
return self.list_metrics()
def list_metrics() -> bytes:
"""Display a list of metrics."""
metrics = cherrypy.engine.p... | the_stack_v2_python_sparse | apps/metrics/main.py | lovett/medley | train | 6 | |
8e2d37d3848a28427cf801da86557efa125ccf88 | [
"try:\n natController = NatController()\n json_data = json.dumps(natController.get_floating_ip_private_address(id))\n resp = Response(json_data, status=200, mimetype='application/json')\n return resp\nexcept ValueError as ve:\n logging.debug(ve)\n return Response(status=404)\nexcept Exception as e... | <|body_start_0|>
try:
natController = NatController()
json_data = json.dumps(natController.get_floating_ip_private_address(id))
resp = Response(json_data, status=200, mimetype='application/json')
return resp
except ValueError as ve:
logging.deb... | Nat_FloatingIP_PrivateAddress | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Nat_FloatingIP_PrivateAddress:
def get(self, id=None):
"""Gets the Floating IP private address parameter"""
<|body_0|>
def put(self, id):
"""Update the Floating IP private address parameter"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
... | stack_v2_sparse_classes_36k_train_032007 | 6,500 | no_license | [
{
"docstring": "Gets the Floating IP private address parameter",
"name": "get",
"signature": "def get(self, id=None)"
},
{
"docstring": "Update the Floating IP private address parameter",
"name": "put",
"signature": "def put(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011248 | Implement the Python class `Nat_FloatingIP_PrivateAddress` described below.
Class description:
Implement the Nat_FloatingIP_PrivateAddress class.
Method signatures and docstrings:
- def get(self, id=None): Gets the Floating IP private address parameter
- def put(self, id): Update the Floating IP private address param... | Implement the Python class `Nat_FloatingIP_PrivateAddress` described below.
Class description:
Implement the Nat_FloatingIP_PrivateAddress class.
Method signatures and docstrings:
- def get(self, id=None): Gets the Floating IP private address parameter
- def put(self, id): Update the Floating IP private address param... | b543ca1f90e1463a08e15ab45c7248e1db238327 | <|skeleton|>
class Nat_FloatingIP_PrivateAddress:
def get(self, id=None):
"""Gets the Floating IP private address parameter"""
<|body_0|>
def put(self, id):
"""Update the Floating IP private address parameter"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Nat_FloatingIP_PrivateAddress:
def get(self, id=None):
"""Gets the Floating IP private address parameter"""
try:
natController = NatController()
json_data = json.dumps(natController.get_floating_ip_private_address(id))
resp = Response(json_data, status=200, ... | the_stack_v2_python_sparse | configuration-agent/nat/rest_api/resources/floating_ip.py | piscoroma/Configurable-VNF | train | 0 | |
6df3c248f181cedd71ff960516e56a2f6053cf5e | [
"params = get_params(locals())\nraw_result = await self.api_request('get', params)\nif return_raw_response:\n return raw_result\nresult = NotificationsGetResponse(**raw_result)\nreturn result",
"params = get_params(locals())\nraw_result = await self.api_request('markAsViewed', params)\nif return_raw_response:\... | <|body_start_0|>
params = get_params(locals())
raw_result = await self.api_request('get', params)
if return_raw_response:
return raw_result
result = NotificationsGetResponse(**raw_result)
return result
<|end_body_0|>
<|body_start_1|>
params = get_params(local... | Notifications | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notifications:
async def get(self, return_raw_response: bool=False, count: typing.Optional[int]=None, start_from: typing.Optional[str]=None, filters: typing.Optional[typing.List[str]]=None, start_time: typing.Optional[int]=None, end_time: typing.Optional[int]=None) -> typing.Union[dict, Notifica... | stack_v2_sparse_classes_36k_train_032008 | 2,879 | permissive | [
{
"docstring": ":param count: - Number of notifications to return. :param start_from: :param filters: - Type of notifications to return: 'wall' — wall posts, 'mentions' — mentions in wall posts, comments, or topics, 'comments' — comments to wall posts, photos, and videos, 'likes' — likes, 'reposted' — wall post... | 3 | stack_v2_sparse_classes_30k_train_000450 | Implement the Python class `Notifications` described below.
Class description:
Implement the Notifications class.
Method signatures and docstrings:
- async def get(self, return_raw_response: bool=False, count: typing.Optional[int]=None, start_from: typing.Optional[str]=None, filters: typing.Optional[typing.List[str]]... | Implement the Python class `Notifications` described below.
Class description:
Implement the Notifications class.
Method signatures and docstrings:
- async def get(self, return_raw_response: bool=False, count: typing.Optional[int]=None, start_from: typing.Optional[str]=None, filters: typing.Optional[typing.List[str]]... | d88311a680e52faf04f3a18f9c5b381ee9e94a8f | <|skeleton|>
class Notifications:
async def get(self, return_raw_response: bool=False, count: typing.Optional[int]=None, start_from: typing.Optional[str]=None, filters: typing.Optional[typing.List[str]]=None, start_time: typing.Optional[int]=None, end_time: typing.Optional[int]=None) -> typing.Union[dict, Notifica... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Notifications:
async def get(self, return_raw_response: bool=False, count: typing.Optional[int]=None, start_from: typing.Optional[str]=None, filters: typing.Optional[typing.List[str]]=None, start_time: typing.Optional[int]=None, end_time: typing.Optional[int]=None) -> typing.Union[dict, NotificationsGetRespon... | the_stack_v2_python_sparse | vkwave/api/methods/notifications.py | prog1ckg/vkwave | train | 0 | |
a30473da673e472eb7249bc50bfdef62e0d0d77d | [
"xmin = 3\nxmax = 4\nymin = 3\nymax = 4\nNx = 1000\nNy = 1000\nmax_escape_time = 100\nplot_filename = 'None'\ntruth = np.zeros((Nx, Ny))\ntest = compute_mandelbrot(xmin, xmax, ymin, ymax, Nx, Ny, max_escape_time, plot_filename)\nself.assertTrue((truth == test).all(), True)",
"xmin = -0.1\nxmax = 0.1\nymin = -0.1\... | <|body_start_0|>
xmin = 3
xmax = 4
ymin = 3
ymax = 4
Nx = 1000
Ny = 1000
max_escape_time = 100
plot_filename = 'None'
truth = np.zeros((Nx, Ny))
test = compute_mandelbrot(xmin, xmax, ymin, ymax, Nx, Ny, max_escape_time, plot_filename)
... | TestMandelbrot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMandelbrot:
def test_if_outside_set(self):
"""Tests if the user defined area is entirely outside of the mandelbrotset."""
<|body_0|>
def test_if_inside_set(self):
"""Tests if the user defined area is entirely inside of the mandelbrotset."""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_032009 | 1,004 | no_license | [
{
"docstring": "Tests if the user defined area is entirely outside of the mandelbrotset.",
"name": "test_if_outside_set",
"signature": "def test_if_outside_set(self)"
},
{
"docstring": "Tests if the user defined area is entirely inside of the mandelbrotset.",
"name": "test_if_inside_set",
... | 2 | stack_v2_sparse_classes_30k_train_009426 | Implement the Python class `TestMandelbrot` described below.
Class description:
Implement the TestMandelbrot class.
Method signatures and docstrings:
- def test_if_outside_set(self): Tests if the user defined area is entirely outside of the mandelbrotset.
- def test_if_inside_set(self): Tests if the user defined area... | Implement the Python class `TestMandelbrot` described below.
Class description:
Implement the TestMandelbrot class.
Method signatures and docstrings:
- def test_if_outside_set(self): Tests if the user defined area is entirely outside of the mandelbrotset.
- def test_if_inside_set(self): Tests if the user defined area... | 61c64ad8ab246e4f9ee058441e898f2fbef56ce3 | <|skeleton|>
class TestMandelbrot:
def test_if_outside_set(self):
"""Tests if the user defined area is entirely outside of the mandelbrotset."""
<|body_0|>
def test_if_inside_set(self):
"""Tests if the user defined area is entirely inside of the mandelbrotset."""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestMandelbrot:
def test_if_outside_set(self):
"""Tests if the user defined area is entirely outside of the mandelbrotset."""
xmin = 3
xmax = 4
ymin = 3
ymax = 4
Nx = 1000
Ny = 1000
max_escape_time = 100
plot_filename = 'None'
tru... | the_stack_v2_python_sparse | mandelbrot/test_mandelbrot.py | nirusant/python_projects | train | 0 | |
413f1bb04e3ccbe71eeefac579cac4f5161b7e4b | [
"model = self.env['metro_park_maintenance.train_dev']\nfor train in self.train_dev_id:\n record = model.browse(train.id)\n old_miles = record.miles\n record.miles = self.miles\n record_mode = self.env['metro_park_maintenance.operation_record']\n tm = pendulum.now()\n date = tm.format('YYYY/MM/DD')... | <|body_start_0|>
model = self.env['metro_park_maintenance.train_dev']
for train in self.train_dev_id:
record = model.browse(train.id)
old_miles = record.miles
record.miles = self.miles
record_mode = self.env['metro_park_maintenance.operation_record']
... | 公里数录入 | TrainMilesSetWizard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainMilesSetWizard:
"""公里数录入"""
def on_ok(self):
"""设置公里数 :return:"""
<|body_0|>
def on_click(self):
"""设置预估公里数的年度目标 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
model = self.env['metro_park_maintenance.train_dev']
for train... | stack_v2_sparse_classes_36k_train_032010 | 2,880 | no_license | [
{
"docstring": "设置公里数 :return:",
"name": "on_ok",
"signature": "def on_ok(self)"
},
{
"docstring": "设置预估公里数的年度目标 :return:",
"name": "on_click",
"signature": "def on_click(self)"
}
] | 2 | null | Implement the Python class `TrainMilesSetWizard` described below.
Class description:
公里数录入
Method signatures and docstrings:
- def on_ok(self): 设置公里数 :return:
- def on_click(self): 设置预估公里数的年度目标 :return: | Implement the Python class `TrainMilesSetWizard` described below.
Class description:
公里数录入
Method signatures and docstrings:
- def on_ok(self): 设置公里数 :return:
- def on_click(self): 设置预估公里数的年度目标 :return:
<|skeleton|>
class TrainMilesSetWizard:
"""公里数录入"""
def on_ok(self):
"""设置公里数 :return:"""
... | 13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9 | <|skeleton|>
class TrainMilesSetWizard:
"""公里数录入"""
def on_ok(self):
"""设置公里数 :return:"""
<|body_0|>
def on_click(self):
"""设置预估公里数的年度目标 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrainMilesSetWizard:
"""公里数录入"""
def on_ok(self):
"""设置公里数 :return:"""
model = self.env['metro_park_maintenance.train_dev']
for train in self.train_dev_id:
record = model.browse(train.id)
old_miles = record.miles
record.miles = self.miles
... | the_stack_v2_python_sparse | mdias_addons/metro_park_maintenance/models/train_miles_set_wizard.py | rezaghanimi/main_mdias | train | 0 |
6ef174debc9c4df53079af9f9de8035078221814 | [
"heapq.heapify(nums)\nfor _ in range(len(nums) + 1 - k):\n elem = heapq.heappop(nums)\nreturn elem",
"heapq.heapify(nums)\nk_largest = heapq.nlargest(k, nums)\nreturn k_largest[-1]"
] | <|body_start_0|>
heapq.heapify(nums)
for _ in range(len(nums) + 1 - k):
elem = heapq.heappop(nums)
return elem
<|end_body_0|>
<|body_start_1|>
heapq.heapify(nums)
k_largest = heapq.nlargest(k, nums)
return k_largest[-1]
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
heapq.h... | stack_v2_sparse_classes_36k_train_032011 | 2,345 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|... | 844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4 | <|skeleton|>
class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
heapq.heapify(nums)
for _ in range(len(nums) + 1 - k):
elem = heapq.heappop(nums)
return elem
def findKthLargest(self, nums, k):
""":type nums: List[int] :... | the_stack_v2_python_sparse | 215-kth_largest_elem_in_array.py | stevestar888/leetcode-problems | train | 2 | |
0eefcafceb04ac96823a081e0fcd61afcfc3b498 | [
"self.trophy = ImageObject(screen_width // 2, screen_height // 5 + screen_height // 15, 50, 50, VictoryScreen.sprites[1], debug)\nself.question_mark = ImageObject(screen_width // 2, screen_height // 5 + screen_height // 15, 50, 50, VictoryScreen.sprites[0], debug)\nself.tracker = achievement_tracker\nself.refreshed... | <|body_start_0|>
self.trophy = ImageObject(screen_width // 2, screen_height // 5 + screen_height // 15, 50, 50, VictoryScreen.sprites[1], debug)
self.question_mark = ImageObject(screen_width // 2, screen_height // 5 + screen_height // 15, 50, 50, VictoryScreen.sprites[0], debug)
self.tracker = a... | AchievementScreen | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AchievementScreen:
def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False):
"""Constructor for the powerup instructions screen"""
<|body_0|>
def preprocess(self):
"""Load other variables which will be used later"... | stack_v2_sparse_classes_36k_train_032012 | 4,205 | permissive | [
{
"docstring": "Constructor for the powerup instructions screen",
"name": "__init__",
"signature": "def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False)"
},
{
"docstring": "Load other variables which will be used later",
"name": "prep... | 6 | null | Implement the Python class `AchievementScreen` described below.
Class description:
Implement the AchievementScreen class.
Method signatures and docstrings:
- def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False): Constructor for the powerup instructions screen
... | Implement the Python class `AchievementScreen` described below.
Class description:
Implement the AchievementScreen class.
Method signatures and docstrings:
- def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False): Constructor for the powerup instructions screen
... | 6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9 | <|skeleton|>
class AchievementScreen:
def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False):
"""Constructor for the powerup instructions screen"""
<|body_0|>
def preprocess(self):
"""Load other variables which will be used later"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AchievementScreen:
def __init__(self, screen_width: int, screen_height: int, screen, fps, achievement_tracker, debug: bool=False):
"""Constructor for the powerup instructions screen"""
self.trophy = ImageObject(screen_width // 2, screen_height // 5 + screen_height // 15, 50, 50, VictoryScreen.... | the_stack_v2_python_sparse | Space_Invaders/classes/Game/Instructions/AchievementsScreen.py | Jh123x/Orbital | train | 4 | |
7ab22ed3cff3fb28a7afe9152499246650c131bc | [
"super().__init__(**kwargs)\nif not isinstance(ignore_rbi_delays, bool):\n raise ValueError(\"'ignore_rbi_delays' parameter should be boolean.\")\ndefault_rbi_delays = {'00': 32, '01': 40, '35': 20, '86': 19, '91': 20, '99': 69}\nif per_rbi_delays is None:\n per_rbi_delays = {}\nelif ignore_rbi_delays:\n r... | <|body_start_0|>
super().__init__(**kwargs)
if not isinstance(ignore_rbi_delays, bool):
raise ValueError("'ignore_rbi_delays' parameter should be boolean.")
default_rbi_delays = {'00': 32, '01': 40, '35': 20, '86': 19, '91': 20, '99': 69}
if per_rbi_delays is None:
... | Implementation of the GSMANotFound classification dimension. | GSMANotFound | [
"BSD-3-Clause-Clear"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GSMANotFound:
"""Implementation of the GSMANotFound classification dimension."""
def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs):
"""Constructor."""
<|body_0|>
def _matching_imeis_sql(self, conn, app_config, virt_imei_range_start, virt_imei_... | stack_v2_sparse_classes_36k_train_032013 | 7,065 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs)"
},
{
"docstring": "Overrides Dimension._matching_imeis_sql.",
"name": "_matching_imeis_sql",
"signature": "def _matching_imeis_sql(self, conn, a... | 2 | stack_v2_sparse_classes_30k_train_004839 | Implement the Python class `GSMANotFound` described below.
Class description:
Implementation of the GSMANotFound classification dimension.
Method signatures and docstrings:
- def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs): Constructor.
- def _matching_imeis_sql(self, conn, app_config, v... | Implement the Python class `GSMANotFound` described below.
Class description:
Implementation of the GSMANotFound classification dimension.
Method signatures and docstrings:
- def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs): Constructor.
- def _matching_imeis_sql(self, conn, app_config, v... | 6b48457715338cce4eb6b3948940297ebd789189 | <|skeleton|>
class GSMANotFound:
"""Implementation of the GSMANotFound classification dimension."""
def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs):
"""Constructor."""
<|body_0|>
def _matching_imeis_sql(self, conn, app_config, virt_imei_range_start, virt_imei_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GSMANotFound:
"""Implementation of the GSMANotFound classification dimension."""
def __init__(self, *, per_rbi_delays=None, ignore_rbi_delays=False, **kwargs):
"""Constructor."""
super().__init__(**kwargs)
if not isinstance(ignore_rbi_delays, bool):
raise ValueError("'... | the_stack_v2_python_sparse | src/dirbs/dimensions/gsma_not_found.py | bryang-qti-qualcomm/DIRBS-Core | train | 0 |
fb5d1c35004953147bdfefd4119ef421237d3fc0 | [
"self.bridge = ROSBridge()\nself.service_name = service_name\nself.model_generator = PIFuGeneratorLearner(device=device, checkpoint_dir=checkpoint_dir)",
"rospy.init_node('opendr_human_model_generation', anonymous=True)\nrospy.Service('human_model_generation', Mesh_vc, self.handle_human_model_generation)\nrospy.l... | <|body_start_0|>
self.bridge = ROSBridge()
self.service_name = service_name
self.model_generator = PIFuGeneratorLearner(device=device, checkpoint_dir=checkpoint_dir)
<|end_body_0|>
<|body_start_1|>
rospy.init_node('opendr_human_model_generation', anonymous=True)
rospy.Service('h... | PifuNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PifuNode:
def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'):
"""Creates a ROS Node for pose detection :param 'human_model_generation': The name of the service :type input_image_topic: str :param device: device on which we are running inference (... | stack_v2_sparse_classes_36k_train_032014 | 3,298 | permissive | [
{
"docstring": "Creates a ROS Node for pose detection :param 'human_model_generation': The name of the service :type input_image_topic: str :param device: device on which we are running inference ('cpu' or 'cuda') :type device: str :param checkpoint_dir: the directory where the PIFu weights will be downloaded/l... | 3 | null | Implement the Python class `PifuNode` described below.
Class description:
Implement the PifuNode class.
Method signatures and docstrings:
- def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): Creates a ROS Node for pose detection :param 'human_model_generation': The name of t... | Implement the Python class `PifuNode` described below.
Class description:
Implement the PifuNode class.
Method signatures and docstrings:
- def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): Creates a ROS Node for pose detection :param 'human_model_generation': The name of t... | b3d6ce670cdf63469fc5766630eb295d67b3d788 | <|skeleton|>
class PifuNode:
def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'):
"""Creates a ROS Node for pose detection :param 'human_model_generation': The name of the service :type input_image_topic: str :param device: device on which we are running inference (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PifuNode:
def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'):
"""Creates a ROS Node for pose detection :param 'human_model_generation': The name of the service :type input_image_topic: str :param device: device on which we are running inference ('cpu' or 'cuda... | the_stack_v2_python_sparse | projects/opendr_ws/src/opendr_simulation/scripts/human_model_generation_service.py | opendr-eu/opendr | train | 535 | |
01cda23f1541d885ff24899f2d840e19b88284b3 | [
"result = []\nfor i in range(0, len(nums) + 1):\n result += self.combinationSolo(nums, i)\nreturn result",
"nums = sorted(nums)\nif k == 0:\n return [[]]\nelif k == len(nums):\n return [nums]\nelif k == 1:\n result = []\n for i in nums:\n if [i] not in result:\n result.append([i])... | <|body_start_0|>
result = []
for i in range(0, len(nums) + 1):
result += self.combinationSolo(nums, i)
return result
<|end_body_0|>
<|body_start_1|>
nums = sorted(nums)
if k == 0:
return [[]]
elif k == len(nums):
return [nums]
... | Solution_B | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_B:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
"""With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run"""
<|body_0|>
def combinationSolo(self, nums: List[int], k: int) -> ... | stack_v2_sparse_classes_36k_train_032015 | 4,175 | permissive | [
{
"docstring": "With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run",
"name": "subsetsWithDup",
"signature": "def subsetsWithDup(self, nums: List[int]) -> List[List[int]]"
},
{
"docstring": "Helper for A1, refer to LC0... | 2 | stack_v2_sparse_classes_30k_train_020349 | Implement the Python class `Solution_B` described below.
Class description:
Implement the Solution_B class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove dupl... | Implement the Python class `Solution_B` described below.
Class description:
Implement the Solution_B class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove dupl... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution_B:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
"""With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run"""
<|body_0|>
def combinationSolo(self, nums: List[int], k: int) -> ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution_B:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
"""With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run"""
result = []
for i in range(0, len(nums) + 1):
result += self.com... | the_stack_v2_python_sparse | LeetCode/LC090_subsets_ii.py | jxie0755/Learning_Python | train | 0 | |
3a4fb159f3c2e3c8e62fdba7aa3bc4042e903955 | [
"max_sum = nums[0]\ncurrent_sum = nums[0]\nfor n in nums[1:]:\n current_sum = max(current_sum + n, n)\n max_sum = max(max_sum, current_sum)\nreturn max_sum",
"if max(nums) < 0:\n return max(nums)\nglobal_max, local_max = (float('-inf'), 0)\nfor x in nums:\n local_max = max(0, local_max + x)\n globa... | <|body_start_0|>
max_sum = nums[0]
current_sum = nums[0]
for n in nums[1:]:
current_sum = max(current_sum + n, n)
max_sum = max(max_sum, current_sum)
return max_sum
<|end_body_0|>
<|body_start_1|>
if max(nums) < 0:
return max(nums)
glo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_verbose(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def maxSubArray_dp(self, nums):
""":type nums: List[int] :rtype: int... | stack_v2_sparse_classes_36k_train_032016 | 2,296 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_verbose",
"signature": "def maxSubArray_verbose(self, nums)"
},
{
"docstring": ":type ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_verbose(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_dp(self, nums): :type nu... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_verbose(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_dp(self, nums): :type nu... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_verbose(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def maxSubArray_dp(self, nums):
""":type nums: List[int] :rtype: int... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
max_sum = nums[0]
current_sum = nums[0]
for n in nums[1:]:
current_sum = max(current_sum + n, n)
max_sum = max(max_sum, current_sum)
return max_sum
def maxSubArra... | the_stack_v2_python_sparse | src/lt_53.py | oxhead/CodingYourWay | train | 0 | |
fdf29d115289758c0fc2b00344f357292e489ce7 | [
"test = '5 6\\n1 2\\n1 3\\n2 3\\n2 4\\n3 4\\n4 5'\nd = Musk(test)\nself.assertEqual(d.n, 5)\nself.assertEqual(d.m, 6)\nself.assertEqual(d.numa, [0, 0, 1, 1, 2, 3])\nself.assertEqual(d.numb, [1, 2, 2, 3, 3, 4])\nself.assertEqual(d.sets[0], {1, 2})\nself.assertEqual(d.sets[3], {1, 2, 4})\nself.assertEqual(Musk(test).... | <|body_start_0|>
test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5'
d = Musk(test)
self.assertEqual(d.n, 5)
self.assertEqual(d.m, 6)
self.assertEqual(d.numa, [0, 0, 1, 1, 2, 3])
self.assertEqual(d.numb, [1, 2, 2, 3, 3, 4])
self.assertEqual(d.sets[0], {1, 2})
self.... | unitTests | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class unitTests:
def test_single_test(self):
"""Musk class testing"""
<|body_0|>
def time_limit_test(self, nmax):
"""Timelimit testing"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5'
d = Musk(test)
... | stack_v2_sparse_classes_36k_train_032017 | 3,953 | permissive | [
{
"docstring": "Musk class testing",
"name": "test_single_test",
"signature": "def test_single_test(self)"
},
{
"docstring": "Timelimit testing",
"name": "time_limit_test",
"signature": "def time_limit_test(self, nmax)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007964 | Implement the Python class `unitTests` described below.
Class description:
Implement the unitTests class.
Method signatures and docstrings:
- def test_single_test(self): Musk class testing
- def time_limit_test(self, nmax): Timelimit testing | Implement the Python class `unitTests` described below.
Class description:
Implement the unitTests class.
Method signatures and docstrings:
- def test_single_test(self): Musk class testing
- def time_limit_test(self, nmax): Timelimit testing
<|skeleton|>
class unitTests:
def test_single_test(self):
"""M... | ae02ea872ca91ef98630cc172a844b82cc56f621 | <|skeleton|>
class unitTests:
def test_single_test(self):
"""Musk class testing"""
<|body_0|>
def time_limit_test(self, nmax):
"""Timelimit testing"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class unitTests:
def test_single_test(self):
"""Musk class testing"""
test = '5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5'
d = Musk(test)
self.assertEqual(d.n, 5)
self.assertEqual(d.m, 6)
self.assertEqual(d.numa, [0, 0, 1, 1, 2, 3])
self.assertEqual(d.numb, [1, 2, 2, 3,... | the_stack_v2_python_sparse | codeforces/574B_musk.py | snsokolov/contests | train | 1 | |
5dc4e213daef57cb10919bb09b98075aeb004d7a | [
"dummy = ListNode(float('-inf'))\nfor i in lists:\n dummy = self.merge_two(dummy, i)\nreturn dummy.next",
"curr = dummy = ListNode('X')\nwhile l1 and l2:\n if l1.val < l2.val:\n curr.next, l1 = (l1, l1.next)\n else:\n curr.next, l2 = (l2, l2.next)\n curr = curr.next\ncurr.next = l1 or l2... | <|body_start_0|>
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
<|end_body_0|>
<|body_start_1|>
curr = dummy = ListNode('X')
while l1 and l2:
if l1.val < l2.val:
curr.next, l1 = (l1, l1.n... | SolutionC1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_36k_train_032018 | 4,145 | permissive | [
{
"docstring": "use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists: List[ListNode]) -> ListNode"
},
{
"docstring": "Helper for Solution C1 and C2 (now set out side of the Solution) merge two sorted linked... | 2 | stack_v2_sparse_classes_30k_train_001787 | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
def merge_... | the_stack_v2_python_sparse | LeetCode/LC023_merge_k_sorted_list.py | jxie0755/Learning_Python | train | 0 | |
b20be1ba3f7ed3d9b7920ff4878b202dab6e8655 | [
"result = await self.get_attribute_value('current_position_lift_percentage', from_cache=False)\nself.debug('read current position: %s', result)\nif result is not None:\n self.async_send_signal(f'{self.unique_id}_{SIGNAL_ATTR_UPDATED}', 8, 'current_position_lift_percentage', result)",
"attr_name = self._get_att... | <|body_start_0|>
result = await self.get_attribute_value('current_position_lift_percentage', from_cache=False)
self.debug('read current position: %s', result)
if result is not None:
self.async_send_signal(f'{self.unique_id}_{SIGNAL_ATTR_UPDATED}', 8, 'current_position_lift_percentage... | Window cluster handler. | WindowCovering | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowCovering:
"""Window cluster handler."""
async def async_update(self):
"""Retrieve latest state."""
<|body_0|>
def attribute_updated(self, attrid: int, value: Any, _: Any) -> None:
"""Handle attribute update from window_covering cluster."""
<|body_1|... | stack_v2_sparse_classes_36k_train_032019 | 5,467 | permissive | [
{
"docstring": "Retrieve latest state.",
"name": "async_update",
"signature": "async def async_update(self)"
},
{
"docstring": "Handle attribute update from window_covering cluster.",
"name": "attribute_updated",
"signature": "def attribute_updated(self, attrid: int, value: Any, _: Any) ... | 2 | null | Implement the Python class `WindowCovering` described below.
Class description:
Window cluster handler.
Method signatures and docstrings:
- async def async_update(self): Retrieve latest state.
- def attribute_updated(self, attrid: int, value: Any, _: Any) -> None: Handle attribute update from window_covering cluster. | Implement the Python class `WindowCovering` described below.
Class description:
Window cluster handler.
Method signatures and docstrings:
- async def async_update(self): Retrieve latest state.
- def attribute_updated(self, attrid: int, value: Any, _: Any) -> None: Handle attribute update from window_covering cluster.... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class WindowCovering:
"""Window cluster handler."""
async def async_update(self):
"""Retrieve latest state."""
<|body_0|>
def attribute_updated(self, attrid: int, value: Any, _: Any) -> None:
"""Handle attribute update from window_covering cluster."""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowCovering:
"""Window cluster handler."""
async def async_update(self):
"""Retrieve latest state."""
result = await self.get_attribute_value('current_position_lift_percentage', from_cache=False)
self.debug('read current position: %s', result)
if result is not None:
... | the_stack_v2_python_sparse | homeassistant/components/zha/core/cluster_handlers/closures.py | home-assistant/core | train | 35,501 |
01c70a3ce64a35861398a6fded9db64d12ec285e | [
"if arch_code is None:\n warnings.warn('arch_code not provided when not searching.')\nsuper().__init__(arch_code=arch_code, channel_mul=channel_mul, cell=cell, num_blocks=num_blocks, num_depths=num_depths, spatial_dims=spatial_dims, act_name=act_name, norm_name=norm_name, use_downsample=use_downsample, device=de... | <|body_start_0|>
if arch_code is None:
warnings.warn('arch_code not provided when not searching.')
super().__init__(arch_code=arch_code, channel_mul=channel_mul, cell=cell, num_blocks=num_blocks, num_depths=num_depths, spatial_dims=spatial_dims, act_name=act_name, norm_name=norm_name, use_do... | Instance of the final searched architecture. Only used in re-training/inference stage. | TopologyInstance | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopologyInstance:
"""Instance of the final searched architecture. Only used in re-training/inference stage."""
def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spatial_dims: int=3, act_name: tuple | str='RELU', norm_name: tuple | str... | stack_v2_sparse_classes_36k_train_032020 | 44,771 | permissive | [
{
"docstring": "Initialize DiNTS topology search space of neural architectures.",
"name": "__init__",
"signature": "def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spatial_dims: int=3, act_name: tuple | str='RELU', norm_name: tuple | str=('INST... | 2 | stack_v2_sparse_classes_30k_train_003682 | Implement the Python class `TopologyInstance` described below.
Class description:
Instance of the final searched architecture. Only used in re-training/inference stage.
Method signatures and docstrings:
- def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spati... | Implement the Python class `TopologyInstance` described below.
Class description:
Instance of the final searched architecture. Only used in re-training/inference stage.
Method signatures and docstrings:
- def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spati... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class TopologyInstance:
"""Instance of the final searched architecture. Only used in re-training/inference stage."""
def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spatial_dims: int=3, act_name: tuple | str='RELU', norm_name: tuple | str... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TopologyInstance:
"""Instance of the final searched architecture. Only used in re-training/inference stage."""
def __init__(self, arch_code=None, channel_mul: float=1.0, cell=Cell, num_blocks: int=6, num_depths: int=3, spatial_dims: int=3, act_name: tuple | str='RELU', norm_name: tuple | str=('INSTANCE',... | the_stack_v2_python_sparse | monai/networks/nets/dints.py | Project-MONAI/MONAI | train | 4,805 |
2fc7f12b22a41be1f79d3732d18a82c818a8f2e9 | [
"super().__init__(name=name)\nself.input_size = None\nself.output_size = output_size\nself.with_bias = with_bias\nself.w_init = w_init\nself.b_init = b_init or jnp.zeros",
"if not inputs.shape:\n raise ValueError('Input must not be scalar.')\ninput_size = self.input_size = inputs.shape[-1]\noutput_size = self.... | <|body_start_0|>
super().__init__(name=name)
self.input_size = None
self.output_size = output_size
self.with_bias = with_bias
self.w_init = w_init
self.b_init = b_init or jnp.zeros
<|end_body_0|>
<|body_start_1|>
if not inputs.shape:
raise ValueError(... | Linear module. | Linear | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Linear:
"""Linear module."""
def __init__(self, output_size: int, with_bias: bool=True, w_init: Optional[hk.initializers.Initializer]=None, b_init: Optional[hk.initializers.Initializer]=None, name: Optional[str]=None):
"""Constructs the Linear module. Args: output_size: Output dimens... | stack_v2_sparse_classes_36k_train_032021 | 11,578 | permissive | [
{
"docstring": "Constructs the Linear module. Args: output_size: Output dimensionality. with_bias: Whether to add a bias to the output. w_init: Optional initializer for weights. By default, uses random values from truncated normal, with stddev ``1 / sqrt(fan_in)``. See https://arxiv.org/abs/1502.03167v3. b_init... | 2 | stack_v2_sparse_classes_30k_train_002811 | Implement the Python class `Linear` described below.
Class description:
Linear module.
Method signatures and docstrings:
- def __init__(self, output_size: int, with_bias: bool=True, w_init: Optional[hk.initializers.Initializer]=None, b_init: Optional[hk.initializers.Initializer]=None, name: Optional[str]=None): Const... | Implement the Python class `Linear` described below.
Class description:
Linear module.
Method signatures and docstrings:
- def __init__(self, output_size: int, with_bias: bool=True, w_init: Optional[hk.initializers.Initializer]=None, b_init: Optional[hk.initializers.Initializer]=None, name: Optional[str]=None): Const... | 66f9c69353a6259a3523875fdc24ca35c5f27131 | <|skeleton|>
class Linear:
"""Linear module."""
def __init__(self, output_size: int, with_bias: bool=True, w_init: Optional[hk.initializers.Initializer]=None, b_init: Optional[hk.initializers.Initializer]=None, name: Optional[str]=None):
"""Constructs the Linear module. Args: output_size: Output dimens... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Linear:
"""Linear module."""
def __init__(self, output_size: int, with_bias: bool=True, w_init: Optional[hk.initializers.Initializer]=None, b_init: Optional[hk.initializers.Initializer]=None, name: Optional[str]=None):
"""Constructs the Linear module. Args: output_size: Output dimensionality. wit... | the_stack_v2_python_sparse | haiku/_src/basic.py | arita37/dm-haiku | train | 1 |
1c6315bf1ee497701ab03a0319aa9cf1024b13f0 | [
"url = '/success/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)",
"url = '/success/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)",
... | <|body_start_0|>
url = '/success/'
response = self.client.get(url, HTTP_HOST='website.domain')
self.assertEqual(response.status_code, 302)
<|end_body_0|>
<|body_start_1|>
url = '/success/'
self.client.login(username=self.adminUN, password='pass')
response = self.client.g... | SuccessTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuccessTestCase:
def test_not_logged_in(self):
"""Test that the success view will redirect whilst not logged in and no booking made."""
<|body_0|>
def test_logged_in_admin(self):
"""Test that the success view will redirect whilst logged in as admin and no booking mad... | stack_v2_sparse_classes_36k_train_032022 | 26,818 | permissive | [
{
"docstring": "Test that the success view will redirect whilst not logged in and no booking made.",
"name": "test_not_logged_in",
"signature": "def test_not_logged_in(self)"
},
{
"docstring": "Test that the success view will redirect whilst logged in as admin and no booking made.",
"name": ... | 3 | null | Implement the Python class `SuccessTestCase` described below.
Class description:
Implement the SuccessTestCase class.
Method signatures and docstrings:
- def test_not_logged_in(self): Test that the success view will redirect whilst not logged in and no booking made.
- def test_logged_in_admin(self): Test that the suc... | Implement the Python class `SuccessTestCase` described below.
Class description:
Implement the SuccessTestCase class.
Method signatures and docstrings:
- def test_not_logged_in(self): Test that the success view will redirect whilst not logged in and no booking made.
- def test_logged_in_admin(self): Test that the suc... | 37d2942efcbdaad072f7a06ac876a40e0f69f702 | <|skeleton|>
class SuccessTestCase:
def test_not_logged_in(self):
"""Test that the success view will redirect whilst not logged in and no booking made."""
<|body_0|>
def test_logged_in_admin(self):
"""Test that the success view will redirect whilst logged in as admin and no booking mad... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuccessTestCase:
def test_not_logged_in(self):
"""Test that the success view will redirect whilst not logged in and no booking made."""
url = '/success/'
response = self.client.get(url, HTTP_HOST='website.domain')
self.assertEqual(response.status_code, 302)
def test_logged... | the_stack_v2_python_sparse | mooring/test_views.py | dbca-wa/moorings | train | 0 | |
466d0babc55ba3949ae0ebac5e065a43cdaf27b7 | [
"token = AccessToken(app_id, app_certificate, expire=expire)\nchar_user_id = get_md5(user_uuid)\neducation_service = ServiceEducation(room_uuid, user_uuid, role)\neducation_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)\ntoken.add_service(education_service)\nrtm_service = ServiceRtm(user_uuid)\n... | <|body_start_0|>
token = AccessToken(app_id, app_certificate, expire=expire)
char_user_id = get_md5(user_uuid)
education_service = ServiceEducation(room_uuid, user_uuid, role)
education_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)
token.add_service(education... | EducationTokenBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_36k_train_032023 | 3,863 | permissive | [
{
"docstring": "Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificate: Certificate of the application that you registered in the Agora Dashboard. See Get an App Certificate. :p... | 3 | stack_v2_sparse_classes_30k_test_000977 | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | 5c800b136f132a92d5f70252aac12e9c32dbf5e7 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificat... | the_stack_v2_python_sparse | DynamicKey/AgoraDynamicKey/python3/src/education_token_builder.py | AgoraIO/Tools | train | 380 | |
678eac4361b5fc5fc64fb0fa09106dda9f00b893 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ManagedAppOperation()",
"from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'displayName': lambda n: setattr(self, 'display_name', n.get_str_value()), 'lastModifiedDateTime': lambda n: s... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ManagedAppOperation()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .entity import Entity
fields: Dict[str, Callable[[Any], None]] = {'displayName': lambda n: s... | Represents an operation applied against an app registration. | ManagedAppOperation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManagedAppOperation:
"""Represents an operation applied against an app registration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: ... | stack_v2_sparse_classes_36k_train_032024 | 2,793 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ManagedAppOperation",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | null | Implement the Python class `ManagedAppOperation` described below.
Class description:
Represents an operation applied against an app registration.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: Creates a new instance of the appropri... | Implement the Python class `ManagedAppOperation` described below.
Class description:
Represents an operation applied against an app registration.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation: Creates a new instance of the appropri... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ManagedAppOperation:
"""Represents an operation applied against an app registration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ManagedAppOperation:
"""Represents an operation applied against an app registration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod... | the_stack_v2_python_sparse | msgraph/generated/models/managed_app_operation.py | microsoftgraph/msgraph-sdk-python | train | 135 |
f8b79ee7eaa24fb4f8019d428ddf914a6aed4484 | [
"header_parser = ParserDef(end_marker=lambda line, _ln, nextline: line[0:8] == ' Summary', label=lambda line, _ln: line[1:19], parser_def={'Solution refers to': {'parser': self._parse_time, 'fields': {'year': (26, 30), 'month': (31, 33), 'day': (34, 36), 'hours': (37, 39), 'minutes': (40, 42), 'decimaldate': (47, 5... | <|body_start_0|>
header_parser = ParserDef(end_marker=lambda line, _ln, nextline: line[0:8] == ' Summary', label=lambda line, _ln: line[1:19], parser_def={'Solution refers to': {'parser': self._parse_time, 'fields': {'year': (26, 30), 'month': (31, 33), 'day': (34, 36), 'hours': (37, 39), 'minutes': (40, 42), '... | A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the parser (as needed to call parsers.parse_...). system (String): GNSS identifier. Met... | GamitOrgParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GamitOrgParser:
"""A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the parser (as needed to call parsers.parse_.... | stack_v2_sparse_classes_36k_train_032025 | 7,461 | permissive | [
{
"docstring": "Parser defined for reading .org file line by line First the header information are read and afterwards the data block.",
"name": "setup_parser",
"signature": "def setup_parser(self) -> Iterable[ParserDef]"
},
{
"docstring": "Parse a line with station coordinates, and add a dictio... | 4 | stack_v2_sparse_classes_30k_train_005111 | Implement the Python class `GamitOrgParser` described below.
Class description:
A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the pa... | Implement the Python class `GamitOrgParser` described below.
Class description:
A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the pa... | 31939afee943273b23fa0a5ef193cfecfa68d6c0 | <|skeleton|>
class GamitOrgParser:
"""A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the parser (as needed to call parsers.parse_.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GamitOrgParser:
"""A parser for reading gamit org file Attributes: data (Dict): The (observation) data read from file. file_path (Path): Path to the datafile that will be read. meta (Dict): Metainformation read from file. parser_name (String): Name of the parser (as needed to call parsers.parse_...). system (... | the_stack_v2_python_sparse | midgard/parsers/gamit_org.py | kartverket/midgard | train | 18 |
50bd88ae2aa82057df74b52b640e504b817b3e40 | [
"if not root:\n return ''\nq = [root]\nres = []\nwhile q:\n node = q.pop(0)\n if not node:\n res.append('X')\n else:\n res.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\nreturn ','.join(res)",
"if not data:\n return None\ndata = data.split(',')\nroot... | <|body_start_0|>
if not root:
return ''
q = [root]
res = []
while q:
node = q.pop(0)
if not node:
res.append('X')
else:
res.append(str(node.val))
q.append(node.left)
q.append(n... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_032026 | 2,948 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 021c77ec5a5cec6401154627134192e42d24cd14 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
q = [root]
res = []
while q:
node = q.pop(0)
if not node:
res.append('X')
e... | the_stack_v2_python_sparse | 二叉树专辑/297.二叉树的序列化与反序列化.py | Jaeker0512/gocrack-algorithm | train | 0 | |
2eeadeedb1f4545810bb4e9bbc02586e4e3df09e | [
"self.from_stop_geo = kwargs['from_stop_geo']\nself.to_stop_geo = kwargs['to_stop_geo']\nself.from_city = kwargs['from_city']\nself.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None\nself.to_city = kwargs['to_city']\nself.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not... | <|body_start_0|>
self.from_stop_geo = kwargs['from_stop_geo']
self.to_stop_geo = kwargs['to_stop_geo']
self.from_city = kwargs['from_city']
self.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None
self.to_city = kwargs['to_city']
se... | Holder for starting and ending point (and other parameters) of travel. | Travel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Travel:
"""Holder for starting and ending point (and other parameters) of travel."""
def __init__(self, **kwargs):
"""Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers."""
<|body_0|>
def get_minimal_info(se... | stack_v2_sparse_classes_36k_train_032027 | 14,137 | permissive | [
{
"docstring": "Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Return minimal waypoints information in the form of a stringified inform() dial... | 2 | null | Implement the Python class `Travel` described below.
Class description:
Holder for starting and ending point (and other parameters) of travel.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran... | Implement the Python class `Travel` described below.
Class description:
Holder for starting and ending point (and other parameters) of travel.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran... | 73af644ec35c8a1cd0c37cd478c2afc1db717e0b | <|skeleton|>
class Travel:
"""Holder for starting and ending point (and other parameters) of travel."""
def __init__(self, **kwargs):
"""Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers."""
<|body_0|>
def get_minimal_info(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Travel:
"""Holder for starting and ending point (and other parameters) of travel."""
def __init__(self, **kwargs):
"""Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers."""
self.from_stop_geo = kwargs['from_stop_geo']
... | the_stack_v2_python_sparse | alex/applications/PublicTransportInfoEN/directions.py | oplatek/alex | train | 0 |
63e37f64f5e61bfa066154b82ae2cb22a3bbf121 | [
"self.background = image\nself.int_screen = int_screen\nself.back_rect = self.background.get_rect()\nself.use_stars = use_stars\nself.back_speed = 0.03\nif type in ['flyby', 'repeat']:\n if type == 'repeat':\n self.type = 2\n else:\n self.type = 0\n times = lenght * CFG().spawn_speed\n ... | <|body_start_0|>
self.background = image
self.int_screen = int_screen
self.back_rect = self.background.get_rect()
self.use_stars = use_stars
self.back_speed = 0.03
if type in ['flyby', 'repeat']:
if type == 'repeat':
self.type = 2
e... | Manage and draw level background | Background | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Background:
"""Manage and draw level background"""
def __init__(self, int_screen, image, type='flyby', use_stars=1, lenght=0):
"""Inits level background, background types: flyby - image flies by exactly once on random x position repeat - image continually flies by on random x positio... | stack_v2_sparse_classes_36k_train_032028 | 4,699 | permissive | [
{
"docstring": "Inits level background, background types: flyby - image flies by exactly once on random x position repeat - image continually flies by on random x position, with short random pauses in repeat scroll - image scrolls continually from top to bottom, with no spaces in between and no randomness :para... | 3 | stack_v2_sparse_classes_30k_train_006543 | Implement the Python class `Background` described below.
Class description:
Manage and draw level background
Method signatures and docstrings:
- def __init__(self, int_screen, image, type='flyby', use_stars=1, lenght=0): Inits level background, background types: flyby - image flies by exactly once on random x positio... | Implement the Python class `Background` described below.
Class description:
Manage and draw level background
Method signatures and docstrings:
- def __init__(self, int_screen, image, type='flyby', use_stars=1, lenght=0): Inits level background, background types: flyby - image flies by exactly once on random x positio... | 2d02242e136227e533a70a8f1921d2567379c2d2 | <|skeleton|>
class Background:
"""Manage and draw level background"""
def __init__(self, int_screen, image, type='flyby', use_stars=1, lenght=0):
"""Inits level background, background types: flyby - image flies by exactly once on random x position repeat - image continually flies by on random x positio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Background:
"""Manage and draw level background"""
def __init__(self, int_screen, image, type='flyby', use_stars=1, lenght=0):
"""Inits level background, background types: flyby - image flies by exactly once on random x position repeat - image continually flies by on random x position, with short... | the_stack_v2_python_sparse | src/background.py | velezd/space-war-2027 | train | 0 |
6a082da177298f4abf44d99c717d9f4057db0b8a | [
"if model._meta.app_label in apps:\n return db_name\nreturn None",
"if model._meta.app_label in apps:\n return db_name\nreturn None",
"if obj1._meta.app_label in apps or obj2._meta.app_label in apps:\n return True\nreturn None",
"if db == db_name:\n return model._meta.app_label in apps\nelif model... | <|body_start_0|>
if model._meta.app_label in apps:
return db_name
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label in apps:
return db_name
return None
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_label in apps or obj2._meta.app_l... | A router to control all database operations on models from applications in apps | PatientRouter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatientRouter:
"""A router to control all database operations on models from applications in apps"""
def db_for_read(self, model, **hints):
"""Point all operations on apps models to db_name"""
<|body_0|>
def db_for_write(self, model, **hints):
"""Point all operat... | stack_v2_sparse_classes_36k_train_032029 | 1,200 | permissive | [
{
"docstring": "Point all operations on apps models to db_name",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Point all operations on apps models to db_name",
"name": "db_for_write",
"signature": "def db_for_write(self, model, **hints)"
... | 4 | stack_v2_sparse_classes_30k_train_007650 | Implement the Python class `PatientRouter` described below.
Class description:
A router to control all database operations on models from applications in apps
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Point all operations on apps models to db_name
- def db_for_write(self, model, **hin... | Implement the Python class `PatientRouter` described below.
Class description:
A router to control all database operations on models from applications in apps
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Point all operations on apps models to db_name
- def db_for_write(self, model, **hin... | 3d3eebef1969442474a85c449bdf32660b7b15cc | <|skeleton|>
class PatientRouter:
"""A router to control all database operations on models from applications in apps"""
def db_for_read(self, model, **hints):
"""Point all operations on apps models to db_name"""
<|body_0|>
def db_for_write(self, model, **hints):
"""Point all operat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PatientRouter:
"""A router to control all database operations on models from applications in apps"""
def db_for_read(self, model, **hints):
"""Point all operations on apps models to db_name"""
if model._meta.app_label in apps:
return db_name
return None
def db_for... | the_stack_v2_python_sparse | thousand/dbrouters.py | ewheeler/rapidsms-thousand-days | train | 1 |
d3c3b662d4f2d7e4a8f7205e16d8b51aa46e7aa0 | [
"if not _checkPermission(ModifyPortalContent, content):\n raise AccessControl_Unauthorized\nif allowDiscussion is None or allowDiscussion == 'None':\n disc_flag = getattr(aq_base(content), 'allow_discussion', _marker)\n if disc_flag is not _marker:\n try:\n del content.allow_discussion\n ... | <|body_start_0|>
if not _checkPermission(ModifyPortalContent, content):
raise AccessControl_Unauthorized
if allowDiscussion is None or allowDiscussion == 'None':
disc_flag = getattr(aq_base(content), 'allow_discussion', _marker)
if disc_flag is not _marker:
... | Links content to discussions. | DiscussionTool | [
"ZPL-2.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscussionTool:
"""Links content to discussions."""
def overrideDiscussionFor(self, content, allowDiscussion):
"""Override discussability for the given object or clear the setting."""
<|body_0|>
def getDiscussionFor(self, content):
"""Get DiscussionItemContainer ... | stack_v2_sparse_classes_36k_train_032030 | 5,092 | permissive | [
{
"docstring": "Override discussability for the given object or clear the setting.",
"name": "overrideDiscussionFor",
"signature": "def overrideDiscussionFor(self, content, allowDiscussion)"
},
{
"docstring": "Get DiscussionItemContainer for content, create it if necessary.",
"name": "getDis... | 4 | null | Implement the Python class `DiscussionTool` described below.
Class description:
Links content to discussions.
Method signatures and docstrings:
- def overrideDiscussionFor(self, content, allowDiscussion): Override discussability for the given object or clear the setting.
- def getDiscussionFor(self, content): Get Dis... | Implement the Python class `DiscussionTool` described below.
Class description:
Links content to discussions.
Method signatures and docstrings:
- def overrideDiscussionFor(self, content, allowDiscussion): Override discussability for the given object or clear the setting.
- def getDiscussionFor(self, content): Get Dis... | eabf7529eefe13a53ed088250d179a92218af1ed | <|skeleton|>
class DiscussionTool:
"""Links content to discussions."""
def overrideDiscussionFor(self, content, allowDiscussion):
"""Override discussability for the given object or clear the setting."""
<|body_0|>
def getDiscussionFor(self, content):
"""Get DiscussionItemContainer ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscussionTool:
"""Links content to discussions."""
def overrideDiscussionFor(self, content, allowDiscussion):
"""Override discussability for the given object or clear the setting."""
if not _checkPermission(ModifyPortalContent, content):
raise AccessControl_Unauthorized
... | the_stack_v2_python_sparse | branches/Products.CMFDefault/Products/CMFDefault/DiscussionTool.py | openlegis-br/sagl | train | 17 |
615d071d466f15ce838e2321a5751860f14b03b8 | [
"stack = []\n\ndef reverse(c):\n if c == ']':\n return '['\n if c == '}':\n return '{'\n if c == ')':\n return '('\nfor c in s:\n stack += (c,)\n '{}({[]})'\n if c == ']' or c == '}' or c == ')':\n if len(stack) > 1 and stack[-2] == reverse(c):\n stack = stac... | <|body_start_0|>
stack = []
def reverse(c):
if c == ']':
return '['
if c == '}':
return '{'
if c == ')':
return '('
for c in s:
stack += (c,)
'{}({[]})'
if c == ']' or c == '}... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def rewrite(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def rewrite2(self, s):
""":type s: str :rtype: bool"""
<|body_2|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_032031 | 2,604 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "rewrite",
"signature": "def rewrite(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "rewrite2",
"sig... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def rewrite(self, s): :type s: str :rtype: bool
- def rewrite2(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def rewrite(self, s): :type s: str :rtype: bool
- def rewrite2(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def rewrite(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def rewrite2(self, s):
""":type s: str :rtype: bool"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
stack = []
def reverse(c):
if c == ']':
return '['
if c == '}':
return '{'
if c == ')':
return '('
for c in s:
stack ... | the_stack_v2_python_sparse | co_fb/20_Valid_Parentheses.py | vsdrun/lc_public | train | 6 | |
d675ffb926b6f8f2fb131440c062b5fa10eee2f4 | [
"super().__init__()\nself.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2)\nself.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)",
"x = self.up(x)\nx = self.conv(x)\nx = F.relu(x)\nreturn x"
] | <|body_start_0|>
super().__init__()
self.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2)
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)
<|end_body_0|>
<|body_start_1|>
x = self.up(x)
x = self.conv(x)
x = F.relu(x)
... | Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user. | UpConvBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpConvBlock:
"""Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user."""
def __init__(self, in_channels, out_channels):
"""Init. ... | stack_v2_sparse_classes_36k_train_032032 | 10,936 | no_license | [
{
"docstring": "Init. Args: in_channels(int): Input channels. out_channels(int): Output channels.",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels)"
},
{
"docstring": "Forward pass. Args: x(torch.Tensor): Input data. Returns: torch.Tensor: Activations.",
"name... | 2 | stack_v2_sparse_classes_30k_train_001470 | Implement the Python class `UpConvBlock` described below.
Class description:
Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.
Method signatures and docstrings... | Implement the Python class `UpConvBlock` described below.
Class description:
Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.
Method signatures and docstrings... | 9027b529eaa4cf0a38f25512141810f92db99639 | <|skeleton|>
class UpConvBlock:
"""Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user."""
def __init__(self, in_channels, out_channels):
"""Init. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpConvBlock:
"""Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user."""
def __init__(self, in_channels, out_channels):
"""Init. Args: in_chan... | the_stack_v2_python_sparse | grae/models/torch_modules.py | jakerhodes/GRAE | train | 0 |
2ed8e2ee99e70d4fb88d5df1c1c6b74a3e7671d3 | [
"if n == 1:\n return 9\nif n == 2:\n return 987\nif n == 3:\n return 123\nif n == 4:\n return 597\nif n == 5:\n return 677\nif n == 6:\n return 1218\nif n == 7:\n return 877\nif n == 8:\n return 475",
"if n == 1:\n return 9\nif n == 2:\n return 987\nfor a in range(2, 9 * 10 ** (n - 1... | <|body_start_0|>
if n == 1:
return 9
if n == 2:
return 987
if n == 3:
return 123
if n == 4:
return 597
if n == 5:
return 677
if n == 6:
return 1218
if n == 7:
return 877
if... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestPalindrome_cheat(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def largestPalindrome(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 1:
return 9
if n == 2:
... | stack_v2_sparse_classes_36k_train_032033 | 1,851 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "largestPalindrome_cheat",
"signature": "def largestPalindrome_cheat(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "largestPalindrome",
"signature": "def largestPalindrome(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014433 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestPalindrome_cheat(self, n): :type n: int :rtype: int
- def largestPalindrome(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestPalindrome_cheat(self, n): :type n: int :rtype: int
- def largestPalindrome(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def largestPalindrome... | 3f0ffd519404165fd1a735441b212c801fd1ad1e | <|skeleton|>
class Solution:
def largestPalindrome_cheat(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def largestPalindrome(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestPalindrome_cheat(self, n):
""":type n: int :rtype: int"""
if n == 1:
return 9
if n == 2:
return 987
if n == 3:
return 123
if n == 4:
return 597
if n == 5:
return 677
if n ==... | the_stack_v2_python_sparse | Problems/0400_0499/0479_Largest_Palindrome_Product/Project_Python3/Largest_Palindrome_Product.py | NobuyukiInoue/LeetCode | train | 0 | |
a02ff9451ce3ea4a1b9ab2c64a1cf321b18e64bc | [
"if not cost:\n return 0\nif len(cost) <= 2:\n return min(cost)\nprv = cost[0]\ncur = cost[1]\nfor i, c in enumerate(cost[2:], 2):\n prv, cur = (cur, min(cur, prv) + c)\nreturn min(prv, cur)",
"n = len(cost)\nif n == 0:\n return 0\ndp = [0, 0]\nfor i in range(2, n + 1):\n dp[i % 2] = min(dp[(i - 1)... | <|body_start_0|>
if not cost:
return 0
if len(cost) <= 2:
return min(cost)
prv = cost[0]
cur = cost[1]
for i, c in enumerate(cost[2:], 2):
prv, cur = (cur, min(cur, prv) + c)
return min(prv, cur)
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
"""06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)"""
<|body_0|>
def minCostClimbingStairs(self, cost: List[int]) -> int:
"""07/29/2022 23:43 Time complexity: O(n) Space complexity: O(1)... | stack_v2_sparse_classes_36k_train_032034 | 2,222 | no_license | [
{
"docstring": "06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)",
"name": "minCostClimbingStairs",
"signature": "def minCostClimbingStairs(self, cost: List[int]) -> int"
},
{
"docstring": "07/29/2022 23:43 Time complexity: O(n) Space complexity: O(1)",
"name": "minCostClimbingS... | 2 | stack_v2_sparse_classes_30k_train_004778 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost: List[int]) -> int: 06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)
- def minCostClimbingStairs(self, cost: List[int]) -> int: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost: List[int]) -> int: 06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)
- def minCostClimbingStairs(self, cost: List[int]) -> int: ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
"""06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)"""
<|body_0|>
def minCostClimbingStairs(self, cost: List[int]) -> int:
"""07/29/2022 23:43 Time complexity: O(n) Space complexity: O(1)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
"""06/20/2021 07:05 Time complexity: O(n) Space complexity: O(1)"""
if not cost:
return 0
if len(cost) <= 2:
return min(cost)
prv = cost[0]
cur = cost[1]
for i, c in enume... | the_stack_v2_python_sparse | leetcode/solved/747_Min_Cost_Climbing_Stairs/solution.py | sungminoh/algorithms | train | 0 | |
2b90bc40a617ae92170ce726232dc9f65cf40aff | [
"self.implementation = {DSXClustering.NUMBA_VORONOI: self.__numba}[mode]\nself.max_iterations = max_iterations\nself.tolerance = tolerance",
"assert isinstance(dsx, DSX)\nweights = dsx.validate_and_convert_weights(weights)\nif k is not None and initial_medoids is not None:\n assert len(initial_medoids) == k, '... | <|body_start_0|>
self.implementation = {DSXClustering.NUMBA_VORONOI: self.__numba}[mode]
self.max_iterations = max_iterations
self.tolerance = tolerance
<|end_body_0|>
<|body_start_1|>
assert isinstance(dsx, DSX)
weights = dsx.validate_and_convert_weights(weights)
if k i... | DSXClustering | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DSXClustering:
def __init__(self, mode, max_iterations=1e+99, tolerance=0.001):
"""Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---------- mode: str Implementation of clustering algorithm to use. Must be in DSXClustering.ALL_MODES ma... | stack_v2_sparse_classes_36k_train_032035 | 11,498 | no_license | [
{
"docstring": "Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---------- mode: str Implementation of clustering algorithm to use. Must be in DSXClustering.ALL_MODES max_iterations: Numeric Maximum number of iterations of the clustering algorithm tolerance: f... | 4 | stack_v2_sparse_classes_30k_train_020420 | Implement the Python class `DSXClustering` described below.
Class description:
Implement the DSXClustering class.
Method signatures and docstrings:
- def __init__(self, mode, max_iterations=1e+99, tolerance=0.001): Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---... | Implement the Python class `DSXClustering` described below.
Class description:
Implement the DSXClustering class.
Method signatures and docstrings:
- def __init__(self, mode, max_iterations=1e+99, tolerance=0.001): Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---... | d683b2a7bc260f0edb23e686ecf934f7c4c22717 | <|skeleton|>
class DSXClustering:
def __init__(self, mode, max_iterations=1e+99, tolerance=0.001):
"""Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---------- mode: str Implementation of clustering algorithm to use. Must be in DSXClustering.ALL_MODES ma... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DSXClustering:
def __init__(self, mode, max_iterations=1e+99, tolerance=0.001):
"""Clustering method used in the algorithm. The selected mode is the actual implementation. Parameters ---------- mode: str Implementation of clustering algorithm to use. Must be in DSXClustering.ALL_MODES max_iterations: ... | the_stack_v2_python_sparse | cjo/weighted_adapted_jaccard/bootstrap/bootstraphelpers.py | YorickSpenrath/PKDD2020 | train | 0 | |
f18d06d8b9e9880a1789c2a424bcf440d6728b61 | [
"self.affix_canonical_form = affix_canonical_form\nself.pos_types = pos_types\nself.rules = rules",
"if pos not in self.pos_types:\n return None\nfor rule in self.rules:\n base = rule.get_base_form(lower)\n if base is not None:\n return base\nreturn None"
] | <|body_start_0|>
self.affix_canonical_form = affix_canonical_form
self.pos_types = pos_types
self.rules = rules
<|end_body_0|>
<|body_start_1|>
if pos not in self.pos_types:
return None
for rule in self.rules:
base = rule.get_base_form(lower)
... | SuffixGroup | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuffixGroup:
def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule]):
""":param affix_canonical_form: :param pos_types: a string of pos types separated by '|' :param rules:"""
<|body_0|>
def get_base_form(self, lower: str, pos: str):
... | stack_v2_sparse_classes_36k_train_032036 | 1,754 | permissive | [
{
"docstring": ":param affix_canonical_form: :param pos_types: a string of pos types separated by '|' :param rules:",
"name": "__init__",
"signature": "def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule])"
},
{
"docstring": "If pos_types contains the input p... | 2 | stack_v2_sparse_classes_30k_train_014490 | Implement the Python class `SuffixGroup` described below.
Class description:
Implement the SuffixGroup class.
Method signatures and docstrings:
- def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule]): :param affix_canonical_form: :param pos_types: a string of pos types separated b... | Implement the Python class `SuffixGroup` described below.
Class description:
Implement the SuffixGroup class.
Method signatures and docstrings:
- def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule]): :param affix_canonical_form: :param pos_types: a string of pos types separated b... | 78c00ec098d7626fd29ca49a9aef28950fabfed9 | <|skeleton|>
class SuffixGroup:
def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule]):
""":param affix_canonical_form: :param pos_types: a string of pos types separated by '|' :param rules:"""
<|body_0|>
def get_base_form(self, lower: str, pos: str):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuffixGroup:
def __init__(self, affix_canonical_form: str, pos_types: str, rules: Sequence[SuffixRule]):
""":param affix_canonical_form: :param pos_types: a string of pos types separated by '|' :param rules:"""
self.affix_canonical_form = affix_canonical_form
self.pos_types = pos_types... | the_stack_v2_python_sparse | elit/component/lemmatization/english/suffix_group.py | elitcloud/elit | train | 38 | |
aecd73cc0cd643404af05902ec53ede08bb20e0a | [
"from scapy.config import conf\nfrom scapy.utils import get_temp_file, ContextManagerSubprocess\ncanvas = self.canvas_dump(**kargs)\nif filename is None:\n fname = get_temp_file(autoext=kargs.get('suffix', '.eps'))\n canvas.writeEPSfile(fname)\n if WINDOWS and conf.prog.psreader is None:\n os.startf... | <|body_start_0|>
from scapy.config import conf
from scapy.utils import get_temp_file, ContextManagerSubprocess
canvas = self.canvas_dump(**kargs)
if filename is None:
fname = get_temp_file(autoext=kargs.get('suffix', '.eps'))
canvas.writeEPSfile(fname)
... | _CanvasDumpExtended | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _CanvasDumpExtended:
def psdump(self, filename=None, **kargs):
"""psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called. :param filename: the file's filename"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_032037 | 12,215 | permissive | [
{
"docstring": "psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called. :param filename: the file's filename",
"name": "psdump",
"signature": "def psdump(self, filename=None, **kargs)"
},
{
... | 3 | null | Implement the Python class `_CanvasDumpExtended` described below.
Class description:
Implement the _CanvasDumpExtended class.
Method signatures and docstrings:
- def psdump(self, filename=None, **kargs): psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provid... | Implement the Python class `_CanvasDumpExtended` described below.
Class description:
Implement the _CanvasDumpExtended class.
Method signatures and docstrings:
- def psdump(self, filename=None, **kargs): psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provid... | e6cccba69335816442c515d65d9aedea9e7dc58b | <|skeleton|>
class _CanvasDumpExtended:
def psdump(self, filename=None, **kargs):
"""psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called. :param filename: the file's filename"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _CanvasDumpExtended:
def psdump(self, filename=None, **kargs):
"""psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called. :param filename: the file's filename"""
from scapy.config import ... | the_stack_v2_python_sparse | Botnets/App/App Web/PDG-env/lib/python3.6/site-packages/scapy/base_classes.py | i2tResearch/Ciberseguridad_web | train | 14 | |
9b14e47a390889c730650dd6d0add5f2803d3c8d | [
"super(TokenAuthenticator, self).__init__(rpc, response_handler, **kwargs)\nself.basic_token_handler = BasicTokenHandler(self._rpc)\nself.oidc_token_handler = OidcTokenHandler(self._rpc)",
"def token_decorator(*args: Any, **kwargs: Any) -> Union[Callable, Response]:\n \"\"\"Validate a token and execute the pro... | <|body_start_0|>
super(TokenAuthenticator, self).__init__(rpc, response_handler, **kwargs)
self.basic_token_handler = BasicTokenHandler(self._rpc)
self.oidc_token_handler = OidcTokenHandler(self._rpc)
<|end_body_0|>
<|body_start_1|>
def token_decorator(*args: Any, **kwargs: Any) -> Unio... | Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary arguments to be used by child classes - not needed here. | TokenAuthenticator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokenAuthenticator:
"""Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary arguments to be used by child classes -... | stack_v2_sparse_classes_36k_train_032038 | 13,445 | permissive | [
{
"docstring": "Initialize TokenAuthenticator.",
"name": "__init__",
"signature": "def __init__(self, rpc: FlaskPooledClusterRpcProxy, response_handler: ResponseParser, **kwargs: Any) -> None"
},
{
"docstring": "Decorator to authenticate a user by validating its token. Args: func: The wrapped fu... | 4 | null | Implement the Python class `TokenAuthenticator` described below.
Class description:
Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary ... | Implement the Python class `TokenAuthenticator` described below.
Class description:
Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary ... | 822dbd3ccee25180cc48efd2f891504b6b5edc14 | <|skeleton|>
class TokenAuthenticator:
"""Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary arguments to be used by child classes -... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TokenAuthenticator:
"""Authenticate a user by validating a token. Attributes: rpc: Connection to RPC functions - used to connect to the user service. response_handler: The ResponseParser to parse an exception if the authentication fails. **kwargs: Auxiliary arguments to be used by child classes - not needed h... | the_stack_v2_python_sparse | gateway/gateway/dependencies/auth.py | Open-EO/openeo-eodc-driver | train | 3 |
3bd441f462a7eb76665697e83b18b49416109305 | [
"if isinstance(node.op, ast.And):\n return self.visit_mutation_site(node, len(node.values))\nreturn node",
"node.op = ast.Or()\nif idx and len(node.values) > 2:\n left = node.values[:idx]\n if len(left) > 1:\n left = [ast.BoolOp(op=ast.And(), values=left)]\n right = node.values[idx:]\n if le... | <|body_start_0|>
if isinstance(node.op, ast.And):
return self.visit_mutation_site(node, len(node.values))
return node
<|end_body_0|>
<|body_start_1|>
node.op = ast.Or()
if idx and len(node.values) > 2:
left = node.values[:idx]
if len(left) > 1:
... | An operator that swaps 'and' with 'or'. | ReplaceAndWithOr | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReplaceAndWithOr:
"""An operator that swaps 'and' with 'or'."""
def visit_BoolOp(self, node):
"""http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp"""
<|body_0|>
def mutate(self, node, idx):
"""Replace AND with OR."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_032039 | 4,264 | permissive | [
{
"docstring": "http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp",
"name": "visit_BoolOp",
"signature": "def visit_BoolOp(self, node)"
},
{
"docstring": "Replace AND with OR.",
"name": "mutate",
"signature": "def mutate(self, node, idx)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020192 | Implement the Python class `ReplaceAndWithOr` described below.
Class description:
An operator that swaps 'and' with 'or'.
Method signatures and docstrings:
- def visit_BoolOp(self, node): http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp
- def mutate(self, node, idx): Replace AND with OR. | Implement the Python class `ReplaceAndWithOr` described below.
Class description:
An operator that swaps 'and' with 'or'.
Method signatures and docstrings:
- def visit_BoolOp(self, node): http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp
- def mutate(self, node, idx): Replace AND with OR.
<|skeleton|... | 0d5ba9c773299385195f6c32e5bf4de55d3494a6 | <|skeleton|>
class ReplaceAndWithOr:
"""An operator that swaps 'and' with 'or'."""
def visit_BoolOp(self, node):
"""http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp"""
<|body_0|>
def mutate(self, node, idx):
"""Replace AND with OR."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReplaceAndWithOr:
"""An operator that swaps 'and' with 'or'."""
def visit_BoolOp(self, node):
"""http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp"""
if isinstance(node.op, ast.And):
return self.visit_mutation_site(node, len(node.values))
return node
... | the_stack_v2_python_sparse | cosmic_ray/operators/boolean_replacer.py | sobolevn/cosmic-ray | train | 0 |
2ad9d67ca21f0197286f0dbc264529615b671d36 | [
"self.inputs = inputs\nself.layer_dims = layer_dims\nself.test_phase = test_phase\nif output_dim is not None:\n self.output_dim = output_dim\nelse:\n self.output_dim = inputs.get_shape()[-1]\nself._build_model()",
"start_trainable_variables = tf.trainable_variables()\nnet = self.inputs\nfor layer_dim in lay... | <|body_start_0|>
self.inputs = inputs
self.layer_dims = layer_dims
self.test_phase = test_phase
if output_dim is not None:
self.output_dim = output_dim
else:
self.output_dim = inputs.get_shape()[-1]
self._build_model()
<|end_body_0|>
<|body_start_... | An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing. | ModelMLP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelMLP:
"""An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing."""
def __init__(self, inputs, layer_dims, test_phase=False, output_dim=Non... | stack_v2_sparse_classes_36k_train_032040 | 4,780 | no_license | [
{
"docstring": "We really expect this constructor call to be made within a proper scope so that variable reuse is properly used.",
"name": "__init__",
"signature": "def __init__(self, inputs, layer_dims, test_phase=False, output_dim=None)"
},
{
"docstring": "It does not want arguments because it... | 2 | stack_v2_sparse_classes_30k_train_011459 | Implement the Python class `ModelMLP` described below.
Class description:
An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing.
Method signatures and docstrings:
- def... | Implement the Python class `ModelMLP` described below.
Class description:
An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing.
Method signatures and docstrings:
- def... | e2bd4eeff078c8ad91df11119fe8372b28c8fd0e | <|skeleton|>
class ModelMLP:
"""An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing."""
def __init__(self, inputs, layer_dims, test_phase=False, output_dim=Non... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelMLP:
"""An instance of this class contains everything with the model being applied to an input tensor. It features more than just the weights of the model. Multiple applications are handled through scope sharing."""
def __init__(self, inputs, layer_dims, test_phase=False, output_dim=None):
"... | the_stack_v2_python_sparse | 2019_spiral/src/denoising_autoencoder/models.py | gyom/denoising_autoencoder | train | 0 |
6c1d0c55aed16d1c75e26981b32fa74cabba5ffd | [
"try:\n return cls._function[state, action]\nexcept KeyError as e:\n print(\"Exception: {}. Invalid state: '{}' and action: '{}' pair\".format(e, state, action))\n raise",
"cls.dimensions = 0\nfor state in AgentActionType:\n for action in UserActionType:\n cls.dimensions += 1\ni = 0\nfor state ... | <|body_start_0|>
try:
return cls._function[state, action]
except KeyError as e:
print("Exception: {}. Invalid state: '{}' and action: '{}' pair".format(e, state, action))
raise
<|end_body_0|>
<|body_start_1|>
cls.dimensions = 0
for state in AgentActio... | UserFeatures | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserFeatures:
def get_vector(cls, state, action):
"""Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. Returns: numpy.array: Feature vector for the given state-action pair."""
<|body_0|>
def _... | stack_v2_sparse_classes_36k_train_032041 | 1,539 | no_license | [
{
"docstring": "Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. Returns: numpy.array: Feature vector for the given state-action pair.",
"name": "get_vector",
"signature": "def get_vector(cls, state, action)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_005546 | Implement the Python class `UserFeatures` described below.
Class description:
Implement the UserFeatures class.
Method signatures and docstrings:
- def get_vector(cls, state, action): Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. R... | Implement the Python class `UserFeatures` described below.
Class description:
Implement the UserFeatures class.
Method signatures and docstrings:
- def get_vector(cls, state, action): Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. R... | 435bc0d23df4b2d4494697f3e3e21a998f510742 | <|skeleton|>
class UserFeatures:
def get_vector(cls, state, action):
"""Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. Returns: numpy.array: Feature vector for the given state-action pair."""
<|body_0|>
def _... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserFeatures:
def get_vector(cls, state, action):
"""Returns the feature vector for a state-action pair. Args: state (AgentActionType): User state. action (UserActionType): User action. Returns: numpy.array: Feature vector for the given state-action pair."""
try:
return cls._functi... | the_stack_v2_python_sparse | user/user_features.py | txye/inverse-reinforcement-learning | train | 0 | |
d0189637af948eb9b79f3259caf5bcc55a3bde60 | [
"super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height)\nself.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10)\ngames.screen.add(self.score)",
"self.x = games.mouse.x\nif self.left < 0:\n self.left = 0\nif self.right > games.screen.width:\n self... | <|body_start_0|>
super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height)
self.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10)
games.screen.add(self.score)
<|end_body_0|>
<|body_start_1|>
self.x = games.mouse.x
if sel... | Pan, in whom player will catch fall pizza | Pan | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pan:
"""Pan, in whom player will catch fall pizza"""
def __init__(self):
"""init object Pan and create object Text for visual count"""
<|body_0|>
def update(self):
"""Move object on horizontal in"""
<|body_1|>
def check_catch(self):
"""Check,... | stack_v2_sparse_classes_36k_train_032042 | 6,619 | no_license | [
{
"docstring": "init object Pan and create object Text for visual count",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Move object on horizontal in",
"name": "update",
"signature": "def update(self)"
},
{
"docstring": "Check, player catch fall pizza or... | 3 | null | Implement the Python class `Pan` described below.
Class description:
Pan, in whom player will catch fall pizza
Method signatures and docstrings:
- def __init__(self): init object Pan and create object Text for visual count
- def update(self): Move object on horizontal in
- def check_catch(self): Check, player catch f... | Implement the Python class `Pan` described below.
Class description:
Pan, in whom player will catch fall pizza
Method signatures and docstrings:
- def __init__(self): init object Pan and create object Text for visual count
- def update(self): Move object on horizontal in
- def check_catch(self): Check, player catch f... | 501aed406bc88e0baebd402e18851f1f2f8ac9da | <|skeleton|>
class Pan:
"""Pan, in whom player will catch fall pizza"""
def __init__(self):
"""init object Pan and create object Text for visual count"""
<|body_0|>
def update(self):
"""Move object on horizontal in"""
<|body_1|>
def check_catch(self):
"""Check,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Pan:
"""Pan, in whom player will catch fall pizza"""
def __init__(self):
"""init object Pan and create object Text for visual count"""
super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height)
self.score = games.Text(value=0, size=25, color=color.black, top=5, right... | the_stack_v2_python_sparse | _Chapter_11_PYGAME_LIVEWIRES/panic_in_pizzeria.py | MrVeshij/Michael-Dawson | train | 1 |
25d7df6cb548000c5fa4b7ac196ff1fb36d9f6ec | [
"n = len(words)\nmask = [0] * n\nres = 0\nfor i in range(n):\n for c in words[i]:\n mask[i] |= 1 << ord(c) - ord('a')\nfor i in range(n):\n for j in range(i + 1, n):\n if mask[i] and mask[j] and (mask[i] & mask[j] == 0):\n res = max(res, len(words[i]) * len(words[j]))\nreturn res",
... | <|body_start_0|>
n = len(words)
mask = [0] * n
res = 0
for i in range(n):
for c in words[i]:
mask[i] |= 1 << ord(c) - ord('a')
for i in range(n):
for j in range(i + 1, n):
if mask[i] and mask[j] and (mask[i] & mask[j] == 0):... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProduct(self, words):
"""用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:"""
<|body_0|>
def maxProduct2(self, words):
"""时间复杂度>O(n^2) :type words: List[str] :rtype: int"""
<|bo... | stack_v2_sparse_classes_36k_train_032043 | 1,992 | no_license | [
{
"docstring": "用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:",
"name": "maxProduct",
"signature": "def maxProduct(self, words)"
},
{
"docstring": "时间复杂度>O(n^2) :type words: List[str] :rtype: int",
"name": "maxProduct2",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, words): 用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:
- def maxProduct2(self, words): 时间... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, words): 用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:
- def maxProduct2(self, words): 时间... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def maxProduct(self, words):
"""用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:"""
<|body_0|>
def maxProduct2(self, words):
"""时间复杂度>O(n^2) :type words: List[str] :rtype: int"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProduct(self, words):
"""用一个26bit的数来存储每一个单词,如果两个数做与运算=0,就表示没有相同的字母,在找出相遇为零的这个字母就可以了 时间复杂度O(n^2) 不需要转成word,数字与运算比set快 :param words: :return:"""
n = len(words)
mask = [0] * n
res = 0
for i in range(n):
for c in words[i]:
mask[i... | the_stack_v2_python_sparse | 318_最大单词长度乘积.py | lovehhf/LeetCode | train | 0 | |
cc878044d30b3563836322d6f429d72294c9dd17 | [
"settings = current.deployment_settings\nscope = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'\nuser_agent = 'google-api-client-python-plus-cmdline/1.0'\nredirect_uri = '%s/%s/default/google/login' % (settings.get_base_public_url(), current.request.application)\nO... | <|body_start_0|>
settings = current.deployment_settings
scope = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'
user_agent = 'google-api-client-python-plus-cmdline/1.0'
redirect_uri = '%s/%s/default/google/login' % (settings.get_base_publ... | OAuth implementation for Google https://code.google.com/apis/console/ | GooglePlusAccount | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GooglePlusAccount:
"""OAuth implementation for Google https://code.google.com/apis/console/"""
def __init__(self, channel):
"""Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}"""
<|body_0|>
def __build_url_opener(self, uri)... | stack_v2_sparse_classes_36k_train_032044 | 31,965 | permissive | [
{
"docstring": "Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}",
"name": "__init__",
"signature": "def __init__(self, channel)"
},
{
"docstring": "Build the url opener for managing HTTP Basic Authentication",
"name": "__build_url_opener",
... | 6 | stack_v2_sparse_classes_30k_train_000793 | Implement the Python class `GooglePlusAccount` described below.
Class description:
OAuth implementation for Google https://code.google.com/apis/console/
Method signatures and docstrings:
- def __init__(self, channel): Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}
- d... | Implement the Python class `GooglePlusAccount` described below.
Class description:
OAuth implementation for Google https://code.google.com/apis/console/
Method signatures and docstrings:
- def __init__(self, channel): Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}
- d... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class GooglePlusAccount:
"""OAuth implementation for Google https://code.google.com/apis/console/"""
def __init__(self, channel):
"""Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}"""
<|body_0|>
def __build_url_opener(self, uri)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GooglePlusAccount:
"""OAuth implementation for Google https://code.google.com/apis/console/"""
def __init__(self, channel):
"""Constructor @param channel: dict with Google API credentials: {id=clientID, secret=clientSecret}"""
settings = current.deployment_settings
scope = 'https:... | the_stack_v2_python_sparse | modules/core/aaa/oauth.py | nursix/drkcm | train | 3 |
ebab8580bcb84d5bfc48a59f73003a137528eff2 | [
"if not tree:\n return None\nnew_tree = TreeNode(0)\nnew_tree.left = self.deep_clone(tree.left)\nnew_tree.right = self.deep_clone(tree.right)\nreturn new_tree",
"if not N & 1:\n return []\nelif N == 1:\n return [TreeNode(0)]\nrtn = []\nfor i in range(2, N + 1, 2):\n left_branch = self.allPossibleFBT(i... | <|body_start_0|>
if not tree:
return None
new_tree = TreeNode(0)
new_tree.left = self.deep_clone(tree.left)
new_tree.right = self.deep_clone(tree.right)
return new_tree
<|end_body_0|>
<|body_start_1|>
if not N & 1:
return []
elif N == 1:
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deep_clone(self, tree: TreeNode) -> TreeNode:
"""Similar to deep copy"""
<|body_0|>
def allPossibleFBT(self, N: int) -> List[TreeNode]:
"""if N = 7, think of the nodes as 1, 2, 3, 4, 5, 6, 7 Even values cannot be lead nodes and all Odd values are leaf n... | stack_v2_sparse_classes_36k_train_032045 | 1,735 | permissive | [
{
"docstring": "Similar to deep copy",
"name": "deep_clone",
"signature": "def deep_clone(self, tree: TreeNode) -> TreeNode"
},
{
"docstring": "if N = 7, think of the nodes as 1, 2, 3, 4, 5, 6, 7 Even values cannot be lead nodes and all Odd values are leaf nodes",
"name": "allPossibleFBT",
... | 2 | stack_v2_sparse_classes_30k_train_021476 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deep_clone(self, tree: TreeNode) -> TreeNode: Similar to deep copy
- def allPossibleFBT(self, N: int) -> List[TreeNode]: if N = 7, think of the nodes as 1, 2, 3, 4, 5, 6, 7 E... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deep_clone(self, tree: TreeNode) -> TreeNode: Similar to deep copy
- def allPossibleFBT(self, N: int) -> List[TreeNode]: if N = 7, think of the nodes as 1, 2, 3, 4, 5, 6, 7 E... | c07b555127ee89d6f461cea7cd87811c382086ff | <|skeleton|>
class Solution:
def deep_clone(self, tree: TreeNode) -> TreeNode:
"""Similar to deep copy"""
<|body_0|>
def allPossibleFBT(self, N: int) -> List[TreeNode]:
"""if N = 7, think of the nodes as 1, 2, 3, 4, 5, 6, 7 Even values cannot be lead nodes and all Odd values are leaf n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def deep_clone(self, tree: TreeNode) -> TreeNode:
"""Similar to deep copy"""
if not tree:
return None
new_tree = TreeNode(0)
new_tree.left = self.deep_clone(tree.left)
new_tree.right = self.deep_clone(tree.right)
return new_tree
def al... | the_stack_v2_python_sparse | Leetcode/week_4/p0894_all_possible_full_binary_trees.py | scohen40/wallbreakers_projects | train | 0 | |
e8d327d73f1a5517c46426ae077a1290c082f06b | [
"dist = self.map_x_to_distribution(y_pred)\nsamples = dist.sample((n_samples,)).permute(2, 1, 0)\nreturn samples",
"distribution = self.map_x_to_distribution(y_pred)\nloss = -distribution.log_prob(y_actual.transpose(0, 1)).sum() * y_actual.size(0)\nreturn loss"
] | <|body_start_0|>
dist = self.map_x_to_distribution(y_pred)
samples = dist.sample((n_samples,)).permute(2, 1, 0)
return samples
<|end_body_0|>
<|body_start_1|>
distribution = self.map_x_to_distribution(y_pred)
loss = -distribution.log_prob(y_actual.transpose(0, 1)).sum() * y_actu... | Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time dimension still remains independent. | MultivariateDistributionLoss | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultivariateDistributionLoss:
"""Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time dimension still remains independent."""
... | stack_v2_sparse_classes_36k_train_032046 | 36,785 | permissive | [
{
"docstring": "Sample from distribution. Args: y_pred: prediction output of network (shape batch_size x n_timesteps x n_paramters) n_samples (int): number of samples to draw Returns: torch.Tensor: tensor with samples (shape batch_size x n_timesteps x n_samples)",
"name": "sample",
"signature": "def sam... | 2 | stack_v2_sparse_classes_30k_train_019460 | Implement the Python class `MultivariateDistributionLoss` described below.
Class description:
Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time di... | Implement the Python class `MultivariateDistributionLoss` described below.
Class description:
Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time di... | 7c775c1a2fe3effe62eac0a476db98ca5b24ca4c | <|skeleton|>
class MultivariateDistributionLoss:
"""Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time dimension still remains independent."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultivariateDistributionLoss:
"""Base class for multivariate distribution losses. Class should be inherited for all multivariate distribution losses, i.e. if a batch of values is predicted in one go and the batch dimension is not independent, but the time dimension still remains independent."""
def sampl... | the_stack_v2_python_sparse | pytorch_forecasting/metrics/base_metrics.py | jdb78/pytorch-forecasting | train | 3,233 |
8afbcf0cd7c8848a88f3a9e7f9f17a090479c30d | [
"try:\n return Link.objects.get(pk=pk)\nexcept Category.DoesNotExist:\n raise Http404",
"links = self.get_object(pk)\nserializer = LinksSerializer(links)\nreturn Response(serializer.data)",
"links = self.get_object(pk)\nserializer = LinksSerializer(links, data=request.data)\nif serializer.is_valid():\n ... | <|body_start_0|>
try:
return Link.objects.get(pk=pk)
except Category.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
links = self.get_object(pk)
serializer = LinksSerializer(links)
return Response(serializer.data)
<|end_body_1|>
<|body_start_... | Retrieve, update or delete a category instance. | LinksDetails | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinksDetails:
"""Retrieve, update or delete a category instance."""
def get_object(self, pk):
"""Get the perticular row from the table."""
<|body_0|>
def get(self, request, pk, format=None):
"""We are going to add the Category content along with this pull request... | stack_v2_sparse_classes_36k_train_032047 | 4,310 | permissive | [
{
"docstring": "Get the perticular row from the table.",
"name": "get_object",
"signature": "def get_object(self, pk)"
},
{
"docstring": "We are going to add the Category content along with this pull request",
"name": "get",
"signature": "def get(self, request, pk, format=None)"
},
{... | 4 | stack_v2_sparse_classes_30k_train_011289 | Implement the Python class `LinksDetails` described below.
Class description:
Retrieve, update or delete a category instance.
Method signatures and docstrings:
- def get_object(self, pk): Get the perticular row from the table.
- def get(self, request, pk, format=None): We are going to add the Category content along w... | Implement the Python class `LinksDetails` described below.
Class description:
Retrieve, update or delete a category instance.
Method signatures and docstrings:
- def get_object(self, pk): Get the perticular row from the table.
- def get(self, request, pk, format=None): We are going to add the Category content along w... | b0635e72338e14dad24f1ee0329212cd60a3e83a | <|skeleton|>
class LinksDetails:
"""Retrieve, update or delete a category instance."""
def get_object(self, pk):
"""Get the perticular row from the table."""
<|body_0|>
def get(self, request, pk, format=None):
"""We are going to add the Category content along with this pull request... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinksDetails:
"""Retrieve, update or delete a category instance."""
def get_object(self, pk):
"""Get the perticular row from the table."""
try:
return Link.objects.get(pk=pk)
except Category.DoesNotExist:
raise Http404
def get(self, request, pk, format... | the_stack_v2_python_sparse | links/views.py | faisaltheparttimecoder/carelogBackend | train | 1 |
a3caa7498eda007356814f580720f7a3ae027914 | [
"choices_plist, error = subprocess.Popen(['/usr/sbin/installer', '-showChoicesXML', '-pkg', choices_pkg_path], stdout=subprocess.PIPE).communicate()\nif choices_plist:\n try:\n choices_list = plistlib.loads(choices_plist)\n except Exception as err:\n raise ProcessorError(f\"Unexpected error pars... | <|body_start_0|>
choices_plist, error = subprocess.Popen(['/usr/sbin/installer', '-showChoicesXML', '-pkg', choices_pkg_path], stdout=subprocess.PIPE).communicate()
if choices_plist:
try:
choices_list = plistlib.loads(choices_plist)
except Exception as err:
... | Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml | ChoicesXMLGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChoicesXMLGenerator:
"""Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml"""
def output_showchoicesxml(self, choices_pkg_path):
"""Invoke the installer showChoicesXML command and return the contents"""
... | stack_v2_sparse_classes_36k_train_032048 | 4,729 | permissive | [
{
"docstring": "Invoke the installer showChoicesXML command and return the contents",
"name": "output_showchoicesxml",
"signature": "def output_showchoicesxml(self, choices_pkg_path)"
},
{
"docstring": "Generates the python dictionary of choices. Desired choices are given the choice attribute '1... | 4 | stack_v2_sparse_classes_30k_train_010509 | Implement the Python class `ChoicesXMLGenerator` described below.
Class description:
Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml
Method signatures and docstrings:
- def output_showchoicesxml(self, choices_pkg_path): Invoke the inst... | Implement the Python class `ChoicesXMLGenerator` described below.
Class description:
Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml
Method signatures and docstrings:
- def output_showchoicesxml(self, choices_pkg_path): Invoke the inst... | 7c0a2eaf223822480ccd80a7ea3d163cc9b5b507 | <|skeleton|>
class ChoicesXMLGenerator:
"""Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml"""
def output_showchoicesxml(self, choices_pkg_path):
"""Invoke the installer showChoicesXML command and return the contents"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChoicesXMLGenerator:
"""Generates a choices.xml file for use with an installer. A postinstall script is required to run the installer with the choices.xml"""
def output_showchoicesxml(self, choices_pkg_path):
"""Invoke the installer showChoicesXML command and return the contents"""
choice... | the_stack_v2_python_sparse | CommonProcessors/ChoicesXMLGenerator.py | autopkg/grahampugh-recipes | train | 66 |
14e30cf3c5200b81437847b1ea28adc6036209ca | [
"super().__init__(dim_param=dim_param, seed=seed)\nself.I = I\nself.dt = dt\nself.t = np.arange(0, len(self.I), 1) * self.dt\nself.RibonModel = Model\nself.pre_step = pre_step\nself.ID = ID",
"\"\"\"with open(str(self.ID) + '.log', 'a') as f:\n tmp_params = \" \".join([str(params[i]) for i in range(len... | <|body_start_0|>
super().__init__(dim_param=dim_param, seed=seed)
self.I = I
self.dt = dt
self.t = np.arange(0, len(self.I), 1) * self.dt
self.RibonModel = Model
self.pre_step = pre_step
self.ID = ID
<|end_body_0|>
<|body_start_1|>
"""with open(str(self.I... | Ribon | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ribon:
def __init__(self, I, dt, dim_param, pre_step, Model, ID, seed=None):
"""Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param : int Number of parameter pre_step : int Number of time points before the stimuli seed : int or... | stack_v2_sparse_classes_36k_train_032049 | 6,046 | permissive | [
{
"docstring": "Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param : int Number of parameter pre_step : int Number of time points before the stimuli seed : int or None If set, randomness across runs is disabled",
"name": "__init__",
"signatur... | 2 | null | Implement the Python class `Ribon` described below.
Class description:
Implement the Ribon class.
Method signatures and docstrings:
- def __init__(self, I, dt, dim_param, pre_step, Model, ID, seed=None): Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param :... | Implement the Python class `Ribon` described below.
Class description:
Implement the Ribon class.
Method signatures and docstrings:
- def __init__(self, I, dt, dim_param, pre_step, Model, ID, seed=None): Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param :... | d06b9f2e6ce6235c4b318b9807a75263beb3e518 | <|skeleton|>
class Ribon:
def __init__(self, I, dt, dim_param, pre_step, Model, ID, seed=None):
"""Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param : int Number of parameter pre_step : int Number of time points before the stimuli seed : int or... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ribon:
def __init__(self, I, dt, dim_param, pre_step, Model, ID, seed=None):
"""Ribon simulator Parameters ---------- I : array Numpy array with the input current dt : float Timestep dim_param : int Number of parameter pre_step : int Number of time points before the stimuli seed : int or None If set, ... | the_stack_v2_python_sparse | model/Ribon/Ribon_simulation.py | holmosaint/delfi | train | 0 | |
63935b09bc8a7ffdca73f629bfadd662819e79ea | [
"three_months_ago = datetime.today() - timedelta(days=90)\nfor event in events:\n start = self.legistar_start(event)\n if not start or (start < three_months_ago and (not self.settings.getbool('CITY_SCRAPERS_ARCHIVE'))):\n continue\n meeting = Meeting(title=event['Name']['label'], description='', cla... | <|body_start_0|>
three_months_ago = datetime.today() - timedelta(days=90)
for event in events:
start = self.legistar_start(event)
if not start or (start < three_months_ago and (not self.settings.getbool('CITY_SCRAPERS_ARCHIVE'))):
continue
meeting = Me... | ChiCityCouncilSpider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChiCityCouncilSpider:
def parse_legistar(self, events):
"""`parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_location(self, item):
"""Parse or generate loc... | stack_v2_sparse_classes_36k_train_032050 | 2,055 | permissive | [
{
"docstring": "`parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.",
"name": "parse_legistar",
"signature": "def parse_legistar(self, events)"
},
{
"docstring": "Parse or generate location.",
"name": "_pars... | 2 | stack_v2_sparse_classes_30k_train_011413 | Implement the Python class `ChiCityCouncilSpider` described below.
Class description:
Implement the ChiCityCouncilSpider class.
Method signatures and docstrings:
- def parse_legistar(self, events): `parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your... | Implement the Python class `ChiCityCouncilSpider` described below.
Class description:
Implement the ChiCityCouncilSpider class.
Method signatures and docstrings:
- def parse_legistar(self, events): `parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your... | 611fce6a2705446e25a2fc33e32090a571eb35d1 | <|skeleton|>
class ChiCityCouncilSpider:
def parse_legistar(self, events):
"""`parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_location(self, item):
"""Parse or generate loc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChiCityCouncilSpider:
def parse_legistar(self, events):
"""`parse_legistar` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
three_months_ago = datetime.today() - timedelta(days=90)
for event in events:
... | the_stack_v2_python_sparse | city_scrapers/spiders/chi_citycouncil.py | City-Bureau/city-scrapers | train | 308 | |
05e527cd0a8dbbb35cfcc000e19d4875dcdfb1bc | [
"G = self.parent()\nL = G.splitting_field()\na = G._pari_data.galoispermtopol(pari(self.domain()).Vecsmall())\nP = L._pari_absolute_structure()[1].lift()\na = L(P(a.Mod(L.pari_polynomial('y'))))\nreturn L.hom(a, L)",
"if x.parent() == self.parent().splitting_field():\n return self.as_hom()(x)\nelse:\n retur... | <|body_start_0|>
G = self.parent()
L = G.splitting_field()
a = G._pari_data.galoispermtopol(pari(self.domain()).Vecsmall())
P = L._pari_absolute_structure()[1].lift()
a = L(P(a.Mod(L.pari_polynomial('y'))))
return L.hom(a, L)
<|end_body_0|>
<|body_start_1|>
if x.... | An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() sage: G[1] (1,2) sage: G[1](w + 2) -w + 2 sage: L.<v> = NumberField(x^3 - 2); G = L.g... | GaloisGroupElement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaloisGroupElement:
"""An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() sage: G[1] (1,2) sage: G[1](w + 2) -w +... | stack_v2_sparse_classes_36k_train_032051 | 27,204 | no_license | [
{
"docstring": "Return the homomorphism L -> L corresponding to self, where L is the Galois closure of the ambient number field. EXAMPLE:: sage: G = QuadraticField(-7,'w').galois_group() sage: G[1].as_hom() Ring endomorphism of Number Field in w with defining polynomial x^2 + 7 Defn: w |--> -w TESTS: Number fie... | 3 | stack_v2_sparse_classes_30k_train_011969 | Implement the Python class `GaloisGroupElement` described below.
Class description:
An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() ... | Implement the Python class `GaloisGroupElement` described below.
Class description:
An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() ... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class GaloisGroupElement:
"""An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() sage: G[1] (1,2) sage: G[1](w + 2) -w +... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GaloisGroupElement:
"""An element of a Galois group. This is stored as a permutation, but may also be made to act on elements of the field (generally returning elements of its Galois closure). EXAMPLE:: sage: K.<w> = QuadraticField(-7); G = K.galois_group() sage: G[1] (1,2) sage: G[1](w + 2) -w + 2 sage: L.<v... | the_stack_v2_python_sparse | sage/src/sage/rings/number_field/galois_group.py | bopopescu/geosci | train | 0 |
c572665643048d044ef428070028aaba1fb959a1 | [
"self.language = language or u'it'\nself.chunker = chunker or u'link'\nself.grammar = grammar",
"tagged_tokens = self.disambiguate_tokens(tagged_tokens, simplify=simplify)\nif self.language == u'it' and self.chunker == u'link':\n chunked_tokens = self.link_chunker(tagged_tokens)\nelse:\n chunked_tokens = []... | <|body_start_0|>
self.language = language or u'it'
self.chunker = chunker or u'link'
self.grammar = grammar
<|end_body_0|>
<|body_start_1|>
tagged_tokens = self.disambiguate_tokens(tagged_tokens, simplify=simplify)
if self.language == u'it' and self.chunker == u'link':
... | An object representing a chunker wizard | NltkChunker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NltkChunker:
"""An object representing a chunker wizard"""
def __init__(self, language=None, chunker=None, grammar=None):
"""set language"""
<|body_0|>
def main_chunker(self, tagged_tokens, simplify=True, chunk_tag=None):
"""choose a chunker based on some paramet... | stack_v2_sparse_classes_36k_train_032052 | 2,336 | no_license | [
{
"docstring": "set language",
"name": "__init__",
"signature": "def __init__(self, language=None, chunker=None, grammar=None)"
},
{
"docstring": "choose a chunker based on some parameters",
"name": "main_chunker",
"signature": "def main_chunker(self, tagged_tokens, simplify=True, chunk_... | 5 | stack_v2_sparse_classes_30k_train_013878 | Implement the Python class `NltkChunker` described below.
Class description:
An object representing a chunker wizard
Method signatures and docstrings:
- def __init__(self, language=None, chunker=None, grammar=None): set language
- def main_chunker(self, tagged_tokens, simplify=True, chunk_tag=None): choose a chunker ... | Implement the Python class `NltkChunker` described below.
Class description:
An object representing a chunker wizard
Method signatures and docstrings:
- def __init__(self, language=None, chunker=None, grammar=None): set language
- def main_chunker(self, tagged_tokens, simplify=True, chunk_tag=None): choose a chunker ... | 2bcd965de76c33480af55b8df5242171772a96f6 | <|skeleton|>
class NltkChunker:
"""An object representing a chunker wizard"""
def __init__(self, language=None, chunker=None, grammar=None):
"""set language"""
<|body_0|>
def main_chunker(self, tagged_tokens, simplify=True, chunk_tag=None):
"""choose a chunker based on some paramet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NltkChunker:
"""An object representing a chunker wizard"""
def __init__(self, language=None, chunker=None, grammar=None):
"""set language"""
self.language = language or u'it'
self.chunker = chunker or u'link'
self.grammar = grammar
def main_chunker(self, tagged_tokens... | the_stack_v2_python_sparse | wip_nltk/chunkers.py | gtoffoli/django-wip | train | 2 |
d4bf260c03641d7c602bb72f6756b9fd42e930f7 | [
"super().__init__(**kwargs)\nassert json_topology is not None, 'must give a JSON format topology'\nassert init_state is not None, 'must give an init state for the topology PDB'\nif main_rep_idxs is None:\n self.main_rep_idxs = list(range(init_state['positions'].shape[0]))\nelse:\n self.main_rep_idxs = main_re... | <|body_start_0|>
super().__init__(**kwargs)
assert json_topology is not None, 'must give a JSON format topology'
assert init_state is not None, 'must give an init state for the topology PDB'
if main_rep_idxs is None:
self.main_rep_idxs = list(range(init_state['positions'].sha... | Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the call to the 'init' method). This defines t... | WalkerReporter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the ... | stack_v2_sparse_classes_36k_train_032053 | 5,495 | permissive | [
{
"docstring": "Constructor for the WalkerReporter. Parameters ---------- init_state : object implementing WalkerState An initial state, only used for writing the PDB topology. json_topology : str A molecular topology in the common JSON format, that matches the main_rep_idxs. main_rep_idxs : listlike of int The... | 3 | stack_v2_sparse_classes_30k_train_013552 | Implement the Python class `WalkerReporter` described below.
Class description:
Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at... | Implement the Python class `WalkerReporter` described below.
Class description:
Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at... | 3a029510114db6e66db6a264bd213c9f06559b41 | <|skeleton|>
class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WalkerReporter:
"""Reporter for generating 3D molecular structure files of the walkers produced by a cycle. It generates two different files using the mdtraj library: a PDB format and a DCD file. The PDB is used as a "topology" that is only generated once at the beginning of a simulation (in the call to the '... | the_stack_v2_python_sparse | src/wepy/reporter/walker.py | ADicksonLab/wepy | train | 43 |
a8fc46e817f96e4a28116e21595a47200ee57e35 | [
"for project_id, backend_services in resource_from_api.iteritems():\n for backend_service in backend_services:\n yield {'project_id': project_id, 'id': backend_service.get('id'), 'creation_timestamp': parser.format_timestamp(backend_service.get('creationTimestamp'), self.MYSQL_DATETIME_FORMAT), 'name': ba... | <|body_start_0|>
for project_id, backend_services in resource_from_api.iteritems():
for backend_service in backend_services:
yield {'project_id': project_id, 'id': backend_service.get('id'), 'creation_timestamp': parser.format_timestamp(backend_service.get('creationTimestamp'), self.... | Load compute backend services for all projects. | LoadBackendServicesPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadBackendServicesPipeline:
"""Load compute backend services for all projects."""
def _transform(self, resource_from_api):
"""Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: it... | stack_v2_sparse_classes_36k_train_032054 | 4,698 | permissive | [
{
"docstring": "Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: iterator: backend service properties in a dict.",
"name": "_transform",
"signature": "def _transform(self, resource_from_api)"
},
... | 3 | stack_v2_sparse_classes_30k_val_000322 | Implement the Python class `LoadBackendServicesPipeline` described below.
Class description:
Load compute backend services for all projects.
Method signatures and docstrings:
- def _transform(self, resource_from_api): Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwar... | Implement the Python class `LoadBackendServicesPipeline` described below.
Class description:
Load compute backend services for all projects.
Method signatures and docstrings:
- def _transform(self, resource_from_api): Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwar... | a6a1aa7464cda2ad5948e3e8876eb8dded5e2514 | <|skeleton|>
class LoadBackendServicesPipeline:
"""Load compute backend services for all projects."""
def _transform(self, resource_from_api):
"""Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: it... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadBackendServicesPipeline:
"""Load compute backend services for all projects."""
def _transform(self, resource_from_api):
"""Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: iterator: backe... | the_stack_v2_python_sparse | google/cloud/security/inventory/pipelines/load_backend_services_pipeline.py | shimizu19691210/forseti-security | train | 1 |
26ae598a4362d6ff746580dbb6ca750f2818ae3f | [
"app = AndroidApplication.instance()\nf = app.create_future()\n\ndef on_result(perms):\n f.set_result(perms.get(cls.CAMERA_PERMISSION, False))\n\ndef on_has_perm(result):\n if result:\n f.set_result(True)\n else:\n app.request_permissions((cls.CAMERA_PERMISSION,)).then(on_result)\napp.has_per... | <|body_start_0|>
app = AndroidApplication.instance()
f = app.create_future()
def on_result(perms):
f.set_result(perms.get(cls.CAMERA_PERMISSION, False))
def on_has_perm(result):
if result:
f.set_result(True)
else:
app.... | Access android's CameraManager. Use the static class methods. | CameraManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraManager:
"""Access android's CameraManager. Use the static class methods."""
def request_permission(cls):
"""Requests permission and returns an future result that returns a boolean indicating if all the given permission were granted or denied."""
<|body_0|>
def get... | stack_v2_sparse_classes_36k_train_032055 | 15,665 | permissive | [
{
"docstring": "Requests permission and returns an future result that returns a boolean indicating if all the given permission were granted or denied.",
"name": "request_permission",
"signature": "def request_permission(cls)"
},
{
"docstring": "Return the list of cameras this device supports",
... | 2 | stack_v2_sparse_classes_30k_train_003687 | Implement the Python class `CameraManager` described below.
Class description:
Access android's CameraManager. Use the static class methods.
Method signatures and docstrings:
- def request_permission(cls): Requests permission and returns an future result that returns a boolean indicating if all the given permission w... | Implement the Python class `CameraManager` described below.
Class description:
Access android's CameraManager. Use the static class methods.
Method signatures and docstrings:
- def request_permission(cls): Requests permission and returns an future result that returns a boolean indicating if all the given permission w... | 04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc | <|skeleton|>
class CameraManager:
"""Access android's CameraManager. Use the static class methods."""
def request_permission(cls):
"""Requests permission and returns an future result that returns a boolean indicating if all the given permission were granted or denied."""
<|body_0|>
def get... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CameraManager:
"""Access android's CameraManager. Use the static class methods."""
def request_permission(cls):
"""Requests permission and returns an future result that returns a boolean indicating if all the given permission were granted or denied."""
app = AndroidApplication.instance()
... | the_stack_v2_python_sparse | src/enamlnative/android/android_camera.py | mfkiwl/enaml-native | train | 0 |
61a5dff3746d83b2e879a0da368addc3f813edad | [
"dic = {root: None}\n\ndef dfs(node):\n if node:\n if node.left:\n dic[node.left] = node\n if node.right:\n dic[node.right] = node\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nl1, l2 = (p, q)\nwhile l1 != l2:\n l1 = dic.get(l1, q)\n l2 = dic.get(l2, p)\nr... | <|body_start_0|>
dic = {root: None}
def dfs(node):
if node:
if node.left:
dic[node.left] = node
if node.right:
dic[node.right] = node
dfs(node.left)
dfs(node.right)
dfs(root)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""思路:存储父节点"""
<|body_0|>
def lowestCommonAncestor2(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""思路:递归"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_032056 | 5,443 | no_license | [
{
"docstring": "思路:存储父节点",
"name": "lowestCommonAncestor1",
"signature": "def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'"
},
{
"docstring": "思路:递归",
"name": "lowestCommonAncestor2",
"signature": "def lowestCommonAncestor2(self, root: 'TreeNo... | 2 | stack_v2_sparse_classes_30k_train_002935 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 思路:存储父节点
- def lowestCommonAncestor2(self, root: 'TreeNode', p: 'TreeNode', q: 'Tre... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 思路:存储父节点
- def lowestCommonAncestor2(self, root: 'TreeNode', p: 'TreeNode', q: 'Tre... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""思路:存储父节点"""
<|body_0|>
def lowestCommonAncestor2(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""思路:递归"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""思路:存储父节点"""
dic = {root: None}
def dfs(node):
if node:
if node.left:
dic[node.left] = node
if node.right:
... | the_stack_v2_python_sparse | LeetCode/树(Binary Tree)/236. Lowest Common Ancestor of a Binary Tree.py | yiming1012/MyLeetCode | train | 2 | |
45b535e9651401875563e04fd2f08e4e2247175d | [
"self.logger = Log()\nself.logger.info('########################### TestWalletOpen START ###########################')\nconfig = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()\napp_package = config['appPackage_chezhu']\napp_activity = config['appActivity_chezhu']\nself.db = DbOperation()\... | <|body_start_0|>
self.logger = Log()
self.logger.info('########################### TestWalletOpen START ###########################')
config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()
app_package = config['appPackage_chezhu']
app_activity = config... | 凯京车主APP 开通钱包 | TestWalletOpen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestWalletOpen:
"""凯京车主APP 开通钱包"""
def setUp(self):
"""前置条件准备"""
<|body_0|>
def tearDown(self):
"""测试环境重置"""
<|body_1|>
def test_bvt_wallet_open(self):
"""开通司机钱包"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.logger = ... | stack_v2_sparse_classes_36k_train_032057 | 2,299 | no_license | [
{
"docstring": "前置条件准备",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "测试环境重置",
"name": "tearDown",
"signature": "def tearDown(self)"
},
{
"docstring": "开通司机钱包",
"name": "test_bvt_wallet_open",
"signature": "def test_bvt_wallet_open(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_018874 | Implement the Python class `TestWalletOpen` described below.
Class description:
凯京车主APP 开通钱包
Method signatures and docstrings:
- def setUp(self): 前置条件准备
- def tearDown(self): 测试环境重置
- def test_bvt_wallet_open(self): 开通司机钱包 | Implement the Python class `TestWalletOpen` described below.
Class description:
凯京车主APP 开通钱包
Method signatures and docstrings:
- def setUp(self): 前置条件准备
- def tearDown(self): 测试环境重置
- def test_bvt_wallet_open(self): 开通司机钱包
<|skeleton|>
class TestWalletOpen:
"""凯京车主APP 开通钱包"""
def setUp(self):
"""前置条... | 4112ee34827a68289ba95a30518c4b1ecf38a3b2 | <|skeleton|>
class TestWalletOpen:
"""凯京车主APP 开通钱包"""
def setUp(self):
"""前置条件准备"""
<|body_0|>
def tearDown(self):
"""测试环境重置"""
<|body_1|>
def test_bvt_wallet_open(self):
"""开通司机钱包"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestWalletOpen:
"""凯京车主APP 开通钱包"""
def setUp(self):
"""前置条件准备"""
self.logger = Log()
self.logger.info('########################### TestWalletOpen START ###########################')
config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()
... | the_stack_v2_python_sparse | BVT/chezhuAPP/driver_unregister/test_case/test_wallet_open_chezhu.py | penny1205/AppUI | train | 0 |
5f1dd141c169131cb651e1c644b3feaa73662497 | [
"if not root:\n return []\n\ndef dfs(node):\n stack.append(node)\n if not node.left and (not node.right):\n vals = [i.val for i in stack]\n if sum(vals) == su:\n result.append(vals)\n if node.left:\n dfs(node.left)\n if node.right:\n dfs(node.right)\n stack.p... | <|body_start_0|>
if not root:
return []
def dfs(node):
stack.append(node)
if not node.left and (not node.right):
vals = [i.val for i in stack]
if sum(vals) == su:
result.append(vals)
if node.left:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root, su):
""":type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[stack]"""
<|body_0|>
def rewrite(self, root, sum):
""":type root: TreeNode :typ... | stack_v2_sparse_classes_36k_train_032058 | 3,396 | no_license | [
{
"docstring": ":type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[stack]",
"name": "pathSum",
"signature": "def pathSum(self, root, su)"
},
{
"docstring": ":type root: TreeNode :type su: int :rtype: L... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, su): :type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[sta... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, su): :type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[sta... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def pathSum(self, root, su):
""":type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[stack]"""
<|body_0|>
def rewrite(self, root, sum):
""":type root: TreeNode :typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pathSum(self, root, su):
""":type root: TreeNode :type su: int :rtype: List[List[int]] DFS: Use stack to save path. 用 sum - current value 直到 根node等於剩下的sum 則為答案 這樣比較快 不用每次sum[stack]"""
if not root:
return []
def dfs(node):
stack.append(node)
... | the_stack_v2_python_sparse | co_fb/113_Path_Sum_II.py | vsdrun/lc_public | train | 6 | |
8d2b05c36ae48025a75a2352629f4739a5a2009f | [
"if type(columns) is list:\n self._columns = columns\nelif type(columns) is str:\n self._columns = [columns]\nelse:\n self._columns = None",
"if self._columns is None:\n yield df\nelse:\n for _, frame in df.groupby(self._columns):\n yield frame"
] | <|body_start_0|>
if type(columns) is list:
self._columns = columns
elif type(columns) is str:
self._columns = [columns]
else:
self._columns = None
<|end_body_0|>
<|body_start_1|>
if self._columns is None:
yield df
else:
... | Divides data into groups. | GroupBy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupBy:
"""Divides data into groups."""
def __init__(self, columns: str or list[str] or None=None) -> None:
"""Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then the whole data frame is treated as one group Returns: no ... | stack_v2_sparse_classes_36k_train_032059 | 1,090 | permissive | [
{
"docstring": "Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then the whole data frame is treated as one group Returns: no value",
"name": "__init__",
"signature": "def __init__(self, columns: str or list[str] or None=None) -> None"
},
... | 2 | stack_v2_sparse_classes_30k_val_000748 | Implement the Python class `GroupBy` described below.
Class description:
Divides data into groups.
Method signatures and docstrings:
- def __init__(self, columns: str or list[str] or None=None) -> None: Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then ... | Implement the Python class `GroupBy` described below.
Class description:
Divides data into groups.
Method signatures and docstrings:
- def __init__(self, columns: str or list[str] or None=None) -> None: Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then ... | fea40936261dcbcfd144a15a498abf0b556c64f1 | <|skeleton|>
class GroupBy:
"""Divides data into groups."""
def __init__(self, columns: str or list[str] or None=None) -> None:
"""Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then the whole data frame is treated as one group Returns: no ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupBy:
"""Divides data into groups."""
def __init__(self, columns: str or list[str] or None=None) -> None:
"""Creates a new instance of GroupBy Args: columns (str or list[str]): list of columns to group by. If not given then the whole data frame is treated as one group Returns: no value"""
... | the_stack_v2_python_sparse | datavalid/group_by.py | pckhoi/datavalid | train | 5 |
49075da7a422037382d2a046d521292e07e7cbc1 | [
"results = None\npaginator = None\ntry:\n paginator = Paginator(collection, per_page)\nexcept Exception:\n pass\ntry:\n results = paginator.page(page)\nexcept PageNotAnInteger:\n results = paginator.page(1)\nexcept EmptyPage:\n results = paginator.page(paginator.num_pages)\nreturn (results, paginator... | <|body_start_0|>
results = None
paginator = None
try:
paginator = Paginator(collection, per_page)
except Exception:
pass
try:
results = paginator.page(page)
except PageNotAnInteger:
results = paginator.page(1)
except... | A model for a seach page, to respond to query requests. | SearchPage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchPage:
"""A model for a seach page, to respond to query requests."""
def get_paginated(self, collection, page: int, per_page: int=10):
"""Handle some error conditions and tries to return working pagination."""
<|body_0|>
def serve(self, request, page=None):
... | stack_v2_sparse_classes_36k_train_032060 | 3,767 | permissive | [
{
"docstring": "Handle some error conditions and tries to return working pagination.",
"name": "get_paginated",
"signature": "def get_paginated(self, collection, page: int, per_page: int=10)"
},
{
"docstring": "Serve the search page with query info and paginated results.",
"name": "serve",
... | 2 | stack_v2_sparse_classes_30k_train_010597 | Implement the Python class `SearchPage` described below.
Class description:
A model for a seach page, to respond to query requests.
Method signatures and docstrings:
- def get_paginated(self, collection, page: int, per_page: int=10): Handle some error conditions and tries to return working pagination.
- def serve(sel... | Implement the Python class `SearchPage` described below.
Class description:
A model for a seach page, to respond to query requests.
Method signatures and docstrings:
- def get_paginated(self, collection, page: int, per_page: int=10): Handle some error conditions and tries to return working pagination.
- def serve(sel... | 4cf7be72b6b3d0c46dcadcc9d9904b471215ea81 | <|skeleton|>
class SearchPage:
"""A model for a seach page, to respond to query requests."""
def get_paginated(self, collection, page: int, per_page: int=10):
"""Handle some error conditions and tries to return working pagination."""
<|body_0|>
def serve(self, request, page=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchPage:
"""A model for a seach page, to respond to query requests."""
def get_paginated(self, collection, page: int, per_page: int=10):
"""Handle some error conditions and tries to return working pagination."""
results = None
paginator = None
try:
paginator... | the_stack_v2_python_sparse | search/models.py | IATI/IATI-Standard-Website | train | 4 |
39a05543fcc027b0f8ccff1d41cdcf95b12d7ff2 | [
"if config is None:\n config = pipeline_config.PipelineConfig(supported_launcher_classes=[in_process_component_launcher.InProcessComponentLauncher, docker_component_launcher.DockerComponentLauncher])\nsuper().__init__(config)",
"tfx_pipeline.pipeline_info.run_id = datetime.datetime.now().isoformat()\nwith tele... | <|body_start_0|>
if config is None:
config = pipeline_config.PipelineConfig(supported_launcher_classes=[in_process_component_launcher.InProcessComponentLauncher, docker_component_launcher.DockerComponentLauncher])
super().__init__(config)
<|end_body_0|>
<|body_start_1|>
tfx_pipeline... | Local TFX DAG runner. | LocalDagRunner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalDagRunner:
"""Local TFX DAG runner."""
def __init__(self, config: Optional[pipeline_config.PipelineConfig]=None):
"""Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that suppo... | stack_v2_sparse_classes_36k_train_032061 | 3,897 | permissive | [
{
"docstring": "Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that supports InProcessComponentLauncher and DockerComponentLauncher.",
"name": "__init__",
"signature": "def __init__(self, config: Opt... | 2 | stack_v2_sparse_classes_30k_train_014092 | Implement the Python class `LocalDagRunner` described below.
Class description:
Local TFX DAG runner.
Method signatures and docstrings:
- def __init__(self, config: Optional[pipeline_config.PipelineConfig]=None): Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching ... | Implement the Python class `LocalDagRunner` described below.
Class description:
Local TFX DAG runner.
Method signatures and docstrings:
- def __init__(self, config: Optional[pipeline_config.PipelineConfig]=None): Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching ... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class LocalDagRunner:
"""Local TFX DAG runner."""
def __init__(self, config: Optional[pipeline_config.PipelineConfig]=None):
"""Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that suppo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalDagRunner:
"""Local TFX DAG runner."""
def __init__(self, config: Optional[pipeline_config.PipelineConfig]=None):
"""Initializes local TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that supports InProcess... | the_stack_v2_python_sparse | tfx/orchestration/local/legacy/local_dag_runner.py | tensorflow/tfx | train | 2,116 |
3c36c8665b45a1664df341a7bfc8109cd0f3c636 | [
"self.counts = {}\nself.max_time = {}\nself.min_time = {}\nself.total_time = {}",
"if name in self.counts:\n self.counts[name] += 1\n self.max_time[name] = max(self.max_time[name], duration)\n self.min_time[name] = min(self.min_time[name], duration)\n self.total_time[name] += duration\nelse:\n self... | <|body_start_0|>
self.counts = {}
self.max_time = {}
self.min_time = {}
self.total_time = {}
<|end_body_0|>
<|body_start_1|>
if name in self.counts:
self.counts[name] += 1
self.max_time[name] = max(self.max_time[name], duration)
self.min_time[... | A collection of statistics. | Stats | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stats:
"""A collection of statistics."""
def __init__(self):
"""Initialize the Stats instance."""
<|body_0|>
def log(self, name: str, duration: float):
"""Log an entry in the stats."""
<|body_1|>
def extract(self, names: Sequence[str]=None) -> dict:
... | stack_v2_sparse_classes_36k_train_032062 | 6,778 | permissive | [
{
"docstring": "Initialize the Stats instance.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Log an entry in the stats.",
"name": "log",
"signature": "def log(self, name: str, duration: float)"
},
{
"docstring": "Summarize the stats in a dictionary.",... | 3 | null | Implement the Python class `Stats` described below.
Class description:
A collection of statistics.
Method signatures and docstrings:
- def __init__(self): Initialize the Stats instance.
- def log(self, name: str, duration: float): Log an entry in the stats.
- def extract(self, names: Sequence[str]=None) -> dict: Summ... | Implement the Python class `Stats` described below.
Class description:
A collection of statistics.
Method signatures and docstrings:
- def __init__(self): Initialize the Stats instance.
- def log(self, name: str, duration: float): Log an entry in the stats.
- def extract(self, names: Sequence[str]=None) -> dict: Summ... | 39cac36d8937ce84a9307ce100aaefb8bc05ec04 | <|skeleton|>
class Stats:
"""A collection of statistics."""
def __init__(self):
"""Initialize the Stats instance."""
<|body_0|>
def log(self, name: str, duration: float):
"""Log an entry in the stats."""
<|body_1|>
def extract(self, names: Sequence[str]=None) -> dict:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Stats:
"""A collection of statistics."""
def __init__(self):
"""Initialize the Stats instance."""
self.counts = {}
self.max_time = {}
self.min_time = {}
self.total_time = {}
def log(self, name: str, duration: float):
"""Log an entry in the stats."""
... | the_stack_v2_python_sparse | aries_cloudagent/utils/stats.py | hyperledger/aries-cloudagent-python | train | 370 |
b7b243d2056dd82940463cafd5c63a6c367a1933 | [
"all_cl_with_extrussion = []\ninner_cls = []\nouter_cls = []\ni_x = 0\nfor cl in curve_loops:\n plane_normal = cl.GetPlane().Normal\n solid_elem = GeometryCreationUtilities.CreateExtrusionGeometry([cl], plane_normal, 1)\n i_x = i_x + 1\n for face in solid_elem.Faces:\n if face.FaceNormal.IsAlmost... | <|body_start_0|>
all_cl_with_extrussion = []
inner_cls = []
outer_cls = []
i_x = 0
for cl in curve_loops:
plane_normal = cl.GetPlane().Normal
solid_elem = GeometryCreationUtilities.CreateExtrusionGeometry([cl], plane_normal, 1)
i_x = i_x + 1
... | Работа с проемами геометрии. | Hole | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hole:
"""Работа с проемами геометрии."""
def find_outer_contur_in_cls(cls, curve_loops):
"""Ищет внешний контур."""
<|body_0|>
def first_point_is_inside_face(cls, e_1, e_2):
"""Находится ли первая точка контура внутри поверхности."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_032063 | 2,714 | no_license | [
{
"docstring": "Ищет внешний контур.",
"name": "find_outer_contur_in_cls",
"signature": "def find_outer_contur_in_cls(cls, curve_loops)"
},
{
"docstring": "Находится ли первая точка контура внутри поверхности.",
"name": "first_point_is_inside_face",
"signature": "def first_point_is_insid... | 2 | stack_v2_sparse_classes_30k_train_008724 | Implement the Python class `Hole` described below.
Class description:
Работа с проемами геометрии.
Method signatures and docstrings:
- def find_outer_contur_in_cls(cls, curve_loops): Ищет внешний контур.
- def first_point_is_inside_face(cls, e_1, e_2): Находится ли первая точка контура внутри поверхности. | Implement the Python class `Hole` described below.
Class description:
Работа с проемами геометрии.
Method signatures and docstrings:
- def find_outer_contur_in_cls(cls, curve_loops): Ищет внешний контур.
- def first_point_is_inside_face(cls, e_1, e_2): Находится ли первая точка контура внутри поверхности.
<|skeleton... | 520c69a2769bb3d9c91cce6da314fdcc239320c4 | <|skeleton|>
class Hole:
"""Работа с проемами геометрии."""
def find_outer_contur_in_cls(cls, curve_loops):
"""Ищет внешний контур."""
<|body_0|>
def first_point_is_inside_face(cls, e_1, e_2):
"""Находится ли первая точка контура внутри поверхности."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Hole:
"""Работа с проемами геометрии."""
def find_outer_contur_in_cls(cls, curve_loops):
"""Ищет внешний контур."""
all_cl_with_extrussion = []
inner_cls = []
outer_cls = []
i_x = 0
for cl in curve_loops:
plane_normal = cl.GetPlane().Normal
... | the_stack_v2_python_sparse | common_scripts/RB_Geometry/Hole.py | NauGaika/RedBimTest | train | 0 |
a6fd5a79e0892cbf08161f34eed2ade38d5f07fd | [
"v1 = Vector(v1, copy=False)\nv2 = Vector(v2, copy=False)\nn1 = v1.norm()\nn2 = v2.norm()\nif n1 == 0 or n2 == 0:\n raise ValueError(\"Can't calculate angle between zero length vectors !\")\ncos_a = v1.dot(v2) / (n1 * n2)\ncos_a = max(-1.0, min(1.0, cos_a))\nreturn math.acos(cos_a)",
"p1 = Vector(p1, copy=Fals... | <|body_start_0|>
v1 = Vector(v1, copy=False)
v2 = Vector(v2, copy=False)
n1 = v1.norm()
n2 = v2.norm()
if n1 == 0 or n2 == 0:
raise ValueError("Can't calculate angle between zero length vectors !")
cos_a = v1.dot(v2) / (n1 * n2)
cos_a = max(-1.0, min(1... | Represents a triangle constructed from different other geometrical entities. | Triangle | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Triangle:
"""Represents a triangle constructed from different other geometrical entities."""
def angle_between_vectors(v1, v2):
"""Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError."... | stack_v2_sparse_classes_36k_train_032064 | 1,355 | permissive | [
{
"docstring": "Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError.",
"name": "angle_between_vectors",
"signature": "def angle_between_vectors(v1, v2)"
},
{
"docstring": "Calculates the angle p1-... | 2 | stack_v2_sparse_classes_30k_train_002347 | Implement the Python class `Triangle` described below.
Class description:
Represents a triangle constructed from different other geometrical entities.
Method signatures and docstrings:
- def angle_between_vectors(v1, v2): Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate inp... | Implement the Python class `Triangle` described below.
Class description:
Represents a triangle constructed from different other geometrical entities.
Method signatures and docstrings:
- def angle_between_vectors(v1, v2): Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate inp... | 43cceabf5fd4ddf6dbfd8c6d5329b9a4bba4ecb7 | <|skeleton|>
class Triangle:
"""Represents a triangle constructed from different other geometrical entities."""
def angle_between_vectors(v1, v2):
"""Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Triangle:
"""Represents a triangle constructed from different other geometrical entities."""
def angle_between_vectors(v1, v2):
"""Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError."""
v1... | the_stack_v2_python_sparse | brlcad/vmath/triangle.py | kanzure/python-brlcad | train | 6 |
7d7f05f3d91e0e686f6b21602d64b6f280f8b29d | [
"forward = {i: set() for i in range(numCourses)}\nbackward = collections.defaultdict(set)\nfor i, j in prerequisites:\n forward[i].add(j)\n backward[j].add(i)\nqueue = collections.deque([node for node in forward if len(forward[node]) == 0])\ncount, res = (0, [])\nwhile queue:\n node = queue.popleft()\n ... | <|body_start_0|>
forward = {i: set() for i in range(numCourses)}
backward = collections.defaultdict(set)
for i, j in prerequisites:
forward[i].add(j)
backward[j].add(i)
queue = collections.deque([node for node in forward if len(forward[node]) == 0])
count,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findOrder(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findOrder_1(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rt... | stack_v2_sparse_classes_36k_train_032065 | 3,709 | no_license | [
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]",
"name": "findOrder",
"signature": "def findOrder(self, numCourses, prerequisites)"
},
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool",
"name": "findOrder_1"... | 2 | stack_v2_sparse_classes_30k_train_007940 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findOrder(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]
- def findOrder_1(self, numCourses, prerequisites): :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findOrder(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]
- def findOrder_1(self, numCourses, prerequisites): :... | 3d9e0ad2f6ed92ec969556f75d97c51ea4854719 | <|skeleton|>
class Solution:
def findOrder(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findOrder_1(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findOrder(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int]"""
forward = {i: set() for i in range(numCourses)}
backward = collections.defaultdict(set)
for i, j in prerequisites:
forward[i]... | the_stack_v2_python_sparse | Solutions/0210_findOrder.py | YoupengLi/leetcode-sorting | train | 3 | |
1643746f03331cdeb7da929080bc0033af9bd61c | [
"url = reverse('it_system_api_resource')\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, self.it_prod.name)\nself.assertContains(response, self.it_leg.name)\nself.assertNotContains(response, self.it_dev.name)\nself.assertNotContains(response, self.it_dec.... | <|body_start_0|>
url = reverse('it_system_api_resource')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.it_prod.name)
self.assertContains(response, self.it_leg.name)
self.assertNotContains(response, self.it_d... | ITSystemAPIResourceTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ITSystemAPIResourceTestCase:
def test_list(self):
"""Test the ITSystemAPIResource list response"""
<|body_0|>
def test_list_filtering(self):
"""Test the ITSystemAPIResource filtered responses"""
<|body_1|>
def test_list_tailored(self):
"""Test th... | stack_v2_sparse_classes_36k_train_032066 | 1,674 | permissive | [
{
"docstring": "Test the ITSystemAPIResource list response",
"name": "test_list",
"signature": "def test_list(self)"
},
{
"docstring": "Test the ITSystemAPIResource filtered responses",
"name": "test_list_filtering",
"signature": "def test_list_filtering(self)"
},
{
"docstring": ... | 3 | stack_v2_sparse_classes_30k_train_008068 | Implement the Python class `ITSystemAPIResourceTestCase` described below.
Class description:
Implement the ITSystemAPIResourceTestCase class.
Method signatures and docstrings:
- def test_list(self): Test the ITSystemAPIResource list response
- def test_list_filtering(self): Test the ITSystemAPIResource filtered respo... | Implement the Python class `ITSystemAPIResourceTestCase` described below.
Class description:
Implement the ITSystemAPIResourceTestCase class.
Method signatures and docstrings:
- def test_list(self): Test the ITSystemAPIResource list response
- def test_list_filtering(self): Test the ITSystemAPIResource filtered respo... | 25f173279ac1e1a81af9ff1d8dc0360b51adccf6 | <|skeleton|>
class ITSystemAPIResourceTestCase:
def test_list(self):
"""Test the ITSystemAPIResource list response"""
<|body_0|>
def test_list_filtering(self):
"""Test the ITSystemAPIResource filtered responses"""
<|body_1|>
def test_list_tailored(self):
"""Test th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ITSystemAPIResourceTestCase:
def test_list(self):
"""Test the ITSystemAPIResource list response"""
url = reverse('it_system_api_resource')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.it_prod.name)
... | the_stack_v2_python_sparse | registers/test_api.py | ropable/it-assets | train | 1 | |
74cd87827d18a9e0e2cb2f999a894ca92ee3fe42 | [
"self.num_vms_in_cluster = num_vms_in_cluster\nself.scaler_logic_called = False\nScale.__init__(self, sim=sim, scale_rate=scale_rate, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_delay)",
"servers_to_stop = 0\nif self.scaler_logic_called is False:\n servers_to_start = self.num_vms_in_cluster\... | <|body_start_0|>
self.num_vms_in_cluster = num_vms_in_cluster
self.scaler_logic_called = False
Scale.__init__(self, sim=sim, scale_rate=scale_rate, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_delay)
<|end_body_0|>
<|body_start_1|>
servers_to_stop = 0
if self.s... | Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request. | FixedSizePolicy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FixedSizePolicy:
"""Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request."""
def __init__(self, sim, scale_rate, startup_delay_func, shutdown_dela... | stack_v2_sparse_classes_36k_train_032067 | 1,645 | no_license | [
{
"docstring": "Initializes a FixedSizePolicy object parameters: sim -- The Simulation containing a cluster cluster object this scale function is managing scale_rate -- The interarrival time between scale events in seconds startup_delay_func -- A callable that returns the time a server spends in the booting sta... | 2 | stack_v2_sparse_classes_30k_train_017178 | Implement the Python class `FixedSizePolicy` described below.
Class description:
Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request.
Method signatures and docstrings:
- d... | Implement the Python class `FixedSizePolicy` described below.
Class description:
Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request.
Method signatures and docstrings:
- d... | 30dc0702f6189307ff776525a2f3006ec471de47 | <|skeleton|>
class FixedSizePolicy:
"""Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request."""
def __init__(self, sim, scale_rate, startup_delay_func, shutdown_dela... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FixedSizePolicy:
"""Wake up periodically and Scale the cluster This policy requests self.num_vms_in_cluster number of virtual machines, and makes no further requests to modify the cluster size after the initial request."""
def __init__(self, sim, scale_rate, startup_delay_func, shutdown_delay, num_vms_in... | the_stack_v2_python_sparse | appsim/scaler/fixed_size_policy.py | bmbouter/vcl_simulation | train | 0 |
5172a1d92a77c27833bc810b2eb69fb4e8c0cb47 | [
"super().__init__()\nself.sock = sock\nself.database = database\nself.setFixedSize(350, 120)\nself.setWindowTitle('Выберите контакт для добавления:')\nself.setAttribute(Qt.WA_DeleteOnClose)\nself.setModal(True)\nself.selector_label = QLabel(f'would u add:\\n {contact}', self)\nself.selector_label.setFixedSize(200, ... | <|body_start_0|>
super().__init__()
self.sock = sock
self.database = database
self.setFixedSize(350, 120)
self.setWindowTitle('Выберите контакт для добавления:')
self.setAttribute(Qt.WA_DeleteOnClose)
self.setModal(True)
self.selector_label = QLabel(f'woul... | AddContactDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddContactDialog:
def __init__(self, sock, database, contact):
"""GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of adding contact"""
<|body_0|>
def possible_contacts_update(self):
""":return: set of ... | stack_v2_sparse_classes_36k_train_032068 | 2,448 | no_license | [
{
"docstring": "GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of adding contact",
"name": "__init__",
"signature": "def __init__(self, sock, database, contact)"
},
{
"docstring": ":return: set of possible contact from database",... | 3 | null | Implement the Python class `AddContactDialog` described below.
Class description:
Implement the AddContactDialog class.
Method signatures and docstrings:
- def __init__(self, sock, database, contact): GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of ... | Implement the Python class `AddContactDialog` described below.
Class description:
Implement the AddContactDialog class.
Method signatures and docstrings:
- def __init__(self, sock, database, contact): GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of ... | 138b59fd8c858a0272f10f7e86b001c174f73a40 | <|skeleton|>
class AddContactDialog:
def __init__(self, sock, database, contact):
"""GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of adding contact"""
<|body_0|>
def possible_contacts_update(self):
""":return: set of ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddContactDialog:
def __init__(self, sock, database, contact):
"""GUI for add dialog window :param sock: connection socket :param database: connected database :param contact: name of adding contact"""
super().__init__()
self.sock = sock
self.database = database
self.set... | the_stack_v2_python_sparse | part_2/lesson_7/client/add_contact.py | isthatjoke/messenger | train | 0 | |
30cc8da777a83a5cf7ad3ae3568251cea9ad4b3a | [
"with tables(db.engine, 'bams') as (con, bams):\n q = select(bams.c).where(bams.c.id == bam_id)\n return dict(_abort_if_none(q.execute().fetchone(), bam_id))",
"with tables(db.engine, 'bams') as (con, bams):\n q = bams.update(bams.c.id == bam_id).values(**request.validated_body).returning(*bams.c)\n r... | <|body_start_0|>
with tables(db.engine, 'bams') as (con, bams):
q = select(bams.c).where(bams.c.id == bam_id)
return dict(_abort_if_none(q.execute().fetchone(), bam_id))
<|end_body_0|>
<|body_start_1|>
with tables(db.engine, 'bams') as (con, bams):
q = bams.update(ba... | Bam | [
"Apache-2.0",
"CC-BY-3.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bam:
def get(self, bam_id):
"""Get a BAM by its ID."""
<|body_0|>
def put(self, bam_id):
"""Update the BAM by its ID."""
<|body_1|>
def delete(self, bam_id):
"""Delete a BAM by its ID."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_032069 | 4,466 | permissive | [
{
"docstring": "Get a BAM by its ID.",
"name": "get",
"signature": "def get(self, bam_id)"
},
{
"docstring": "Update the BAM by its ID.",
"name": "put",
"signature": "def put(self, bam_id)"
},
{
"docstring": "Delete a BAM by its ID.",
"name": "delete",
"signature": "def d... | 3 | stack_v2_sparse_classes_30k_train_020184 | Implement the Python class `Bam` described below.
Class description:
Implement the Bam class.
Method signatures and docstrings:
- def get(self, bam_id): Get a BAM by its ID.
- def put(self, bam_id): Update the BAM by its ID.
- def delete(self, bam_id): Delete a BAM by its ID. | Implement the Python class `Bam` described below.
Class description:
Implement the Bam class.
Method signatures and docstrings:
- def get(self, bam_id): Get a BAM by its ID.
- def put(self, bam_id): Update the BAM by its ID.
- def delete(self, bam_id): Delete a BAM by its ID.
<|skeleton|>
class Bam:
def get(sel... | a436c4fc212e4429fb5196a9a4d36c37bd050c52 | <|skeleton|>
class Bam:
def get(self, bam_id):
"""Get a BAM by its ID."""
<|body_0|>
def put(self, bam_id):
"""Update the BAM by its ID."""
<|body_1|>
def delete(self, bam_id):
"""Delete a BAM by its ID."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bam:
def get(self, bam_id):
"""Get a BAM by its ID."""
with tables(db.engine, 'bams') as (con, bams):
q = select(bams.c).where(bams.c.id == bam_id)
return dict(_abort_if_none(q.execute().fetchone(), bam_id))
def put(self, bam_id):
"""Update the BAM by its I... | the_stack_v2_python_sparse | cycledash/api/bams.py | haoziyeung/cycledash | train | 0 | |
e058866aab8b0d075db8236bb6da253417dfcecc | [
"with self.assertRaisesRegex(TypeError, 'cirq.sim.simulator.SimulatesExpectationValues.'):\n cirq_ops._get_cirq_analytical_expectation('junk')\ncirq_ops._get_cirq_analytical_expectation()\ncirq_ops._get_cirq_analytical_expectation(cirq.Simulator())\ncirq_ops._get_cirq_analytical_expectation(cirq.DensityMatrixSim... | <|body_start_0|>
with self.assertRaisesRegex(TypeError, 'cirq.sim.simulator.SimulatesExpectationValues.'):
cirq_ops._get_cirq_analytical_expectation('junk')
cirq_ops._get_cirq_analytical_expectation()
cirq_ops._get_cirq_analytical_expectation(cirq.Simulator())
cirq_ops._get_c... | Tests get_cirq_analytical_expectation. | CirqAnalyticalExpectationTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CirqAnalyticalExpectationTest:
"""Tests get_cirq_analytical_expectation."""
def test_get_cirq_analytical_expectation_op(self):
"""Input check the wrapper for the cirq analytical expectation op."""
<|body_0|>
def test_cirq_analytical_expectation_op_inputs(self):
"... | stack_v2_sparse_classes_36k_train_032070 | 23,553 | permissive | [
{
"docstring": "Input check the wrapper for the cirq analytical expectation op.",
"name": "test_get_cirq_analytical_expectation_op",
"signature": "def test_get_cirq_analytical_expectation_op(self)"
},
{
"docstring": "Test input checking in the state sim op.",
"name": "test_cirq_analytical_ex... | 4 | stack_v2_sparse_classes_30k_train_018388 | Implement the Python class `CirqAnalyticalExpectationTest` described below.
Class description:
Tests get_cirq_analytical_expectation.
Method signatures and docstrings:
- def test_get_cirq_analytical_expectation_op(self): Input check the wrapper for the cirq analytical expectation op.
- def test_cirq_analytical_expect... | Implement the Python class `CirqAnalyticalExpectationTest` described below.
Class description:
Tests get_cirq_analytical_expectation.
Method signatures and docstrings:
- def test_get_cirq_analytical_expectation_op(self): Input check the wrapper for the cirq analytical expectation op.
- def test_cirq_analytical_expect... | f56257bceb988b743790e1e480eac76fd036d4ff | <|skeleton|>
class CirqAnalyticalExpectationTest:
"""Tests get_cirq_analytical_expectation."""
def test_get_cirq_analytical_expectation_op(self):
"""Input check the wrapper for the cirq analytical expectation op."""
<|body_0|>
def test_cirq_analytical_expectation_op_inputs(self):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CirqAnalyticalExpectationTest:
"""Tests get_cirq_analytical_expectation."""
def test_get_cirq_analytical_expectation_op(self):
"""Input check the wrapper for the cirq analytical expectation op."""
with self.assertRaisesRegex(TypeError, 'cirq.sim.simulator.SimulatesExpectationValues.'):
... | the_stack_v2_python_sparse | tensorflow_quantum/core/ops/cirq_ops_test.py | tensorflow/quantum | train | 1,799 |
620e6244d1969215d76512ea24d19e9492a8e3c3 | [
"\"\"\"\n case 1: A point is influenced by an edge.\n\n (1,5) *\n (0,0)*-----------* (10,0)\n\n \"\"\"\nvertices1 = np.array([[0, 0], [5, 1], [10, 0]])\nd1 = 5\ngradients1 = np.array([[0, 0], [0, 8], [0, 0]])\nenergy1 = 16\n'\\n case 2: Case 1 in inverse order\\n ... | <|body_start_0|>
"""
case 1: A point is influenced by an edge.
(1,5) *
(0,0)*-----------* (10,0)
"""
vertices1 = np.array([[0, 0], [5, 1], [10, 0]])
d1 = 5
gradients1 = np.array([[0, 0], [0, 8], [0, 0]])
... | TestEdgeConstraint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEdgeConstraint:
def setUp(self):
""":return:"""
<|body_0|>
def test_edge_constraint_grad(self):
"""Tests whether the vertex_constraint_grad function works."""
<|body_1|>
def test_vertex_constraint(self):
"""Tests whether the edge_constraint f... | stack_v2_sparse_classes_36k_train_032071 | 19,054 | no_license | [
{
"docstring": ":return:",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests whether the vertex_constraint_grad function works.",
"name": "test_edge_constraint_grad",
"signature": "def test_edge_constraint_grad(self)"
},
{
"docstring": "Tests whether the ed... | 3 | stack_v2_sparse_classes_30k_train_006425 | Implement the Python class `TestEdgeConstraint` described below.
Class description:
Implement the TestEdgeConstraint class.
Method signatures and docstrings:
- def setUp(self): :return:
- def test_edge_constraint_grad(self): Tests whether the vertex_constraint_grad function works.
- def test_vertex_constraint(self): ... | Implement the Python class `TestEdgeConstraint` described below.
Class description:
Implement the TestEdgeConstraint class.
Method signatures and docstrings:
- def setUp(self): :return:
- def test_edge_constraint_grad(self): Tests whether the vertex_constraint_grad function works.
- def test_vertex_constraint(self): ... | 63cbf87823d772c9db18d285f7ff211d18551472 | <|skeleton|>
class TestEdgeConstraint:
def setUp(self):
""":return:"""
<|body_0|>
def test_edge_constraint_grad(self):
"""Tests whether the vertex_constraint_grad function works."""
<|body_1|>
def test_vertex_constraint(self):
"""Tests whether the edge_constraint f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestEdgeConstraint:
def setUp(self):
""":return:"""
"""
case 1: A point is influenced by an edge.
(1,5) *
(0,0)*-----------* (10,0)
"""
vertices1 = np.array([[0, 0], [5, 1], [10, 0]])
d1 = 5
... | the_stack_v2_python_sparse | main_directory/test_energies.py | Jeronics/cac-segmenter | train | 3 | |
c871ee0b8913b833c51cd0620584ba5f3495db75 | [
"lines = ['foobar'] + PRESUBMIT.ARC_COMPILE_GUARD\nmock_input = PRESUBMIT_test_mocks.MockInputApi()\nmock_input.files = [PRESUBMIT_test_mocks.MockFile('ios/path/foo_controller.mm', lines), PRESUBMIT_test_mocks.MockFile('ios/path/foo_controller.m', lines)]\nmock_output = PRESUBMIT_test_mocks.MockOutputApi()\nerrors ... | <|body_start_0|>
lines = ['foobar'] + PRESUBMIT.ARC_COMPILE_GUARD
mock_input = PRESUBMIT_test_mocks.MockInputApi()
mock_input.files = [PRESUBMIT_test_mocks.MockFile('ios/path/foo_controller.mm', lines), PRESUBMIT_test_mocks.MockFile('ios/path/foo_controller.m', lines)]
mock_output = PRES... | Test the _CheckARCCompilationGuard presubmit check. | CheckARCCompilationGuardTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckARCCompilationGuardTest:
"""Test the _CheckARCCompilationGuard presubmit check."""
def testGoodImplementationFiles(self):
"""Test that .m and .mm files with a guard don't raise any errors."""
<|body_0|>
def testBadImplementationFiles(self):
"""Test that .m a... | stack_v2_sparse_classes_36k_train_032072 | 3,527 | permissive | [
{
"docstring": "Test that .m and .mm files with a guard don't raise any errors.",
"name": "testGoodImplementationFiles",
"signature": "def testGoodImplementationFiles(self)"
},
{
"docstring": "Test that .m and .mm files without a guard raise an error.",
"name": "testBadImplementationFiles",
... | 3 | stack_v2_sparse_classes_30k_train_018721 | Implement the Python class `CheckARCCompilationGuardTest` described below.
Class description:
Test the _CheckARCCompilationGuard presubmit check.
Method signatures and docstrings:
- def testGoodImplementationFiles(self): Test that .m and .mm files with a guard don't raise any errors.
- def testBadImplementationFiles(... | Implement the Python class `CheckARCCompilationGuardTest` described below.
Class description:
Test the _CheckARCCompilationGuard presubmit check.
Method signatures and docstrings:
- def testGoodImplementationFiles(self): Test that .m and .mm files with a guard don't raise any errors.
- def testBadImplementationFiles(... | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | <|skeleton|>
class CheckARCCompilationGuardTest:
"""Test the _CheckARCCompilationGuard presubmit check."""
def testGoodImplementationFiles(self):
"""Test that .m and .mm files with a guard don't raise any errors."""
<|body_0|>
def testBadImplementationFiles(self):
"""Test that .m a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckARCCompilationGuardTest:
"""Test the _CheckARCCompilationGuard presubmit check."""
def testGoodImplementationFiles(self):
"""Test that .m and .mm files with a guard don't raise any errors."""
lines = ['foobar'] + PRESUBMIT.ARC_COMPILE_GUARD
mock_input = PRESUBMIT_test_mocks.M... | the_stack_v2_python_sparse | ios/PRESUBMIT_test.py | Samsung/Castanets | train | 58 |
6702ed69e8b8b657f69824e879d632a9ef624975 | [
"super(RandomWander, self).__init__()\nself.iteration = 0\nself.rate = rate\nself.speed = 0\nself.heading = 0",
"if self.iteration > self.rate:\n self.iteration = 0\n heading = random.random() * 180 - 90\n self.speed = 0.1\n if heading >= 0:\n self.heading = heading\n else:\n self.hea... | <|body_start_0|>
super(RandomWander, self).__init__()
self.iteration = 0
self.rate = rate
self.speed = 0
self.heading = 0
<|end_body_0|>
<|body_start_1|>
if self.iteration > self.rate:
self.iteration = 0
heading = random.random() * 180 - 90
... | Simple behavior tht wanders, turning with some randomness each time. | RandomWander | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWander:
"""Simple behavior tht wanders, turning with some randomness each time."""
def __init__(self, rate):
"""Sets up the behavior with all rates set to zero."""
<|body_0|>
def update(self):
"""wanders with a random heading."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_032073 | 8,374 | no_license | [
{
"docstring": "Sets up the behavior with all rates set to zero.",
"name": "__init__",
"signature": "def __init__(self, rate)"
},
{
"docstring": "wanders with a random heading.",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021372 | Implement the Python class `RandomWander` described below.
Class description:
Simple behavior tht wanders, turning with some randomness each time.
Method signatures and docstrings:
- def __init__(self, rate): Sets up the behavior with all rates set to zero.
- def update(self): wanders with a random heading. | Implement the Python class `RandomWander` described below.
Class description:
Simple behavior tht wanders, turning with some randomness each time.
Method signatures and docstrings:
- def __init__(self, rate): Sets up the behavior with all rates set to zero.
- def update(self): wanders with a random heading.
<|skelet... | 97bb378a325b1639110de06b88d6e237dffc7330 | <|skeleton|>
class RandomWander:
"""Simple behavior tht wanders, turning with some randomness each time."""
def __init__(self, rate):
"""Sets up the behavior with all rates set to zero."""
<|body_0|>
def update(self):
"""wanders with a random heading."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomWander:
"""Simple behavior tht wanders, turning with some randomness each time."""
def __init__(self, rate):
"""Sets up the behavior with all rates set to zero."""
super(RandomWander, self).__init__()
self.iteration = 0
self.rate = rate
self.speed = 0
... | the_stack_v2_python_sparse | src/match_seeker/scripts/FieldBehaviors.py | FoxRobotLab/catkin_ws | train | 6 |
139edbe4662078df21da12c4e36fcb3b931a5e5d | [
"data = {}\ntry:\n data = DBPocsuiteVul.get_detail_by_id(vul_id)\n if data:\n data['vid'] = str(data['_id'])\n del data['_id']\n data['date'] = timestamp_to_str(data['date'])\n return Response.success(data=data)\n else:\n return Response.failed(message=\"can't find the vu... | <|body_start_0|>
data = {}
try:
data = DBPocsuiteVul.get_detail_by_id(vul_id)
if data:
data['vid'] = str(data['_id'])
del data['_id']
data['date'] = timestamp_to_str(data['date'])
return Response.success(data=data)
... | PocsuiteResultManageV1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PocsuiteResultManageV1:
def get(self, vul_id):
"""GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]"""
<|body_0|>
def delete(self, vul_id):
"""通过 id 删除漏洞 DELETE /api/v1/scanner/poc/vul/<vul_id> :param vul_id: :return:"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_032074 | 14,120 | permissive | [
{
"docstring": "GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]",
"name": "get",
"signature": "def get(self, vul_id)"
},
{
"docstring": "通过 id 删除漏洞 DELETE /api/v1/scanner/poc/vul/<vul_id> :param vul_id: :return:",
"name": "delete",
"signature": "def delete(self, vul_id)"
... | 2 | stack_v2_sparse_classes_30k_train_012953 | Implement the Python class `PocsuiteResultManageV1` described below.
Class description:
Implement the PocsuiteResultManageV1 class.
Method signatures and docstrings:
- def get(self, vul_id): GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]
- def delete(self, vul_id): 通过 id 删除漏洞 DELETE /api/v1/scanner/p... | Implement the Python class `PocsuiteResultManageV1` described below.
Class description:
Implement the PocsuiteResultManageV1 class.
Method signatures and docstrings:
- def get(self, vul_id): GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]
- def delete(self, vul_id): 通过 id 删除漏洞 DELETE /api/v1/scanner/p... | fadb1136b8896fe2a0f7783627bda867d5e6fd98 | <|skeleton|>
class PocsuiteResultManageV1:
def get(self, vul_id):
"""GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]"""
<|body_0|>
def delete(self, vul_id):
"""通过 id 删除漏洞 DELETE /api/v1/scanner/poc/vul/<vul_id> :param vul_id: :return:"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PocsuiteResultManageV1:
def get(self, vul_id):
"""GET /api/v1/scanner/poc/vul/<vul_id> :return: all plugin [list]"""
data = {}
try:
data = DBPocsuiteVul.get_detail_by_id(vul_id)
if data:
data['vid'] = str(data['_id'])
del data['_i... | the_stack_v2_python_sparse | fuxi/web/api/scanner/poc_scanner.py | Solotov/fuxi | train | 0 | |
8a97bdd90bb2e3a133eb28ce455dedc3427aba5c | [
"self.filters = hyper_parameters['model'].get('filters', [2, 3, 4])\nself.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1)\nself.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')\nself.rnn_units = hyper_parameters['model'].get('rnn_units', 256)\nsuper().__init__(hyper_parameters)",
"... | <|body_start_0|>
self.filters = hyper_parameters['model'].get('filters', [2, 3, 4])
self.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1)
self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')
self.rnn_units = hyper_parameters['model'].get('rnn_units', 256)
... | BiLSTMGraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiLSTMGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_032075 | 2,700 | permissive | [
{
"docstring": "初始化 :param hyper_parameters: json,超参",
"name": "__init__",
"signature": "def __init__(self, hyper_parameters)"
},
{
"docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl",
"name": "create_model",
"signature": "def create_mod... | 2 | stack_v2_sparse_classes_30k_train_015986 | Implement the Python class `BiLSTMGraph` described below.
Class description:
Implement the BiLSTMGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters... | Implement the Python class `BiLSTMGraph` described below.
Class description:
Implement the BiLSTMGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters... | 1d7b8f9938cb8b6d7744e9caabc3eb41c8891283 | <|skeleton|>
class BiLSTMGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiLSTMGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
self.filters = hyper_parameters['model'].get('filters', [2, 3, 4])
self.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1)
self.rnn_type = hyper_parameters['model'].ge... | the_stack_v2_python_sparse | macropodus/network/graph/bilstm.py | a627414850/Macropodus | train | 0 | |
65e82a4377f6d922df70c04dd68d7c68afef2c80 | [
"keyList = list(self.cache_data)[0:]\nif key and item:\n if key in keyList:\n self.cache_data.update({key: item})\n self.__LFUDict.update({key: self.__bit})\n self.__bit += 1\n elif len(self.cache_data) < self.MAX_ITEMS:\n self.__LFUDict.update({key: self.__bit})\n self.__bi... | <|body_start_0|>
keyList = list(self.cache_data)[0:]
if key and item:
if key in keyList:
self.cache_data.update({key: item})
self.__LFUDict.update({key: self.__bit})
self.__bit += 1
elif len(self.cache_data) < self.MAX_ITEMS:
... | LFU Caching algorithm | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
"""LFU Caching algorithm"""
def put(self, key, item):
"""Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key"""
<|body_0|>
def get(self, key):
"""Return... | stack_v2_sparse_classes_36k_train_032076 | 2,258 | no_license | [
{
"docstring": "Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key",
"name": "put",
"signature": "def put(self, key, item)"
},
{
"docstring": "Returns the value of self.cache_data of given key P... | 3 | stack_v2_sparse_classes_30k_train_006491 | Implement the Python class `LFUCache` described below.
Class description:
LFU Caching algorithm
Method signatures and docstrings:
- def put(self, key, item): Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key
- def g... | Implement the Python class `LFUCache` described below.
Class description:
LFU Caching algorithm
Method signatures and docstrings:
- def put(self, key, item): Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key
- def g... | 03a8272d98af1975b7c476398a5cd95610ea2c1f | <|skeleton|>
class LFUCache:
"""LFU Caching algorithm"""
def put(self, key, item):
"""Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key"""
<|body_0|>
def get(self, key):
"""Return... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
"""LFU Caching algorithm"""
def put(self, key, item):
"""Assign key: item to self.cache_data If key or item is None do nothing Parameters: key: key for item in self.cache_data dict item: contains value for key"""
keyList = list(self.cache_data)[0:]
if key and item:
... | the_stack_v2_python_sparse | 0x03-caching/100-lfu_cache.py | veeteeran/holbertonschool-web_back_end | train | 0 |
2362728ec7b09bf6ea191d763ee72257f6423bd5 | [
"super().__init__()\nif seq is None:\n seq = []\nfor el in seq:\n self.count(el)",
"self[item] = self.get(item, 0) + f\nif self[item] == 0:\n del self[item]"
] | <|body_start_0|>
super().__init__()
if seq is None:
seq = []
for el in seq:
self.count(el)
<|end_body_0|>
<|body_start_1|>
self[item] = self.get(item, 0) + f
if self[item] == 0:
del self[item]
<|end_body_1|>
| A map from each item to its frequency. | Hist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hist:
"""A map from each item to its frequency."""
def __init__(self, seq=None):
"""Creates a new histogram starting with the items in sequence."""
<|body_0|>
def count(self, item, f=1):
"""Increments the counter associated with item."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_032077 | 5,544 | no_license | [
{
"docstring": "Creates a new histogram starting with the items in sequence.",
"name": "__init__",
"signature": "def __init__(self, seq=None)"
},
{
"docstring": "Increments the counter associated with item.",
"name": "count",
"signature": "def count(self, item, f=1)"
}
] | 2 | null | Implement the Python class `Hist` described below.
Class description:
A map from each item to its frequency.
Method signatures and docstrings:
- def __init__(self, seq=None): Creates a new histogram starting with the items in sequence.
- def count(self, item, f=1): Increments the counter associated with item. | Implement the Python class `Hist` described below.
Class description:
A map from each item to its frequency.
Method signatures and docstrings:
- def __init__(self, seq=None): Creates a new histogram starting with the items in sequence.
- def count(self, item, f=1): Increments the counter associated with item.
<|skel... | 490333f19b463973c05abc734ac3e9dc4e6d019a | <|skeleton|>
class Hist:
"""A map from each item to its frequency."""
def __init__(self, seq=None):
"""Creates a new histogram starting with the items in sequence."""
<|body_0|>
def count(self, item, f=1):
"""Increments the counter associated with item."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Hist:
"""A map from each item to its frequency."""
def __init__(self, seq=None):
"""Creates a new histogram starting with the items in sequence."""
super().__init__()
if seq is None:
seq = []
for el in seq:
self.count(el)
def count(self, item, ... | the_stack_v2_python_sparse | 18-inheritance/ex_18_12_3.py | akshirapov/think-python | train | 0 |
234dc89a9e2732adbe4d8fbcc10f15c6aa207528 | [
"if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects",
"if list_dictionaries is not None and list_dictionaries:\n return json.dumps(list_dictionaries)\nreturn '[]'",
"a_list = []\nfilename = cls.__name__ + '.json'\nwith open(filename, 'w') as a_file:\n ... | <|body_start_0|>
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = Base.__nb_objects
<|end_body_0|>
<|body_start_1|>
if list_dictionaries is not None and list_dictionaries:
return json.dumps(list_dictionaries)
return '... | class base | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""class base"""
def __init__(self, id=None):
"""init method"""
<|body_0|>
def to_json_string(list_dictionaries):
"""to_json_string static method"""
<|body_1|>
def save_to_file(cls, list_objs):
"""save_to_file class method"""
<|... | stack_v2_sparse_classes_36k_train_032078 | 2,135 | no_license | [
{
"docstring": "init method",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "to_json_string static method",
"name": "to_json_string",
"signature": "def to_json_string(list_dictionaries)"
},
{
"docstring": "save_to_file class method",
"name":... | 6 | stack_v2_sparse_classes_30k_train_015758 | Implement the Python class `Base` described below.
Class description:
class base
Method signatures and docstrings:
- def __init__(self, id=None): init method
- def to_json_string(list_dictionaries): to_json_string static method
- def save_to_file(cls, list_objs): save_to_file class method
- def from_json_string(json_... | Implement the Python class `Base` described below.
Class description:
class base
Method signatures and docstrings:
- def __init__(self, id=None): init method
- def to_json_string(list_dictionaries): to_json_string static method
- def save_to_file(cls, list_objs): save_to_file class method
- def from_json_string(json_... | 9943a8bf7a6b8f1d3d8648d76219a05677a1b979 | <|skeleton|>
class Base:
"""class base"""
def __init__(self, id=None):
"""init method"""
<|body_0|>
def to_json_string(list_dictionaries):
"""to_json_string static method"""
<|body_1|>
def save_to_file(cls, list_objs):
"""save_to_file class method"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base:
"""class base"""
def __init__(self, id=None):
"""init method"""
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = Base.__nb_objects
def to_json_string(list_dictionaries):
"""to_json_string static method"""... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | jhonatang1988/holbertonschool-higher_level_programming | train | 0 |
7bbe6ff85c57ff3dda3a1eb95e2eab12c735ee1b | [
"json_data = open(BASE_DIR + '/../config/keyArel.json')\nif json_data:\n data = json.load(json_data)\n key = data['key']\n app = data['app']\n data = {'grant_type': 'password', 'username': user, 'password': pwd, 'scope': 'read', 'format': 'json'}\n http_response = requests.post('https://arel.eisti.fr... | <|body_start_0|>
json_data = open(BASE_DIR + '/../config/keyArel.json')
if json_data:
data = json.load(json_data)
key = data['key']
app = data['app']
data = {'grant_type': 'password', 'username': user, 'password': pwd, 'scope': 'read', 'format': 'json'}
... | Arel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Arel:
def get_token(self, user, pwd):
"""recupere un token de l'api d'arel si le user et le mot de passe correspondent"""
<|body_0|>
def requete_arel(self, url_api, token):
"""fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)... | stack_v2_sparse_classes_36k_train_032079 | 1,755 | permissive | [
{
"docstring": "recupere un token de l'api d'arel si le user et le mot de passe correspondent",
"name": "get_token",
"signature": "def get_token(self, user, pwd)"
},
{
"docstring": "fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)",
"name": "requete... | 2 | stack_v2_sparse_classes_30k_train_004419 | Implement the Python class `Arel` described below.
Class description:
Implement the Arel class.
Method signatures and docstrings:
- def get_token(self, user, pwd): recupere un token de l'api d'arel si le user et le mot de passe correspondent
- def requete_arel(self, url_api, token): fait une requete sur l'api d'arel ... | Implement the Python class `Arel` described below.
Class description:
Implement the Arel class.
Method signatures and docstrings:
- def get_token(self, user, pwd): recupere un token de l'api d'arel si le user et le mot de passe correspondent
- def requete_arel(self, url_api, token): fait une requete sur l'api d'arel ... | 753890fe5c57cd5f6ac7754d9042817059b2ee4a | <|skeleton|>
class Arel:
def get_token(self, user, pwd):
"""recupere un token de l'api d'arel si le user et le mot de passe correspondent"""
<|body_0|>
def requete_arel(self, url_api, token):
"""fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Arel:
def get_token(self, user, pwd):
"""recupere un token de l'api d'arel si le user et le mot de passe correspondent"""
json_data = open(BASE_DIR + '/../config/keyArel.json')
if json_data:
data = json.load(json_data)
key = data['key']
app = data['a... | the_stack_v2_python_sparse | peytalaneApp/functions/arel.py | lpmng/lpmng-peytalane | train | 1 | |
e0824c73db8b23c8218c1951193e344ce18110ad | [
"provider = get_provider()\nif provider.PROVIDER_NAME != ONPREM:\n return provider.get_func_region()\nraise ProviderException('no region defined')",
"dbg = 'false'\nif settings.SSM_CONFIG is None:\n return dbg\ntry:\n DEBUG_LOG = settings.SSM_CONFIG.get_param('DEBUG_LOG')\n dbg = DEBUG_LOG['val']\n ... | <|body_start_0|>
provider = get_provider()
if provider.PROVIDER_NAME != ONPREM:
return provider.get_func_region()
raise ProviderException('no region defined')
<|end_body_0|>
<|body_start_1|>
dbg = 'false'
if settings.SSM_CONFIG is None:
return dbg
... | ProviderUtil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProviderUtil:
def get_func_region():
""":return:"""
<|body_0|>
def get_debug_param():
""":return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
provider = get_provider()
if provider.PROVIDER_NAME != ONPREM:
return provider.get_... | stack_v2_sparse_classes_36k_train_032080 | 1,288 | permissive | [
{
"docstring": ":return:",
"name": "get_func_region",
"signature": "def get_func_region()"
},
{
"docstring": ":return:",
"name": "get_debug_param",
"signature": "def get_debug_param()"
}
] | 2 | null | Implement the Python class `ProviderUtil` described below.
Class description:
Implement the ProviderUtil class.
Method signatures and docstrings:
- def get_func_region(): :return:
- def get_debug_param(): :return: | Implement the Python class `ProviderUtil` described below.
Class description:
Implement the ProviderUtil class.
Method signatures and docstrings:
- def get_func_region(): :return:
- def get_debug_param(): :return:
<|skeleton|>
class ProviderUtil:
def get_func_region():
""":return:"""
<|body_0|>
... | 98e057b2f433d97d903589ac75a6c2544174bac8 | <|skeleton|>
class ProviderUtil:
def get_func_region():
""":return:"""
<|body_0|>
def get_debug_param():
""":return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProviderUtil:
def get_func_region():
""":return:"""
provider = get_provider()
if provider.PROVIDER_NAME != ONPREM:
return provider.get_func_region()
raise ProviderException('no region defined')
def get_debug_param():
""":return:"""
dbg = 'false'... | the_stack_v2_python_sparse | halo_app/infra/providers/util.py | halo-framework/halo-app | train | 0 | |
244766b906d701891cdc67d195314161b61ef65d | [
"try:\n account_obj = super(account_account, self).create(vals)\n is_budget = vals.get('budget', False)\n if is_budget:\n _logger.info('预算科目,准备创建预算状况、产品...')\n self._create_budget_pos(account_obj.id, account_obj.name)\n self._create_product(account_obj.id, account_obj.name, account_obj... | <|body_start_0|>
try:
account_obj = super(account_account, self).create(vals)
is_budget = vals.get('budget', False)
if is_budget:
_logger.info('预算科目,准备创建预算状况、产品...')
self._create_budget_pos(account_obj.id, account_obj.name)
self... | 功能:科目增加-“是否预算科目” | account_account | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_account:
"""功能:科目增加-“是否预算科目”"""
def create(self, vals):
"""功能:如果是“预算科目”则创建“预算状况” :param vals: :return:"""
<|body_0|>
def write(self, vals):
"""功能:由“非预算科目”更改为“预算科目时”处理预算状况 :param vals: :return:"""
<|body_1|>
def _create_budget_pos(self, accoun... | stack_v2_sparse_classes_36k_train_032081 | 4,242 | no_license | [
{
"docstring": "功能:如果是“预算科目”则创建“预算状况” :param vals: :return:",
"name": "create",
"signature": "def create(self, vals)"
},
{
"docstring": "功能:由“非预算科目”更改为“预算科目时”处理预算状况 :param vals: :return:",
"name": "write",
"signature": "def write(self, vals)"
},
{
"docstring": "功能:根据“科目”创建“预算状况” ... | 4 | stack_v2_sparse_classes_30k_train_004272 | Implement the Python class `account_account` described below.
Class description:
功能:科目增加-“是否预算科目”
Method signatures and docstrings:
- def create(self, vals): 功能:如果是“预算科目”则创建“预算状况” :param vals: :return:
- def write(self, vals): 功能:由“非预算科目”更改为“预算科目时”处理预算状况 :param vals: :return:
- def _create_budget_pos(self, account_id... | Implement the Python class `account_account` described below.
Class description:
功能:科目增加-“是否预算科目”
Method signatures and docstrings:
- def create(self, vals): 功能:如果是“预算科目”则创建“预算状况” :param vals: :return:
- def write(self, vals): 功能:由“非预算科目”更改为“预算科目时”处理预算状况 :param vals: :return:
- def _create_budget_pos(self, account_id... | 5a4fd72991c846d5cb7c5082f6bdfef5b2bca572 | <|skeleton|>
class account_account:
"""功能:科目增加-“是否预算科目”"""
def create(self, vals):
"""功能:如果是“预算科目”则创建“预算状况” :param vals: :return:"""
<|body_0|>
def write(self, vals):
"""功能:由“非预算科目”更改为“预算科目时”处理预算状况 :param vals: :return:"""
<|body_1|>
def _create_budget_pos(self, accoun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class account_account:
"""功能:科目增加-“是否预算科目”"""
def create(self, vals):
"""功能:如果是“预算科目”则创建“预算状况” :param vals: :return:"""
try:
account_obj = super(account_account, self).create(vals)
is_budget = vals.get('budget', False)
if is_budget:
_logger.in... | the_stack_v2_python_sparse | yuancloud/plugin/account_budget_department/models/account_account.py | cash2one/yuancloud | train | 0 |
608ffd1c12cff468953116e852fdeba02ba556a7 | [
"self.__logger = State().getLogger('PipeController_Component_Logger')\nself.__logger.info('Starting __init__()', 'PipeConstructor:__init__')\nself.__config = config\nself.__logger.info('Finished __init__()', 'PipeConstructor:__init__')",
"self.__logger.info('Starting to constructPipe()', 'PipeConstructor:construc... | <|body_start_0|>
self.__logger = State().getLogger('PipeController_Component_Logger')
self.__logger.info('Starting __init__()', 'PipeConstructor:__init__')
self.__config = config
self.__logger.info('Finished __init__()', 'PipeConstructor:__init__')
<|end_body_0|>
<|body_start_1|>
... | PipeConstructor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PipeConstructor:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)"""
<|body_0|>
def constructPipe(self):
"""Konstruiert die Pipe für die Klassifizierung und gibt dies... | stack_v2_sparse_classes_36k_train_032082 | 2,202 | no_license | [
{
"docstring": "Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Konstruiert die Pipe für die Klassifizierung und gibt diese zurück. :return: s... | 2 | stack_v2_sparse_classes_30k_val_001178 | Implement the Python class `PipeConstructor` described below.
Class description:
Implement the PipeConstructor class.
Method signatures and docstrings:
- def __init__(self, config): Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)
- def constructPi... | Implement the Python class `PipeConstructor` described below.
Class description:
Implement the PipeConstructor class.
Method signatures and docstrings:
- def __init__(self, config): Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)
- def constructPi... | 3daaa72b193ebfb55894b47b6a752cdc2192bb6b | <|skeleton|>
class PipeConstructor:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)"""
<|body_0|>
def constructPipe(self):
"""Konstruiert die Pipe für die Klassifizierung und gibt dies... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PipeConstructor:
def __init__(self, config):
"""Constructor, initialisiert Membervariablen :param Config : config Die Konfiguration. :example: PipeConstructor(config)"""
self.__logger = State().getLogger('PipeController_Component_Logger')
self.__logger.info('Starting __init__()', 'Pipe... | the_stack_v2_python_sparse | SheetMusicScanner/PipeController_Component/PipeConstructor/PipeConstructor.py | jadeskon/score-scan | train | 0 | |
77f52c8f7f6f76c274527de4e90f6eb778743d29 | [
"missing = len(nums)\nfor i, num in enumerate(nums):\n missing ^= i ^ num\nreturn missing",
"target = len(nums) * (len(nums) + 1) // 2\nactual = sum(nums)\nreturn target - actual",
"num_set = set(nums)\nn = len(nums) + 1\nfor number in range(n):\n if number not in num_set:\n return number"
] | <|body_start_0|>
missing = len(nums)
for i, num in enumerate(nums):
missing ^= i ^ num
return missing
<|end_body_0|>
<|body_start_1|>
target = len(nums) * (len(nums) + 1) // 2
actual = sum(nums)
return target - actual
<|end_body_1|>
<|body_start_2|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def missing_number(nums: List[int]) -> int:
"""位运算"""
<|body_0|>
def missing_number_v2(nums: List[int]) -> int:
"""数学"""
<|body_1|>
def missing_number_v3(nums: List[int]) -> int:
"""哈希表"""
<|body_2|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_032083 | 1,527 | no_license | [
{
"docstring": "位运算",
"name": "missing_number",
"signature": "def missing_number(nums: List[int]) -> int"
},
{
"docstring": "数学",
"name": "missing_number_v2",
"signature": "def missing_number_v2(nums: List[int]) -> int"
},
{
"docstring": "哈希表",
"name": "missing_number_v3",
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missing_number(nums: List[int]) -> int: 位运算
- def missing_number_v2(nums: List[int]) -> int: 数学
- def missing_number_v3(nums: List[int]) -> int: 哈希表 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missing_number(nums: List[int]) -> int: 位运算
- def missing_number_v2(nums: List[int]) -> int: 数学
- def missing_number_v3(nums: List[int]) -> int: 哈希表
<|skeleton|>
class Solut... | 1d1876620a55ff88af7bc390cf1a4fd4350d8d16 | <|skeleton|>
class Solution:
def missing_number(nums: List[int]) -> int:
"""位运算"""
<|body_0|>
def missing_number_v2(nums: List[int]) -> int:
"""数学"""
<|body_1|>
def missing_number_v3(nums: List[int]) -> int:
"""哈希表"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def missing_number(nums: List[int]) -> int:
"""位运算"""
missing = len(nums)
for i, num in enumerate(nums):
missing ^= i ^ num
return missing
def missing_number_v2(nums: List[int]) -> int:
"""数学"""
target = len(nums) * (len(nums) + 1) // ... | the_stack_v2_python_sparse | 02-算法思想/位运算/268.缺失数字.py | jh-lau/leetcode_in_python | train | 0 | |
18ea306c0443a12d22326fbf220047c147da1d68 | [
"ForGetPwdPage(app_page).forget(data['username'])\ntime.sleep(2)\nForGetPwdPage(app_page).forget_success(data['username'], data['new_pwd'], data['new_pwd_second'])\nlogging.info('开始断言')\ntime.sleep(5)\ntry:\n assert 1 == 1\n logging.info('忘记密码成功')\nexcept:\n print('忘记密码失败')\n common.save_screenShot(app_... | <|body_start_0|>
ForGetPwdPage(app_page).forget(data['username'])
time.sleep(2)
ForGetPwdPage(app_page).forget_success(data['username'], data['new_pwd'], data['new_pwd_second'])
logging.info('开始断言')
time.sleep(5)
try:
assert 1 == 1
logging.info('忘记... | TestForGetPwd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestForGetPwd:
def test_forget_success(self, data, app_page):
"""成功忘记密码"""
<|body_0|>
def test_login_toast(self, data, app_page):
"""验证码不正确"""
<|body_1|>
def test_forget_success(self, data, app_page):
"""两次密码不一致"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_36k_train_032084 | 2,820 | no_license | [
{
"docstring": "成功忘记密码",
"name": "test_forget_success",
"signature": "def test_forget_success(self, data, app_page)"
},
{
"docstring": "验证码不正确",
"name": "test_login_toast",
"signature": "def test_login_toast(self, data, app_page)"
},
{
"docstring": "两次密码不一致",
"name": "test_fo... | 3 | null | Implement the Python class `TestForGetPwd` described below.
Class description:
Implement the TestForGetPwd class.
Method signatures and docstrings:
- def test_forget_success(self, data, app_page): 成功忘记密码
- def test_login_toast(self, data, app_page): 验证码不正确
- def test_forget_success(self, data, app_page): 两次密码不一致 | Implement the Python class `TestForGetPwd` described below.
Class description:
Implement the TestForGetPwd class.
Method signatures and docstrings:
- def test_forget_success(self, data, app_page): 成功忘记密码
- def test_login_toast(self, data, app_page): 验证码不正确
- def test_forget_success(self, data, app_page): 两次密码不一致
<|s... | b262c13e55a6e9eae1d4fa11d50b71814028261c | <|skeleton|>
class TestForGetPwd:
def test_forget_success(self, data, app_page):
"""成功忘记密码"""
<|body_0|>
def test_login_toast(self, data, app_page):
"""验证码不正确"""
<|body_1|>
def test_forget_success(self, data, app_page):
"""两次密码不一致"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestForGetPwd:
def test_forget_success(self, data, app_page):
"""成功忘记密码"""
ForGetPwdPage(app_page).forget(data['username'])
time.sleep(2)
ForGetPwdPage(app_page).forget_success(data['username'], data['new_pwd'], data['new_pwd_second'])
logging.info('开始断言')
time.... | the_stack_v2_python_sparse | TestCase/test_app/test_forget_pwd.py | xjx985426946/Test_UI | train | 0 | |
56d1e5199e2611796026b814ecf5d94bc34372cf | [
"expected_record_count = (4, 3, 12)\nexpected_error_count = (0, 0, 0)\ntup_record_count, tup_error_count = import_data(DATA_FILE_PATH, DATA_FILE_PRODUCT, DATA_FILE_CUSTOMER, DATA_FILE_RENTAL)\nself.assertTupleEqual(tup_record_count, expected_record_count)\nself.assertTupleEqual(tup_error_count, expected_error_count... | <|body_start_0|>
expected_record_count = (4, 3, 12)
expected_error_count = (0, 0, 0)
tup_record_count, tup_error_count = import_data(DATA_FILE_PATH, DATA_FILE_PRODUCT, DATA_FILE_CUSTOMER, DATA_FILE_RENTAL)
self.assertTupleEqual(tup_record_count, expected_record_count)
self.assert... | unit test for database.py | TestDatabase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDatabase:
"""unit test for database.py"""
def test_import_data(self):
"""test import_data"""
<|body_0|>
def test_import_data_error(self):
"""test import_data"""
<|body_1|>
def test_show_available_product(self):
"""test show_available_prod... | stack_v2_sparse_classes_36k_train_032085 | 3,286 | no_license | [
{
"docstring": "test import_data",
"name": "test_import_data",
"signature": "def test_import_data(self)"
},
{
"docstring": "test import_data",
"name": "test_import_data_error",
"signature": "def test_import_data_error(self)"
},
{
"docstring": "test show_available_product",
"n... | 4 | stack_v2_sparse_classes_30k_train_016443 | Implement the Python class `TestDatabase` described below.
Class description:
unit test for database.py
Method signatures and docstrings:
- def test_import_data(self): test import_data
- def test_import_data_error(self): test import_data
- def test_show_available_product(self): test show_available_product
- def test_... | Implement the Python class `TestDatabase` described below.
Class description:
unit test for database.py
Method signatures and docstrings:
- def test_import_data(self): test import_data
- def test_import_data_error(self): test import_data
- def test_show_available_product(self): test show_available_product
- def test_... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class TestDatabase:
"""unit test for database.py"""
def test_import_data(self):
"""test import_data"""
<|body_0|>
def test_import_data_error(self):
"""test import_data"""
<|body_1|>
def test_show_available_product(self):
"""test show_available_prod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestDatabase:
"""unit test for database.py"""
def test_import_data(self):
"""test import_data"""
expected_record_count = (4, 3, 12)
expected_error_count = (0, 0, 0)
tup_record_count, tup_error_count = import_data(DATA_FILE_PATH, DATA_FILE_PRODUCT, DATA_FILE_CUSTOMER, DATA_... | the_stack_v2_python_sparse | students/ttlarson/lesson05/assignment/test_database.py | JavaRod/SP_Python220B_2019 | train | 1 |
5d00cb4e3ac0b2a37666d5e7d10fc1a38e9570d9 | [
"nums = [i for i in range(n)]\nindex = 0\nwhile n > 1:\n index = (index + m - 1) % n\n nums.pop(index)\n n -= 1\nreturn nums[0]",
"if n == 1:\n return 0\nreturn (self.lastRemaining2(n - 1, m) + m) % n"
] | <|body_start_0|>
nums = [i for i in range(n)]
index = 0
while n > 1:
index = (index + m - 1) % n
nums.pop(index)
n -= 1
return nums[0]
<|end_body_0|>
<|body_start_1|>
if n == 1:
return 0
return (self.lastRemaining2(n - 1, m... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lastRemaining(self, n, m):
""":type n: int :type m: int :rtype: int"""
<|body_0|>
def lastRemaining2(self, n, m):
""":type n: int :type m: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums = [i for i in range(n)]
... | stack_v2_sparse_classes_36k_train_032086 | 731 | no_license | [
{
"docstring": ":type n: int :type m: int :rtype: int",
"name": "lastRemaining",
"signature": "def lastRemaining(self, n, m)"
},
{
"docstring": ":type n: int :type m: int :rtype: int",
"name": "lastRemaining2",
"signature": "def lastRemaining2(self, n, m)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013058 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastRemaining(self, n, m): :type n: int :type m: int :rtype: int
- def lastRemaining2(self, n, m): :type n: int :type m: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastRemaining(self, n, m): :type n: int :type m: int :rtype: int
- def lastRemaining2(self, n, m): :type n: int :type m: int :rtype: int
<|skeleton|>
class Solution:
de... | 690b685048c8e89d26047b6bc48b5f9af7d59cbb | <|skeleton|>
class Solution:
def lastRemaining(self, n, m):
""":type n: int :type m: int :rtype: int"""
<|body_0|>
def lastRemaining2(self, n, m):
""":type n: int :type m: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lastRemaining(self, n, m):
""":type n: int :type m: int :rtype: int"""
nums = [i for i in range(n)]
index = 0
while n > 1:
index = (index + m - 1) % n
nums.pop(index)
n -= 1
return nums[0]
def lastRemaining2(self, n... | the_stack_v2_python_sparse | 剑指offer题/剑指 Offer 62. 圆圈中最后剩下的数字.py | SimmonsChen/LeetCode | train | 0 | |
a0c71bebfec8a4e9c5f85e6dda4a021f3bd32c9f | [
"if start_time is None:\n self.started = time.time()\nelse:\n self.started = start_time",
"ended = time.time()\nstarted_wait = datetime.datetime.fromtimestamp(self.started).strftime('%Y-%m-%d %H:%M:%S')\nraised_date = datetime.datetime.fromtimestamp(ended).strftime('%Y-%m-%d %H:%M:%S')\nduration = ended - s... | <|body_start_0|>
if start_time is None:
self.started = time.time()
else:
self.started = start_time
<|end_body_0|>
<|body_start_1|>
ended = time.time()
started_wait = datetime.datetime.fromtimestamp(self.started).strftime('%Y-%m-%d %H:%M:%S')
raised_date =... | Holds timeout exception information. | TimeoutExceptionInfo | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeoutExceptionInfo:
"""Holds timeout exception information."""
def __init__(self, start_time=None):
"""Mark the time for started waiting."""
<|body_0|>
def msg(self):
"""Return a message to be used by TimeoutException containing timing information."""
<... | stack_v2_sparse_classes_36k_train_032087 | 14,890 | permissive | [
{
"docstring": "Mark the time for started waiting.",
"name": "__init__",
"signature": "def __init__(self, start_time=None)"
},
{
"docstring": "Return a message to be used by TimeoutException containing timing information.",
"name": "msg",
"signature": "def msg(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002787 | Implement the Python class `TimeoutExceptionInfo` described below.
Class description:
Holds timeout exception information.
Method signatures and docstrings:
- def __init__(self, start_time=None): Mark the time for started waiting.
- def msg(self): Return a message to be used by TimeoutException containing timing info... | Implement the Python class `TimeoutExceptionInfo` described below.
Class description:
Holds timeout exception information.
Method signatures and docstrings:
- def __init__(self, start_time=None): Mark the time for started waiting.
- def msg(self): Return a message to be used by TimeoutException containing timing info... | 69c082d2bf9b9985db77d1d25a3f423ecf016e00 | <|skeleton|>
class TimeoutExceptionInfo:
"""Holds timeout exception information."""
def __init__(self, start_time=None):
"""Mark the time for started waiting."""
<|body_0|>
def msg(self):
"""Return a message to be used by TimeoutException containing timing information."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeoutExceptionInfo:
"""Holds timeout exception information."""
def __init__(self, start_time=None):
"""Mark the time for started waiting."""
if start_time is None:
self.started = time.time()
else:
self.started = start_time
def msg(self):
"""R... | the_stack_v2_python_sparse | testplan/common/utils/timing.py | morganstanley/testplan | train | 78 |
c4319a41fcddb935990e9d1f9ce22a888ccae5f0 | [
"if isinstance(file_object, io.BufferedReader) or isinstance(file_object, InMemoryUploadedFile) or isinstance(file_object, TemporaryUploadedFile):\n super(Audio, self).__init__(file_object)\n self.obj = file_object\nelse:\n raise TypeError('File object not instance of BufferedReader, InMemoryUploadedFile o... | <|body_start_0|>
if isinstance(file_object, io.BufferedReader) or isinstance(file_object, InMemoryUploadedFile) or isinstance(file_object, TemporaryUploadedFile):
super(Audio, self).__init__(file_object)
self.obj = file_object
else:
raise TypeError('File object not in... | Class to handle Audio files | Audio | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Audio:
"""Class to handle Audio files"""
def __init__(self, file_object):
"""Constructor :param file_object: object created using Python's open() :return: None"""
<|body_0|>
def save(self, filename, custom_bucket=False):
"""Save an audio file. Saves locally to me... | stack_v2_sparse_classes_36k_train_032088 | 1,629 | no_license | [
{
"docstring": "Constructor :param file_object: object created using Python's open() :return: None",
"name": "__init__",
"signature": "def __init__(self, file_object)"
},
{
"docstring": "Save an audio file. Saves locally to media or remotely :param filename: name to give to the audio file :param... | 2 | stack_v2_sparse_classes_30k_train_008603 | Implement the Python class `Audio` described below.
Class description:
Class to handle Audio files
Method signatures and docstrings:
- def __init__(self, file_object): Constructor :param file_object: object created using Python's open() :return: None
- def save(self, filename, custom_bucket=False): Save an audio file... | Implement the Python class `Audio` described below.
Class description:
Class to handle Audio files
Method signatures and docstrings:
- def __init__(self, file_object): Constructor :param file_object: object created using Python's open() :return: None
- def save(self, filename, custom_bucket=False): Save an audio file... | 38a09ce2fe68312338c8cb597a341853901eeaa3 | <|skeleton|>
class Audio:
"""Class to handle Audio files"""
def __init__(self, file_object):
"""Constructor :param file_object: object created using Python's open() :return: None"""
<|body_0|>
def save(self, filename, custom_bucket=False):
"""Save an audio file. Saves locally to me... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Audio:
"""Class to handle Audio files"""
def __init__(self, file_object):
"""Constructor :param file_object: object created using Python's open() :return: None"""
if isinstance(file_object, io.BufferedReader) or isinstance(file_object, InMemoryUploadedFile) or isinstance(file_object, Temp... | the_stack_v2_python_sparse | apps/podcast/audio.py | AOV-Team/aov-py-backend | train | 0 |
86450e2bc9f0da56b212ebbbfc145b8a78ea74a9 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the FeedItemTarget service. Service to manage feed item targets. | FeedItemTargetServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedItemTargetServiceServicer:
"""Proto file describing the FeedItemTarget service. Service to manage feed item targets."""
def GetFeedItemTarget(self, request, context):
"""Returns the requested feed item targets in full detail."""
<|body_0|>
def MutateFeedItemTargets(s... | stack_v2_sparse_classes_36k_train_032089 | 3,507 | permissive | [
{
"docstring": "Returns the requested feed item targets in full detail.",
"name": "GetFeedItemTarget",
"signature": "def GetFeedItemTarget(self, request, context)"
},
{
"docstring": "Creates or removes feed item targets. Operation statuses are returned.",
"name": "MutateFeedItemTargets",
... | 2 | stack_v2_sparse_classes_30k_train_013080 | Implement the Python class `FeedItemTargetServiceServicer` described below.
Class description:
Proto file describing the FeedItemTarget service. Service to manage feed item targets.
Method signatures and docstrings:
- def GetFeedItemTarget(self, request, context): Returns the requested feed item targets in full detai... | Implement the Python class `FeedItemTargetServiceServicer` described below.
Class description:
Proto file describing the FeedItemTarget service. Service to manage feed item targets.
Method signatures and docstrings:
- def GetFeedItemTarget(self, request, context): Returns the requested feed item targets in full detai... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class FeedItemTargetServiceServicer:
"""Proto file describing the FeedItemTarget service. Service to manage feed item targets."""
def GetFeedItemTarget(self, request, context):
"""Returns the requested feed item targets in full detail."""
<|body_0|>
def MutateFeedItemTargets(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedItemTargetServiceServicer:
"""Proto file describing the FeedItemTarget service. Service to manage feed item targets."""
def GetFeedItemTarget(self, request, context):
"""Returns the requested feed item targets in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
... | the_stack_v2_python_sparse | google/ads/google_ads/v1/proto/services/feed_item_target_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
3dbf0ac49449127672d21b514c773321ffae9278 | [
"self.host = host\nself.port = port\nself.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\nself.sock.bind((self.host, self.port))\nself.messagesList = []\nself.connected = []",
"self.sock.listen(5)\nwhile True:\n client, address = self.s... | <|body_start_0|>
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self.host, self.port))
self.messagesList = []
self.connected = []
<|end... | ChatServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChatServer:
def __init__(self, host, port):
"""Initialization for the server"""
<|body_0|>
def listen(self):
"""Loop for accepting clients"""
<|body_1|>
def listenToClient(self, client, address):
"""Client thread method"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_032090 | 2,925 | no_license | [
{
"docstring": "Initialization for the server",
"name": "__init__",
"signature": "def __init__(self, host, port)"
},
{
"docstring": "Loop for accepting clients",
"name": "listen",
"signature": "def listen(self)"
},
{
"docstring": "Client thread method",
"name": "listenToClien... | 4 | stack_v2_sparse_classes_30k_train_017961 | Implement the Python class `ChatServer` described below.
Class description:
Implement the ChatServer class.
Method signatures and docstrings:
- def __init__(self, host, port): Initialization for the server
- def listen(self): Loop for accepting clients
- def listenToClient(self, client, address): Client thread method... | Implement the Python class `ChatServer` described below.
Class description:
Implement the ChatServer class.
Method signatures and docstrings:
- def __init__(self, host, port): Initialization for the server
- def listen(self): Loop for accepting clients
- def listenToClient(self, client, address): Client thread method... | 0249a73062f6bef9e40d0ab792f9cf30eaa363ed | <|skeleton|>
class ChatServer:
def __init__(self, host, port):
"""Initialization for the server"""
<|body_0|>
def listen(self):
"""Loop for accepting clients"""
<|body_1|>
def listenToClient(self, client, address):
"""Client thread method"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChatServer:
def __init__(self, host, port):
"""Initialization for the server"""
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self.h... | the_stack_v2_python_sparse | Bimester2/Class10/ChatServer.py | aloysiogl/CES-22_solutions | train | 0 | |
bb81acffda78761f3b0bd4b107bb361813bf25a4 | [
"self._x_range = x_range\nself._y_range = y_range\nself._save_correction = save_correction\nself.k = k\nsuper(FlatEarth, self).__init__(str_description)",
"if self._save_correction:\n flat_earth_dict = OrderedDict()\nfor label, data in obj_data.getIterator():\n latlon = obj_data.info(label)['Geolocation']\n... | <|body_start_0|>
self._x_range = x_range
self._y_range = y_range
self._save_correction = save_correction
self.k = k
super(FlatEarth, self).__init__(str_description)
<|end_body_0|>
<|body_start_1|>
if self._save_correction:
flat_earth_dict = OrderedDict()
... | *** In Development *** Remove flat Earth contribution from interferogram | FlatEarth | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlatEarth:
"""*** In Development *** Remove flat Earth contribution from interferogram"""
def __init__(self, str_description, x_range=None, y_range=None, k=2, remove_topography=False, save_correction=False):
"""Initialize Flat Earth item @param str_description: String describing item... | stack_v2_sparse_classes_36k_train_032091 | 4,754 | permissive | [
{
"docstring": "Initialize Flat Earth item @param str_description: String describing item @param x_range: x pixel range to process (None for entire range) @param y_range: y pixel range to process (None for entire range) @param k: Number of satellite or aircraft passes used to generate the interferogram (1 or 2)... | 2 | stack_v2_sparse_classes_30k_train_001615 | Implement the Python class `FlatEarth` described below.
Class description:
*** In Development *** Remove flat Earth contribution from interferogram
Method signatures and docstrings:
- def __init__(self, str_description, x_range=None, y_range=None, k=2, remove_topography=False, save_correction=False): Initialize Flat ... | Implement the Python class `FlatEarth` described below.
Class description:
*** In Development *** Remove flat Earth contribution from interferogram
Method signatures and docstrings:
- def __init__(self, str_description, x_range=None, y_range=None, k=2, remove_topography=False, save_correction=False): Initialize Flat ... | 4d22e3ef90ef842d6b390074a8b5deedc7658a2b | <|skeleton|>
class FlatEarth:
"""*** In Development *** Remove flat Earth contribution from interferogram"""
def __init__(self, str_description, x_range=None, y_range=None, k=2, remove_topography=False, save_correction=False):
"""Initialize Flat Earth item @param str_description: String describing item... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlatEarth:
"""*** In Development *** Remove flat Earth contribution from interferogram"""
def __init__(self, str_description, x_range=None, y_range=None, k=2, remove_topography=False, save_correction=False):
"""Initialize Flat Earth item @param str_description: String describing item @param x_ran... | the_stack_v2_python_sparse | pyinsar/processing/discovery/flat_earth.py | MITeaps/pyinsar | train | 11 |
cce283188614738967871d513ab55c75d177642f | [
"shim_format_util.replace_autoclass_value_with_prefixed_time(bucket_resource, use_gsutil_time_style=True)\nshim_format_util.replace_time_values_with_gsutil_style_strings(bucket_resource)\nshim_format_util.replace_bucket_values_with_present_string(bucket_resource)\nreturn base.get_formatted_string(bucket_resource, _... | <|body_start_0|>
shim_format_util.replace_autoclass_value_with_prefixed_time(bucket_resource, use_gsutil_time_style=True)
shim_format_util.replace_time_values_with_gsutil_style_strings(bucket_resource)
shim_format_util.replace_bucket_values_with_present_string(bucket_resource)
return bas... | Format a resource as per gsutil Storage style for ls -L output. | GsutilFullResourceFormatter | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GsutilFullResourceFormatter:
"""Format a resource as per gsutil Storage style for ls -L output."""
def format_bucket(self, bucket_resource):
"""See super class."""
<|body_0|>
def format_object(self, object_resource, show_acl=True, show_version_in_url=False, **kwargs):
... | stack_v2_sparse_classes_36k_train_032092 | 8,524 | permissive | [
{
"docstring": "See super class.",
"name": "format_bucket",
"signature": "def format_bucket(self, bucket_resource)"
},
{
"docstring": "See super class.",
"name": "format_object",
"signature": "def format_object(self, object_resource, show_acl=True, show_version_in_url=False, **kwargs)"
... | 2 | null | Implement the Python class `GsutilFullResourceFormatter` described below.
Class description:
Format a resource as per gsutil Storage style for ls -L output.
Method signatures and docstrings:
- def format_bucket(self, bucket_resource): See super class.
- def format_object(self, object_resource, show_acl=True, show_ver... | Implement the Python class `GsutilFullResourceFormatter` described below.
Class description:
Format a resource as per gsutil Storage style for ls -L output.
Method signatures and docstrings:
- def format_bucket(self, bucket_resource): See super class.
- def format_object(self, object_resource, show_acl=True, show_ver... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class GsutilFullResourceFormatter:
"""Format a resource as per gsutil Storage style for ls -L output."""
def format_bucket(self, bucket_resource):
"""See super class."""
<|body_0|>
def format_object(self, object_resource, show_acl=True, show_version_in_url=False, **kwargs):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GsutilFullResourceFormatter:
"""Format a resource as per gsutil Storage style for ls -L output."""
def format_bucket(self, bucket_resource):
"""See super class."""
shim_format_util.replace_autoclass_value_with_prefixed_time(bucket_resource, use_gsutil_time_style=True)
shim_format_... | the_stack_v2_python_sparse | lib/googlecloudsdk/command_lib/storage/resources/gsutil_full_resource_formatter.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
69ec0e59d8dcbe48569a36647d1bf781e9181daf | [
"model = self._meta.verbose_name.title()\ntitle = self.title or str(_('Empty title'))\nreturn f'{model:s}: {title:s}'",
"if self.__class__.objects.filter(master__draft_course_run__translations__pk=self.pk, language_code=self.language_code).exclude(title=self.title).exists():\n self.master.direct_course.extende... | <|body_start_0|>
model = self._meta.verbose_name.title()
title = self.title or str(_('Empty title'))
return f'{model:s}: {title:s}'
<|end_body_0|>
<|body_start_1|>
if self.__class__.objects.filter(master__draft_course_run__translations__pk=self.pk, language_code=self.language_code).excl... | CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields. | CourseRunTranslation | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CourseRunTranslation:
"""CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields."""
def __str__(self):
"""Human representation of a course run translation."""
<|body_0|>
def save(self, *args, **kwargs):
"""Mark rel... | stack_v2_sparse_classes_36k_train_032093 | 42,905 | permissive | [
{
"docstring": "Human representation of a course run translation.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Mark related course page dirty if the title has changed compared to the public version.",
"name": "save",
"signature": "def save(self, *args, **kwarg... | 2 | stack_v2_sparse_classes_30k_train_018724 | Implement the Python class `CourseRunTranslation` described below.
Class description:
CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields.
Method signatures and docstrings:
- def __str__(self): Human representation of a course run translation.
- def save(self, *args... | Implement the Python class `CourseRunTranslation` described below.
Class description:
CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields.
Method signatures and docstrings:
- def __str__(self): Human representation of a course run translation.
- def save(self, *args... | f2d46fc46b271eb3b4d565039a29c15ba15f027c | <|skeleton|>
class CourseRunTranslation:
"""CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields."""
def __str__(self):
"""Human representation of a course run translation."""
<|body_0|>
def save(self, *args, **kwargs):
"""Mark rel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CourseRunTranslation:
"""CourseRun Translation model. Django parler model linked to the CourseRun to internationalize the fields."""
def __str__(self):
"""Human representation of a course run translation."""
model = self._meta.verbose_name.title()
title = self.title or str(_('Empt... | the_stack_v2_python_sparse | src/richie/apps/courses/models/course.py | openfun/richie | train | 238 |
17cee83e3e5a809cb048f95ed247a4eb32cc94b1 | [
"self.config_ = pConfig\nself.convBuilder_ = pConvBuilder\nself.protein_ = pProtein\nprint('')\nprint('##################### ProtEncoder #####################')\nprint('')\nconvRadii = parse_elem_list(self.config_['enc.radii'], float)\nnumBasis = int(self.config_['enc.numbasis'])\nfeatureList = parse_elem_list(self... | <|body_start_0|>
self.config_ = pConfig
self.convBuilder_ = pConvBuilder
self.protein_ = pProtein
print('')
print('##################### ProtEncoder #####################')
print('')
convRadii = parse_elem_list(self.config_['enc.radii'], float)
numBasis = ... | Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. latentCode_ (float tensor bxf): Latent code for each model of the batch. numConvs_ ... | ProtEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtEncoder:
"""Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. latentCode_ (float tensor bxf): Latent code ... | stack_v2_sparse_classes_36k_train_032094 | 6,956 | permissive | [
{
"docstring": "Constructor. Args: pConfig (dictionary): Dictionary containing the parameters needed to create the network in string format. pConvBuilder (MolConvBuilder): Convolution builder. pProtein (Protein): Protein. pInFeatures (float tensor nxf): Input features. pBNAFDO (BNAFDO): BNAFDO object.",
"na... | 2 | stack_v2_sparse_classes_30k_train_015592 | Implement the Python class `ProtEncoder` described below.
Class description:
Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. laten... | Implement the Python class `ProtEncoder` described below.
Class description:
Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. laten... | 9c79ea000c20088fa48234f1868e42883a9b5a21 | <|skeleton|>
class ProtEncoder:
"""Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. latentCode_ (float tensor bxf): Latent code ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtEncoder:
"""Encoder. Attributes: config_ (dictionary): Dictionary with the configuration parameters. convBuilder_ (MolConvBuilder): Convolution builder. protein_ (Protein): Protein. outLayers_ (list of tensors): Output of each level of the encoder. latentCode_ (float tensor bxf): Latent code for each mode... | the_stack_v2_python_sparse | IEProtLib/models/mol/ProtEncoder.py | sailfish009/IEConv_proteins | train | 0 |
85cf03543052069c7936fb1466192326a33c8f90 | [
"self.errors = JsonBackend(fname='errors', initialize=False)\nself._cork = cork_obj\nassert error_name in self.errors, 'Unknown error'\nself.error_name = error_name\nerror = self._cork.errors[error_name]\nself.time = error['time']\nself.counted = error['counted']\nif session is not None:\n try:\n self.ses... | <|body_start_0|>
self.errors = JsonBackend(fname='errors', initialize=False)
self._cork = cork_obj
assert error_name in self.errors, 'Unknown error'
self.error_name = error_name
error = self._cork.errors[error_name]
self.time = error['time']
self.counted = error['... | Errors | [
"X11-distribute-modifications-variant"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Errors:
def __init__(self, error_name, cork_obj, session=None):
"""Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creation_time, session_accessed_time, session_id. The session-related attributes are available for the... | stack_v2_sparse_classes_36k_train_032095 | 6,513 | permissive | [
{
"docstring": "Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creation_time, session_accessed_time, session_id. The session-related attributes are available for the current user only. :param email_addr: email_addr :type email_addr: str. :p... | 3 | stack_v2_sparse_classes_30k_train_002704 | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def __init__(self, error_name, cork_obj, session=None): Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creatio... | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def __init__(self, error_name, cork_obj, session=None): Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creatio... | 4559b9053a5af83b0bf6d267bb65cbd2faa3b7d3 | <|skeleton|>
class Errors:
def __init__(self, error_name, cork_obj, session=None):
"""Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creation_time, session_accessed_time, session_id. The session-related attributes are available for the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Errors:
def __init__(self, error_name, cork_obj, session=None):
"""Represent an authenticated user, exposing useful attributes: email_addr, role, level, description, email_addr, session_creation_time, session_accessed_time, session_id. The session-related attributes are available for the current user ... | the_stack_v2_python_sparse | munin/json_backend.py | namndev/python-munin | train | 1 | |
1af32c233fa1289e2541dbf6607a6f358cef0859 | [
"try:\n spare = self.get_object(Spare, spare_id)\n if not spare:\n return self.object_not_found(request)\n serializer = serializers.SpareSerializer(spare)\n return Utils.dispatch_success(request, serializer.data)\nexcept Exception as e:\n return self.internal_server_error(request, e)",
"try:... | <|body_start_0|>
try:
spare = self.get_object(Spare, spare_id)
if not spare:
return self.object_not_found(request)
serializer = serializers.SpareSerializer(spare)
return Utils.dispatch_success(request, serializer.data)
except Exception as e... | particular spare details | SpareDetails | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpareDetails:
"""particular spare details"""
def get(self, request, spare_id):
"""Return requested spare :param request: :param spare_id: :return:"""
<|body_0|>
def put(self, request, spare_id):
"""Updates the requested spare :param request: # partial fields are ... | stack_v2_sparse_classes_36k_train_032096 | 23,745 | permissive | [
{
"docstring": "Return requested spare :param request: :param spare_id: :return:",
"name": "get",
"signature": "def get(self, request, spare_id)"
},
{
"docstring": "Updates the requested spare :param request: # partial fields are also acceptable { \"spare_name\": \"SIde Mirror\", \"spare_id\": #... | 3 | stack_v2_sparse_classes_30k_train_011015 | Implement the Python class `SpareDetails` described below.
Class description:
particular spare details
Method signatures and docstrings:
- def get(self, request, spare_id): Return requested spare :param request: :param spare_id: :return:
- def put(self, request, spare_id): Updates the requested spare :param request: ... | Implement the Python class `SpareDetails` described below.
Class description:
particular spare details
Method signatures and docstrings:
- def get(self, request, spare_id): Return requested spare :param request: :param spare_id: :return:
- def put(self, request, spare_id): Updates the requested spare :param request: ... | 1e31affddf60d2de72445a85dd2055bdeba6f670 | <|skeleton|>
class SpareDetails:
"""particular spare details"""
def get(self, request, spare_id):
"""Return requested spare :param request: :param spare_id: :return:"""
<|body_0|>
def put(self, request, spare_id):
"""Updates the requested spare :param request: # partial fields are ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpareDetails:
"""particular spare details"""
def get(self, request, spare_id):
"""Return requested spare :param request: :param spare_id: :return:"""
try:
spare = self.get_object(Spare, spare_id)
if not spare:
return self.object_not_found(request)
... | the_stack_v2_python_sparse | the_mechanic_backend/v0/stock/views.py | muthukumar4999/the-mechanic-backend | train | 0 |
0981f7037fda1f107f407df3c68ffd7d8b6fa4a8 | [
"self.cacheMap = {}\nself.keyList = []\nself.maxLen = capacity",
"value = self.cacheMap.get(key)\nif value != None and self.keyList[0] != key:\n index = self.keyList.index(key)\n self.keyList.pop(index)\n self.keyList.insert(0, key)\nvalue = value if value != None else -1\nreturn value",
"if self.cache... | <|body_start_0|>
self.cacheMap = {}
self.keyList = []
self.maxLen = capacity
<|end_body_0|>
<|body_start_1|>
value = self.cacheMap.get(key)
if value != None and self.keyList[0] != key:
index = self.keyList.index(key)
self.keyList.pop(index)
se... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_032097 | 1,193 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: None",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_004331 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None
<|sk... | b03528bfc954e8c402d66e84b397ec3b065ddb84 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.cacheMap = {}
self.keyList = []
self.maxLen = capacity
def get(self, key):
""":type key: int :rtype: int"""
value = self.cacheMap.get(key)
if value != None and self.keyList[0] !=... | the_stack_v2_python_sparse | bytedance/LRU缓存机制/Solution.py | wudc5/LeetCode | train | 0 | |
5513b1a465acc12fc9e986102ffd80c109b438d1 | [
"super().__init__(*args, **kwargs)\nself.config = {}\nself.config_file = kwargs.get('config_file', 'config.json')\nself.session = aiohttp.ClientSession(loop=self.loop)",
"if not filename:\n filename = self.config_file\nwith open(filename) as file_object:\n config = json.load(file_object)\nif isinstance(conf... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.config = {}
self.config_file = kwargs.get('config_file', 'config.json')
self.session = aiohttp.ClientSession(loop=self.loop)
<|end_body_0|>
<|body_start_1|>
if not filename:
filename = self.config_file
w... | A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3. | Bot | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bot:
"""A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3."""
def __init__(self, *args, **kwargs):
"""In addition to everything supported by commands.Bot, this also supports: * `config_file` - An `str` representing the confi... | stack_v2_sparse_classes_36k_train_032098 | 2,231 | permissive | [
{
"docstring": "In addition to everything supported by commands.Bot, this also supports: * `config_file` - An `str` representing the configuration file of the bot. Defaults to `config.json`. This doesn't really have to be used, but it's there for convenience reasons. Instance variables not in the constructor: *... | 3 | stack_v2_sparse_classes_30k_train_004850 | Implement the Python class `Bot` described below.
Class description:
A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): In addition to everything supported by commands.Bot, this also su... | Implement the Python class `Bot` described below.
Class description:
A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): In addition to everything supported by commands.Bot, this also su... | 9bf3f2125939b66bd1894e509c1b1fa1ab413a6a | <|skeleton|>
class Bot:
"""A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3."""
def __init__(self, *args, **kwargs):
"""In addition to everything supported by commands.Bot, this also supports: * `config_file` - An `str` representing the confi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bot:
"""A custom bot object that provides a configuration handler and an aiohttp ClientSession. This is similar to k3."""
def __init__(self, *args, **kwargs):
"""In addition to everything supported by commands.Bot, this also supports: * `config_file` - An `str` representing the configuration file... | the_stack_v2_python_sparse | k2/core.py | DasWolke/kitsuchan-2 | train | 1 |
c4d3bb0ba74c8a302027dda80c5c671b7c59293b | [
"model = model if isinstance(model, SpaceForDialogIntent) else Model.from_pretrained(model)\nif preprocessor is None:\n preprocessor = DialogIntentPredictionPreprocessor(model.model_dir)\nself.model = model\nsuper().__init__(model=model, preprocessor=preprocessor, **kwargs)\nself.categories = preprocessor.catego... | <|body_start_0|>
model = model if isinstance(model, SpaceForDialogIntent) else Model.from_pretrained(model)
if preprocessor is None:
preprocessor = DialogIntentPredictionPreprocessor(model.model_dir)
self.model = model
super().__init__(model=model, preprocessor=preprocessor, ... | DialogIntentPredictionPipeline | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogIntentPredictionPipeline:
def __init__(self, model: Union[SpaceForDialogIntent, str], preprocessor: DialogIntentPredictionPreprocessor=None, **kwargs):
"""Use `model` and `preprocessor` to create a dialog intent prediction pipeline Args: model (str or SpaceForDialogIntent): Supply ... | stack_v2_sparse_classes_36k_train_032099 | 2,215 | permissive | [
{
"docstring": "Use `model` and `preprocessor` to create a dialog intent prediction pipeline Args: model (str or SpaceForDialogIntent): Supply either a local model dir or a model id from the model hub, or a SpaceForDialogIntent instance. preprocessor (DialogIntentPredictionPreprocessor): An optional preprocesso... | 2 | stack_v2_sparse_classes_30k_train_012921 | Implement the Python class `DialogIntentPredictionPipeline` described below.
Class description:
Implement the DialogIntentPredictionPipeline class.
Method signatures and docstrings:
- def __init__(self, model: Union[SpaceForDialogIntent, str], preprocessor: DialogIntentPredictionPreprocessor=None, **kwargs): Use `mod... | Implement the Python class `DialogIntentPredictionPipeline` described below.
Class description:
Implement the DialogIntentPredictionPipeline class.
Method signatures and docstrings:
- def __init__(self, model: Union[SpaceForDialogIntent, str], preprocessor: DialogIntentPredictionPreprocessor=None, **kwargs): Use `mod... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class DialogIntentPredictionPipeline:
def __init__(self, model: Union[SpaceForDialogIntent, str], preprocessor: DialogIntentPredictionPreprocessor=None, **kwargs):
"""Use `model` and `preprocessor` to create a dialog intent prediction pipeline Args: model (str or SpaceForDialogIntent): Supply ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DialogIntentPredictionPipeline:
def __init__(self, model: Union[SpaceForDialogIntent, str], preprocessor: DialogIntentPredictionPreprocessor=None, **kwargs):
"""Use `model` and `preprocessor` to create a dialog intent prediction pipeline Args: model (str or SpaceForDialogIntent): Supply either a local... | the_stack_v2_python_sparse | ai/modelscope/modelscope/pipelines/nlp/dialog_intent_prediction_pipeline.py | alldatacenter/alldata | train | 774 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.