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
1870aa76642e6b913e13cccb5e09ceea3fa477bd
[ "def addSquares(n, seen=set()):\n sumSquare = 0\n for digit in str(n):\n sumSquare += int(digit) ** 2\n if sumSquare in seen:\n return False\n elif sumSquare == 1:\n return True\n else:\n seen.add(sumSquare)\n return addSquares(sumSquare, seen)\nreturn addSquares(n)", ...
<|body_start_0|> def addSquares(n, seen=set()): sumSquare = 0 for digit in str(n): sumSquare += int(digit) ** 2 if sumSquare in seen: return False elif sumSquare == 1: return True else: se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n: int) -> bool: """Recursive solution""" <|body_0|> def isHappyIter(self, n: int) -> bool: """Iterative solution""" <|body_1|> <|end_skeleton|> <|body_start_0|> def addSquares(n, seen=set()): sumSquare = 0 ...
stack_v2_sparse_classes_36k_train_001100
1,710
no_license
[ { "docstring": "Recursive solution", "name": "isHappy", "signature": "def isHappy(self, n: int) -> bool" }, { "docstring": "Iterative solution", "name": "isHappyIter", "signature": "def isHappyIter(self, n: int) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_003196
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n: int) -> bool: Recursive solution - def isHappyIter(self, n: int) -> bool: Iterative solution
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n: int) -> bool: Recursive solution - def isHappyIter(self, n: int) -> bool: Iterative solution <|skeleton|> class Solution: def isHappy(self, n: int) -> ...
03bd244295a50e03b9717f19208c10377ed98f5a
<|skeleton|> class Solution: def isHappy(self, n: int) -> bool: """Recursive solution""" <|body_0|> def isHappyIter(self, n: int) -> bool: """Iterative solution""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isHappy(self, n: int) -> bool: """Recursive solution""" def addSquares(n, seen=set()): sumSquare = 0 for digit in str(n): sumSquare += int(digit) ** 2 if sumSquare in seen: return False elif sumSquare...
the_stack_v2_python_sparse
02-HashTables-StacksQueues/happyNum.py
ram25794/codepath
train
0
812018a6c7c10c8c313615447182921d220a28cb
[ "self.bot.plugin['xep_0030'].add_feature(FEATURE)\nself.bot.add_handler(MASK, self.handle_tune)\nself.tunes = {}", "logging.info('Got Tune')\njid = xml.get('from')\ntune = xml.find(FIND)\nif tune is None:\n self.tunes[jid] = 'No tune.'\n return\nartist = tune.find('{http://jabber.org/protocol/tune}artist')\...
<|body_start_0|> self.bot.plugin['xep_0030'].add_feature(FEATURE) self.bot.add_handler(MASK, self.handle_tune) self.tunes = {} <|end_body_0|> <|body_start_1|> logging.info('Got Tune') jid = xml.get('from') tune = xml.find(FIND) if tune is None: self.t...
A plugin to get user tune info.
GetTune
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetTune: """A plugin to get user tune info.""" def _on_register(self): """Register tunes into disco service plugin""" <|body_0|> def handle_tune(self, xml): """Store a tune.""" <|body_1|> def handle_gettune(self, cmd, args, msg): """Returns t...
stack_v2_sparse_classes_36k_train_001101
1,940
permissive
[ { "docstring": "Register tunes into disco service plugin", "name": "_on_register", "signature": "def _on_register(self)" }, { "docstring": "Store a tune.", "name": "handle_tune", "signature": "def handle_tune(self, xml)" }, { "docstring": "Returns the published tunes.", "name...
3
stack_v2_sparse_classes_30k_train_020726
Implement the Python class `GetTune` described below. Class description: A plugin to get user tune info. Method signatures and docstrings: - def _on_register(self): Register tunes into disco service plugin - def handle_tune(self, xml): Store a tune. - def handle_gettune(self, cmd, args, msg): Returns the published tu...
Implement the Python class `GetTune` described below. Class description: A plugin to get user tune info. Method signatures and docstrings: - def _on_register(self): Register tunes into disco service plugin - def handle_tune(self, xml): Store a tune. - def handle_gettune(self, cmd, args, msg): Returns the published tu...
6690cc9f644d5b0c9f8eb6e3540eea336ed61847
<|skeleton|> class GetTune: """A plugin to get user tune info.""" def _on_register(self): """Register tunes into disco service plugin""" <|body_0|> def handle_tune(self, xml): """Store a tune.""" <|body_1|> def handle_gettune(self, cmd, args, msg): """Returns t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetTune: """A plugin to get user tune info.""" def _on_register(self): """Register tunes into disco service plugin""" self.bot.plugin['xep_0030'].add_feature(FEATURE) self.bot.add_handler(MASK, self.handle_tune) self.tunes = {} def handle_tune(self, xml): """S...
the_stack_v2_python_sparse
sleekbot/plugins/gettune.py
hgrecco/SleekBot
train
2
323203ee605eae5e5619cf67fdbb1fc079274de3
[ "VapiInterface.__init__(self, config, _CurrentPeerCertificatesStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})", "task_id = self._invoke('list$task', {'cluster': cluster, 'provider': provider, 'spec': spec})\ntask_svc = Tasks(self._config)\ntask_instance = Task(tas...
<|body_start_0|> VapiInterface.__init__(self, config, _CurrentPeerCertificatesStub) self._VAPI_OPERATION_IDS = {} self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'}) <|end_body_0|> <|body_start_1|> task_id = self._invoke('list$task', {'cluster': cluster, 'provider': provider, 's...
Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class was added in vSphere API 7.0.0.
CurrentPeerCertificates
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentPeerCertificates: """Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class was added in vSphere API 7.0.0.""" ...
stack_v2_sparse_classes_36k_train_001102
43,803
permissive
[ { "docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Return the remote server certificates. Contacts the configured key ...
2
null
Implement the Python class `CurrentPeerCertificates` described below. Class description: Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class w...
Implement the Python class `CurrentPeerCertificates` described below. Class description: Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class w...
c07e1be98615201139b26c28db3aa584c4254b66
<|skeleton|> class CurrentPeerCertificates: """Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class was added in vSphere API 7.0.0.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrentPeerCertificates: """Retrieves the list of TLS certificates used by peer key servers. Those are meant for review. Following approval these certificates should be added as trusted certificates in the :class:`TrustedPeerCertificates` class. This class was added in vSphere API 7.0.0.""" def __init__(...
the_stack_v2_python_sparse
com/vmware/vcenter/trusted_infrastructure/trust_authority_clusters/kms/providers_client.py
adammillerio/vsphere-automation-sdk-python
train
0
e36c765bb308236a417478e84ace8a264fbb6d47
[ "player_id = current_user['player_id']\ntry:\n lobby = lobbies.get_player_lobby(player_id, lobby_id)\n return _add_lobby_urls(lobby)\nexcept lobbies.NotFoundException as e:\n abort(http_client.NOT_FOUND, message=e.msg)\nexcept lobbies.UnauthorizedException as e:\n abort(http_client.UNAUTHORIZED, message...
<|body_start_0|> player_id = current_user['player_id'] try: lobby = lobbies.get_player_lobby(player_id, lobby_id) return _add_lobby_urls(lobby) except lobbies.NotFoundException as e: abort(http_client.NOT_FOUND, message=e.msg) except lobbies.Unauthoriz...
LobbyAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LobbyAPI: def get(self, lobby_id: str): """Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby.""" <|body_0|> def patch(self, args, lobby_id: str): """Update lobby info. Requesting player must be the lobby host.""" <|b...
stack_v2_sparse_classes_36k_train_001103
13,314
permissive
[ { "docstring": "Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby.", "name": "get", "signature": "def get(self, lobby_id: str)" }, { "docstring": "Update lobby info. Requesting player must be the lobby host.", "name": "patch", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_006767
Implement the Python class `LobbyAPI` described below. Class description: Implement the LobbyAPI class. Method signatures and docstrings: - def get(self, lobby_id: str): Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby. - def patch(self, args, lobby_id: str): Update lobby i...
Implement the Python class `LobbyAPI` described below. Class description: Implement the LobbyAPI class. Method signatures and docstrings: - def get(self, lobby_id: str): Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby. - def patch(self, args, lobby_id: str): Update lobby i...
2771bb46db7fd331448f9db3cfb257fab7f89bcc
<|skeleton|> class LobbyAPI: def get(self, lobby_id: str): """Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby.""" <|body_0|> def patch(self, args, lobby_id: str): """Update lobby info. Requesting player must be the lobby host.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LobbyAPI: def get(self, lobby_id: str): """Retrieve a specific lobby if the requesting player is a member of the lobby. Returns a lobby.""" player_id = current_user['player_id'] try: lobby = lobbies.get_player_lobby(player_id, lobby_id) return _add_lobby_urls(lo...
the_stack_v2_python_sparse
driftbase/api/lobbies.py
directivegames/drift-base
train
1
070ce3c336e3c96c0725cc26100d280c1a46dbf7
[ "self.hash_set = defaultdict(list)\nfor i, w in enumerate(words):\n self.hash_set[w].append(i)", "min_dis = float('Inf')\nfor idx in self.hash_set[word2]:\n insert_idx = bisect.bisect(self.hash_set[word1], idx)\n if insert_idx == 0:\n min_dis = min(min_dis, abs(idx - self.hash_set[word1][0]))\n ...
<|body_start_0|> self.hash_set = defaultdict(list) for i, w in enumerate(words): self.hash_set[w].append(i) <|end_body_0|> <|body_start_1|> min_dis = float('Inf') for idx in self.hash_set[word2]: insert_idx = bisect.bisect(self.hash_set[word1], idx) i...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.hash_set = defaultdict(list) ...
stack_v2_sparse_classes_36k_train_001104
1,113
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_006156
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
e42ec45d98f990d446bbf4f1a568b70855af5380
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.hash_set = defaultdict(list) for i, w in enumerate(words): self.hash_set[w].append(i) def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" min_di...
the_stack_v2_python_sparse
wordDistance.py
LYoung-Hub/Algorithm-Data-Structure
train
0
320edffd4bd7252c7f2eec5876bee71f6db11886
[ "results = []\ndoc = photoshop.app.activeDocument\nfor task in tasks:\n item = task['item']\n output = task['output']\n errors = []\n progress_cb(0, 'Validating', task)\n if output['name'] == 'tif_output':\n pass\n elif output['name'] == 'export_groups':\n group_errors = self.__valid...
<|body_start_0|> results = [] doc = photoshop.app.activeDocument for task in tasks: item = task['item'] output = task['output'] errors = [] progress_cb(0, 'Validating', task) if output['name'] == 'tif_output': pass ...
Single hook that implements pre-publish functionality
PrePublishHook
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Di...
stack_v2_sparse_classes_36k_train_001105
5,312
no_license
[ { "docstring": "Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Dictionary This is the item returned by the scan hook { name: String description: String type: String other_params: Dictionary } output: Dictionary This is t...
2
stack_v2_sparse_classes_30k_train_011253
Implement the Python class `PrePublishHook` described below. Class description: Single hook that implements pre-publish functionality Method signatures and docstrings: - def execute(self, tasks, work_template, progress_cb, **kwargs): Main hook entry point :param tasks: List of tasks to be pre-published. Each task is ...
Implement the Python class `PrePublishHook` described below. Class description: Single hook that implements pre-publish functionality Method signatures and docstrings: - def execute(self, tasks, work_template, progress_cb, **kwargs): Main hook entry point :param tasks: List of tasks to be pre-published. Each task is ...
7a6d3bad242afba2e3670281a539985f8c673f46
<|skeleton|> class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Dictionary This...
the_stack_v2_python_sparse
hooks/secondary_pre_publish_photoshopOutputs.py
AardmanCGI/aardtemplate
train
3
2a176e4a75005899e0a2265c640a078ab1f7a219
[ "super(BaseHandler, self).__init__(klass)\nself.fieldAttributes['default_expression'] = zope.schema.TextLine(__name__='default_expression', title=u'Default from TALES expression')\nself.fieldAttributes['default_from_member'] = zope.schema.TextLine(__name__='default_from_member', title=u'Default from Member property...
<|body_start_0|> super(BaseHandler, self).__init__(klass) self.fieldAttributes['default_expression'] = zope.schema.TextLine(__name__='default_expression', title=u'Default from TALES expression') self.fieldAttributes['default_from_member'] = zope.schema.TextLine(__name__='default_from_member', ti...
BaseHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseHandler: def __init__(self, klass): """Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel export/import handlers.""" <|body_0|> def _constructField(self, attributes): """S...
stack_v2_sparse_classes_36k_train_001106
9,163
no_license
[ { "docstring": "Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel export/import handlers.", "name": "__init__", "signature": "def __init__(self, klass)" }, { "docstring": "Sneak our custom attributes by ...
3
null
Implement the Python class `BaseHandler` described below. Class description: Implement the BaseHandler class. Method signatures and docstrings: - def __init__(self, klass): Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel ex...
Implement the Python class `BaseHandler` described below. Class description: Implement the BaseHandler class. Method signatures and docstrings: - def __init__(self, klass): Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel ex...
a01bec6c00d203c21a1b0449f8d489d0033c02b7
<|skeleton|> class BaseHandler: def __init__(self, klass): """Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel export/import handlers.""" <|body_0|> def _constructField(self, attributes): """S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseHandler: def __init__(self, klass): """Add support for our custom attributes. These get stored as plain Python attributes on the IField that gets passed from/to the plone.supermodel export/import handlers.""" super(BaseHandler, self).__init__(klass) self.fieldAttributes['default_ex...
the_stack_v2_python_sparse
opengever/propertysheets/exportimport.py
4teamwork/opengever.core
train
19
409e72c8b2f80097e55fff06527e5c19cd329071
[ "if self.is_admin:\n return True\nif image.owner is None:\n return True\nif image.is_public:\n return True\nif self.owner is not None:\n if self.owner == image.owner:\n return True\n try:\n tmp = db_api.image_member_find(self, image.id, self.owner)\n return not tmp['deleted']\n ...
<|body_start_0|> if self.is_admin: return True if image.owner is None: return True if image.is_public: return True if self.owner is not None: if self.owner == image.owner: return True try: tmp = d...
Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability.
RequestContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestContext: """Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability.""" def is_image_visible(self, image): """Return True if the image is visible...
stack_v2_sparse_classes_36k_train_001107
3,355
permissive
[ { "docstring": "Return True if the image is visible in this context.", "name": "is_image_visible", "signature": "def is_image_visible(self, image)" }, { "docstring": "Return True if the image is mutable in this context.", "name": "is_image_mutable", "signature": "def is_image_mutable(sel...
3
null
Implement the Python class `RequestContext` described below. Class description: Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability. Method signatures and docstrings: - def is_image_...
Implement the Python class `RequestContext` described below. Class description: Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability. Method signatures and docstrings: - def is_image_...
1a3d7575d4b341f64fa1764ed47e47a7504a9bcc
<|skeleton|> class RequestContext: """Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability.""" def is_image_visible(self, image): """Return True if the image is visible...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestContext: """Stores information about the security context under which the user accesses the system, as well as additional request information. Also provides tests for image visibility and sharability.""" def is_image_visible(self, image): """Return True if the image is visible in this cont...
the_stack_v2_python_sparse
stack/glance/glance/registry/context.py
ashokcse/openstack-bill
train
5
c7cca67e7cc2d5a5ded317040857073e9293f2a8
[ "maxArea = 0\nhist = []\ni = 0\nwhile i < len(heights):\n if not hist or heights[hist[-1]] <= heights[i]:\n hist.append(i)\n i += 1\n else:\n h = heights[hist.pop()]\n if not hist:\n w = i\n else:\n w = i - 1 - hist[-1]\n maxArea = max(h * w, max...
<|body_start_0|> maxArea = 0 hist = [] i = 0 while i < len(heights): if not hist or heights[hist[-1]] <= heights[i]: hist.append(i) i += 1 else: h = heights[hist.pop()] if not hist: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> maxArea = 0 ...
stack_v2_sparse_classes_36k_train_001108
2,261
no_license
[ { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" }, { "docstring": ":type matrix: List[List[str]] :rtype: int", "name": "maximalRectangle", "signature": "def maximalRectangle(self, matrix)" } ]
2
stack_v2_sparse_classes_30k_train_009520
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int <|skeleton|> class ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" maxArea = 0 hist = [] i = 0 while i < len(heights): if not hist or heights[hist[-1]] <= heights[i]: hist.append(i) i += 1 ...
the_stack_v2_python_sparse
code85MaximalRectangle.py
cybelewang/leetcode-python
train
0
db437c96b5d257ec32a1cab4e6d81bd7d4b3df56
[ "Frame.__init__(self, kwargs)\nself.config = config\nself.entry_variables = None\nself.master.title('Solver parameters')", "notebook = tkinter.ttk.Notebook(self.master)\nhelp_font = tkinter.font.Font(slant='italic', size=10)\nself.entry_variables = {}\nfor tab, options in self.config.items():\n self.entry_vari...
<|body_start_0|> Frame.__init__(self, kwargs) self.config = config self.entry_variables = None self.master.title('Solver parameters') <|end_body_0|> <|body_start_1|> notebook = tkinter.ttk.Notebook(self.master) help_font = tkinter.font.Font(slant='italic', size=10) ...
Tabbed widget allowing to handle a configuration
ConfigWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigWidget: """Tabbed widget allowing to handle a configuration""" def __init__(self, config, **kwargs): """Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initial value, 'help': information about param1}, param2: {.......
stack_v2_sparse_classes_36k_train_001109
4,448
no_license
[ { "docstring": "Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initial value, 'help': information about param1}, param2: {....}}}", "name": "__init__", "signature": "def __init__(self, config, **kwargs)" }, { "docstring": "Display t...
3
stack_v2_sparse_classes_30k_train_010528
Implement the Python class `ConfigWidget` described below. Class description: Tabbed widget allowing to handle a configuration Method signatures and docstrings: - def __init__(self, config, **kwargs): Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initia...
Implement the Python class `ConfigWidget` described below. Class description: Tabbed widget allowing to handle a configuration Method signatures and docstrings: - def __init__(self, config, **kwargs): Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initia...
cf4383c4a162962b68df470e2bf757ad534880b9
<|skeleton|> class ConfigWidget: """Tabbed widget allowing to handle a configuration""" def __init__(self, config, **kwargs): """Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initial value, 'help': information about param1}, param2: {.......
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigWidget: """Tabbed widget allowing to handle a configuration""" def __init__(self, config, **kwargs): """Create config widget `config` should have the following structure: {category: {param1: {'type': type, 'value': initial value, 'help': information about param1}, param2: {....}}}""" ...
the_stack_v2_python_sparse
python/tympan/config_gui.py
FDiot/code_tympan3
train
1
d467c71aaafe3503afc6eb9427857411aaf6e73a
[ "start_time = time.time()\nprint('--- INICIO ORDER_TO_INTERNAL ---')\nclient_instance = Client.objects.get(users=self.context['request'].user)\ntry:\n last_order_id = Order.objects.filter(client=client_instance.id).latest('created_at').order_id\nexcept:\n last_order_id = 'AAAA000000'\nvalue['order_id'] = Data...
<|body_start_0|> start_time = time.time() print('--- INICIO ORDER_TO_INTERNAL ---') client_instance = Client.objects.get(users=self.context['request'].user) try: last_order_id = Order.objects.filter(client=client_instance.id).latest('created_at').order_id except: ...
Order Serializer. Serialize order information.
OrderSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderSerializer: """Order Serializer. Serialize order information.""" def to_internal_value(self, value): """Convert client code to client_id for db write. Returns: json: order request pre processed data.""" <|body_0|> def validate(self, value): """Calculate deli...
stack_v2_sparse_classes_36k_train_001110
16,033
no_license
[ { "docstring": "Convert client code to client_id for db write. Returns: json: order request pre processed data.", "name": "to_internal_value", "signature": "def to_internal_value(self, value)" }, { "docstring": "Calculate delivery time and order price with services functions. Raises: serializers...
3
stack_v2_sparse_classes_30k_train_015059
Implement the Python class `OrderSerializer` described below. Class description: Order Serializer. Serialize order information. Method signatures and docstrings: - def to_internal_value(self, value): Convert client code to client_id for db write. Returns: json: order request pre processed data. - def validate(self, v...
Implement the Python class `OrderSerializer` described below. Class description: Order Serializer. Serialize order information. Method signatures and docstrings: - def to_internal_value(self, value): Convert client code to client_id for db write. Returns: json: order request pre processed data. - def validate(self, v...
2c63a323d3bb5d924de2926bd8e9ba9b92d94c3a
<|skeleton|> class OrderSerializer: """Order Serializer. Serialize order information.""" def to_internal_value(self, value): """Convert client code to client_id for db write. Returns: json: order request pre processed data.""" <|body_0|> def validate(self, value): """Calculate deli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderSerializer: """Order Serializer. Serialize order information.""" def to_internal_value(self, value): """Convert client code to client_id for db write. Returns: json: order request pre processed data.""" start_time = time.time() print('--- INICIO ORDER_TO_INTERNAL ---') ...
the_stack_v2_python_sparse
tasks/serializers.py
nachitog83/packtrack
train
0
e00c59fec6031c7cbabad9a118be156a14df51b8
[ "if parameter_name not in request_data:\n raise ParseError('`{}` parameter is required'.format(parameter_name))\nids = request_data.get(parameter_name)\nif not isinstance(ids, list):\n raise ParseError('`{}` parameter not a list'.format(parameter_name))\nif not ids:\n raise ParseError('`{}` parameter is em...
<|body_start_0|> if parameter_name not in request_data: raise ParseError('`{}` parameter is required'.format(parameter_name)) ids = request_data.get(parameter_name) if not isinstance(ids, list): raise ParseError('`{}` parameter not a list'.format(parameter_name)) ...
Mixin for viewsets for handling various parameters.
ParametersMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParametersMixin: """Mixin for viewsets for handling various parameters.""" def get_ids(self, request_data, parameter_name='ids'): """Extract a list of integers from request data.""" <|body_0|> def get_id(self, request_data, parameter_name='id'): """Extract an int...
stack_v2_sparse_classes_36k_train_001111
7,923
permissive
[ { "docstring": "Extract a list of integers from request data.", "name": "get_ids", "signature": "def get_ids(self, request_data, parameter_name='ids')" }, { "docstring": "Extract an integer from request data.", "name": "get_id", "signature": "def get_id(self, request_data, parameter_name...
2
stack_v2_sparse_classes_30k_train_018003
Implement the Python class `ParametersMixin` described below. Class description: Mixin for viewsets for handling various parameters. Method signatures and docstrings: - def get_ids(self, request_data, parameter_name='ids'): Extract a list of integers from request data. - def get_id(self, request_data, parameter_name=...
Implement the Python class `ParametersMixin` described below. Class description: Mixin for viewsets for handling various parameters. Method signatures and docstrings: - def get_ids(self, request_data, parameter_name='ids'): Extract a list of integers from request data. - def get_id(self, request_data, parameter_name=...
25c0c45235ef37beb45c1af4c917fbbae6282016
<|skeleton|> class ParametersMixin: """Mixin for viewsets for handling various parameters.""" def get_ids(self, request_data, parameter_name='ids'): """Extract a list of integers from request data.""" <|body_0|> def get_id(self, request_data, parameter_name='id'): """Extract an int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParametersMixin: """Mixin for viewsets for handling various parameters.""" def get_ids(self, request_data, parameter_name='ids'): """Extract a list of integers from request data.""" if parameter_name not in request_data: raise ParseError('`{}` parameter is required'.format(par...
the_stack_v2_python_sparse
resolwe/flow/views/mixins.py
genialis/resolwe
train
35
e3e373dca38def5b549d4340cfe676d11bd436d6
[ "self.pokemon = pokemon\nself.targets = targets\nself.environment = environment\nself.action = None\nentries = []\nfor attack in self.pokemon.getAttacks():\n entries.append(AttackMenuEntry(attack, self.setAction))\nself.menu = Menu(entries, columns=2)\nscreen.setBottomView(ActionMenuWidget(self.menu, self.getWin...
<|body_start_0|> self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] for attack in self.pokemon.getAttacks(): entries.append(AttackMenuEntry(attack, self.setAction)) self.menu = Menu(entries, col...
Controller for Attack Menu
AttackMenuController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_001112
2,031
no_license
[ { "docstring": "Initialize the Attack Menu", "name": "__init__", "signature": "def __init__(self, pokemon, targets, environment, screen)" }, { "docstring": "Set the Chosen Action", "name": "setAction", "signature": "def setAction(self, entry)" } ]
2
stack_v2_sparse_classes_30k_train_020706
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action <|skeleton|> class AttackMenuC...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] ...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ActionMenu/AttackMenu/attack_menu_controller.py
sgtnourry/Pokemon-Project
train
0
0ef718cab0c87bf9d4545a1ebc463adfbe150f04
[ "page = request.args.get('page', 1)\nif tab == 'all':\n orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False)\nelif tab == 'test':\n orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=True)\nelif tab == 'tran...
<|body_start_0|> page = request.args.get('page', 1) if tab == 'all': orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False) elif tab == 'test': orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED...
OrderView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderView: def index(self, tab='all'): """展示首页 :param tab: :return:""" <|body_0|> def search(self, page=1): """搜索 :param page: :return:""" <|body_1|> def cancel_order(self, order_id): """取消订单 :param order_id: :return:""" <|body_2|> d...
stack_v2_sparse_classes_36k_train_001113
3,603
no_license
[ { "docstring": "展示首页 :param tab: :return:", "name": "index", "signature": "def index(self, tab='all')" }, { "docstring": "搜索 :param page: :return:", "name": "search", "signature": "def search(self, page=1)" }, { "docstring": "取消订单 :param order_id: :return:", "name": "cancel_o...
4
null
Implement the Python class `OrderView` described below. Class description: Implement the OrderView class. Method signatures and docstrings: - def index(self, tab='all'): 展示首页 :param tab: :return: - def search(self, page=1): 搜索 :param page: :return: - def cancel_order(self, order_id): 取消订单 :param order_id: :return: - ...
Implement the Python class `OrderView` described below. Class description: Implement the OrderView class. Method signatures and docstrings: - def index(self, tab='all'): 展示首页 :param tab: :return: - def search(self, page=1): 搜索 :param page: :return: - def cancel_order(self, order_id): 取消订单 :param order_id: :return: - ...
867de34eea10ea4219eec9130b7b14412cbbd8a0
<|skeleton|> class OrderView: def index(self, tab='all'): """展示首页 :param tab: :return:""" <|body_0|> def search(self, page=1): """搜索 :param page: :return:""" <|body_1|> def cancel_order(self, order_id): """取消订单 :param order_id: :return:""" <|body_2|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderView: def index(self, tab='all'): """展示首页 :param tab: :return:""" page = request.args.get('page', 1) if tab == 'all': orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False) elif tab == 'test': orde...
the_stack_v2_python_sparse
app/views/admin/order/order.py
FreeGodCode/e-commerce
train
0
50d1697b0e55df35d6fafef224581434ff08c976
[ "super().__init__(name=name)\nself._output_size = output_size\nself._conv_channels = 64\nself._conv_kernel_shape = [7, 7]\nself._conv_stride = 2\nself._pooling_kernel_shape = [2, 2]\nself._pooling_stride = 2\nself._resunit_channels = [64, 64, 128, 128, 256, 256, 512, 512]\nself._num_resunits = len(self._resunit_cha...
<|body_start_0|> super().__init__(name=name) self._output_size = output_size self._conv_channels = 64 self._conv_kernel_shape = [7, 7] self._conv_stride = 2 self._pooling_kernel_shape = [2, 2] self._pooling_stride = 2 self._resunit_channels = [64, 64, 128,...
ResNet18
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNet18: def __init__(self, output_size, name='resnet18', use_weight_norm=False, activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_p...
stack_v2_sparse_classes_36k_train_001114
3,541
permissive
[ { "docstring": "Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional keyword arguments will be passed to all the Conv2DWN and to the ResUnit layers.", "name": "__init__", ...
2
null
Implement the Python class `ResNet18` described below. Class description: Implement the ResNet18 class. Method signatures and docstrings: - def __init__(self, output_size, name='resnet18', use_weight_norm=False, activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name...
Implement the Python class `ResNet18` described below. Class description: Implement the ResNet18 class. Method signatures and docstrings: - def __init__(self, output_size, name='resnet18', use_weight_norm=False, activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name...
a10c33346803239db8a64c104db7f22ec4e05bef
<|skeleton|> class ResNet18: def __init__(self, output_size, name='resnet18', use_weight_norm=False, activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNet18: def __init__(self, output_size, name='resnet18', use_weight_norm=False, activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the...
the_stack_v2_python_sparse
argo/core/network/ResNet18.py
ricvo/argo
train
0
6776cf540c2f509377584f324cb50c222ff0e7bd
[ "self._test_channel_read()\nself.set_base_prompt()\nself.send_command(command_string='telnet localhost', expect_string='\\\\(UBNT\\\\) >')\nself.set_base_prompt()\nself.enable()\nself.disable_paging()\ntime.sleep(0.3 * self.global_delay_factor)\nself.clear_buffer()", "try:\n if self.check_config_mode(pattern='...
<|body_start_0|> self._test_channel_read() self.set_base_prompt() self.send_command(command_string='telnet localhost', expect_string='\\(UBNT\\) >') self.set_base_prompt() self.enable() self.disable_paging() time.sleep(0.3 * self.global_delay_factor) self....
UbiquitiUnifiSwitchSSH
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UbiquitiUnifiSwitchSSH: def session_preparation(self) -> None: """Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initially starts at a Linux shell. Nothing interesting can be done in this environment, however, running `telnet loc...
stack_v2_sparse_classes_36k_train_001115
1,318
permissive
[ { "docstring": "Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initially starts at a Linux shell. Nothing interesting can be done in this environment, however, running `telnet localhost` drops the session to a more familiar environment.", "name": "s...
2
stack_v2_sparse_classes_30k_train_002221
Implement the Python class `UbiquitiUnifiSwitchSSH` described below. Class description: Implement the UbiquitiUnifiSwitchSSH class. Method signatures and docstrings: - def session_preparation(self) -> None: Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initi...
Implement the Python class `UbiquitiUnifiSwitchSSH` described below. Class description: Implement the UbiquitiUnifiSwitchSSH class. Method signatures and docstrings: - def session_preparation(self) -> None: Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initi...
2e56b40ec639da130471c59dd1f3c93983471e41
<|skeleton|> class UbiquitiUnifiSwitchSSH: def session_preparation(self) -> None: """Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initially starts at a Linux shell. Nothing interesting can be done in this environment, however, running `telnet loc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UbiquitiUnifiSwitchSSH: def session_preparation(self) -> None: """Prepare the session after the connection has been established. When SSHing to a UniFi switch, the session initially starts at a Linux shell. Nothing interesting can be done in this environment, however, running `telnet localhost` drops ...
the_stack_v2_python_sparse
netmiko/ubiquiti/unifiswitch_ssh.py
ktbyers/netmiko
train
3,397
2409e849af27cb337230bfc385f2e6aa0f365a4b
[ "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...
Service to manage customer-manager links.
CustomerManagerLinkServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerManagerLinkServiceServicer: """Service to manage customer-manager links.""" def GetCustomerManagerLink(self, request, context): """Returns the requested CustomerManagerLink in full detail.""" <|body_0|> def MutateCustomerManagerLink(self, request, context): ...
stack_v2_sparse_classes_36k_train_001116
3,589
permissive
[ { "docstring": "Returns the requested CustomerManagerLink in full detail.", "name": "GetCustomerManagerLink", "signature": "def GetCustomerManagerLink(self, request, context)" }, { "docstring": "Creates or updates customer manager links. Operation statuses are returned.", "name": "MutateCust...
2
null
Implement the Python class `CustomerManagerLinkServiceServicer` described below. Class description: Service to manage customer-manager links. Method signatures and docstrings: - def GetCustomerManagerLink(self, request, context): Returns the requested CustomerManagerLink in full detail. - def MutateCustomerManagerLin...
Implement the Python class `CustomerManagerLinkServiceServicer` described below. Class description: Service to manage customer-manager links. Method signatures and docstrings: - def GetCustomerManagerLink(self, request, context): Returns the requested CustomerManagerLink in full detail. - def MutateCustomerManagerLin...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class CustomerManagerLinkServiceServicer: """Service to manage customer-manager links.""" def GetCustomerManagerLink(self, request, context): """Returns the requested CustomerManagerLink in full detail.""" <|body_0|> def MutateCustomerManagerLink(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerManagerLinkServiceServicer: """Service to manage customer-manager links.""" def GetCustomerManagerLink(self, request, context): """Returns the requested CustomerManagerLink in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not i...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/customer_manager_link_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
876d1c05948421aead858f1c7a1a03ed90a14848
[ "minheap = []\nM, N = (len(matrix), len(matrix[0]))\nfor r in range(min(k, M)):\n heapq.heappush(minheap, (matrix[r][0], r, 0))\nfor i in range(k):\n ans, r, c = heapq.heappop(minheap)\n if c + 1 < N:\n heapq.heappush(minheap, (matrix[r][c + 1], r, c + 1))\nreturn ans", "M, N = (len(matrix), len(m...
<|body_start_0|> minheap = [] M, N = (len(matrix), len(matrix[0])) for r in range(min(k, M)): heapq.heappush(minheap, (matrix[r][0], r, 0)) for i in range(k): ans, r, c = heapq.heappop(minheap) if c + 1 < N: heapq.heappush(minheap, (mat...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k)""" <|body_0|> def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """Binary Search 로 최대 범위의 값을 이동해나아가면서 그 값이 몇번째인지 매번 계산 O((M+N)...
stack_v2_sparse_classes_36k_train_001117
1,440
no_license
[ { "docstring": "한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k)", "name": "kthSmallest", "signature": "def kthSmallest(self, matrix: List[List[int]], k: int) -> int" }, { "docstring": "Binary Search 로 최대 범위의 값을 이동해나아가면서 그 값이 몇번째인지 매번 계산 O((M+N)logD) / O(1)", "name": "kthSmallest", "s...
2
stack_v2_sparse_classes_30k_train_014591
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix: List[List[int]], k: int) -> int: 한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k) - def kthSmallest(self, matrix: List[List[int]], k: int) -> int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix: List[List[int]], k: int) -> int: 한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k) - def kthSmallest(self, matrix: List[List[int]], k: int) -> int...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k)""" <|body_0|> def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """Binary Search 로 최대 범위의 값을 이동해나아가면서 그 값이 몇번째인지 매번 계산 O((M+N)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """한 줄을 더해놓고, 그로부터 오른쪽으로 이동하게 heap을 구현 O(klogk) / O(k)""" minheap = [] M, N = (len(matrix), len(matrix[0])) for r in range(min(k, M)): heapq.heappush(minheap, (matrix[r][0], r, 0)) for ...
the_stack_v2_python_sparse
Leetcode/378.py
hanwgyu/algorithm_problem_solving
train
5
a158856da0b29047561ea7615fea309c8e1ec63e
[ "AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel)\nif not xlabel:\n self.plot_xlabel = '$t$'\nif not ylabel:\n self.plot_ylabel = self.__labels[fluxes[0].name]\nif not idlabel:\n self.plot_idlabel = self.data[0].name + ' : ' + self.data[0].calc_ids[0]\nself.lines = len(self.data) * [None]", ...
<|body_start_0|> AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel) if not xlabel: self.plot_xlabel = '$t$' if not ylabel: self.plot_ylabel = self.__labels[fluxes[0].name] if not idlabel: self.plot_idlabel = self.data[0].name + ' : ' + sel...
Flux plotter
tdc_Fluxes_Plotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" <|body_0|> def plot(self, ax, semilog=True, **kwargs): """semilog <True> if True make semilog plot: t-linear,...
stack_v2_sparse_classes_36k_train_001118
1,553
no_license
[ { "docstring": "fluxes -- list with fluxes to be plotted", "name": "__init__", "signature": "def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None)" }, { "docstring": "semilog <True> if True make semilog plot: t-linear, f-log scale, if False make linear plot: t,f-linear", "name":...
2
stack_v2_sparse_classes_30k_train_000142
Implement the Python class `tdc_Fluxes_Plotter` described below. Class description: Flux plotter Method signatures and docstrings: - def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): fluxes -- list with fluxes to be plotted - def plot(self, ax, semilog=True, **kwargs): semilog <True> if True make se...
Implement the Python class `tdc_Fluxes_Plotter` described below. Class description: Flux plotter Method signatures and docstrings: - def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): fluxes -- list with fluxes to be plotted - def plot(self, ax, semilog=True, **kwargs): semilog <True> if True make se...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" <|body_0|> def plot(self, ax, semilog=True, **kwargs): """semilog <True> if True make semilog plot: t-linear,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel) if not xlabel: self.plot_xlabel = '$t$' if ...
the_stack_v2_python_sparse
Fluxes/tdc_fluxes_plotter.py
atimokhin/tdc_vis
train
0
41509b2636d050b471e4877eeff0fc14e0a8116e
[ "be = instantiate_backend(be, D)\nself.be = be\nself.compute_with_backend = compute_with_backend\nif hasattr(D, 'compute'):\n self.D = D.compute()\nelse:\n self.D = D\nself.D = self.be.cast(self.D, dtype=self.be.float64)\nm, n = self.be.shape(self.D)\nself.R_ = self.be.zeros((m + 2, n + 2), dtype=self.be.floa...
<|body_start_0|> be = instantiate_backend(be, D) self.be = be self.compute_with_backend = compute_with_backend if hasattr(D, 'compute'): self.D = D.compute() else: self.D = D self.D = self.be.cast(self.D, dtype=self.be.float64) m, n = self....
SoftDTW
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDTW: def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False): """Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method 'compute' Distances. An example of class computing distance is 'SquaredEuclidean'. gamma: float ...
stack_v2_sparse_classes_36k_train_001119
27,011
permissive
[ { "docstring": "Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method 'compute' Distances. An example of class computing distance is 'SquaredEuclidean'. gamma: float Regularization parameter. Lower is less smoothed (closer to true DTW). be : Backend object ...
3
stack_v2_sparse_classes_30k_train_019527
Implement the Python class `SoftDTW` described below. Class description: Implement the SoftDTW class. Method signatures and docstrings: - def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False): Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method ...
Implement the Python class `SoftDTW` described below. Class description: Implement the SoftDTW class. Method signatures and docstrings: - def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False): Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method ...
e9b3ecca5f56bc8ffab5a0106e2d41f17ae89109
<|skeleton|> class SoftDTW: def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False): """Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method 'compute' Distances. An example of class computing distance is 'SquaredEuclidean'. gamma: float ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftDTW: def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False): """Parameters ---------- D : array-like, shape=[m, n], dtype=float64 or class computing distances with a method 'compute' Distances. An example of class computing distance is 'SquaredEuclidean'. gamma: float Regularization...
the_stack_v2_python_sparse
tslearn/metrics/softdtw_variants.py
tslearn-team/tslearn
train
1,687
6ced3c0472633753126be4992303a1f4c315f026
[ "self.directory = None\nself.cuda = True\nself.augmentation = None\nself.loss = None\nself.summary_gradients = None\nself.trainloader = None\nself.testloader = None\nself.epochs = None\nself.snapshot = None\nself.get_writer = None\nself.get_optimizer = None\nself.get_scheduler = None\nself.get_model = None", "ass...
<|body_start_0|> self.directory = None self.cuda = True self.augmentation = None self.loss = None self.summary_gradients = None self.trainloader = None self.testloader = None self.epochs = None self.snapshot = None self.get_writer = None ...
Configuration for normal training.
NormalTrainingConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalTrainingConfig: """Configuration for normal training.""" def __init__(self): """Constructor.""" <|body_0|> def validate(self): """Check validity.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.directory = None self.cuda = Tru...
stack_v2_sparse_classes_36k_train_001120
16,771
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Check validity.", "name": "validate", "signature": "def validate(self)" } ]
2
stack_v2_sparse_classes_30k_train_000376
Implement the Python class `NormalTrainingConfig` described below. Class description: Configuration for normal training. Method signatures and docstrings: - def __init__(self): Constructor. - def validate(self): Check validity.
Implement the Python class `NormalTrainingConfig` described below. Class description: Configuration for normal training. Method signatures and docstrings: - def __init__(self): Constructor. - def validate(self): Check validity. <|skeleton|> class NormalTrainingConfig: """Configuration for normal training.""" ...
736c99b55a77d0c650eae5ced2d8312d13af0baf
<|skeleton|> class NormalTrainingConfig: """Configuration for normal training.""" def __init__(self): """Constructor.""" <|body_0|> def validate(self): """Check validity.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NormalTrainingConfig: """Configuration for normal training.""" def __init__(self): """Constructor.""" self.directory = None self.cuda = True self.augmentation = None self.loss = None self.summary_gradients = None self.trainloader = None self...
the_stack_v2_python_sparse
common/experiments.py
Adversarial-Intelligence-Group/color-adversarial-training
train
0
380e4edb41efb2deeef293839a0f0545f33000bd
[ "if not isinstance(geometry, np.ndarray):\n raise ValueError('geometry should be of type numpy.ndarray')\nif not isinstance(templates, np.ndarray):\n raise ValueError('templates should be of type numpy.ndarray')\nif not len(templates.shape) == 3:\n raise ValueError('template must have shape (n_samples, n_c...
<|body_start_0|> if not isinstance(geometry, np.ndarray): raise ValueError('geometry should be of type numpy.ndarray') if not isinstance(templates, np.ndarray): raise ValueError('templates should be of type numpy.ndarray') if not len(templates.shape) == 3: rai...
Class for plotting spatial traces of waveforms.
WaveFormTrace
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaveFormTrace: """Class for plotting spatial traces of waveforms.""" def __init__(self, geometry, templates, unit_labels=None, templates_sec=None, unit_map=None): """Sets up the plotting descriptions for spatial trace. Parameters: ----------- geometry: numpy.ndarray shape (C, 2) Inci...
stack_v2_sparse_classes_36k_train_001121
12,809
permissive
[ { "docstring": "Sets up the plotting descriptions for spatial trace. Parameters: ----------- geometry: numpy.ndarray shape (C, 2) Incidates coordinates of the probes. templates: numpy.ndarray shape (T, C, K) Where T, C and K respectively indicate time samples, number of channels, and number of units. unit_label...
2
stack_v2_sparse_classes_30k_train_001129
Implement the Python class `WaveFormTrace` described below. Class description: Class for plotting spatial traces of waveforms. Method signatures and docstrings: - def __init__(self, geometry, templates, unit_labels=None, templates_sec=None, unit_map=None): Sets up the plotting descriptions for spatial trace. Paramete...
Implement the Python class `WaveFormTrace` described below. Class description: Class for plotting spatial traces of waveforms. Method signatures and docstrings: - def __init__(self, geometry, templates, unit_labels=None, templates_sec=None, unit_map=None): Sets up the plotting descriptions for spatial trace. Paramete...
09b5984fe77fca69bbb8d42311ba690dd1d78c70
<|skeleton|> class WaveFormTrace: """Class for plotting spatial traces of waveforms.""" def __init__(self, geometry, templates, unit_labels=None, templates_sec=None, unit_map=None): """Sets up the plotting descriptions for spatial trace. Parameters: ----------- geometry: numpy.ndarray shape (C, 2) Inci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WaveFormTrace: """Class for plotting spatial traces of waveforms.""" def __init__(self, geometry, templates, unit_labels=None, templates_sec=None, unit_map=None): """Sets up the plotting descriptions for spatial trace. Parameters: ----------- geometry: numpy.ndarray shape (C, 2) Incidates coordin...
the_stack_v2_python_sparse
src/yass/evaluate/visualization.py
ShenghaoWu/yass
train
0
30eb5b8c042fe27066734500d1d3addd4493068f
[ "self.data = data\nself.ivar = ivar\nself.chisq = chisq\nself.header = header\nself.reads = reads\nself.flags = flags\nself.filename = filename\nself.extraheader = extraheader\nself.instrument_name = instrument_name\nif data is None and filename != '':\n self.load(filename)", "try:\n self.filename = filenam...
<|body_start_0|> self.data = data self.ivar = ivar self.chisq = chisq self.header = header self.reads = reads self.flags = flags self.filename = filename self.extraheader = extraheader self.instrument_name = instrument_name if data is None ...
Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribute references: self.data (default None) self.ivar (default None) self.hea...
Image
[ "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Image: """Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribute references: self.data (default None) ...
stack_v2_sparse_classes_36k_train_001122
5,996
permissive
[ { "docstring": "Image initialization Parameters ---------- filename: string Name of input file data: ndarray Numpy ndarray containing your data. Can be multi-dimensional. ivar: ndarray Numpy ndarray containing the inverse variance of the data. Should be same shape as data chisq: ndarray Numpy ndarray containing...
3
stack_v2_sparse_classes_30k_train_018086
Implement the Python class `Image` described below. Class description: Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribut...
Implement the Python class `Image` described below. Class description: Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribut...
88291d4442eac281b522d234663a611782ad2ac0
<|skeleton|> class Image: """Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribute references: self.data (default None) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Image: """Image is the basic class for raw and partially reduced CHARIS data. It must have at least the following boolean attribute references: self.destriped (default False) self.flatfielded (default False) It must have at least the following other attribute references: self.data (default None) self.ivar (de...
the_stack_v2_python_sparse
charis/image/image.py
PrincetonUniversity/charis-dep
train
3
0ace9bc249852ff43b0098c6a99601c2b23c5632
[ "with mute_signals(post_save):\n profile = ProfileFactory.create(agreed_to_terms_of_service=agreed_to_terms_of_service, filled_out=filled_out)\n profile.user.social_auth.create(provider=EdxOrgOAuth2.name, uid='{}_edx'.format(profile.user.username))\nself.client.force_login(profile.user)", "self.create_user_...
<|body_start_0|> with mute_signals(post_save): profile = ProfileFactory.create(agreed_to_terms_of_service=agreed_to_terms_of_service, filled_out=filled_out) profile.user.social_auth.create(provider=EdxOrgOAuth2.name, uid='{}_edx'.format(profile.user.username)) self.client.force_l...
Decorator tests for UI views
DecoratorTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoratorTests: """Decorator tests for UI views""" def create_user_and_login(self, agreed_to_terms_of_service, filled_out): """Create a user and social auth, and login that user""" <|body_0|> def test_redirect_profile(self): """If user has not completed the profi...
stack_v2_sparse_classes_36k_train_001123
2,002
permissive
[ { "docstring": "Create a user and social auth, and login that user", "name": "create_user_and_login", "signature": "def create_user_and_login(self, agreed_to_terms_of_service, filled_out)" }, { "docstring": "If user has not completed the profile, they should be redirected to the profile", "n...
4
stack_v2_sparse_classes_30k_train_013523
Implement the Python class `DecoratorTests` described below. Class description: Decorator tests for UI views Method signatures and docstrings: - def create_user_and_login(self, agreed_to_terms_of_service, filled_out): Create a user and social auth, and login that user - def test_redirect_profile(self): If user has no...
Implement the Python class `DecoratorTests` described below. Class description: Decorator tests for UI views Method signatures and docstrings: - def create_user_and_login(self, agreed_to_terms_of_service, filled_out): Create a user and social auth, and login that user - def test_redirect_profile(self): If user has no...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class DecoratorTests: """Decorator tests for UI views""" def create_user_and_login(self, agreed_to_terms_of_service, filled_out): """Create a user and social auth, and login that user""" <|body_0|> def test_redirect_profile(self): """If user has not completed the profi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoratorTests: """Decorator tests for UI views""" def create_user_and_login(self, agreed_to_terms_of_service, filled_out): """Create a user and social auth, and login that user""" with mute_signals(post_save): profile = ProfileFactory.create(agreed_to_terms_of_service=agreed_...
the_stack_v2_python_sparse
ui/decorators_test.py
mitodl/micromasters
train
35
4dc8b4ffd74e7820e31c62b863b4d643876ba8f5
[ "assert curFormat in ('symbol', 'standard')\nself._curFormat = curFormat\nself.curCode = curCode\nself.srcLang = NAME_YAPPN_MAPPINGS[sourceLang]\nself.tgtLang = NAME_YAPPN_MAPPINGS[targetLang]\nself.srcLocale = sourceLocale if sourceLocale else re.sub('-', '_', CULTURE_CODES[sourceLang][0])\nself.tgtLocale = target...
<|body_start_0|> assert curFormat in ('symbol', 'standard') self._curFormat = curFormat self.curCode = curCode self.srcLang = NAME_YAPPN_MAPPINGS[sourceLang] self.tgtLang = NAME_YAPPN_MAPPINGS[targetLang] self.srcLocale = sourceLocale if sourceLocale else re.sub('-', '_',...
Rule-based currency translation
CurrencyTranslator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrencyTranslator: """Rule-based currency translation""" def __init__(self, curFormat, curCode, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): """Initialize a CurrencyTranslator instance Args: curFormat (str): currency symbol format 'symbol' (symbol-only, e.g....
stack_v2_sparse_classes_36k_train_001124
21,856
no_license
[ { "docstring": "Initialize a CurrencyTranslator instance Args: curFormat (str): currency symbol format 'symbol' (symbol-only, e.g., '$') or 'standard' (the one used by babel, e.g., '$US') curCode (str): currency code, e.g., 'USD' sourceLang (str): source language in full spelling, e.g., 'English' ignored if sou...
3
stack_v2_sparse_classes_30k_train_016336
Implement the Python class `CurrencyTranslator` described below. Class description: Rule-based currency translation Method signatures and docstrings: - def __init__(self, curFormat, curCode, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): Initialize a CurrencyTranslator instance Args: curFormat ...
Implement the Python class `CurrencyTranslator` described below. Class description: Rule-based currency translation Method signatures and docstrings: - def __init__(self, curFormat, curCode, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): Initialize a CurrencyTranslator instance Args: curFormat ...
3db60d54f076ea26d45cdbbe194d1cd357f8f1a3
<|skeleton|> class CurrencyTranslator: """Rule-based currency translation""" def __init__(self, curFormat, curCode, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): """Initialize a CurrencyTranslator instance Args: curFormat (str): currency symbol format 'symbol' (symbol-only, e.g....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrencyTranslator: """Rule-based currency translation""" def __init__(self, curFormat, curCode, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): """Initialize a CurrencyTranslator instance Args: curFormat (str): currency symbol format 'symbol' (symbol-only, e.g., '$') or 'st...
the_stack_v2_python_sparse
tb_utils/rules.py
EthannyDing/text_mining
train
0
b04d9d170e5c1ee1f827d38578b7bea9ec5443b1
[ "options = super()._default_options()\noptions.plotter.set_figure_options(xlabel='Delay', ylabel='P(1)', xval_unit='s')\noptions.result_parameters = [curve.ParameterRepr('freq', 'Frequency', 'Hz'), curve.ParameterRepr('tau', 'T2star', 's')]\nreturn options", "amp = fit_data.ufloat_params['amp']\ntau = fit_data.uf...
<|body_start_0|> options = super()._default_options() options.plotter.set_figure_options(xlabel='Delay', ylabel='P(1)', xval_unit='s') options.result_parameters = [curve.ParameterRepr('freq', 'Frequency', 'Hz'), curve.ParameterRepr('tau', 'T2star', 's')] return options <|end_body_0|> <|...
T2 Ramsey result analysis class.
T2RamseyAnalysis
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class T2RamseyAnalysis: """T2 Ramsey result analysis class.""" def _default_options(cls) -> Options: """Default analysis options.""" <|body_0|> def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: """Algorithmic criteria for whether the fit ...
stack_v2_sparse_classes_36k_train_001125
2,121
permissive
[ { "docstring": "Default analysis options.", "name": "_default_options", "signature": "def _default_options(cls) -> Options" }, { "docstring": "Algorithmic criteria for whether the fit is good or bad. A good fit has: - a reduced chi-squared lower than three - relative error of amp is less than 10...
2
null
Implement the Python class `T2RamseyAnalysis` described below. Class description: T2 Ramsey result analysis class. Method signatures and docstrings: - def _default_options(cls) -> Options: Default analysis options. - def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: Algorithmic criteria...
Implement the Python class `T2RamseyAnalysis` described below. Class description: T2 Ramsey result analysis class. Method signatures and docstrings: - def _default_options(cls) -> Options: Default analysis options. - def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: Algorithmic criteria...
a387675a3fe817cef05b968bbf3e05799a09aaae
<|skeleton|> class T2RamseyAnalysis: """T2 Ramsey result analysis class.""" def _default_options(cls) -> Options: """Default analysis options.""" <|body_0|> def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: """Algorithmic criteria for whether the fit ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class T2RamseyAnalysis: """T2 Ramsey result analysis class.""" def _default_options(cls) -> Options: """Default analysis options.""" options = super()._default_options() options.plotter.set_figure_options(xlabel='Delay', ylabel='P(1)', xval_unit='s') options.result_parameters = ...
the_stack_v2_python_sparse
qiskit_experiments/library/characterization/analysis/t2ramsey_analysis.py
oliverdial/qiskit-experiments
train
0
4053afefd7fe3d5dff3809953325abe09ddcc7d7
[ "self.sender = 'kkpatil007@gmail.com'\nself.receiver = ['krishnatpatil@yahoo.co.in']\nself.cc = None\nself.subject = None\nself.body = None\nself.attachment = None\nself._handleArgs(**args)", "for attribute in (loopAttribute for loopAttribute in self.__dict__.keys() if loopAttribute in args):\n setattr(self, a...
<|body_start_0|> self.sender = 'kkpatil007@gmail.com' self.receiver = ['krishnatpatil@yahoo.co.in'] self.cc = None self.subject = None self.body = None self.attachment = None self._handleArgs(**args) <|end_body_0|> <|body_start_1|> for attribute in (loopA...
Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send()
Email
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Email: """Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send()""" def __init__(self, **args): ...
stack_v2_sparse_classes_36k_train_001126
5,514
no_license
[ { "docstring": "Constructor method to instantiate the class with required parameters Required Parameters: subject: string, subject of the mail body: string, body of the mail. Could be text or html format Optional Parameters: sender: string, FROM address. Default is \"kkpatil007@gmail.com\" receiver: list, TO ad...
3
stack_v2_sparse_classes_30k_train_018489
Implement the Python class `Email` described below. Class description: Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send() Me...
Implement the Python class `Email` described below. Class description: Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send() Me...
e84ba5e1ac4bd0adaf3217a4b9a0fade40601810
<|skeleton|> class Email: """Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send()""" def __init__(self, **args): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Email: """Class to send the mail notifications using SMTP Usage: mail = Email( sender="kkpatil007@gmail.com", receiver=["krishnatpatil@yahoo.co.in"], cc=["testmail@example.com"], subject="Testing", body="Test mail", attachment=["data.csv"], ) mail.send()""" def __init__(self, **args): """Construc...
the_stack_v2_python_sparse
utils/Email.py
krishnatpatil/python-practice
train
0
b443b2586272040e2af9499257ba87b381b92745
[ "if st == ed:\n if base == limit:\n ref = tmp[:]\n lst.append(ref)\n return\nfor i in xrange(step + 1, 10):\n tmp.append(i)\n self.CS(st + 1, ed, lst, tmp, base + i, i, limit)\n tmp.pop()", "res, tmp = ([], [])\nself.CS(0, k, res, tmp, 0, 0, n)\nreturn res" ]
<|body_start_0|> if st == ed: if base == limit: ref = tmp[:] lst.append(ref) return for i in xrange(step + 1, 10): tmp.append(i) self.CS(st + 1, ed, lst, tmp, base + i, i, limit) tmp.pop() <|end_body_0|> <|body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def CS(self, st, ed, lst, tmp, base, step, limit): """st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制""" <|body_0|> def combinationSum3(self, k, n): """:type k: int :type n: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_001127
1,178
no_license
[ { "docstring": "st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制", "name": "CS", "signature": "def CS(self, st, ed, lst, tmp, base, step, limit)" }, { "docstring": ":type k: int :type n: int :rtype: List[List[int]]", "name": "combinationSum3", "signature": "def combinationSum3(self, k, n)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, st, ed, lst, tmp, base, step, limit): st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制 - def combinationSum3(self, k, n): :type k: int :type n: int :rtype: List[List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, st, ed, lst, tmp, base, step, limit): st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制 - def combinationSum3(self, k, n): :type k: int :type n: int :rtype: List[List[in...
507ed2efeff7818ca9cf53a8ee7fb80d3c530d67
<|skeleton|> class Solution: def CS(self, st, ed, lst, tmp, base, step, limit): """st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制""" <|body_0|> def combinationSum3(self, k, n): """:type k: int :type n: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def CS(self, st, ed, lst, tmp, base, step, limit): """st和ed表示对k的控制,base和limit表示n的控制 step来表示不超过10的限制""" if st == ed: if base == limit: ref = tmp[:] lst.append(ref) return for i in xrange(step + 1, 10): tmp.app...
the_stack_v2_python_sparse
Leetcode/Backtracking/#216-Combination Sum III/main.py
qizongjun/Algorithms-1
train
0
4bb5d0302c5a3977946273389a5c0c6c749ebb3f
[ "super().__init__()\nself._mappers = mappers\nself._consumer = consumer", "for mapper in self._mappers:\n LOG.debug('Calling mapper (%s) for event (%s)', mapper, event)\n event = mapper.map(event)\nLOG.debug('Calling consumer (%s) for event (%s)', self._consumer, event)\nself._consumer.consume(event)" ]
<|body_start_0|> super().__init__() self._mappers = mappers self._consumer = consumer <|end_body_0|> <|body_start_1|> for mapper in self._mappers: LOG.debug('Calling mapper (%s) for event (%s)', mapper, event) event = mapper.map(event) LOG.debug('Calling ...
A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer
ObservabilityEventConsumerDecorator
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __in...
stack_v2_sparse_classes_36k_train_001128
8,249
permissive
[ { "docstring": "Parameters ---------- mappers : List[ObservabilityEventMapper] List of event mappers which will be used to process events before passing to consumer consumer : ObservabilityEventConsumer Actual consumer which will handle the events after they are processed by mappers", "name": "__init__", ...
2
null
Implement the Python class `ObservabilityEventConsumerDecorator` described below. Class description: A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass t...
Implement the Python class `ObservabilityEventConsumerDecorator` described below. Class description: A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass t...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __init__(self, ma...
the_stack_v2_python_sparse
samcli/lib/observability/observability_info_puller.py
aws/aws-sam-cli
train
1,402
8bc423d8ce82dc3317bd8d4aa6d2354557258dfa
[ "names = []\nshapes = []\nori_shapes = []\nformats = []\nori_formats = []\nfor k, v in op_inputs.items():\n if v.get('value') is not None:\n continue\n names.append(k)\n shapes.append(v['shape'])\n ori_shapes.append(v['ori_shape'] if v.get('ori_shape') else None)\n formats.append(v['format'])\...
<|body_start_0|> names = [] shapes = [] ori_shapes = [] formats = [] ori_formats = [] for k, v in op_inputs.items(): if v.get('value') is not None: continue names.append(k) shapes.append(v['shape']) ori_shape...
TransShape
TransShape
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransShape: """TransShape""" def trans_elemwise_shape(cls, op_inputs, inputs): """deal with elemwise shape.""" <|body_0|> def trans_batch_matmul_shape(cls, op_inputs, inputs): """deal with batch_matmul.""" <|body_1|> def run(cls, op_name, pattern, op...
stack_v2_sparse_classes_36k_train_001129
20,603
permissive
[ { "docstring": "deal with elemwise shape.", "name": "trans_elemwise_shape", "signature": "def trans_elemwise_shape(cls, op_inputs, inputs)" }, { "docstring": "deal with batch_matmul.", "name": "trans_batch_matmul_shape", "signature": "def trans_batch_matmul_shape(cls, op_inputs, inputs)"...
3
null
Implement the Python class `TransShape` described below. Class description: TransShape Method signatures and docstrings: - def trans_elemwise_shape(cls, op_inputs, inputs): deal with elemwise shape. - def trans_batch_matmul_shape(cls, op_inputs, inputs): deal with batch_matmul. - def run(cls, op_name, pattern, op_inp...
Implement the Python class `TransShape` described below. Class description: TransShape Method signatures and docstrings: - def trans_elemwise_shape(cls, op_inputs, inputs): deal with elemwise shape. - def trans_batch_matmul_shape(cls, op_inputs, inputs): deal with batch_matmul. - def run(cls, op_name, pattern, op_inp...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class TransShape: """TransShape""" def trans_elemwise_shape(cls, op_inputs, inputs): """deal with elemwise shape.""" <|body_0|> def trans_batch_matmul_shape(cls, op_inputs, inputs): """deal with batch_matmul.""" <|body_1|> def run(cls, op_name, pattern, op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransShape: """TransShape""" def trans_elemwise_shape(cls, op_inputs, inputs): """deal with elemwise shape.""" names = [] shapes = [] ori_shapes = [] formats = [] ori_formats = [] for k, v in op_inputs.items(): if v.get('value') is not N...
the_stack_v2_python_sparse
mindspore/python/mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py
mindspore-ai/mindspore
train
4,178
e223b7720b40dbf89be1618c31a14fd44756d6d2
[ "cls.tool = feature(name, feature('name', sub=True), feature('version', sub=True))\nfor k, v in dict.items():\n if isinstance(v, action):\n v._cls = cls\n v.name = k", "a = type.__getattribute__(cls, name)\nif isinstance(a, action) and a._cls is not cls:\n a = deepcopy(a)\n a._cls = cls\nre...
<|body_start_0|> cls.tool = feature(name, feature('name', sub=True), feature('version', sub=True)) for k, v in dict.items(): if isinstance(v, action): v._cls = cls v.name = k <|end_body_0|> <|body_start_1|> a = type.__getattribute__(cls, name) ...
tool_type
[ "BSL-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tool_type: def __init__(cls, name, bases, dict): """For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. This provides a means to look up virtual overloads. For example, if a rule refers to 'compiler.link',...
stack_v2_sparse_classes_36k_train_001130
6,408
permissive
[ { "docstring": "For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. This provides a means to look up virtual overloads. For example, if a rule refers to 'compiler.link', and the build is invoked with 'compiler=gcc', we can substi...
2
stack_v2_sparse_classes_30k_train_012190
Implement the Python class `tool_type` described below. Class description: Implement the tool_type class. Method signatures and docstrings: - def __init__(cls, name, bases, dict): For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. Thi...
Implement the Python class `tool_type` described below. Class description: Implement the tool_type class. Method signatures and docstrings: - def __init__(cls, name, bases, dict): For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. Thi...
0f369a8a9e4de305e5379d9662b2e79bffd43910
<|skeleton|> class tool_type: def __init__(cls, name, bases, dict): """For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. This provides a means to look up virtual overloads. For example, if a rule refers to 'compiler.link',...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tool_type: def __init__(cls, name, bases, dict): """For any attribute of type 'action', set the action's name to the attribute name. Further, set the action's 'tool' attribute to be cls. This provides a means to look up virtual overloads. For example, if a rule refers to 'compiler.link', and the build...
the_stack_v2_python_sparse
src/faber/tool.py
stefanseefeld/faber
train
15
9b61f04626982c0cdaf9b9f7d3730ff0db2ef790
[ "args = self._pop_args(args, arglist='name')\nrss, res = _getRSS(name, **args)\nself.update_results(res)\nif rss:\n try:\n nsa_data = rss.nsa\n except (MarvinError, BrainError):\n nsa_data = None\n wavelength = rss._wavelength.tolist() if isinstance(rss._wavelength, numpy.ndarray) else rss._w...
<|body_start_0|> args = self._pop_args(args, arglist='name') rss, res = _getRSS(name, **args) self.update_results(res) if rss: try: nsa_data = rss.nsa except (MarvinError, BrainError): nsa_data = None wavelength = rss._w...
Class describing API calls related to RSS files.
RSSView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RSSView: """Class describing API calls related to RSS files.""" def get(self, args, name): """This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name: The name of the cube as plate-ifu or mangaid :form rele...
stack_v2_sparse_classes_36k_train_001131
7,790
permissive
[ { "docstring": "This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name: The name of the cube as plate-ifu or mangaid :form release: the release of MaNGA :resjson int status: status of response. 1 if good, -1 if bad. :resjson string e...
2
null
Implement the Python class `RSSView` described below. Class description: Class describing API calls related to RSS files. Method signatures and docstrings: - def get(self, args, name): This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name...
Implement the Python class `RSSView` described below. Class description: Class describing API calls related to RSS files. Method signatures and docstrings: - def get(self, args, name): This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name...
db4c536a65fb2f16fee05a4f34996a7fd35f0527
<|skeleton|> class RSSView: """Class describing API calls related to RSS files.""" def get(self, args, name): """This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name: The name of the cube as plate-ifu or mangaid :form rele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RSSView: """Class describing API calls related to RSS files.""" def get(self, args, name): """This method performs a get request at the url route /rss/<id>. .. :quickref: RSS; Get an RSS given a plate-ifu or mangaid :param name: The name of the cube as plate-ifu or mangaid :form release: the rele...
the_stack_v2_python_sparse
python/marvin/api/rss.py
sdss/marvin
train
56
df292b649fb33d2812388ad9a3634022996c8cf6
[ "try:\n validate_email(value)\n return True\nexcept ValidationError:\n return False", "row_chunks = slice_iterable_into_chunks(rows, self.consent_page_size)\nfor chunk in row_chunks:\n '\\n Loop over the chunks and extract the email and item.\\n Save the item because the iterator...
<|body_start_0|> try: validate_email(value) return True except ValidationError: return False <|end_body_0|> <|body_start_1|> row_chunks = slice_iterable_into_chunks(rows, self.consent_page_size) for chunk in row_chunks: '\n Loop...
Company search export view.
SearchContactExportAPIView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" <|body_0|> def _add_consent_response(self, rows): """Transforms iterable to add user consent from the con...
stack_v2_sparse_classes_36k_train_001132
6,797
permissive
[ { "docstring": "Validate if emails are valid and return a boolean flag.", "name": "_is_valid_email", "signature": "def _is_valid_email(self, value)" }, { "docstring": "Transforms iterable to add user consent from the consent service. The consent lookup makes an external API call to return consen...
3
stack_v2_sparse_classes_30k_train_002917
Implement the Python class `SearchContactExportAPIView` described below. Class description: Company search export view. Method signatures and docstrings: - def _is_valid_email(self, value): Validate if emails are valid and return a boolean flag. - def _add_consent_response(self, rows): Transforms iterable to add user...
Implement the Python class `SearchContactExportAPIView` described below. Class description: Company search export view. Method signatures and docstrings: - def _is_valid_email(self, value): Validate if emails are valid and return a boolean flag. - def _add_consent_response(self, rows): Transforms iterable to add user...
a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e
<|skeleton|> class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" <|body_0|> def _add_consent_response(self, rows): """Transforms iterable to add user consent from the con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchContactExportAPIView: """Company search export view.""" def _is_valid_email(self, value): """Validate if emails are valid and return a boolean flag.""" try: validate_email(value) return True except ValidationError: return False def _a...
the_stack_v2_python_sparse
datahub/search/contact/views.py
cgsunkel/data-hub-api
train
0
928c6b1f1e122434f5153a4d129e31ccf950378e
[ "sLength, pLength = (len(s), len(p))\nmatrix = [[False] * (pLength + 1) for i in range(sLength + 1)]\nmatrix[0][0] = True\nfor i in range(sLength + 1):\n for j in range(1, pLength + 1):\n matrix[i][j] = matrix[i - 1][j] or matrix[i][j - 1] if p[j - 1] == '*' else i > 0 and p[j - 1] in {s[i - 1], '?'} and ...
<|body_start_0|> sLength, pLength = (len(s), len(p)) matrix = [[False] * (pLength + 1) for i in range(sLength + 1)] matrix[0][0] = True for i in range(sLength + 1): for j in range(1, pLength + 1): matrix[i][j] = matrix[i - 1][j] or matrix[i][j - 1] if p[j - 1]...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> def isMatch3(self, s, p): """:type s: str :type p: str :rtype: bool""" ...
stack_v2_sparse_classes_36k_train_001133
1,977
permissive
[ { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch", "signature": "def isMatch(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch2", "signature": "def isMatch2(self, s, p)" }, { "docstring": ":type s: str :type p: str ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch3(self, s, p): :type s: str :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch3(self, s, p): :type s: str :type ...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> def isMatch3(self, s, p): """:type s: str :type p: str :rtype: bool""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" sLength, pLength = (len(s), len(p)) matrix = [[False] * (pLength + 1) for i in range(sLength + 1)] matrix[0][0] = True for i in range(sLength + 1): for j in range(1, pLength + 1)...
the_stack_v2_python_sparse
1-100/41-50/44-wildcardMatching/wildcardMatching-bottom.py
xuychen/Leetcode
train
0
c16378c38ec86ab0bb70d074048909469e1fa717
[ "kwargs = {}\nkwargs.setdefault('method', 'POST')\nkwargs.setdefault('url', '/ime-container/imeQualityCheckOrder/refCreate.action')\nkwargs.setdefault('data', data)\nreq = nr(**kwargs)\nreturn req", "kwargs = {}\nkwargs.setdefault('method', 'POST')\nkwargs.setdefault('url', '/ime-container/imeQualityCheckOrder/ad...
<|body_start_0|> kwargs = {} kwargs.setdefault('method', 'POST') kwargs.setdefault('url', '/ime-container/imeQualityCheckOrder/refCreate.action') kwargs.setdefault('data', data) req = nr(**kwargs) return req <|end_body_0|> <|body_start_1|> kwargs = {} kwa...
质检工单类
QualityWorkOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QualityWorkOrder: """质检工单类""" def qualityWorkOrder_ref(self, data): """质检工单参照生成""" <|body_0|> def qualityWorkOrder_create(self, data): """质检工单直接创建""" <|body_1|> def qualityWorkOrder_delete(self, data): """质检工单删除""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_001134
2,630
no_license
[ { "docstring": "质检工单参照生成", "name": "qualityWorkOrder_ref", "signature": "def qualityWorkOrder_ref(self, data)" }, { "docstring": "质检工单直接创建", "name": "qualityWorkOrder_create", "signature": "def qualityWorkOrder_create(self, data)" }, { "docstring": "质检工单删除", "name": "qualityW...
5
null
Implement the Python class `QualityWorkOrder` described below. Class description: 质检工单类 Method signatures and docstrings: - def qualityWorkOrder_ref(self, data): 质检工单参照生成 - def qualityWorkOrder_create(self, data): 质检工单直接创建 - def qualityWorkOrder_delete(self, data): 质检工单删除 - def qualityWorkOrder_rule(self, data): 质检工单...
Implement the Python class `QualityWorkOrder` described below. Class description: 质检工单类 Method signatures and docstrings: - def qualityWorkOrder_ref(self, data): 质检工单参照生成 - def qualityWorkOrder_create(self, data): 质检工单直接创建 - def qualityWorkOrder_delete(self, data): 质检工单删除 - def qualityWorkOrder_rule(self, data): 质检工单...
2c3b0f5667c9526130a57c5ce2f0865e8f97302f
<|skeleton|> class QualityWorkOrder: """质检工单类""" def qualityWorkOrder_ref(self, data): """质检工单参照生成""" <|body_0|> def qualityWorkOrder_create(self, data): """质检工单直接创建""" <|body_1|> def qualityWorkOrder_delete(self, data): """质检工单删除""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QualityWorkOrder: """质检工单类""" def qualityWorkOrder_ref(self, data): """质检工单参照生成""" kwargs = {} kwargs.setdefault('method', 'POST') kwargs.setdefault('url', '/ime-container/imeQualityCheckOrder/refCreate.action') kwargs.setdefault('data', data) req = nr(**kw...
the_stack_v2_python_sparse
测试用例/接口自动化/接口自动化_V2/接口管理/质量管理/质检工单.py
liuzhengxing/NeuSoftEEP_API_Test
train
0
19823ae82390e2d9123df87592f349b979b727e1
[ "if len(seed_bytes) != CardanoByronLegacyMstKeyGeneratorConst.SEED_BYTE_LEN:\n raise ValueError(f'Invalid seed length ({len(seed_bytes)})')\nreturn cls.__HashRepeatedly(cbor2.dumps(seed_bytes), 1)", "il_bytes, ir_bytes = HmacSha512.QuickDigestHalves(data_bytes, CardanoByronLegacyMstKeyGeneratorConst.HMAC_MESSA...
<|body_start_0|> if len(seed_bytes) != CardanoByronLegacyMstKeyGeneratorConst.SEED_BYTE_LEN: raise ValueError(f'Invalid seed length ({len(seed_bytes)})') return cls.__HashRepeatedly(cbor2.dumps(seed_bytes), 1) <|end_body_0|> <|body_start_1|> il_bytes, ir_bytes = HmacSha512.QuickDige...
Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).
CardanoByronLegacyMstKeyGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a mast...
stack_v2_sparse_classes_36k_train_001135
4,310
permissive
[ { "docstring": "Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed bytes Returns: tuple[bytes, bytes]: Private key bytes (index 0) and chain code bytes (index 1) Raises: Bip32KeyError: If the seed is not suitable for master key generation ValueError: If seed length is not valid", ...
3
stack_v2_sparse_classes_30k_train_000069
Implement the Python class `CardanoByronLegacyMstKeyGenerator` described below. Class description: Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus). Method signatures and docstrings: - def GenerateFromSeed(cls, s...
Implement the Python class `CardanoByronLegacyMstKeyGenerator` described below. Class description: Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus). Method signatures and docstrings: - def GenerateFromSeed(cls, s...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a mast...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a master key from t...
the_stack_v2_python_sparse
bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py
ebellocchia/bip_utils
train
244
4d1f40cce896d340b025fef42b2d10fb28008d23
[ "self.atom_groups: Dict[str, AtomGroup] = atom_groups or {}\nself.start_time: float = start_time\nself.stop_time: Optional[float] = stop_time", "try:\n _ = [self.atom_groups[group_name] for group_name in group_names]\n return None\nexcept KeyError as key_error:\n print('Some atom groups could not be fetc...
<|body_start_0|> self.atom_groups: Dict[str, AtomGroup] = atom_groups or {} self.start_time: float = start_time self.stop_time: Optional[float] = stop_time <|end_body_0|> <|body_start_1|> try: _ = [self.atom_groups[group_name] for group_name in group_names] retur...
Base class with input parameters shared by most (if not all) analysis.
BaseInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseInput: """Base class with input parameters shared by most (if not all) analysis.""" def __init__(self, atom_groups: Optional[Dict[str, AtomGroup]]=None, start_time: float=0, stop_time: Optional[float]=None) -> None: """Initializer Args: atom_groups (Dict[str, AtomGroup]): Diction...
stack_v2_sparse_classes_36k_train_001136
3,975
no_license
[ { "docstring": "Initializer Args: atom_groups (Dict[str, AtomGroup]): Dictionary with the reference/target groups label and the corresponding atom group. start_ps (float): Time in ps where to start analyzing the trajectory. stop_ps (Optional[float]): _description_ Time in ps where to end analyzing the trajector...
3
stack_v2_sparse_classes_30k_train_005881
Implement the Python class `BaseInput` described below. Class description: Base class with input parameters shared by most (if not all) analysis. Method signatures and docstrings: - def __init__(self, atom_groups: Optional[Dict[str, AtomGroup]]=None, start_time: float=0, stop_time: Optional[float]=None) -> None: Init...
Implement the Python class `BaseInput` described below. Class description: Base class with input parameters shared by most (if not all) analysis. Method signatures and docstrings: - def __init__(self, atom_groups: Optional[Dict[str, AtomGroup]]=None, start_time: float=0, stop_time: Optional[float]=None) -> None: Init...
c7ff9753673710a5da2b915c509587d46ca59afb
<|skeleton|> class BaseInput: """Base class with input parameters shared by most (if not all) analysis.""" def __init__(self, atom_groups: Optional[Dict[str, AtomGroup]]=None, start_time: float=0, stop_time: Optional[float]=None) -> None: """Initializer Args: atom_groups (Dict[str, AtomGroup]): Diction...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseInput: """Base class with input parameters shared by most (if not all) analysis.""" def __init__(self, atom_groups: Optional[Dict[str, AtomGroup]]=None, start_time: float=0, stop_time: Optional[float]=None) -> None: """Initializer Args: atom_groups (Dict[str, AtomGroup]): Dictionary with the ...
the_stack_v2_python_sparse
AuPt/aupt/src/aupt/base_io.py
cebasfu93/MD_Analysis
train
0
8204fc10a328b7ce0f6f9f2bac8f8e9613600673
[ "settings = {}\nrset = list(System.objects.filter(category='RABBITMQ').values('config_id', 'value'))\nfor r in rset:\n if r['config_id'] == 'MQ_USER_ID':\n settings['userid'] = r['value']\n if r['config_id'] == 'MQ_PASSWORD':\n settings['password'] = cipher.decrypt(r['value'])\n if r['config_...
<|body_start_0|> settings = {} rset = list(System.objects.filter(category='RABBITMQ').values('config_id', 'value')) for r in rset: if r['config_id'] == 'MQ_USER_ID': settings['userid'] = r['value'] if r['config_id'] == 'MQ_PASSWORD': settin...
RabbitMQ
[ "Apache-2.0", "BSD-3-Clause", "LGPL-3.0-only", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RabbitMQ: def settings(cls): """[概要] RabbitMQ設定情報読み込みメソッド""" <|body_0|> def connect(cls, settings): """[概要] RabbitMQ接続メソッド""" <|body_1|> <|end_skeleton|> <|body_start_0|> settings = {} rset = list(System.objects.filter(category='RABBITMQ').v...
stack_v2_sparse_classes_36k_train_001137
2,149
permissive
[ { "docstring": "[概要] RabbitMQ設定情報読み込みメソッド", "name": "settings", "signature": "def settings(cls)" }, { "docstring": "[概要] RabbitMQ接続メソッド", "name": "connect", "signature": "def connect(cls, settings)" } ]
2
null
Implement the Python class `RabbitMQ` described below. Class description: Implement the RabbitMQ class. Method signatures and docstrings: - def settings(cls): [概要] RabbitMQ設定情報読み込みメソッド - def connect(cls, settings): [概要] RabbitMQ接続メソッド
Implement the Python class `RabbitMQ` described below. Class description: Implement the RabbitMQ class. Method signatures and docstrings: - def settings(cls): [概要] RabbitMQ設定情報読み込みメソッド - def connect(cls, settings): [概要] RabbitMQ接続メソッド <|skeleton|> class RabbitMQ: def settings(cls): """[概要] RabbitMQ設定情報読...
c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94
<|skeleton|> class RabbitMQ: def settings(cls): """[概要] RabbitMQ設定情報読み込みメソッド""" <|body_0|> def connect(cls, settings): """[概要] RabbitMQ接続メソッド""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RabbitMQ: def settings(cls): """[概要] RabbitMQ設定情報読み込みメソッド""" settings = {} rset = list(System.objects.filter(category='RABBITMQ').values('config_id', 'value')) for r in rset: if r['config_id'] == 'MQ_USER_ID': settings['userid'] = r['value'] ...
the_stack_v2_python_sparse
oase-root/libs/commonlibs/rabbitmq.py
exastro-suite/oase
train
10
446292bcd4ee644a095f96e2316ab92f3862aabd
[ "super(ESRCodec, self).__init__(search_space, **kwargs)\nself.func_type, self.func_prob = self.get_choices()\nself.param_block = self.get_para_block()\nself.flops_block = self.get_flops_block()\nself.func_type_num = len(self.func_type)", "model_type = self.search_space['modules'][0]\nblock_types = self.search_spa...
<|body_start_0|> super(ESRCodec, self).__init__(search_space, **kwargs) self.func_type, self.func_prob = self.get_choices() self.param_block = self.get_para_block() self.flops_block = self.get_flops_block() self.func_type_num = len(self.func_type) <|end_body_0|> <|body_start_1|>...
Codec of the MtMSR search space.
ESRCodec
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESRCodec: """Codec of the MtMSR search space.""" def __init__(self, search_space=None, **kwargs): """Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means tha...
stack_v2_sparse_classes_36k_train_001138
5,591
permissive
[ { "docstring": "Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary \"S_\" means that the shrink RDB (SRDB). \"G_\" means that the group RDB (GRDB). \"C_\" means that the contextual RDB (CRDB). f...
5
stack_v2_sparse_classes_30k_train_011548
Implement the Python class `ESRCodec` described below. Class description: Codec of the MtMSR search space. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space o...
Implement the Python class `ESRCodec` described below. Class description: Codec of the MtMSR search space. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space o...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class ESRCodec: """Codec of the MtMSR search space.""" def __init__(self, search_space=None, **kwargs): """Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ESRCodec: """Codec of the MtMSR search space.""" def __init__(self, search_space=None, **kwargs): """Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means that the shrink ...
the_stack_v2_python_sparse
built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/esr_ea/esr_ea_codec.py
Huawei-Ascend/modelzoo
train
1
d728af8f917c2998061704a760563328a38239ed
[ "self.count = {}\nself.queue = collections.deque()\nfor num in nums:\n self.add(num)", "for num in self.queue:\n if self.count[num] == 1:\n return num\nreturn -1", "if value not in self.count:\n self.count[value] = 1\n self.queue.append(value)\nelse:\n self.count[value] += 1" ]
<|body_start_0|> self.count = {} self.queue = collections.deque() for num in nums: self.add(num) <|end_body_0|> <|body_start_1|> for num in self.queue: if self.count[num] == 1: return num return -1 <|end_body_1|> <|body_start_2|> ...
FirstUnique
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirstUnique: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def showFirstUnique(self): """:rtype: int""" <|body_1|> def add(self, value): """:type value: int :rtype: None""" <|body_2|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_001139
843
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":rtype: int", "name": "showFirstUnique", "signature": "def showFirstUnique(self)" }, { "docstring": ":type value: int :rtype: None", "name": "add", "sign...
3
null
Implement the Python class `FirstUnique` described below. Class description: Implement the FirstUnique class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def showFirstUnique(self): :rtype: int - def add(self, value): :type value: int :rtype: None
Implement the Python class `FirstUnique` described below. Class description: Implement the FirstUnique class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def showFirstUnique(self): :rtype: int - def add(self, value): :type value: int :rtype: None <|skeleton|> class FirstUniq...
474886c5c43a6192db2708e664663542c2e39548
<|skeleton|> class FirstUnique: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def showFirstUnique(self): """:rtype: int""" <|body_1|> def add(self, value): """:type value: int :rtype: None""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FirstUnique: def __init__(self, nums): """:type nums: List[int]""" self.count = {} self.queue = collections.deque() for num in nums: self.add(num) def showFirstUnique(self): """:rtype: int""" for num in self.queue: if self.count[num]...
the_stack_v2_python_sparse
question_leetcode/1429_1.py
paul0920/leetcode
train
1
0d5873f4b945e2863728428765362e97531ae596
[ "from matplotlib import pyplot as plt\nfrom trappy.plot_utils import normalize_title, pre_plot_setup, post_plot_setup\ndfr = self.data_frame\ncurr_temp = dfr['current_temperature']\ncontrol_temp_series = (curr_temp + dfr['delta_temperature']) / 1000\ntitle = normalize_title('Temperature', title)\nsetup_plot = False...
<|body_start_0|> from matplotlib import pyplot as plt from trappy.plot_utils import normalize_title, pre_plot_setup, post_plot_setup dfr = self.data_frame curr_temp = dfr['current_temperature'] control_temp_series = (curr_temp + dfr['delta_temperature']) / 1000 title = no...
Process the power allocator data in a ftrace dump
ThermalGovernor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThermalGovernor: """Process the power allocator data in a ftrace dump""" def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label=''): """Plot the temperature""" <|body_0|> def plot_input_power(self, actor_order, title='', width=N...
stack_v2_sparse_classes_36k_train_001140
10,363
permissive
[ { "docstring": "Plot the temperature", "name": "plot_temperature", "signature": "def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label='')" }, { "docstring": "Plot input power :param ax: Axis instance :type ax: :mod:`matplotlib.Axis` :param title: The ...
5
null
Implement the Python class `ThermalGovernor` described below. Class description: Process the power allocator data in a ftrace dump Method signatures and docstrings: - def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label=''): Plot the temperature - def plot_input_power(self...
Implement the Python class `ThermalGovernor` described below. Class description: Process the power allocator data in a ftrace dump Method signatures and docstrings: - def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label=''): Plot the temperature - def plot_input_power(self...
bba21c4de5cbe380d375bdf3f5666c7880235287
<|skeleton|> class ThermalGovernor: """Process the power allocator data in a ftrace dump""" def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label=''): """Plot the temperature""" <|body_0|> def plot_input_power(self, actor_order, title='', width=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThermalGovernor: """Process the power allocator data in a ftrace dump""" def plot_temperature(self, title='', width=None, height=None, ylim='range', ax=None, legend_label=''): """Plot the temperature""" from matplotlib import pyplot as plt from trappy.plot_utils import normalize_t...
the_stack_v2_python_sparse
trappy/thermal.py
ARM-software/trappy
train
63
dade8670a6538df136ed6fbb61c6487cf4454292
[ "self.pump = Pump('127.0.0.1', 8000)\nself.sensor = Sensor('127.0.0.1', 8000)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.sensor.measure = MagicMock(return_value=90)\nself.pump.get_state = MagicMock(return_value=Pump.PUMP_OFF)\nself.decider.decide...
<|body_start_0|> self.pump = Pump('127.0.0.1', 8000) self.sensor = Sensor('127.0.0.1', 8000) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.sensor.measure = MagicMock(return_value=90) ...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setUp method for Controller tests""" <|body_0|> def test_tick(self): """Test for the tick function""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pump = Pump('1...
stack_v2_sparse_classes_36k_train_001141
2,522
no_license
[ { "docstring": "setUp method for Controller tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test for the tick function", "name": "test_tick", "signature": "def test_tick(self)" } ]
2
stack_v2_sparse_classes_30k_train_009799
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): setUp method for Controller tests - def test_tick(self): Test for the tick function
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): setUp method for Controller tests - def test_tick(self): Test for the tick function <|skeleton|> class ControllerTests: """Unit tests for the C...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setUp method for Controller tests""" <|body_0|> def test_tick(self): """Test for the tick function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setUp method for Controller tests""" self.pump = Pump('127.0.0.1', 8000) self.sensor = Sensor('127.0.0.1', 8000) self.decider = Decider(100, 0.05) self.controller = Controller(self.senso...
the_stack_v2_python_sparse
students/wwhite/Lesson06/water-regulation/waterregulation/test.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
ed3c19e8a0e20d19710c4849df0b73d38bef42cf
[ "complexes = UnitComplex.objects.all()\nprint(complexes)\nserializer = UnitComplexSerializer(complexes, many=True)\nprint(serializer.data)\nreturn Response(serializer.data, headers={'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': '*'})", "serializer = UnitComplexSerializer(request.data)\nseria...
<|body_start_0|> complexes = UnitComplex.objects.all() print(complexes) serializer = UnitComplexSerializer(complexes, many=True) print(serializer.data) return Response(serializer.data, headers={'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': '*'}) <|end_body_0...
View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view.
ListComplexes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListComplexes: """View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view.""" def get(self, request): """Return a list of all complexes.""" <|body_0|> def post(self, request): """Creates a new complex...
stack_v2_sparse_classes_36k_train_001142
9,992
no_license
[ { "docstring": "Return a list of all complexes.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Creates a new complex.", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_007105
Implement the Python class `ListComplexes` described below. Class description: View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view. Method signatures and docstrings: - def get(self, request): Return a list of all complexes. - def post(self, request): ...
Implement the Python class `ListComplexes` described below. Class description: View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view. Method signatures and docstrings: - def get(self, request): Return a list of all complexes. - def post(self, request): ...
f887d41800541e058b2d350ded6f02759d174815
<|skeleton|> class ListComplexes: """View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view.""" def get(self, request): """Return a list of all complexes.""" <|body_0|> def post(self, request): """Creates a new complex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListComplexes: """View to list all users in the system. * Requires token authentication. * Only admin users are able to access this view.""" def get(self, request): """Return a list of all complexes.""" complexes = UnitComplex.objects.all() print(complexes) serializer = Un...
the_stack_v2_python_sparse
api/govrent/views.py
kamal94/hacka22019
train
0
3ab37eb3e0be6ba9deac4e9ac1ea74142f28ea8c
[ "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...
Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption.
AsymmetricEncryptionCryptoServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsymmetricEncryptionCryptoServiceServicer: """Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption.""" def Decrypt(self, request, context): """Decrypts the given ciphertext with the specified key.""" <|body_0|> def GetPub...
stack_v2_sparse_classes_36k_train_001143
5,874
permissive
[ { "docstring": "Decrypts the given ciphertext with the specified key.", "name": "Decrypt", "signature": "def Decrypt(self, request, context)" }, { "docstring": "Gets value of public key.", "name": "GetPublicKey", "signature": "def GetPublicKey(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_012144
Implement the Python class `AsymmetricEncryptionCryptoServiceServicer` described below. Class description: Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption. Method signatures and docstrings: - def Decrypt(self, request, context): Decrypts the given ciphertext with...
Implement the Python class `AsymmetricEncryptionCryptoServiceServicer` described below. Class description: Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption. Method signatures and docstrings: - def Decrypt(self, request, context): Decrypts the given ciphertext with...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class AsymmetricEncryptionCryptoServiceServicer: """Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption.""" def Decrypt(self, request, context): """Decrypts the given ciphertext with the specified key.""" <|body_0|> def GetPub...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsymmetricEncryptionCryptoServiceServicer: """Data plane for KMS symmetric cryptography operations Set of methods that perform asymmetric decryption.""" def Decrypt(self, request, context): """Decrypts the given ciphertext with the specified key.""" context.set_code(grpc.StatusCode.UNIMPL...
the_stack_v2_python_sparse
yandex/cloud/kms/v1/asymmetricencryption/asymmetric_encryption_crypto_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
4ab835e9f7c2094640d6ab465315733823f747b0
[ "self.disk_to_overwrite = disk_to_overwrite\nself.source_disk = source_disk\nself.target_location_id = target_location_id", "if dictionary is None:\n return None\ndisk_to_overwrite = cohesity_management_sdk.models.virtual_disk_id_information.VirtualDiskIdInformation.from_dictionary(dictionary.get('diskToOverwr...
<|body_start_0|> self.disk_to_overwrite = disk_to_overwrite self.source_disk = source_disk self.target_location_id = target_location_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None disk_to_overwrite = cohesity_management_sdk.models.virtual_disk_...
Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user wants to overwrite. If specified, then powerOffVmBeforeRecovery must be true. source_...
VirtualDiskMapping
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualDiskMapping: """Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user wants to overwrite. If specified, then ...
stack_v2_sparse_classes_36k_train_001144
2,711
permissive
[ { "docstring": "Constructor for the VirtualDiskMapping class", "name": "__init__", "signature": "def __init__(self, disk_to_overwrite=None, source_disk=None, target_location_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictiona...
2
null
Implement the Python class `VirtualDiskMapping` described below. Class description: Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user ...
Implement the Python class `VirtualDiskMapping` described below. Class description: Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VirtualDiskMapping: """Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user wants to overwrite. If specified, then ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualDiskMapping: """Implementation of the 'VirtualDiskMapping' model. Specifies the request data struct for virtual disk mapping with only the disk ids. Attributes: disk_to_overwrite (VirtualDiskIdInformation): Specifies information about disk which user wants to overwrite. If specified, then powerOffVmBef...
the_stack_v2_python_sparse
cohesity_management_sdk/models/virtual_disk_mapping.py
cohesity/management-sdk-python
train
24
4e8c6db89cf97e418cf72c244fff661180bf150c
[ "request = UpdateStateRequest(state=state)\noperation = self._ipc_client.new_update_state()\noperation.activate(request)\nfuture = operation.get_response()\nreturn future", "try:\n future = self.update_state_async(state)\n future.result(self._timeout)\nexcept Exception as ex:\n raise ex", "request = Su...
<|body_start_0|> request = UpdateStateRequest(state=state) operation = self._ipc_client.new_update_state() operation.activate(request) future = operation.get_response() return future <|end_body_0|> <|body_start_1|> try: future = self.update_state_async(state)...
Client
[ "LicenseRef-scancode-proprietary-license", "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future: """Returns a Future Update the running state of the component""" <|body_0|> def update_state(self, state: LifecycleState): """Updates the running state of the component Throws a...
stack_v2_sparse_classes_36k_train_001145
4,643
permissive
[ { "docstring": "Returns a Future Update the running state of the component", "name": "update_state_async", "signature": "def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future" }, { "docstring": "Updates the running state of the component Throws an exception if the upda...
4
stack_v2_sparse_classes_30k_train_002177
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future: Returns a Future Update the running state of the component - def update_state(self, state: Lifecycle...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future: Returns a Future Update the running state of the component - def update_state(self, state: Lifecycle...
65f7362c84067c61cd3ae0d935cdee52f65f11b4
<|skeleton|> class Client: def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future: """Returns a Future Update the running state of the component""" <|body_0|> def update_state(self, state: LifecycleState): """Updates the running state of the component Throws a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: def update_state_async(self, state: LifecycleState) -> concurrent.futures.Future: """Returns a Future Update the running state of the component""" request = UpdateStateRequest(state=state) operation = self._ipc_client.new_update_state() operation.activate(request) ...
the_stack_v2_python_sparse
v2/os_cmd/cdk/components/ggAccel.os_command/artifacts/ggAccel.os_command/1.0.0/greengrassipcsdk/lifecycle.py
awslabs/aws-iot-greengrass-accelerators
train
64
c808fd46e6cf23b1d10b911b41585c5bf735847c
[ "styleMap = {'bungalow/craftsman': 'american craftsman', 'mission/spanish revival': 'mission revival', 'colonial': 'american colonial', 'pueblo': 'pueblo revival', 'chicago': 'chicago school', 'late victorian': 'victorian', 'modern movement': 'modern'}\nself.ids = {}\nfor c in lookupKeys('ARSTYLM'):\n if not c i...
<|body_start_0|> styleMap = {'bungalow/craftsman': 'american craftsman', 'mission/spanish revival': 'mission revival', 'colonial': 'american colonial', 'pueblo': 'pueblo revival', 'chicago': 'chicago school', 'late victorian': 'victorian', 'modern movement': 'modern'} self.ids = {} for c in look...
ArchStyle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchStyle: def __init__(self, session): """Query Freebase server for all architectural styles in our short table""" <|body_0|> def lookup(self, codes): """Look up Freebase IDs for a list of architectural styles. Return empty list if none found.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_001146
40,039
no_license
[ { "docstring": "Query Freebase server for all architectural styles in our short table", "name": "__init__", "signature": "def __init__(self, session)" }, { "docstring": "Look up Freebase IDs for a list of architectural styles. Return empty list if none found.", "name": "lookup", "signatu...
2
stack_v2_sparse_classes_30k_train_000888
Implement the Python class `ArchStyle` described below. Class description: Implement the ArchStyle class. Method signatures and docstrings: - def __init__(self, session): Query Freebase server for all architectural styles in our short table - def lookup(self, codes): Look up Freebase IDs for a list of architectural s...
Implement the Python class `ArchStyle` described below. Class description: Implement the ArchStyle class. Method signatures and docstrings: - def __init__(self, session): Query Freebase server for all architectural styles in our short table - def lookup(self, codes): Look up Freebase IDs for a list of architectural s...
f8fc5d0ebf77a3732bf33dd5181def5a20bfaf67
<|skeleton|> class ArchStyle: def __init__(self, session): """Query Freebase server for all architectural styles in our short table""" <|body_0|> def lookup(self, codes): """Look up Freebase IDs for a list of architectural styles. Return empty list if none found.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArchStyle: def __init__(self, session): """Query Freebase server for all architectural styles in our short table""" styleMap = {'bungalow/craftsman': 'american craftsman', 'mission/spanish revival': 'mission revival', 'colonial': 'american colonial', 'pueblo': 'pueblo revival', 'chicago': 'chi...
the_stack_v2_python_sparse
src/nrhp-upload/NRISupload.py
thinker007/freebase-utils
train
0
98fa8b67df707b130fc5cf6c16d8f75326c4458d
[ "app = self.app\nroot = self.root\nif not Path(root, FRONTEND).is_dir():\n app.display_info('frontend source missing, skipping cleaning compiled output')\n return\noutput_path = Path(root, APP_JS).parent\napp.display_info(f'cleaning {output_path.relative_to(root)}')\nif output_path.is_dir():\n shutil.rmtre...
<|body_start_0|> app = self.app root = self.root if not Path(root, FRONTEND).is_dir(): app.display_info('frontend source missing, skipping cleaning compiled output') return output_path = Path(root, APP_JS).parent app.display_info(f'cleaning {output_path.re...
Hatching build hook to compile our frontend JS.
FrontendBuildHook
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrontendBuildHook: """Hatching build hook to compile our frontend JS.""" def clean(self, versions): """Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled frontend code that may be present in the source tree.""" ...
stack_v2_sparse_classes_36k_train_001147
2,643
permissive
[ { "docstring": "Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled frontend code that may be present in the source tree.", "name": "clean", "signature": "def clean(self, versions)" }, { "docstring": "Hook called before each packag...
2
stack_v2_sparse_classes_30k_train_021459
Implement the Python class `FrontendBuildHook` described below. Class description: Hatching build hook to compile our frontend JS. Method signatures and docstrings: - def clean(self, versions): Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled fronten...
Implement the Python class `FrontendBuildHook` described below. Class description: Hatching build hook to compile our frontend JS. Method signatures and docstrings: - def clean(self, versions): Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled fronten...
795a55cc1aeb31e63160c5b367fcd13a1c2a60ed
<|skeleton|> class FrontendBuildHook: """Hatching build hook to compile our frontend JS.""" def clean(self, versions): """Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled frontend code that may be present in the source tree.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrontendBuildHook: """Hatching build hook to compile our frontend JS.""" def clean(self, versions): """Called at the beginning of each PEP 517 build, if HATCH_BUILD_CLEAN is set. This implementation deletes any compiled frontend code that may be present in the source tree.""" app = self.a...
the_stack_v2_python_sparse
build_frontend.py
lektor/lektor
train
4,246
683bf0ec1107ab215d2def9d8ce9adf140861a08
[ "prev = [-float('inf')]\ncurr_min = [float('inf')]\n\ndef inorder_traverse(node, prev, curr_min):\n if node:\n inorder_traverse(node.left, prev, curr_min)\n curr_min[0] = min(curr_min[0], node.val - prev[0])\n prev[0] = node.val\n inorder_traverse(node.right, prev, curr_min)\ninorder_...
<|body_start_0|> prev = [-float('inf')] curr_min = [float('inf')] def inorder_traverse(node, prev, curr_min): if node: inorder_traverse(node.left, prev, curr_min) curr_min[0] = min(curr_min[0], node.val - prev[0]) prev[0] = node.val ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDiffInBST(self, root: TreeNode) -> int: """Compare numbers in in-order traversal. Time: O(n) Space: O(1)""" <|body_0|> def minDiffInBST2(self, root: TreeNode) -> int: """Flatten tree then find minimum diff. Time: O(n) Space: O(n)""" <|body_1|...
stack_v2_sparse_classes_36k_train_001148
1,365
no_license
[ { "docstring": "Compare numbers in in-order traversal. Time: O(n) Space: O(1)", "name": "minDiffInBST", "signature": "def minDiffInBST(self, root: TreeNode) -> int" }, { "docstring": "Flatten tree then find minimum diff. Time: O(n) Space: O(n)", "name": "minDiffInBST2", "signature": "def...
2
stack_v2_sparse_classes_30k_train_004109
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDiffInBST(self, root: TreeNode) -> int: Compare numbers in in-order traversal. Time: O(n) Space: O(1) - def minDiffInBST2(self, root: TreeNode) -> int: Flatten tree then f...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDiffInBST(self, root: TreeNode) -> int: Compare numbers in in-order traversal. Time: O(n) Space: O(1) - def minDiffInBST2(self, root: TreeNode) -> int: Flatten tree then f...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def minDiffInBST(self, root: TreeNode) -> int: """Compare numbers in in-order traversal. Time: O(n) Space: O(1)""" <|body_0|> def minDiffInBST2(self, root: TreeNode) -> int: """Flatten tree then find minimum diff. Time: O(n) Space: O(n)""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDiffInBST(self, root: TreeNode) -> int: """Compare numbers in in-order traversal. Time: O(n) Space: O(1)""" prev = [-float('inf')] curr_min = [float('inf')] def inorder_traverse(node, prev, curr_min): if node: inorder_traverse(node....
the_stack_v2_python_sparse
easy/minimum-distance-between-bst-nodes/solution.py
hsuanhauliu/leetcode-solutions
train
0
6fdfa4ccc70e7cbbcf93704dc7f45f5430c6c0cc
[ "self.chamb_len = 2.6\nself.bscx = 0.00378\nself.bscy = 0.00249\nself.dlt22_chamb_side = 0.0065\nself.dlt22_chamb = self.dlt22_chamb_side / np.sqrt(2)\nself.coupling = 1.0 / 100\nself.avg_pressure = 3e-10\nself.total_curr = 100\nself.rf_voltage = 3000000.0\nself.model = None", "mod = si.create_accelerator(ids_vch...
<|body_start_0|> self.chamb_len = 2.6 self.bscx = 0.00378 self.bscy = 0.00249 self.dlt22_chamb_side = 0.0065 self.dlt22_chamb = self.dlt22_chamb_side / np.sqrt(2) self.coupling = 1.0 / 100 self.avg_pressure = 3e-10 self.total_curr = 100 self.rf_vol...
.
VchamberLifetime
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VchamberLifetime: """.""" def __init__(self): """.""" <|body_0|> def create_model(self): """.""" <|body_1|> def calc_bsc(self): """.""" <|body_2|> def calc_lifetime(self, mod=None): """.""" <|body_3|> def cha...
stack_v2_sparse_classes_36k_train_001149
5,251
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "create_model", "signature": "def create_model(self)" }, { "docstring": ".", "name": "calc_bsc", "signature": "def calc_bsc(self)" }, { "docstring": ".", "...
6
stack_v2_sparse_classes_30k_train_010806
Implement the Python class `VchamberLifetime` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def create_model(self): . - def calc_bsc(self): . - def calc_lifetime(self, mod=None): . - def change_horizontal_limitation(self, limitations): . - def plot_lifetime(self, hl...
Implement the Python class `VchamberLifetime` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def create_model(self): . - def calc_bsc(self): . - def calc_lifetime(self, mod=None): . - def change_horizontal_limitation(self, limitations): . - def plot_lifetime(self, hl...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class VchamberLifetime: """.""" def __init__(self): """.""" <|body_0|> def create_model(self): """.""" <|body_1|> def calc_bsc(self): """.""" <|body_2|> def calc_lifetime(self, mod=None): """.""" <|body_3|> def cha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VchamberLifetime: """.""" def __init__(self): """.""" self.chamb_len = 2.6 self.bscx = 0.00378 self.bscy = 0.00249 self.dlt22_chamb_side = 0.0065 self.dlt22_chamb = self.dlt22_chamb_side / np.sqrt(2) self.coupling = 1.0 / 100 self.avg_pressu...
the_stack_v2_python_sparse
generic_scripts/vchamber_effect_lifetime.py
lnls-fac/apsuite
train
1
fc154e1726ec0a1507efdfc84abd4c9dd6ee7956
[ "remediation_entry = json.loads(payload)\nnotification_info = remediation_entry.get('notificationInfo', None)\nfinding_info = notification_info.get('FindingInfo', None)\ncloudtrail_name = finding_info.get('ObjectId', None)\nobject_chain = remediation_entry['notificationInfo']['FindingInfo']['ObjectChain']\nobject_c...
<|body_start_0|> remediation_entry = json.loads(payload) notification_info = remediation_entry.get('notificationInfo', None) finding_info = notification_info.get('FindingInfo', None) cloudtrail_name = finding_info.get('ObjectId', None) object_chain = remediation_entry['notificati...
CloudtrailS3RemovePublicAccess
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudtrailS3RemovePublicAccess: def parse(self, payload): """Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to the remediation job. :type payload: str. :returns: Dictionary of parsed parameters :rtype: dict :raises: Exception, JSON...
stack_v2_sparse_classes_36k_train_001150
5,755
permissive
[ { "docstring": "Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to the remediation job. :type payload: str. :returns: Dictionary of parsed parameters :rtype: dict :raises: Exception, JSONDecodeError", "name": "parse", "signature": "def parse(self, ...
3
stack_v2_sparse_classes_30k_train_007290
Implement the Python class `CloudtrailS3RemovePublicAccess` described below. Class description: Implement the CloudtrailS3RemovePublicAccess class. Method signatures and docstrings: - def parse(self, payload): Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to t...
Implement the Python class `CloudtrailS3RemovePublicAccess` described below. Class description: Implement the CloudtrailS3RemovePublicAccess class. Method signatures and docstrings: - def parse(self, payload): Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to t...
c958afcca4cc25273e2c99526a46225a1a716aed
<|skeleton|> class CloudtrailS3RemovePublicAccess: def parse(self, payload): """Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to the remediation job. :type payload: str. :returns: Dictionary of parsed parameters :rtype: dict :raises: Exception, JSON...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudtrailS3RemovePublicAccess: def parse(self, payload): """Parse payload received from Remediation Service. :param payload: JSON string containing parameters sent to the remediation job. :type payload: str. :returns: Dictionary of parsed parameters :rtype: dict :raises: Exception, JSONDecodeError"""...
the_stack_v2_python_sparse
remediation_worker/jobs/aws_s3_cloudtrail_public_access/aws_s3_cloudtrail_public_access.py
holgerfeix/secure-state-remediation-jobs
train
0
67d551dcccde1f32407da6b9c68f8c84f7448b1f
[ "self.id = id\nself.title = title\nself.device_group = device_group\nself.device_type_id = device_type_id\nself.device_brand_id = device_brand_id\nself.create_on = create_on\nself.update_on = update_on\nself.created_by = created_by\nself.updated_by = updated_by\nself.create_on_persian_date = create_on_persian_date\...
<|body_start_0|> self.id = id self.title = title self.device_group = device_group self.device_type_id = device_type_id self.device_brand_id = device_brand_id self.create_on = create_on self.update_on = update_on self.created_by = created_by self.up...
Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_type_id (int): TODO: type description here. device_brand_id (string): TODO: type desc...
DeviceBrandTypes
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceBrandTypes: """Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_type_id (int): TODO: type description her...
stack_v2_sparse_classes_36k_train_001151
5,769
permissive
[ { "docstring": "Constructor for the DeviceBrandTypes class", "name": "__init__", "signature": "def __init__(self, id=None, title=None, device_group=None, create_on=None, update_on=None, created_by=None, create_on_persian_date=None, update_on_persian_date=None, device_type_brand_model_title=None, device_...
2
stack_v2_sparse_classes_30k_train_000778
Implement the Python class `DeviceBrandTypes` described below. Class description: Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_ty...
Implement the Python class `DeviceBrandTypes` described below. Class description: Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_ty...
b574a76a8805b306a423229b572c36dae0159def
<|skeleton|> class DeviceBrandTypes: """Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_type_id (int): TODO: type description her...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceBrandTypes: """Implementation of the 'DeviceBrandTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. device_group (int): TODO: type description here. device_type_id (int): TODO: type description here. device_bra...
the_stack_v2_python_sparse
easybimehlanding/models/device_brand_types.py
kmelodi/EasyBimehLanding_Python
train
0
b55a17e037a0aee7bcd4cd4815730ea27f5a6132
[ "self.abbr = {}\nself.dic = {}\nfor word in dictionary:\n l = len(word)\n self.dic[word] = 1\n if l <= 2:\n s = word\n else:\n s = word[0] + str(l - 2) + word[-1]\n if s not in self.abbr:\n self.abbr[s] = 1\n else:\n self.abbr[s] += 1", "l = len(word)\nif l <= 2:\n ...
<|body_start_0|> self.abbr = {} self.dic = {} for word in dictionary: l = len(word) self.dic[word] = 1 if l <= 2: s = word else: s = word[0] + str(l - 2) + word[-1] if s not in self.abbr: ...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_001152
1,164
no_license
[ { "docstring": "initialize your data structure here. :type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": "check if a word is unique. :type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" ...
2
stack_v2_sparse_classes_30k_train_020984
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
6ce22264a9c34d6addf4eff4c196105eec12b113
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" self.abbr = {} self.dic = {} for word in dictionary: l = len(word) self.dic[word] = 1 if l <= 2: s = word ...
the_stack_v2_python_sparse
Unique_Word_Abbr.py
zhubw91/Leetcode
train
0
28ec7b9860cf90d5c6a394abfd80c4b3ed5d04e6
[ "self.robot = robot\nself.controller = controller\nself.tlimit_total = rospy.Duration(tlimit_total)\nself.tlimit_convergence = rospy.Duration(tlimit_convergence)\nself.dt_threshold = dt_threshold\nself.f_send_command = f_send_command\nself.f_add_cb = f_add_cb\nself.last_feedback = 0\nself.last_update = None\nself.t...
<|body_start_0|> self.robot = robot self.controller = controller self.tlimit_total = rospy.Duration(tlimit_total) self.tlimit_convergence = rospy.Duration(tlimit_convergence) self.dt_threshold = dt_threshold self.f_send_command = f_send_command self.f_add_cb = f_a...
This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or when a timeout is reached.
InEqRunner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InEqRunner: """This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or when a timeout is reached.""" def ...
stack_v2_sparse_classes_36k_train_001153
16,781
no_license
[ { "docstring": "Constructor. Needs a robot, the controller to run, a total timeout, a timeout for the low activity commands, a function to send commands, a function to add itself as listener for joint states, the threshold for low activity, the names of the constraints to monitor for satisfaction", "name": ...
3
stack_v2_sparse_classes_30k_train_011388
Implement the Python class `InEqRunner` described below. Class description: This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or ...
Implement the Python class `InEqRunner` described below. Class description: This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or ...
948738e4e081473afef2831c83679a0c01271a18
<|skeleton|> class InEqRunner: """This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or when a timeout is reached.""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InEqRunner: """This class runs an inequality controller. It processes joint state updates and new commands. It also terminates controller execution when all constraints are met, when the sum of all commands is smaller than a given value for a given time, or when a timeout is reached.""" def __init__(self...
the_stack_v2_python_sparse
src/gebsyas/basic_controllers.py
ARoefer/gebsyas
train
0
5ac302d461e2c079be025e725c736f632e870d54
[ "self.commander_window = commander_window\nself.font = QtGui.QFont(self)\nself.font.setBold(True)\nself.font.setWeight(75)\nself.setup_footer_panel()", "self.create_footer_push_button('F3 View', 'F3')\nself.create_footer_push_button('F4 Edit', 'F4')\nself.create_footer_push_button('F5 Copy', 'F5')\nself.create_fo...
<|body_start_0|> self.commander_window = commander_window self.font = QtGui.QFont(self) self.font.setBold(True) self.font.setWeight(75) self.setup_footer_panel() <|end_body_0|> <|body_start_1|> self.create_footer_push_button('F3 View', 'F3') self.create_footer_pu...
WindowFooterPanel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" <|body_0|> def setup_footer_panel(self): ...
stack_v2_sparse_classes_36k_train_001154
2,089
no_license
[ { "docstring": "constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class", "name": "__init__", "signature": "def __init__(self, commander_window)" }, { "docstring": "This method is meant to ...
3
stack_v2_sparse_classes_30k_train_017710
Implement the Python class `WindowFooterPanel` described below. Class description: Implement the WindowFooterPanel class. Method signatures and docstrings: - def __init__(self, commander_window): constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (pare...
Implement the Python class `WindowFooterPanel` described below. Class description: Implement the WindowFooterPanel class. Method signatures and docstrings: - def __init__(self, commander_window): constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (pare...
5f7ab5b39c1dc7d8d2182048c5d8eaff04de3d06
<|skeleton|> class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" <|body_0|> def setup_footer_panel(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" self.commander_window = commander_window self.font = QtGui.Q...
the_stack_v2_python_sparse
views/window/window_footer_panel.py
jafi666/pyCommander
train
0
eee18abb93ebdf80418580163a8aa400d31eef34
[ "assert isinstance(web_idl_database, web_idl.Database)\nself._web_idl_database = web_idl_database\nself._target_store = TargetStore(web_idl_database)", "assert isinstance(rule_store, RuleStore)\nrule = None\ntarget_type = None\ntarget_object = None\n\ndef assert_(condition, text, *args, **kwargs):\n if not con...
<|body_start_0|> assert isinstance(web_idl_database, web_idl.Database) self._web_idl_database = web_idl_database self._target_store = TargetStore(web_idl_database) <|end_body_0|> <|body_start_1|> assert isinstance(rule_store, RuleStore) rule = None target_type = None ...
Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database.
Validator
[ "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validator: """Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database.""" def __init__(self, web_idl_database): """Instantiates with web_idl.Database.""" <|body_0|> def execute(self, rule_store, report_erro...
stack_v2_sparse_classes_36k_train_001155
2,079
permissive
[ { "docstring": "Instantiates with web_idl.Database.", "name": "__init__", "signature": "def __init__(self, web_idl_database)" }, { "docstring": "Validates `_web_idl_database` follows the rules stored in `rule_store`. Args: rule_store: A RuleStore which holds rules. report_error: A function to ha...
2
stack_v2_sparse_classes_30k_train_003324
Implement the Python class `Validator` described below. Class description: Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database. Method signatures and docstrings: - def __init__(self, web_idl_database): Instantiates with web_idl.Database. - def execu...
Implement the Python class `Validator` described below. Class description: Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database. Method signatures and docstrings: - def __init__(self, web_idl_database): Instantiates with web_idl.Database. - def execu...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class Validator: """Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database.""" def __init__(self, web_idl_database): """Instantiates with web_idl.Database.""" <|body_0|> def execute(self, rule_store, report_erro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validator: """Provides an API to Check if each IDL file follows rules defined in Web IDL by validating an instance of web_idl.Database.""" def __init__(self, web_idl_database): """Instantiates with web_idl.Database.""" assert isinstance(web_idl_database, web_idl.Database) self._we...
the_stack_v2_python_sparse
third_party/blink/renderer/bindings/scripts/validator/framework/validator.py
chromium/chromium
train
17,408
d304209db64e239dcc2e929deeade4e5b4cd0ed0
[ "if not (key and secret and url and method):\n raise ValueError('invalid oauth parameters')\nself.key = key\nself.secret = secret\nself.url = url\nself.method = method", "url = self.url.format(account=account)\nargs = {'oauth_consumer_key': _penc(self.key), 'oauth_nonce': sha1(urandom(64)).hexdigest(), 'oauth_...
<|body_start_0|> if not (key and secret and url and method): raise ValueError('invalid oauth parameters') self.key = key self.secret = secret self.url = url self.method = method <|end_body_0|> <|body_start_1|> url = self.url.format(account=account) ar...
Two-legged OAuth implementation for Gmail IMAP.
OAuth
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" <|body_0|> def __call__(self, account): """Create a request string for OAuth authentication.""" <|body_1|...
stack_v2_sparse_classes_36k_train_001156
1,940
permissive
[ { "docstring": "Set authentication parameters.", "name": "__init__", "signature": "def __init__(self, key, secret, url, method='GET')" }, { "docstring": "Create a request string for OAuth authentication.", "name": "__call__", "signature": "def __call__(self, account)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_000050
Implement the Python class `OAuth` described below. Class description: Two-legged OAuth implementation for Gmail IMAP. Method signatures and docstrings: - def __init__(self, key, secret, url, method='GET'): Set authentication parameters. - def __call__(self, account): Create a request string for OAuth authentication....
Implement the Python class `OAuth` described below. Class description: Two-legged OAuth implementation for Gmail IMAP. Method signatures and docstrings: - def __init__(self, key, secret, url, method='GET'): Set authentication parameters. - def __call__(self, account): Create a request string for OAuth authentication....
1344069a175afbca0593e4460d99889a2acf86d8
<|skeleton|> class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" <|body_0|> def __call__(self, account): """Create a request string for OAuth authentication.""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" if not (key and secret and url and method): raise ValueError('invalid oauth parameters') self.key = key self.se...
the_stack_v2_python_sparse
_gmdb/oauth.py
uncleweb/gmdb
train
0
c2d90d4251f83d458cb81bfda9ccbc8a9482823c
[ "Page.__init__(self, config)\nself.templatedir = ''\nif hasattr(self.config, 'templates'):\n self.templatedir = self.config.templates\nelse:\n self.warning(\"Configuration doesn't specify template location, guessing %s\" % self.templatedir)\n self.templatedir = '%s/%s' % (__file__.rsplit('/', 1)[0], 'Templ...
<|body_start_0|> Page.__init__(self, config) self.templatedir = '' if hasattr(self.config, 'templates'): self.templatedir = self.config.templates else: self.warning("Configuration doesn't specify template location, guessing %s" % self.templatedir) self...
__TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating
TemplatedPage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplatedPage: """__TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating""" def __init__(self, config={}): """Configure the Page base class then add in the location of the templates. If this is not specified in the configuration take a guess based on the l...
stack_v2_sparse_classes_36k_train_001157
12,480
permissive
[ { "docstring": "Configure the Page base class then add in the location of the templates. If this is not specified in the configuration take a guess based on the location of the file.", "name": "__init__", "signature": "def __init__(self, config={})" }, { "docstring": "Apply the cheetah template ...
2
null
Implement the Python class `TemplatedPage` described below. Class description: __TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating Method signatures and docstrings: - def __init__(self, config={}): Configure the Page base class then add in the location of the templates. If this is not s...
Implement the Python class `TemplatedPage` described below. Class description: __TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating Method signatures and docstrings: - def __init__(self, config={}): Configure the Page base class then add in the location of the templates. If this is not s...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class TemplatedPage: """__TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating""" def __init__(self, config={}): """Configure the Page base class then add in the location of the templates. If this is not specified in the configuration take a guess based on the l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplatedPage: """__TemplatedPage__ TemplatedPage is a class that provides simple Cheetah templating""" def __init__(self, config={}): """Configure the Page base class then add in the location of the templates. If this is not specified in the configuration take a guess based on the location of th...
the_stack_v2_python_sparse
src/python/WMCore/WebTools/Page.py
vkuznet/WMCore
train
0
e7119d0b78ec15e19e4554c64defabe4316cbbba
[ "if hasattr(self, '__len__'):\n return str(len(self))\nelse:\n raise NotImplementedError(f'Define the __nice__ method for {self.__class__!r}')", "try:\n nice = self.__nice__()\n classname = self.__class__.__name__\n return f'<{classname}({nice}) at {hex(id(self))}>'\nexcept NotImplementedError as e...
<|body_start_0|> if hasattr(self, '__len__'): return str(len(self)) else: raise NotImplementedError(f'Define the __nice__ method for {self.__class__!r}') <|end_body_0|> <|body_start_1|> try: nice = self.__nice__() classname = self.__class__.__name...
Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting class has a ``__len__``, method then the default ``__nice__`` method will ret...
NiceRepr
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NiceRepr: """Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting class has a ``__len__``, method then the ...
stack_v2_sparse_classes_36k_train_001158
3,712
permissive
[ { "docstring": "str: a \"nice\" summary string describing this module", "name": "__nice__", "signature": "def __nice__(self)" }, { "docstring": "str: the string of the module", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "str: the string of the module"...
3
stack_v2_sparse_classes_30k_val_000740
Implement the Python class `NiceRepr` described below. Class description: Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting cl...
Implement the Python class `NiceRepr` described below. Class description: Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting cl...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class NiceRepr: """Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting class has a ``__len__``, method then the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NiceRepr: """Inherit from this class and define ``__nice__`` to "nicely" print your objects. Defines ``__str__`` and ``__repr__`` in terms of ``__nice__`` function Classes that inherit from :class:`NiceRepr` should redefine ``__nice__``. If the inheriting class has a ``__len__``, method then the default ``__n...
the_stack_v2_python_sparse
ai/mmdetection/mmdet/utils/util_mixins.py
alldatacenter/alldata
train
774
940b319379b52d9b532bdac175334a0ec46ceb7c
[ "self.full_name = ''\nself.email_addr = ''\nself.username = ''\nself.password = ''", "cmd = '/usr/bin/htpasswd -b /etc/apache2/passwd/eamm.passwd %s %s' % (email_addr, password)\nret_code, ret_text = commands.getstatusoutput(cmd)\nif ret_code != 0:\n logging.info(\"Couldn't add user to htpasswd file - %s\" % r...
<|body_start_0|> self.full_name = '' self.email_addr = '' self.username = '' self.password = '' <|end_body_0|> <|body_start_1|> cmd = '/usr/bin/htpasswd -b /etc/apache2/passwd/eamm.passwd %s %s' % (email_addr, password) ret_code, ret_text = commands.getstatusoutput(cmd) ...
This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username)
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username)""" def __init__(self): """Constructor, sets all in...
stack_v2_sparse_classes_36k_train_001159
3,372
no_license
[ { "docstring": "Constructor, sets all initial valies to NULL. Args: none. Returns: User object. Raises: none.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "A one line summary of the function/method, eg: Fetch rows from a table. Args: Arg1: description Arg2: descripti...
3
stack_v2_sparse_classes_30k_train_005887
Implement the Python class `User` described below. Class description: This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username) Method signatures and d...
Implement the Python class `User` described below. Class description: This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username) Method signatures and d...
7e555ca581cdfb09bd623521e6cf8390aa9b02f6
<|skeleton|> class User: """This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username)""" def __init__(self): """Constructor, sets all in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """This class provides business logic for adding/updating/viewing eamm application users. Public Attributes: none. Public Methods: add_user:(full_name, email_addr, username, password) is_already_registered(email_addr, username)""" def __init__(self): """Constructor, sets all initial valies ...
the_stack_v2_python_sparse
eamm/backend/user.py
richardarchbold/eamm
train
0
63d3b7b8403148179ab79cb06409ddda1816154c
[ "description = response.css('.content > p::text').extract_first()\nif not re.search('100 W(est)? Randolph', description):\n raise ValueError('Meeting location has changed')\nfor item in response.css('.content > ul li'):\n meeting = Meeting(title='Local Records Commission', description='', classification=COMMI...
<|body_start_0|> description = response.css('.content > p::text').extract_first() if not re.search('100 W(est)? Randolph', description): raise ValueError('Meeting location has changed') for item in response.css('.content > ul li'): meeting = Meeting(title='Local Records C...
CookLocalRecordsSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive dateti...
stack_v2_sparse_classes_36k_train_001160
2,513
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse start datetime as a naive datetime object.", "name": "_parse_st...
3
null
Implement the Python class `CookLocalRecordsSpider` described below. Class description: Implement the CookLocalRecordsSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping ne...
Implement the Python class `CookLocalRecordsSpider` described below. Class description: Implement the CookLocalRecordsSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping ne...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive dateti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CookLocalRecordsSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" description = response.css('.content > p::text').extract_first() if not re.search('100 W(est)? Randol...
the_stack_v2_python_sparse
city_scrapers/spiders/cook_local_records.py
City-Bureau/city-scrapers
train
308
f8f1726bad3d7bea6ef1db8341607f7b26dcf439
[ "if value in EMPTY_VALUES:\n return None\nif type(value) in [str, unicode]:\n try:\n value = value.replace(\"'\", '\"')\n value = json.loads(value)\n except ValueError:\n msg = self.error_messages['invalid']\n raise serializers.ValidationError(msg)\nif value:\n day = value.ge...
<|body_start_0|> if value in EMPTY_VALUES: return None if type(value) in [str, unicode]: try: value = value.replace("'", '"') value = json.loads(value) except ValueError: msg = self.error_messages['invalid'] ...
A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }
ThreePartDateField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_001161
4,517
permissive
[ { "docstring": "Parse json data and return a date object", "name": "to_internal_value", "signature": "def to_internal_value(self, value)" }, { "docstring": "Transform datetime.date object to json.", "name": "to_representation", "signature": "def to_representation(self, value)" } ]
2
stack_v2_sparse_classes_30k_test_000138
Implement the Python class `ThreePartDateField` described below. Class description: A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 } Method signatures and docstrings: - def to_internal_value(self, value): Parse json data...
Implement the Python class `ThreePartDateField` described below. Class description: A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 } Method signatures and docstrings: - def to_internal_value(self, value): Parse json data...
51d40345b41eb68fb4d65ae273f3496d1012e2f3
<|skeleton|> class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" if value in EMPTY_VALUES: ...
the_stack_v2_python_sparse
cla_backend/apps/core/drf/fields.py
ministryofjustice/cla_backend
train
4
25c6fbda6b0ebc455449eb0649331b1c9a83360c
[ "db_object = authenticated_access(Object, identifier)\ntags = db.session.query(Tag).filter(Tag.objects.any(id=db_object.id)).all()\nmulti_tag = TagSchema(many=True)\ndumped_tags = multi_tag.dump(tags)\nreturn dumped_tags", "schema = TagSchema()\nobj = schema.loads(request.get_data(as_text=True))\nif obj.errors:\n...
<|body_start_0|> db_object = authenticated_access(Object, identifier) tags = db.session.query(Tag).filter(Tag.objects.any(id=db_object.id)).all() multi_tag = TagSchema(many=True) dumped_tags = multi_tag.dump(tags) return dumped_tags <|end_body_0|> <|body_start_1|> schema...
TagResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagResource: def get(self, type, identifier): """--- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: path name: type schema: type: string enum: [file, config, blob, object] description: Type of object - ...
stack_v2_sparse_classes_36k_train_001162
6,547
no_license
[ { "docstring": "--- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: path name: type schema: type: string enum: [file, config, blob, object] description: Type of object - in: path name: identifier schema: type: string descriptio...
3
null
Implement the Python class `TagResource` described below. Class description: Implement the TagResource class. Method signatures and docstrings: - def get(self, type, identifier): --- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: pa...
Implement the Python class `TagResource` described below. Class description: Implement the TagResource class. Method signatures and docstrings: - def get(self, type, identifier): --- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: pa...
f18f56789d2b7db8fdb7e172113a9918b4b72658
<|skeleton|> class TagResource: def get(self, type, identifier): """--- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: path name: type schema: type: string enum: [file, config, blob, object] description: Type of object - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagResource: def get(self, type, identifier): """--- summary: Get object tags description: | Returns tags attached to an object. security: - bearerAuth: [] tags: - tag parameters: - in: path name: type schema: type: string enum: [file, config, blob, object] description: Type of object - in: path name:...
the_stack_v2_python_sparse
resources/tag.py
dskwhitehat/malwarecage
train
0
6f7dfb0433afcf86abc4c59bd3536abc0a2ce9a1
[ "super(Wait, self).__init__(scenario, annotate=annotate)\nif duration_secs <= 0:\n raise CurieTestException(cause=\"'duration_secs' must be greater than zero (got '%s').\" % duration_secs, impact=\"The scenario '%s' is not valid, and can not be started.\" % self.scenario.display_name, corrective_action=\"If you ...
<|body_start_0|> super(Wait, self).__init__(scenario, annotate=annotate) if duration_secs <= 0: raise CurieTestException(cause="'duration_secs' must be greater than zero (got '%s')." % duration_secs, impact="The scenario '%s' is not valid, and can not be started." % self.scenario.display_nam...
Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds to block. annotate (bool): If True, annotate key points in the step in ...
Wait
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wait: """Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds to block. annotate (bool): If True, ann...
stack_v2_sparse_classes_36k_train_001163
2,088
permissive
[ { "docstring": "Raises: CurieTestException: If duration_secs is not greater than zero.", "name": "__init__", "signature": "def __init__(self, scenario, duration_secs, annotate=False)" }, { "docstring": "Suspend test execution for a given number of seconds. Returns: int: Number of seconds slept."...
2
null
Implement the Python class `Wait` described below. Class description: Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds ...
Implement the Python class `Wait` described below. Class description: Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds ...
e25691f465c23cf53c39be157fcfa2eea4978b26
<|skeleton|> class Wait: """Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds to block. annotate (bool): If True, ann...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Wait: """Suspend test execution for a given number of seconds. The test is not guaranteed to wait for the given number of seconds if the test is marked to stop. Args: scenario (Scenario): Scenario this step belongs to. duration_secs (int): Number of seconds to block. annotate (bool): If True, annotate key poi...
the_stack_v2_python_sparse
curie/steps/test.py
ztabassum1/curie
train
0
b7c5d6b5fa9af420ae7ab056475982cc00566d9b
[ "super(CreateDicomTest, self).setUp()\nself.dataset = self.get_file('dicom_uncompressed')\nself.dicom = self.context.dicom.import_dcm(self.dataset)\nself.xml_directory = self.get_local_dataset('dicom_xml/')\nself.image_directory = self.get_local_dataset('dicom_uncompressed/')", "files = []\nfor filename in os.lis...
<|body_start_0|> super(CreateDicomTest, self).setUp() self.dataset = self.get_file('dicom_uncompressed') self.dicom = self.context.dicom.import_dcm(self.dataset) self.xml_directory = self.get_local_dataset('dicom_xml/') self.image_directory = self.get_local_dataset('dicom_uncompr...
CreateDicomTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateDicomTest: def setUp(self): """import dicom data for testing""" <|body_0|> def test_metadata_content_import_dcm_basic(self): """content test of dicom metadata import""" <|body_1|> def test_image_content_import_dcm_basic(self): """content te...
stack_v2_sparse_classes_36k_train_001164
3,719
permissive
[ { "docstring": "import dicom data for testing", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "content test of dicom metadata import", "name": "test_metadata_content_import_dcm_basic", "signature": "def test_metadata_content_import_dcm_basic(self)" }, { "docst...
4
null
Implement the Python class `CreateDicomTest` described below. Class description: Implement the CreateDicomTest class. Method signatures and docstrings: - def setUp(self): import dicom data for testing - def test_metadata_content_import_dcm_basic(self): content test of dicom metadata import - def test_image_content_im...
Implement the Python class `CreateDicomTest` described below. Class description: Implement the CreateDicomTest class. Method signatures and docstrings: - def setUp(self): import dicom data for testing - def test_metadata_content_import_dcm_basic(self): content test of dicom metadata import - def test_image_content_im...
5548fc925b5c278263cbdebbd9e8c7593320c2f4
<|skeleton|> class CreateDicomTest: def setUp(self): """import dicom data for testing""" <|body_0|> def test_metadata_content_import_dcm_basic(self): """content test of dicom metadata import""" <|body_1|> def test_image_content_import_dcm_basic(self): """content te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateDicomTest: def setUp(self): """import dicom data for testing""" super(CreateDicomTest, self).setUp() self.dataset = self.get_file('dicom_uncompressed') self.dicom = self.context.dicom.import_dcm(self.dataset) self.xml_directory = self.get_local_dataset('dicom_xml/...
the_stack_v2_python_sparse
regression-tests/sparktkregtests/testcases/dicom/create_dicom_test.py
trustedanalytics/spark-tk
train
35
eb7780bb46c5c5f1464dc0958bfb33eb4229828e
[ "try:\n self.fetch_component_api_public_key()\n self.init_settings()\nexcept ProgrammingError as e:\n logger.info(f'init settings failed, err_msg -> {e}.')\nreturn True", "if any([settings.BKPAAS_MAJOR_VERSION == env_constants.BkPaaSVersion.V3.value, settings.BK_BACKEND_CONFIG]):\n logger.info('[JWT] ...
<|body_start_0|> try: self.fetch_component_api_public_key() self.init_settings() except ProgrammingError as e: logger.info(f'init settings failed, err_msg -> {e}.') return True <|end_body_0|> <|body_start_1|> if any([settings.BKPAAS_MAJOR_VERSION == e...
ApiConfig
[ "MIT", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiConfig: def ready(self): """初始化部分配置,主要目的是为了SaaS和后台共用部分配置""" <|body_0|> def fetch_component_api_public_key(cls): """获取JWT公钥并存储到全局配置中""" <|body_1|> def init_settings(cls): """初始化配置,读取DB后写入settings内存中,避免多次查表""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_001165
4,404
permissive
[ { "docstring": "初始化部分配置,主要目的是为了SaaS和后台共用部分配置", "name": "ready", "signature": "def ready(self)" }, { "docstring": "获取JWT公钥并存储到全局配置中", "name": "fetch_component_api_public_key", "signature": "def fetch_component_api_public_key(cls)" }, { "docstring": "初始化配置,读取DB后写入settings内存中,避免多次查表...
3
stack_v2_sparse_classes_30k_train_020291
Implement the Python class `ApiConfig` described below. Class description: Implement the ApiConfig class. Method signatures and docstrings: - def ready(self): 初始化部分配置,主要目的是为了SaaS和后台共用部分配置 - def fetch_component_api_public_key(cls): 获取JWT公钥并存储到全局配置中 - def init_settings(cls): 初始化配置,读取DB后写入settings内存中,避免多次查表
Implement the Python class `ApiConfig` described below. Class description: Implement the ApiConfig class. Method signatures and docstrings: - def ready(self): 初始化部分配置,主要目的是为了SaaS和后台共用部分配置 - def fetch_component_api_public_key(cls): 获取JWT公钥并存储到全局配置中 - def init_settings(cls): 初始化配置,读取DB后写入settings内存中,避免多次查表 <|skeleton|...
72d2104783443bff26c752c5bd934a013b302b6d
<|skeleton|> class ApiConfig: def ready(self): """初始化部分配置,主要目的是为了SaaS和后台共用部分配置""" <|body_0|> def fetch_component_api_public_key(cls): """获取JWT公钥并存储到全局配置中""" <|body_1|> def init_settings(cls): """初始化配置,读取DB后写入settings内存中,避免多次查表""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiConfig: def ready(self): """初始化部分配置,主要目的是为了SaaS和后台共用部分配置""" try: self.fetch_component_api_public_key() self.init_settings() except ProgrammingError as e: logger.info(f'init settings failed, err_msg -> {e}.') return True def fetch_comp...
the_stack_v2_python_sparse
apps/node_man/apps.py
TencentBlueKing/bk-nodeman
train
54
ac2d204b0ede05459a6aeeee5cb41b6a8b3452d6
[ "super(EmployeeBonus, self).onchange_employee_id()\nself.grade_id = False\nif self.employee_id:\n self.grade_id = self.employee_id.grade_id.id", "if values.get('employee_id', False):\n employee = self.env['hr.employee'].browse(values['employee_id'])\n values.update({'grade_id': employee.grade_id.id})\nre...
<|body_start_0|> super(EmployeeBonus, self).onchange_employee_id() self.grade_id = False if self.employee_id: self.grade_id = self.employee_id.grade_id.id <|end_body_0|> <|body_start_1|> if values.get('employee_id', False): employee = self.env['hr.employee'].brow...
EmployeeBonus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeBonus: def onchange_employee_id(self): """onchange the value based on selected employee, grade""" <|body_0|> def create(self, values): """Create a new record :return: Newly created record ID""" <|body_1|> def write(self, values): """Updat...
stack_v2_sparse_classes_36k_train_001166
2,217
no_license
[ { "docstring": "onchange the value based on selected employee, grade", "name": "onchange_employee_id", "signature": "def onchange_employee_id(self)" }, { "docstring": "Create a new record :return: Newly created record ID", "name": "create", "signature": "def create(self, values)" }, ...
3
null
Implement the Python class `EmployeeBonus` described below. Class description: Implement the EmployeeBonus class. Method signatures and docstrings: - def onchange_employee_id(self): onchange the value based on selected employee, grade - def create(self, values): Create a new record :return: Newly created record ID - ...
Implement the Python class `EmployeeBonus` described below. Class description: Implement the EmployeeBonus class. Method signatures and docstrings: - def onchange_employee_id(self): onchange the value based on selected employee, grade - def create(self, values): Create a new record :return: Newly created record ID - ...
59cd55edd536ce9feb85c772e163a2560c224cad
<|skeleton|> class EmployeeBonus: def onchange_employee_id(self): """onchange the value based on selected employee, grade""" <|body_0|> def create(self, values): """Create a new record :return: Newly created record ID""" <|body_1|> def write(self, values): """Updat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmployeeBonus: def onchange_employee_id(self): """onchange the value based on selected employee, grade""" super(EmployeeBonus, self).onchange_employee_id() self.grade_id = False if self.employee_id: self.grade_id = self.employee_id.grade_id.id def create(self, ...
the_stack_v2_python_sparse
slnee_hr_bonus_grade/models/bonus.py
zamzamintl/SLNEE-MASTER
train
0
7acb9b9c4781b5b2fa1f32e0080c3b5d6e727805
[ "super(FeatureSqueezing).__init__()\nassert 8 >= bit_depth > 0\nassert kernel_size > 0\nself.bit_value = 2 ** bit_depth - 1\nself.kernel_size = kernel_size\nself.padding = _quadruple(math.floor(kernel_size / 2))", "squeezed = torch.floor(image * self.bit_value) / self.bit_value\nsqueezed = F.pad(squeezed, self.pa...
<|body_start_0|> super(FeatureSqueezing).__init__() assert 8 >= bit_depth > 0 assert kernel_size > 0 self.bit_value = 2 ** bit_depth - 1 self.kernel_size = kernel_size self.padding = _quadruple(math.floor(kernel_size / 2)) <|end_body_0|> <|body_start_1|> squeezed...
Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf
FeatureSqueezing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureSqueezing: """Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf""" def __init__(self, bit_depth=7, kernel_size=3): """:param bit_depth: Number of bits used to encode image colors. Use 8 for no bit reduction. :param kernel_size: S...
stack_v2_sparse_classes_36k_train_001167
1,555
permissive
[ { "docstring": ":param bit_depth: Number of bits used to encode image colors. Use 8 for no bit reduction. :param kernel_size: Size of filter to use for blurring. Larger size means more blurring. Use kernel size 1 for no blurring.", "name": "__init__", "signature": "def __init__(self, bit_depth=7, kernel...
2
stack_v2_sparse_classes_30k_train_019022
Implement the Python class `FeatureSqueezing` described below. Class description: Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf Method signatures and docstrings: - def __init__(self, bit_depth=7, kernel_size=3): :param bit_depth: Number of bits used to encode image ...
Implement the Python class `FeatureSqueezing` described below. Class description: Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf Method signatures and docstrings: - def __init__(self, bit_depth=7, kernel_size=3): :param bit_depth: Number of bits used to encode image ...
f5a79e3aa5dc15d7f2fd677ea64f41dd3a1e9cd8
<|skeleton|> class FeatureSqueezing: """Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf""" def __init__(self, bit_depth=7, kernel_size=3): """:param bit_depth: Number of bits used to encode image colors. Use 8 for no bit reduction. :param kernel_size: S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureSqueezing: """Implementation of Feature Squeezing defence. Original paper: https://arxiv.org/pdf/1704.01155.pdf""" def __init__(self, bit_depth=7, kernel_size=3): """:param bit_depth: Number of bits used to encode image colors. Use 8 for no bit reduction. :param kernel_size: Size of filter...
the_stack_v2_python_sparse
sat/defence/FeatureSqueezing.py
larsksy/Semantic-Adversarial-Toolbox
train
1
085234c01a637a1654362cb89262db6fb1e70954
[ "if self.cleaned_data['repeat_option'] == NO_REPEAT:\n LOG.info('Saving a single training session')\n return [self.new_session()]\nelse:\n sessions = []\n step = 2 if self.cleaned_data['repeat_option'] in (MULTIPLE_BIWEEKLY, UNTIL_BIWEEKLY) else 1\n if self.cleaned_data['repeat_option'] in (MULTIPLE_...
<|body_start_0|> if self.cleaned_data['repeat_option'] == NO_REPEAT: LOG.info('Saving a single training session') return [self.new_session()] else: sessions = [] step = 2 if self.cleaned_data['repeat_option'] in (MULTIPLE_BIWEEKLY, UNTIL_BIWEEKLY) else 1 ...
A custom form for adding multiple training sessions.
TrainingSessionForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingSessionForm: """A custom form for adding multiple training sessions.""" def save_training_sessions(self): """Save the training sessions specified by the form data.""" <|body_0|> def new_session(self, week_offset=0): """Adds a new training session at the s...
stack_v2_sparse_classes_36k_train_001168
5,224
no_license
[ { "docstring": "Save the training sessions specified by the form data.", "name": "save_training_sessions", "signature": "def save_training_sessions(self)" }, { "docstring": "Adds a new training session at the specified week offset.", "name": "new_session", "signature": "def new_session(s...
2
null
Implement the Python class `TrainingSessionForm` described below. Class description: A custom form for adding multiple training sessions. Method signatures and docstrings: - def save_training_sessions(self): Save the training sessions specified by the form data. - def new_session(self, week_offset=0): Adds a new trai...
Implement the Python class `TrainingSessionForm` described below. Class description: A custom form for adding multiple training sessions. Method signatures and docstrings: - def save_training_sessions(self): Save the training sessions specified by the form data. - def new_session(self, week_offset=0): Adds a new trai...
d85aa4522c4ffa603efa9e8625fc7253fb7550b5
<|skeleton|> class TrainingSessionForm: """A custom form for adding multiple training sessions.""" def save_training_sessions(self): """Save the training sessions specified by the form data.""" <|body_0|> def new_session(self, week_offset=0): """Adds a new training session at the s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainingSessionForm: """A custom form for adding multiple training sessions.""" def save_training_sessions(self): """Save the training sessions specified by the form data.""" if self.cleaned_data['repeat_option'] == NO_REPEAT: LOG.info('Saving a single training session') ...
the_stack_v2_python_sparse
src/training/forms.py
cshc/cshc-web
train
3
ee32f355bfa5d7f0b11c7d670180f76e0274138b
[ "self.rows = []\nself.cols = None\nif isinstance(src, str):\n csv(src, self.add)\nelse:\n for i in src:\n self.add(i)", "if self.cols:\n if isinstance(t, list):\n t = ROW(t)\n self.rows.append(t)\n self.cols.add(t)\nelse:\n self.cols = COL(t)", "data = DATA(self.cols.names)\nfor ...
<|body_start_0|> self.rows = [] self.cols = None if isinstance(src, str): csv(src, self.add) else: for i in src: self.add(i) <|end_body_0|> <|body_start_1|> if self.cols: if isinstance(t, list): t = ROW(t) ...
The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects.
DATA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DATA: """The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects.""" def __init__(self, src): """Constructor for creating a DATA type object Parameters ---------- src : str : The path to the File whose dat...
stack_v2_sparse_classes_36k_train_001169
2,299
permissive
[ { "docstring": "Constructor for creating a DATA type object Parameters ---------- src : str : The path to the File whose data needs to be added into the DATA object", "name": "__init__", "signature": "def __init__(self, src)" }, { "docstring": "Function for adding a new ROW type object and appen...
4
stack_v2_sparse_classes_30k_train_005945
Implement the Python class `DATA` described below. Class description: The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects. Method signatures and docstrings: - def __init__(self, src): Constructor for creating a DATA type object Paramet...
Implement the Python class `DATA` described below. Class description: The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects. Method signatures and docstrings: - def __init__(self, src): Constructor for creating a DATA type object Paramet...
57236cf9c876f12a53fa9b1bb4492036f993f83e
<|skeleton|> class DATA: """The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects.""" def __init__(self, src): """Constructor for creating a DATA type object Parameters ---------- src : str : The path to the File whose dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DATA: """The DATA class is used to act as a container for the information in ROW type objects but is summarized in the form of COL type objects.""" def __init__(self, src): """Constructor for creating a DATA type object Parameters ---------- src : str : The path to the File whose data needs to be...
the_stack_v2_python_sparse
src/HW2/data.py
parthk279/ASE591-HW_GP6
train
0
27624b0edc767306d4c667480f090c4ad1850059
[ "count = 0\nfor item in iterable:\n if func(item):\n count += 1\nreturn count", "min_value = iterable[0]\nfor item in iterable:\n if func(item) < func(min_value):\n min_value = item\nreturn min_value", "for r in range(len(iterable) - 1):\n for c in range(r + 1, len(iterable)):\n if...
<|body_start_0|> count = 0 for item in iterable: if func(item): count += 1 return count <|end_body_0|> <|body_start_1|> min_value = iterable[0] for item in iterable: if func(item) < func(min_value): min_value = item ...
IterableHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterableHelper: def get_count(iterable, func): """在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数""" <|body_0|> def get_min(iterable, func): """在可迭代对象中,找到某一属性的最小值所对应的对象 :param iterable: 可迭代对象 :param func: 找到对象对应的属性 :return: 拥有最...
stack_v2_sparse_classes_36k_train_001170
1,528
permissive
[ { "docstring": "在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数", "name": "get_count", "signature": "def get_count(iterable, func)" }, { "docstring": "在可迭代对象中,找到某一属性的最小值所对应的对象 :param iterable: 可迭代对象 :param func: 找到对象对应的属性 :return: 拥有最小值的对象", "name": "g...
3
null
Implement the Python class `IterableHelper` described below. Class description: Implement the IterableHelper class. Method signatures and docstrings: - def get_count(iterable, func): 在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数 - def get_min(iterable, func): 在可迭代对象中,找到某一属性的最...
Implement the Python class `IterableHelper` described below. Class description: Implement the IterableHelper class. Method signatures and docstrings: - def get_count(iterable, func): 在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数 - def get_min(iterable, func): 在可迭代对象中,找到某一属性的最...
0af44ff39b9ded2c1d2cc96c6d356d21170ac04d
<|skeleton|> class IterableHelper: def get_count(iterable, func): """在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数""" <|body_0|> def get_min(iterable, func): """在可迭代对象中,找到某一属性的最小值所对应的对象 :param iterable: 可迭代对象 :param func: 找到对象对应的属性 :return: 拥有最...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IterableHelper: def get_count(iterable, func): """在可迭代对象中,找到满足一定条件的元素的数量 :param iterable: 可迭代对象 :param func: 需要满足的条件,返回布尔值 :return: 重复的次数""" count = 0 for item in iterable: if func(item): count += 1 return count def get_min(iterable, func): ...
the_stack_v2_python_sparse
month01/文件和异常/内置生成器/homework/common_homework/iterable_tools.py
chaofan-zheng/python_leanring_code
train
4
af8b91f980cd02f42867b1cab9628107eb9e72f5
[ "if ioObj != None:\n self.ioObj = ioObj\n self.triggers = []\nelse:\n raise InvalidArgument('A valid I/O object (file, socket, fifo) is required.\\n')", "if patt != None and cback != None:\n if type(patt) != types.StringType or type(cback) != types.FunctionType:\n raise InvalidArgument\n els...
<|body_start_0|> if ioObj != None: self.ioObj = ioObj self.triggers = [] else: raise InvalidArgument('A valid I/O object (file, socket, fifo) is required.\n') <|end_body_0|> <|body_start_1|> if patt != None and cback != None: if type(patt) != type...
Slurp
[ "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Slurp: def __init__(self, ioObj=None): """Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well""" <|body_0|> def register(self, patt=None, cback=None, final=True): """Register a callback and associat...
stack_v2_sparse_classes_36k_train_001171
6,776
permissive
[ { "docstring": "Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well", "name": "__init__", "signature": "def __init__(self, ioObj=None)" }, { "docstring": "Register a callback and associated pattern Slurp.register(patt=None, cba...
3
null
Implement the Python class `Slurp` described below. Class description: Implement the Slurp class. Method signatures and docstrings: - def __init__(self, ioObj=None): Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well - def register(self, patt=None,...
Implement the Python class `Slurp` described below. Class description: Implement the Slurp class. Method signatures and docstrings: - def __init__(self, ioObj=None): Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well - def register(self, patt=None,...
d097ca0ad6a6aee2180d32dce6a3322621f655fd
<|skeleton|> class Slurp: def __init__(self, ioObj=None): """Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well""" <|body_0|> def register(self, patt=None, cback=None, final=True): """Register a callback and associat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Slurp: def __init__(self, ioObj=None): """Instantiate a Slurp object Example: obj = Slurp(open('/etc/fstab', 'r')) # This will work for sockets and FIFO's as well""" if ioObj != None: self.ioObj = ioObj self.triggers = [] else: raise InvalidArgument(...
the_stack_v2_python_sparse
recipes/Python/578532_slurppy_Regex_based_simple_parsing/recipe-578532.py
betty29/code-1
train
0
4683561b5c7b54e19ffe300d2e40196b4d154ce0
[ "logger.debug(__('Performing health check with message {}.', message))\npath = Path(message['file'])\nif await database_sync_to_async(self.check_database, thread_sensitive=False)():\n logger.debug('Health check passed.')\n path.touch(exist_ok=True)", "with connection.cursor() as cursor:\n cursor.execute(...
<|body_start_0|> logger.debug(__('Performing health check with message {}.', message)) path = Path(message['file']) if await database_sync_to_async(self.check_database, thread_sensitive=False)(): logger.debug('Health check passed.') path.touch(exist_ok=True) <|end_body_0|...
Channels consumer for handling health-check events.
HealtCheckConsumer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealtCheckConsumer: """Channels consumer for handling health-check events.""" async def health_check(self, message: dict): """Perform health check. We are testing the channels layer and database layer. The channels layer is already functioning if this method is called so we have to p...
stack_v2_sparse_classes_36k_train_001172
3,964
permissive
[ { "docstring": "Perform health check. We are testing the channels layer and database layer. The channels layer is already functioning if this method is called so we have to perform database check. If the check is successfull touch the file specified in the channels message.", "name": "health_check", "si...
2
stack_v2_sparse_classes_30k_train_011912
Implement the Python class `HealtCheckConsumer` described below. Class description: Channels consumer for handling health-check events. Method signatures and docstrings: - async def health_check(self, message: dict): Perform health check. We are testing the channels layer and database layer. The channels layer is alr...
Implement the Python class `HealtCheckConsumer` described below. Class description: Channels consumer for handling health-check events. Method signatures and docstrings: - async def health_check(self, message: dict): Perform health check. We are testing the channels layer and database layer. The channels layer is alr...
25c0c45235ef37beb45c1af4c917fbbae6282016
<|skeleton|> class HealtCheckConsumer: """Channels consumer for handling health-check events.""" async def health_check(self, message: dict): """Perform health check. We are testing the channels layer and database layer. The channels layer is already functioning if this method is called so we have to p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HealtCheckConsumer: """Channels consumer for handling health-check events.""" async def health_check(self, message: dict): """Perform health check. We are testing the channels layer and database layer. The channels layer is already functioning if this method is called so we have to perform databa...
the_stack_v2_python_sparse
resolwe/flow/managers/consumer.py
genialis/resolwe
train
35
c3bb9a9a17f1501dfff13cad7e64ea9f00cb4705
[ "super(SARSALearningAgent, self).__init__(data_collection_config, reward_config, model_config)\nif model_config is None:\n raise ValueError('Learning agents require model.')\nself.model = create_model(model_config)\nself.discount_factor = discount_factor\nself.epsilon = epsilon\nself.learning_rate = learning_rat...
<|body_start_0|> super(SARSALearningAgent, self).__init__(data_collection_config, reward_config, model_config) if model_config is None: raise ValueError('Learning agents require model.') self.model = create_model(model_config) self.discount_factor = discount_factor se...
Agent that uses SARSA-Learning strategy to figure out policy.
SARSALearningAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SARSALearningAgent: """Agent that uses SARSA-Learning strategy to figure out policy.""" def __init__(self, data_collection_config, reward_config=None, model_config=None, discount_factor=0.1, epsilon=0.1, learning_rate=0.1, num_epochs=5, initial_num_epochs=50): """Initializer for Foll...
stack_v2_sparse_classes_36k_train_001173
4,867
permissive
[ { "docstring": "Initializer for FollowingFeatureAgent class. Args: data_collection_config: configuration for the data collection used by the agent. reward_config: configuration for reward used by the agent. model_config: configuration for model used by the agent. discount_factor: discount factor. epsilon: epsil...
3
stack_v2_sparse_classes_30k_train_010554
Implement the Python class `SARSALearningAgent` described below. Class description: Agent that uses SARSA-Learning strategy to figure out policy. Method signatures and docstrings: - def __init__(self, data_collection_config, reward_config=None, model_config=None, discount_factor=0.1, epsilon=0.1, learning_rate=0.1, n...
Implement the Python class `SARSALearningAgent` described below. Class description: Agent that uses SARSA-Learning strategy to figure out policy. Method signatures and docstrings: - def __init__(self, data_collection_config, reward_config=None, model_config=None, discount_factor=0.1, epsilon=0.1, learning_rate=0.1, n...
7161026b7b4deb78a934b66550c85a27c6b32933
<|skeleton|> class SARSALearningAgent: """Agent that uses SARSA-Learning strategy to figure out policy.""" def __init__(self, data_collection_config, reward_config=None, model_config=None, discount_factor=0.1, epsilon=0.1, learning_rate=0.1, num_epochs=5, initial_num_epochs=50): """Initializer for Foll...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SARSALearningAgent: """Agent that uses SARSA-Learning strategy to figure out policy.""" def __init__(self, data_collection_config, reward_config=None, model_config=None, discount_factor=0.1, epsilon=0.1, learning_rate=0.1, num_epochs=5, initial_num_epochs=50): """Initializer for FollowingFeatureA...
the_stack_v2_python_sparse
stock_trading_backend/agent/sarsa_learning_agent.py
iryzhkov/stock-trading-backend
train
1
ad348972f1000131c537436478b1d79b9c00950b
[ "self.num_filters = num_filters\nself._build_layer_components()\nsuper(ReductionA, self).__init__(**kwargs)", "self.max_pool1 = MaxPool2D(pool_size=(3, 3), strides=2, padding='valid')\nself.conv_block1 = [Conv2D(int(self.num_filters * 1.5), kernel_size=(3, 3), strides=2, padding='valid', activation=tf.nn.relu)]\n...
<|body_start_0|> self.num_filters = num_filters self._build_layer_components() super(ReductionA, self).__init__(**kwargs) <|end_body_0|> <|body_start_1|> self.max_pool1 = MaxPool2D(pool_size=(3, 3), strides=2, padding='valid') self.conv_block1 = [Conv2D(int(self.num_filters * 1....
Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers.
ReductionA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReductionA: """Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers."...
stack_v2_sparse_classes_36k_train_001174
17,354
permissive
[ { "docstring": "Parameters ---------- num_filters: int, Number of convolutional filters", "name": "__init__", "signature": "def __init__(self, num_filters, **kwargs)" }, { "docstring": "Builds the layers components and set _layers attribute.", "name": "_build_layer_components", "signatur...
3
null
Implement the Python class `ReductionA` described below. Class description: Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computati...
Implement the Python class `ReductionA` described below. Class description: Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computati...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class ReductionA: """Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReductionA: """Variant A of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers.""" def _...
the_stack_v2_python_sparse
deepchem/models/chemnet_layers.py
deepchem/deepchem
train
4,876
3881ec7a9aa8e8b88a1518f7663a807e5b4798da
[ "super().__init__(name=name, add_dry=add_dry, trainable=trainable)\nself._n_frames = n_frames\nself._n_filter_banks = n_filter_banks\nself._synth = synths.FilteredNoise(n_samples=reverb_length, window_size=window_size, scale_fn=scale_fn, initial_bias=initial_bias)", "if self.trainable:\n initializer = tf.rando...
<|body_start_0|> super().__init__(name=name, add_dry=add_dry, trainable=trainable) self._n_frames = n_frames self._n_filter_banks = n_filter_banks self._synth = synths.FilteredNoise(n_samples=reverb_length, window_size=window_size, scale_fn=scale_fn, initial_bias=initial_bias) <|end_body...
Parameterize impulse response with outputs of a filtered noise synth.
FilteredNoiseReverb
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilteredNoiseReverb: """Parameterize impulse response with outputs of a filtered noise synth.""" def __init__(self, trainable=False, reverb_length=48000, window_size=257, n_frames=1000, n_filter_banks=16, scale_fn=core.exp_sigmoid, initial_bias=-3.0, add_dry=True, name='filtered_noise_reverb...
stack_v2_sparse_classes_36k_train_001175
13,484
permissive
[ { "docstring": "Constructor. Args: trainable: Learn the impulse_response as a single variable for the entire dataset. reverb_length: Length of the impulse response. window_size: Window size for filtered noise synthesizer. n_frames: Time resolution of magnitudes coefficients. Only used if trainable=True. n_filte...
3
null
Implement the Python class `FilteredNoiseReverb` described below. Class description: Parameterize impulse response with outputs of a filtered noise synth. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, window_size=257, n_frames=1000, n_filter_banks=16, scale_fn=core.exp_s...
Implement the Python class `FilteredNoiseReverb` described below. Class description: Parameterize impulse response with outputs of a filtered noise synth. Method signatures and docstrings: - def __init__(self, trainable=False, reverb_length=48000, window_size=257, n_frames=1000, n_filter_banks=16, scale_fn=core.exp_s...
7e0a39420f3bd87d9efd54cf0d36f4e258311340
<|skeleton|> class FilteredNoiseReverb: """Parameterize impulse response with outputs of a filtered noise synth.""" def __init__(self, trainable=False, reverb_length=48000, window_size=257, n_frames=1000, n_filter_banks=16, scale_fn=core.exp_sigmoid, initial_bias=-3.0, add_dry=True, name='filtered_noise_reverb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilteredNoiseReverb: """Parameterize impulse response with outputs of a filtered noise synth.""" def __init__(self, trainable=False, reverb_length=48000, window_size=257, n_frames=1000, n_filter_banks=16, scale_fn=core.exp_sigmoid, initial_bias=-3.0, add_dry=True, name='filtered_noise_reverb'): "...
the_stack_v2_python_sparse
ddsp/effects.py
magenta/ddsp
train
2,666
dc952934e1f950a2f4d0dbc8b639b3eae4f872e6
[ "from pymodule import ProcessOptions\nself.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)\nif self.analysis_method_id_ls is not None:\n self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)", ...
<|body_start_0|> from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.analysis_method_id_ls is not None: self.analysis_method_id_ls = getListOutOfStr(self.a...
ResultsMethod2Results
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" <|body_0|> def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): """2009-11-2 split out of run()""" <|body_1|> def run(self): ...
stack_v2_sparse_classes_36k_train_001176
4,990
no_license
[ { "docstring": "2009-2-16", "name": "__init__", "signature": "def __init__(self, **keywords)" }, { "docstring": "2009-11-2 split out of run()", "name": "rm2result", "signature": "def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None)" ...
3
null
Implement the Python class `ResultsMethod2Results` described below. Class description: Implement the ResultsMethod2Results class. Method signatures and docstrings: - def __init__(self, **keywords): 2009-2-16 - def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): ...
Implement the Python class `ResultsMethod2Results` described below. Class description: Implement the ResultsMethod2Results class. Method signatures and docstrings: - def __init__(self, **keywords): 2009-2-16 - def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): ...
7b402496aae81665e6a915b5021b94d56e034c9d
<|skeleton|> class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" <|body_0|> def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): """2009-11-2 split out of run()""" <|body_1|> def run(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.analysis_method_id_ls is n...
the_stack_v2_python_sparse
variation/trunk/src/ResultsMethod2Results.py
polyactis/repos
train
1
a7f7b4a78e3617b6828e101dad2912629f745fb5
[ "n = len(nums)\nif n < 2:\n return 0\nmax_pos = max_steps = nums[0]\njumps = 1\nfor index in range(1, n):\n if max_steps < index:\n jumps += 1\n max_steps = max_pos\n max_pos = max(max_pos, nums[index] + index)\nreturn jumps", "max_reach, length = (0, len(nums))\nfor index in range(length):...
<|body_start_0|> n = len(nums) if n < 2: return 0 max_pos = max_steps = nums[0] jumps = 1 for index in range(1, n): if max_steps < index: jumps += 1 max_steps = max_pos max_pos = max(max_pos, nums[index] + index)...
JumpGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JumpGame: def get_minimum_jumps(self, nums: List[int]) -> int: """Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" <|body_0|> def can_jump(self, nums: List[int]) -> bool: """Approach: Greedy Algorithm Time Complexity: O...
stack_v2_sparse_classes_36k_train_001177
1,322
no_license
[ { "docstring": "Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:", "name": "get_minimum_jumps", "signature": "def get_minimum_jumps(self, nums: List[int]) -> int" }, { "docstring": "Approach: Greedy Algorithm Time Complexity: O(n) Space Complexity: O(...
2
null
Implement the Python class `JumpGame` described below. Class description: Implement the JumpGame class. Method signatures and docstrings: - def get_minimum_jumps(self, nums: List[int]) -> int: Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return: - def can_jump(self, nums: List...
Implement the Python class `JumpGame` described below. Class description: Implement the JumpGame class. Method signatures and docstrings: - def get_minimum_jumps(self, nums: List[int]) -> int: Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return: - def can_jump(self, nums: List...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class JumpGame: def get_minimum_jumps(self, nums: List[int]) -> int: """Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" <|body_0|> def can_jump(self, nums: List[int]) -> bool: """Approach: Greedy Algorithm Time Complexity: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JumpGame: def get_minimum_jumps(self, nums: List[int]) -> int: """Approach: Greedy Algorithm Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" n = len(nums) if n < 2: return 0 max_pos = max_steps = nums[0] jumps = 1 for index in r...
the_stack_v2_python_sparse
data_structures/jump_game.py
Shiv2157k/leet_code
train
1
d59dc40f46a4b2b5610b5823be7a2295f225237f
[ "if len(prices) < 2:\n return 0\ndp = [[[0 for _ in range(2)] for _ in range(3)] for i in range(len(prices))]\nfor i in range(1, 3):\n dp[0][i][0] = 0\n dp[0][i][1] = -prices[0]\nfor i in range(1, len(prices)):\n for k in range(2, 0, -1):\n dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + pri...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[[0 for _ in range(2)] for _ in range(3)] for i in range(len(prices))] for i in range(1, 3): dp[0][i][0] = 0 dp[0][i][1] = -prices[0] for i in range(1, len(prices)): for k in range(2, 0, -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k - 1][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持...
stack_v2_sparse_classes_36k_train_001178
3,161
no_license
[ { "docstring": "动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k - 1][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k][1] = max(dp[i - 1][k][1], dp[i - 1][k][0] - prices[i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k - 1][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划,构造状态转移方程 dp[i][k][j] i表示天数,k表示买卖次数,j表示是持股还是未持股 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k - 1][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit3.py
yinhuax/leet_code
train
0
e6b2e37d8373bb5ac06bcd7b0405998793f7e314
[ "api_root_dict = OrderedDict()\nlist_name = self.routes[0].name\nfor prefix, viewset, basename in self.registry:\n api_root_dict[prefix] = list_name.format(basename=basename)\n\nclass APIRoot(views.APIView):\n _ignore_model_permissions = True\n\n def get(self, request, *args, **kwargs):\n ret = Orde...
<|body_start_0|> api_root_dict = OrderedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) class APIRoot(views.APIView): _ignore_model_permissions = True ...
Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs.
AdvancedDefaultRouter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdvancedDefaultRouter: """Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs.""" def get_api_root_view(self): """Return a view to use as the API root.""" ...
stack_v2_sparse_classes_36k_train_001179
11,049
permissive
[ { "docstring": "Return a view to use as the API root.", "name": "get_api_root_view", "signature": "def get_api_root_view(self)" }, { "docstring": "Generate the list of URL patterns, including a default root view for the API, and appending `.json` style format suffixes.", "name": "get_urls", ...
2
null
Implement the Python class `AdvancedDefaultRouter` described below. Class description: Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs. Method signatures and docstrings: - def get_api_root_vie...
Implement the Python class `AdvancedDefaultRouter` described below. Class description: Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs. Method signatures and docstrings: - def get_api_root_vie...
51d40345b41eb68fb4d65ae273f3496d1012e2f3
<|skeleton|> class AdvancedDefaultRouter: """Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs.""" def get_api_root_view(self): """Return a view to use as the API root.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdvancedDefaultRouter: """Borrowed directly from DRF v3.0.2. The default router extends the AdvancedSimpleRouter, but also adds in a default API root view, and adds format suffix patterns to the URLs.""" def get_api_root_view(self): """Return a view to use as the API root.""" api_root_dic...
the_stack_v2_python_sparse
cla_backend/apps/core/drf/router.py
ministryofjustice/cla_backend
train
4
849d7989ffc0ee066db1b65c0248702fe10c52d4
[ "self.func = func\nself.args = args\nself.kwargs = kwargs\nsuper().__init__()", "try:\n log.info('Executing function \"%s%s\" in separate thread ' % (self.func.__name__, self.args))\n self.func(*self.args, **self.kwargs)\nexcept Exception as err:\n log.error('Error executing function \"%s%s\" in thread: ...
<|body_start_0|> self.func = func self.args = args self.kwargs = kwargs super().__init__() <|end_body_0|> <|body_start_1|> try: log.info('Executing function "%s%s" in separate thread ' % (self.func.__name__, self.args)) self.func(*self.args, **self.kwargs...
Execute a python function in a separate thread
FuncThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuncThread: """Execute a python function in a separate thread""" def __init__(self, func, args=(), kwargs={}): """Initialize Task with the given function.""" <|body_0|> def run(self): """Start the Thread.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001180
1,412
no_license
[ { "docstring": "Initialize Task with the given function.", "name": "__init__", "signature": "def __init__(self, func, args=(), kwargs={})" }, { "docstring": "Start the Thread.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_015055
Implement the Python class `FuncThread` described below. Class description: Execute a python function in a separate thread Method signatures and docstrings: - def __init__(self, func, args=(), kwargs={}): Initialize Task with the given function. - def run(self): Start the Thread.
Implement the Python class `FuncThread` described below. Class description: Execute a python function in a separate thread Method signatures and docstrings: - def __init__(self, func, args=(), kwargs={}): Initialize Task with the given function. - def run(self): Start the Thread. <|skeleton|> class FuncThread: "...
c859bddc445600e7cfaebffcdfcc086d70d18607
<|skeleton|> class FuncThread: """Execute a python function in a separate thread""" def __init__(self, func, args=(), kwargs={}): """Initialize Task with the given function.""" <|body_0|> def run(self): """Start the Thread.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuncThread: """Execute a python function in a separate thread""" def __init__(self, func, args=(), kwargs={}): """Initialize Task with the given function.""" self.func = func self.args = args self.kwargs = kwargs super().__init__() def run(self): """St...
the_stack_v2_python_sparse
dlmclient/system/threads.py
rguenthe/dlms-client
train
0
2cae1f3e767f0614a0283c6300726f6188b42338
[ "if codecs is None:\n encoding = None\nself.baseFilename = os.path.abspath(filename)\nself.mode = mode\nself.encoding = encoding\nself.delay = delay\nself.dblog = dblog\nself.connect = connect\nself.just_write_table = just_write_table\nif delay:\n logging.Handler.__init__(self)\n self.stream = None\nelse:\...
<|body_start_0|> if codecs is None: encoding = None self.baseFilename = os.path.abspath(filename) self.mode = mode self.encoding = encoding self.delay = delay self.dblog = dblog self.connect = connect self.just_write_table = just_write_table ...
A handler class which writes formatted logging records to disk files.
SCFileHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCFileHandler: """A handler class which writes formatted logging records to disk files.""" def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0): """Open the specified file and use it as the stream for logging.""" <|body...
stack_v2_sparse_classes_36k_train_001181
4,529
no_license
[ { "docstring": "Open the specified file and use it as the stream for logging.", "name": "__init__", "signature": "def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0)" }, { "docstring": "Closes the stream.", "name": "close", "signa...
4
stack_v2_sparse_classes_30k_train_002351
Implement the Python class `SCFileHandler` described below. Class description: A handler class which writes formatted logging records to disk files. Method signatures and docstrings: - def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0): Open the specified fil...
Implement the Python class `SCFileHandler` described below. Class description: A handler class which writes formatted logging records to disk files. Method signatures and docstrings: - def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0): Open the specified fil...
df354eb1de71b459b92a5a505e27b9d17880332c
<|skeleton|> class SCFileHandler: """A handler class which writes formatted logging records to disk files.""" def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0): """Open the specified file and use it as the stream for logging.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SCFileHandler: """A handler class which writes formatted logging records to disk files.""" def __init__(self, filename, dblog={}, connect=None, just_write_table=None, mode='a', encoding=None, delay=0): """Open the specified file and use it as the stream for logging.""" if codecs is None: ...
the_stack_v2_python_sparse
IDEA/pythod_work/nlsync_data/sync_logger.py
maizi12580/test
train
0
f6e07f0dbdac9a8738a62930ed70d1e58feaebca
[ "self.lect = dialect\nself.recon = reconstruction\nself.root = LATIN[self.lect][self.recon]\nself.table = self.root['correspondence']\nself.diphs = self.root['diphthongs']\nself.punc = self.root['punctuation']\nself.macronizer = m.Macronizer('tag_ngram_123_backoff')", "out = chars.base(ch).lower()\nlength = chars...
<|body_start_0|> self.lect = dialect self.recon = reconstruction self.root = LATIN[self.lect][self.recon] self.table = self.root['correspondence'] self.diphs = self.root['diphthongs'] self.punc = self.root['punctuation'] self.macronizer = m.Macronizer('tag_ngram_1...
Uses a reconstruction to transcribe a orthographic string into IPA.
Transcriber
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transcriber: """Uses a reconstruction to transcribe a orthographic string into IPA.""" def __init__(self, dialect: str, reconstruction: str): """:param dialect: Latin dialect :param reconstruction: reconstruction method""" <|body_0|> def _parse_diacritics(self, ch: str) ...
stack_v2_sparse_classes_36k_train_001182
25,882
permissive
[ { "docstring": ":param dialect: Latin dialect :param reconstruction: reconstruction method", "name": "__init__", "signature": "def __init__(self, dialect: str, reconstruction: str)" }, { "docstring": "EG: input with base a -> a/LENGTH/DIAERESIS/ :param ch: character :return: a string with separa...
4
stack_v2_sparse_classes_30k_train_018157
Implement the Python class `Transcriber` described below. Class description: Uses a reconstruction to transcribe a orthographic string into IPA. Method signatures and docstrings: - def __init__(self, dialect: str, reconstruction: str): :param dialect: Latin dialect :param reconstruction: reconstruction method - def _...
Implement the Python class `Transcriber` described below. Class description: Uses a reconstruction to transcribe a orthographic string into IPA. Method signatures and docstrings: - def __init__(self, dialect: str, reconstruction: str): :param dialect: Latin dialect :param reconstruction: reconstruction method - def _...
8a122113d2509aef85bebba8e2c303471c107ff4
<|skeleton|> class Transcriber: """Uses a reconstruction to transcribe a orthographic string into IPA.""" def __init__(self, dialect: str, reconstruction: str): """:param dialect: Latin dialect :param reconstruction: reconstruction method""" <|body_0|> def _parse_diacritics(self, ch: str) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transcriber: """Uses a reconstruction to transcribe a orthographic string into IPA.""" def __init__(self, dialect: str, reconstruction: str): """:param dialect: Latin dialect :param reconstruction: reconstruction method""" self.lect = dialect self.recon = reconstruction se...
the_stack_v2_python_sparse
src/cltk/phonology/lat/transcription.py
cltk/cltk
train
847
0329b116613b73aa527f20fbdef65445aa406030
[ "super(EncoderRNN, self).__init__()\nself.vocab_size = vocab_size\nself.embedding_size = embedding_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.dropout = dropout\nself.batch_first = batch_first\nself.bidirectional = bidirectional\nif bidirectional:\n self.num_directions = 2\nelse:\n ...
<|body_start_0|> super(EncoderRNN, self).__init__() self.vocab_size = vocab_size self.embedding_size = embedding_size self.hidden_size = hidden_size self.num_layers = num_layers self.dropout = dropout self.batch_first = batch_first self.bidirectional = bid...
EncoderRNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" <|body_0|> def forward(self, inputs, input...
stack_v2_sparse_classes_36k_train_001183
8,492
permissive
[ { "docstring": "Sentence-level Encoder", "name": "__init__", "signature": "def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None)" }, { "docstring": "Args: inpu...
2
stack_v2_sparse_classes_30k_val_000473
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weig...
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weig...
8851bbde8bedd0fe07beec72d74b3b3624c9c729
<|skeleton|> class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" <|body_0|> def forward(self, inputs, input...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" super(EncoderRNN, self).__init__() self.vocab_size = ...
the_stack_v2_python_sparse
TL-ERC/bert_model/layer/encoder.py
declare-lab/conv-emotion
train
791
eec269b1d989d34ae5f80122a3d62ee2dd7fe227
[ "t0 = Triangle()\nself.assertIsNot(t0, None)\nself.assertIsInstance(t0, Triangle)", "t1 = Triangle([1, 2, 3])\nself.assertIsNot(t1, None)\nself.assertIsInstance(t1, Triangle)\nt2 = Triangle('xyz')\nself.assertIsNot(t2, None)\nself.assertIsInstance(t2, Triangle)\nt3 = Triangle(['x', 'y', 'z'])\nself.assertIsNot(t3...
<|body_start_0|> t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) <|end_body_0|> <|body_start_1|> t1 = Triangle([1, 2, 3]) self.assertIsNot(t1, None) self.assertIsInstance(t1, Triangle) t2 = Triangle('xyz') self.assertIsNot(t...
Test Triangle class call
TestConstructor_Triangle
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_36k_train_001184
11,224
permissive
[ { "docstring": "Calling Triangle class with no key (key = None)", "name": "test_none", "signature": "def test_none(self)" }, { "docstring": "Calling Vertex class with iterable key", "name": "test_iterable", "signature": "def test_iterable(self)" }, { "docstring": "Calling Vertex ...
3
stack_v2_sparse_classes_30k_train_013536
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
f9b00a39bc16aea4abac60c0dd0aab2acac5adcf
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) def test_iterable(self): """Calling Vertex class ...
the_stack_v2_python_sparse
_BACKUPS_V4/v4_5/LightPicture_Test.py
nagame/LightPicture
train
0
d7cb986dddbab89fe4551ce619ad0b3067effd1f
[ "self.collect_function = collect_function\nself.collapse_function = collapse_function\nself.do_commutative_analysis = do_commutative_analysis\nsuper().__init__()", "if self.do_commutative_analysis:\n dag = dag_to_dagdependency(dag)\nblocks = self.collect_function(dag)\nself.collapse_function(dag, blocks)\nif s...
<|body_start_0|> self.collect_function = collect_function self.collapse_function = collapse_function self.do_commutative_analysis = do_commutative_analysis super().__init__() <|end_body_0|> <|body_start_1|> if self.do_commutative_analysis: dag = dag_to_dagdependency(...
A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` takes a DAG and returns a list of blocks. The collapsing function ``collapse_function`` t...
CollectAndCollapse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectAndCollapse: """A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` takes a DAG and returns a list of blocks. T...
stack_v2_sparse_classes_36k_train_001185
4,438
permissive
[ { "docstring": "Args: collect_function (callable): a function that takes a DAG and returns a list of \"collected\" blocks of nodes collapse_function (callable): a function that takes a DAG and a list of \"collected\" blocks, and consolidates each block. do_commutative_analysis (bool): if True, exploits commutat...
2
stack_v2_sparse_classes_30k_train_002136
Implement the Python class `CollectAndCollapse` described below. Class description: A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` take...
Implement the Python class `CollectAndCollapse` described below. Class description: A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` take...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class CollectAndCollapse: """A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` takes a DAG and returns a list of blocks. T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectAndCollapse: """A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. This transpiler pass depends on two functions: the collection function and the collapsing function. The collection function ``collect_function`` takes a DAG and returns a list of blocks. The collapsing...
the_stack_v2_python_sparse
qiskit/transpiler/passes/optimization/collect_and_collapse.py
1ucian0/qiskit-terra
train
6
29db2e0d207bfda7e910500422221fbeb64236d4
[ "pr_quality = PullRequestQuality.objects.get(owner=owner, repo=repo)\nserializer = PullRequestQualitySerializer(pr_quality)\ncustom_serializer = customize_serializer(serializer.data)\nreturn Response(custom_serializer)", "pr_quality = PullRequestQuality.objects.filter(owner=owner, repo=repo)\nif pr_quality:\n ...
<|body_start_0|> pr_quality = PullRequestQuality.objects.get(owner=owner, repo=repo) serializer = PullRequestQualitySerializer(pr_quality) custom_serializer = customize_serializer(serializer.data) return Response(custom_serializer) <|end_body_0|> <|body_start_1|> pr_quality = Pu...
PullRequestQualityView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PullRequestQualityView: def get(self, request, owner, repo, token_auth): """Returns the quality of the pull requests from the repository""" <|body_0|> def post(self, request, owner, repo, token_auth): """Post a new quality of the pull requests from the repository""" ...
stack_v2_sparse_classes_36k_train_001186
6,600
permissive
[ { "docstring": "Returns the quality of the pull requests from the repository", "name": "get", "signature": "def get(self, request, owner, repo, token_auth)" }, { "docstring": "Post a new quality of the pull requests from the repository", "name": "post", "signature": "def post(self, reque...
3
stack_v2_sparse_classes_30k_train_007584
Implement the Python class `PullRequestQualityView` described below. Class description: Implement the PullRequestQualityView class. Method signatures and docstrings: - def get(self, request, owner, repo, token_auth): Returns the quality of the pull requests from the repository - def post(self, request, owner, repo, t...
Implement the Python class `PullRequestQualityView` described below. Class description: Implement the PullRequestQualityView class. Method signatures and docstrings: - def get(self, request, owner, repo, token_auth): Returns the quality of the pull requests from the repository - def post(self, request, owner, repo, t...
3f031eac9559a10fdcf70a88ee4c548cf93e4ac2
<|skeleton|> class PullRequestQualityView: def get(self, request, owner, repo, token_auth): """Returns the quality of the pull requests from the repository""" <|body_0|> def post(self, request, owner, repo, token_auth): """Post a new quality of the pull requests from the repository""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PullRequestQualityView: def get(self, request, owner, repo, token_auth): """Returns the quality of the pull requests from the repository""" pr_quality = PullRequestQuality.objects.get(owner=owner, repo=repo) serializer = PullRequestQualitySerializer(pr_quality) custom_serialize...
the_stack_v2_python_sparse
hubcare/metrics/pull_request_metrics/acceptance_quality/views.py
fga-eps-mds/2019.1-hubcare-api
train
7
bf6972fd314884b665c3d9440a243468710a5e05
[ "assert label_name in ['Log10_Kd', 'Log10_Ki', 'KIBA']\nsuper(DTACollateFunc, self).__init__()\nself.graph_wrapper = graph_wrapper\nself.is_inference = is_inference\nself.label_name = label_name", "graph_list = []\nfor data in batch_data_list:\n atom_numeric_feat = np.concatenate([data['atom_degrees'], data['a...
<|body_start_0|> assert label_name in ['Log10_Kd', 'Log10_Ki', 'KIBA'] super(DTACollateFunc, self).__init__() self.graph_wrapper = graph_wrapper self.is_inference = is_inference self.label_name = label_name <|end_body_0|> <|body_start_1|> graph_list = [] for data...
DTACollateFunc
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DTACollateFunc: def __init__(self, graph_wrapper, label_name='Log10_Kd', is_inference=False): """Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper): graph wrapper for GNN. label_name (str): the key in the feed dictionary for the drug-target affinity...
stack_v2_sparse_classes_36k_train_001187
5,431
permissive
[ { "docstring": "Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper): graph wrapper for GNN. label_name (str): the key in the feed dictionary for the drug-target affinity. For Davis, it is `Log10_Kd`; For Kiba, it is `KIBA`. is_inference (bool): when its value is True, there...
2
stack_v2_sparse_classes_30k_train_002231
Implement the Python class `DTACollateFunc` described below. Class description: Implement the DTACollateFunc class. Method signatures and docstrings: - def __init__(self, graph_wrapper, label_name='Log10_Kd', is_inference=False): Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper...
Implement the Python class `DTACollateFunc` described below. Class description: Implement the DTACollateFunc class. Method signatures and docstrings: - def __init__(self, graph_wrapper, label_name='Log10_Kd', is_inference=False): Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper...
1c84ea6d51625d2d66b3eef1d9a7cc9a87c99e0e
<|skeleton|> class DTACollateFunc: def __init__(self, graph_wrapper, label_name='Log10_Kd', is_inference=False): """Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper): graph wrapper for GNN. label_name (str): the key in the feed dictionary for the drug-target affinity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DTACollateFunc: def __init__(self, graph_wrapper, label_name='Log10_Kd', is_inference=False): """Collate function for PGL dataloader. Args: graph_wrapper (pgl.graph_wrapper.GraphWrapper): graph wrapper for GNN. label_name (str): the key in the feed dictionary for the drug-target affinity. For Davis, i...
the_stack_v2_python_sparse
apps/drug_target_interaction/graph_dta/data_gen.py
RuikangSun/PaddleHelix
train
0
bc40cfc7bc8f8753a4e3cedc59275d134f924416
[ "rsp = apply(Response.Pdus.ResponsePdu, [], kwargs)\nrsp['request_id'] = self['request_id']\nrsp['variable_bindings'] = self['variable_bindings']\nreturn rsp", "if not isinstance(rspPdu, rfc1905.ResponsePdu):\n raise error.BadArgumentError('Incompatible types for comparation %s with %s' % (self.__class__.__nam...
<|body_start_0|> rsp = apply(Response.Pdus.ResponsePdu, [], kwargs) rsp['request_id'] = self['request_id'] rsp['variable_bindings'] = self['variable_bindings'] return rsp <|end_body_0|> <|body_start_1|> if not isinstance(rspPdu, rfc1905.ResponsePdu): raise error.BadA...
Request PDU specific
_RequestPduSpecifics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _RequestPduSpecifics: """Request PDU specific""" def reply(self, **kwargs): """Build and return a response PDU from this request PDU""" <|body_0|> def match(self, rspPdu): """Return true if response PDU matches request PDU""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_001188
10,163
no_license
[ { "docstring": "Build and return a response PDU from this request PDU", "name": "reply", "signature": "def reply(self, **kwargs)" }, { "docstring": "Return true if response PDU matches request PDU", "name": "match", "signature": "def match(self, rspPdu)" } ]
2
null
Implement the Python class `_RequestPduSpecifics` described below. Class description: Request PDU specific Method signatures and docstrings: - def reply(self, **kwargs): Build and return a response PDU from this request PDU - def match(self, rspPdu): Return true if response PDU matches request PDU
Implement the Python class `_RequestPduSpecifics` described below. Class description: Request PDU specific Method signatures and docstrings: - def reply(self, **kwargs): Build and return a response PDU from this request PDU - def match(self, rspPdu): Return true if response PDU matches request PDU <|skeleton|> class...
256401ac313df2e45c516af1a4d5398f54703b9c
<|skeleton|> class _RequestPduSpecifics: """Request PDU specific""" def reply(self, **kwargs): """Build and return a response PDU from this request PDU""" <|body_0|> def match(self, rspPdu): """Return true if response PDU matches request PDU""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _RequestPduSpecifics: """Request PDU specific""" def reply(self, **kwargs): """Build and return a response PDU from this request PDU""" rsp = apply(Response.Pdus.ResponsePdu, [], kwargs) rsp['request_id'] = self['request_id'] rsp['variable_bindings'] = self['variable_bindi...
the_stack_v2_python_sparse
pre/python/lib/python2.7/dist-packages/pysnmp/proto/v2c.py
ag1455/OpenPLi-PC
train
27
2618f18d67a90e3ae036457abb088c8c0294363f
[ "super(ISO, self).__init__()\nself.awsParams = awsParams\nself.logger = logger\nself.job = config\nself.fileUtilities = fileUtilities\nself.localTempDirectory = localTempDirectory\nself.ProcessISOs()", "for iso in self.job['iso_files']:\n self.logger.info('Processing iso: ' + iso['Name'])\n self.CleanFiles(...
<|body_start_0|> super(ISO, self).__init__() self.awsParams = awsParams self.logger = logger self.job = config self.fileUtilities = fileUtilities self.localTempDirectory = localTempDirectory self.ProcessISOs() <|end_body_0|> <|body_start_1|> for iso in se...
ISO handler
ISO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ISO: """ISO handler""" def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams): """Constructor for this class""" <|body_0|> def ProcessISOs(self): """loop through all the iso types in the config file and clean, remove header and load into...
stack_v2_sparse_classes_36k_train_001189
5,152
no_license
[ { "docstring": "Constructor for this class", "name": "__init__", "signature": "def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams)" }, { "docstring": "loop through all the iso types in the config file and clean, remove header and load into Redshift", "name": "Pro...
6
null
Implement the Python class `ISO` described below. Class description: ISO handler Method signatures and docstrings: - def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams): Constructor for this class - def ProcessISOs(self): loop through all the iso types in the config file and clean, remove...
Implement the Python class `ISO` described below. Class description: ISO handler Method signatures and docstrings: - def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams): Constructor for this class - def ProcessISOs(self): loop through all the iso types in the config file and clean, remove...
9ff48f61cfd4e0c5994ad3dabab3987255cea953
<|skeleton|> class ISO: """ISO handler""" def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams): """Constructor for this class""" <|body_0|> def ProcessISOs(self): """loop through all the iso types in the config file and clean, remove header and load into...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ISO: """ISO handler""" def __init__(self, logger, fileUtilities, localTempDirectory, config, awsParams): """Constructor for this class""" super(ISO, self).__init__() self.awsParams = awsParams self.logger = logger self.job = config self.fileUtilities = file...
the_stack_v2_python_sparse
EAA_Dataloader/src/Applications/PGCRISO/ISO.py
eulertech/backup
train
0
aa111b2bb6627e11b479cd5b986e182b36b01c98
[ "send_url = self.get_peizhi_('Login', yaml_ming='yilou_fangdong.yaml')\nsend_url = send_url['send_verifcode']\nlogging.info('url is %s' % send_url)\ndict_send = {'mobile': mobile}\nresponse = self.request_post(send_url, dict_send)\nlogging.info(response)\nyanzhengma = self.get_YanZhengMa(mobile)\nif yanzhengma != N...
<|body_start_0|> send_url = self.get_peizhi_('Login', yaml_ming='yilou_fangdong.yaml') send_url = send_url['send_verifcode'] logging.info('url is %s' % send_url) dict_send = {'mobile': mobile} response = self.request_post(send_url, dict_send) logging.info(response) ...
登录
Login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: """登录""" def login(self, mobile): """denglu""" <|body_0|> def send_verifcode(self, mobile): """发送验证码""" <|body_1|> def shuru_yanzhengma(self, mobile, Code): """输入验证码""" <|body_2|> <|end_skeleton|> <|body_start_0|> sen...
stack_v2_sparse_classes_36k_train_001190
3,124
no_license
[ { "docstring": "denglu", "name": "login", "signature": "def login(self, mobile)" }, { "docstring": "发送验证码", "name": "send_verifcode", "signature": "def send_verifcode(self, mobile)" }, { "docstring": "输入验证码", "name": "shuru_yanzhengma", "signature": "def shuru_yanzhengma(...
3
null
Implement the Python class `Login` described below. Class description: 登录 Method signatures and docstrings: - def login(self, mobile): denglu - def send_verifcode(self, mobile): 发送验证码 - def shuru_yanzhengma(self, mobile, Code): 输入验证码
Implement the Python class `Login` described below. Class description: 登录 Method signatures and docstrings: - def login(self, mobile): denglu - def send_verifcode(self, mobile): 发送验证码 - def shuru_yanzhengma(self, mobile, Code): 输入验证码 <|skeleton|> class Login: """登录""" def login(self, mobile): """den...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class Login: """登录""" def login(self, mobile): """denglu""" <|body_0|> def send_verifcode(self, mobile): """发送验证码""" <|body_1|> def shuru_yanzhengma(self, mobile, Code): """输入验证码""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Login: """登录""" def login(self, mobile): """denglu""" send_url = self.get_peizhi_('Login', yaml_ming='yilou_fangdong.yaml') send_url = send_url['send_verifcode'] logging.info('url is %s' % send_url) dict_send = {'mobile': mobile} response = self.request_pos...
the_stack_v2_python_sparse
public/aYiLou_fangdong/yilou_fangdong_business/fangdongduan_login__.py
GSIL-Monitor/mrbao_python
train
0
cd8bef09dad13b5d09caf15c25b217c00d78559d
[ "try:\n user = self.get_user_from_session()\n vote = model.Vote()\n vote.from_json(self.request.body)\n vote.owner_user_id = user.key().id()\n voteExist = model.Vote.all().filter('owner_user_id =', user.key().id()).filter('photo_id =', vote.photo_id).get()\n if voteExist is None:\n photo = ...
<|body_start_0|> try: user = self.get_user_from_session() vote = model.Vote() vote.from_json(self.request.body) vote.owner_user_id = user.key().id() voteExist = model.Vote.all().filter('owner_user_id =', user.key().id()).filter('photo_id =', vote.photo...
Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes
VotesHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VotesHandler: """Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes""" def put(self): """Exposed as `PUT /api/votes`. Takes a request payload that is a JSON object containing the Photo ID for wh...
stack_v2_sparse_classes_36k_train_001191
32,317
no_license
[ { "docstring": "Exposed as `PUT /api/votes`. Takes a request payload that is a JSON object containing the Photo ID for which the currently logged in user is voting. { 'photoId':0 } Returns the following JSON response representing the Photo for which the User voted. { 'id':0, 'ownerUserId':0, 'ownerDisplayName':...
2
stack_v2_sparse_classes_30k_test_000878
Implement the Python class `VotesHandler` described below. Class description: Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes Method signatures and docstrings: - def put(self): Exposed as `PUT /api/votes`. Takes a request pay...
Implement the Python class `VotesHandler` described below. Class description: Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes Method signatures and docstrings: - def put(self): Exposed as `PUT /api/votes`. Takes a request pay...
f236a8cd20af89e889caf1049217fdbb5c45e536
<|skeleton|> class VotesHandler: """Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes""" def put(self): """Exposed as `PUT /api/votes`. Takes a request payload that is a JSON object containing the Photo ID for wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VotesHandler: """Provides an API for working with Votes. This servlet provides the /api/votes end-point, and exposes the following operations: PUT /api/votes""" def put(self): """Exposed as `PUT /api/votes`. Takes a request payload that is a JSON object containing the Photo ID for which the curre...
the_stack_v2_python_sparse
handlers.py
creationexus/django-x
train
0
b0b855afb7ccd41f4eb013dae28fabd70bc7d699
[ "carry = 1\nfor index in xrange(len(digits) - 1, -1, -1):\n sum = digits[index] + carry\n carry = sum / 10\n digits[index] = sum % 10\nif carry == 1:\n digits = [1] + digits\nreturn digits", "for i in xrange(len(digits) - 1, -1, -1):\n if digits[i] < 9:\n digits[i] = digits[i] + 1\n r...
<|body_start_0|> carry = 1 for index in xrange(len(digits) - 1, -1, -1): sum = digits[index] + carry carry = sum / 10 digits[index] = sum % 10 if carry == 1: digits = [1] + digits return digits <|end_body_0|> <|body_start_1|> for i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne_better(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> carry = 1 for inde...
stack_v2_sparse_classes_36k_train_001192
988
no_license
[ { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne", "signature": "def plusOne(self, digits)" }, { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne_better", "signature": "def plusOne_better(self, digits)" } ]
2
stack_v2_sparse_classes_30k_train_007759
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne_better(self, digits): :type digits: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne_better(self, digits): :type digits: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
a2cd0dc5e098080df87c4fb57d16877d21ca47a3
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne_better(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" carry = 1 for index in xrange(len(digits) - 1, -1, -1): sum = digits[index] + carry carry = sum / 10 digits[index] = sum % 10 if carry == 1: digi...
the_stack_v2_python_sparse
0066_Plus_One/solution.py
benjaminhuanghuang/ben-leetcode
train
1
fed00da94dba24da15f00ee5aca3fb5ae305036c
[ "super().__init__()\nself.df = df\nself.indices = indices\nself.ratio_ben, self.ratio_mal, self.round = params\nself.model_name = model_name\nself.divide_fun = divide_fun\nself.n_jobs = n_jobs\nself.res_dir = res_dir\nself.compute_conf_score = compute_conf_score\nid = '{}-{}-{}'.format(self.ratio_ben, self.ratio_ma...
<|body_start_0|> super().__init__() self.df = df self.indices = indices self.ratio_ben, self.ratio_mal, self.round = params self.model_name = model_name self.divide_fun = divide_fun self.n_jobs = n_jobs self.res_dir = res_dir self.compute_conf_scor...
Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Message content is ignored.
ConsumerActor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsumerActor: """Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Message content is ignored.""" def __...
stack_v2_sparse_classes_36k_train_001193
3,186
no_license
[ { "docstring": ":param df: tuple of pandas dataframe :param indices: store indices for four sets of packed_benign, unpacked_benign, packed_malicious, unpacked_malicious :param params: tuple of ratio of packed benign, ratio of packed malicious, experiment round :param model_name: name of the sklearn model used :...
3
stack_v2_sparse_classes_30k_train_020224
Implement the Python class `ConsumerActor` described below. Class description: Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Mes...
Implement the Python class `ConsumerActor` described below. Class description: Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Mes...
f8424953618e154f52ec95a0d36522168b5cea97
<|skeleton|> class ConsumerActor: """Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Message content is ignored.""" def __...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsumerActor: """Implement a thread as Actor. When instantiated ConsumerActor().start(df, params, model_name, divide_fun) the class stores the parameters needed for the experiment. Everytime a message is received the actor starts running the experiment. Message content is ignored.""" def __init__(self, ...
the_stack_v2_python_sparse
code/experiments/actor.py
Tor4k/packware
train
0
f16b951c35b410045d6365249567f6f730a3c0bb
[ "inherited_attributes = OrderedDict()\nfor base_ in bases:\n if hasattr(base_, 'declared_attrs'):\n inherited_attributes.update(copy(getattr(base_, 'declared_attrs')))\nattributes = OrderedDict()\nfor key in sorted(cls_attrs.keys()):\n if isinstance(cls_attrs[key], AttributeBase):\n attributes[k...
<|body_start_0|> inherited_attributes = OrderedDict() for base_ in bases: if hasattr(base_, 'declared_attrs'): inherited_attributes.update(copy(getattr(base_, 'declared_attrs'))) attributes = OrderedDict() for key in sorted(cls_attrs.keys()): if is...
Turns boring classes into magical, declarative style models!
_ModelMeta
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ModelMeta: """Turns boring classes into magical, declarative style models!""" def __new__(mcs, name, bases, cls_attrs): """Metaclasses are classes for classes... which means this method is responsible for creating a new class. That means we can hijack the class declaration to do mag...
stack_v2_sparse_classes_36k_train_001194
8,344
permissive
[ { "docstring": "Metaclasses are classes for classes... which means this method is responsible for creating a new class. That means we can hijack the class declaration to do magical things... :param name: The name of the class being declared :param bases: The base classes the class is being declared with :param ...
2
stack_v2_sparse_classes_30k_train_005782
Implement the Python class `_ModelMeta` described below. Class description: Turns boring classes into magical, declarative style models! Method signatures and docstrings: - def __new__(mcs, name, bases, cls_attrs): Metaclasses are classes for classes... which means this method is responsible for creating a new class....
Implement the Python class `_ModelMeta` described below. Class description: Turns boring classes into magical, declarative style models! Method signatures and docstrings: - def __new__(mcs, name, bases, cls_attrs): Metaclasses are classes for classes... which means this method is responsible for creating a new class....
c0f371e846806c43b435457e1e2a2a70f6787409
<|skeleton|> class _ModelMeta: """Turns boring classes into magical, declarative style models!""" def __new__(mcs, name, bases, cls_attrs): """Metaclasses are classes for classes... which means this method is responsible for creating a new class. That means we can hijack the class declaration to do mag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ModelMeta: """Turns boring classes into magical, declarative style models!""" def __new__(mcs, name, bases, cls_attrs): """Metaclasses are classes for classes... which means this method is responsible for creating a new class. That means we can hijack the class declaration to do magical things.....
the_stack_v2_python_sparse
soql/model.py
plangrid/soql
train
21
d3dcd82fe22869609945cb73474af1c159388268
[ "if role_str == 'edit':\n return Role.edit\nif role_str == 'install':\n return Role.install\nif role_str == 'view':\n return Role.view\nreturn Role.denied", "if role == Role.edit:\n return 'edit'\nif role == Role.install:\n return 'install'\nif role == Role.view:\n return 'view'\nreturn 'denied'...
<|body_start_0|> if role_str == 'edit': return Role.edit if role_str == 'install': return Role.install if role_str == 'view': return Role.view return Role.denied <|end_body_0|> <|body_start_1|> if role == Role.edit: return 'edit' ...
Defines types of action a user can perform on a team and or project
Role
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Role: """Defines types of action a user can perform on a team and or project""" def from_str(role_str): """Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role)""" <|body_0|> def to_str(role): """Convert a Role ...
stack_v2_sparse_classes_36k_train_001195
3,240
no_license
[ { "docstring": "Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role)", "name": "from_str", "signature": "def from_str(role_str)" }, { "docstring": "Convert a Role object into a string. Args: role: (Role) Returns: (str)", "name": "to_str", ...
2
stack_v2_sparse_classes_30k_train_014994
Implement the Python class `Role` described below. Class description: Defines types of action a user can perform on a team and or project Method signatures and docstrings: - def from_str(role_str): Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role) - def to_str(r...
Implement the Python class `Role` described below. Class description: Defines types of action a user can perform on a team and or project Method signatures and docstrings: - def from_str(role_str): Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role) - def to_str(r...
ff1feea27efa6544c0e443b953951bb50cbdd9bb
<|skeleton|> class Role: """Defines types of action a user can perform on a team and or project""" def from_str(role_str): """Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role)""" <|body_0|> def to_str(role): """Convert a Role ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Role: """Defines types of action a user can perform on a team and or project""" def from_str(role_str): """Convert a string into a Role object Args: role_str: (str) String representation of a Role Returns: (Role)""" if role_str == 'edit': return Role.edit if role_str =...
the_stack_v2_python_sparse
seeweb/models/auth.py
pradal/seeweb
train
0
f9a4ae7a6bd753634912d17fc90a0107215a7fc4
[ "st = set()\nfor i in nums:\n if i in st:\n st.discard(i)\n else:\n st.add(i)\nreturn list(st)", "xor = reduce(lambda a, b: a ^ b, nums)\nxor &= -xor\nres = [0, 0]\nfor n in nums:\n if n & xor == 0:\n res[0] ^= n\n else:\n res[1] ^= n\nreturn res" ]
<|body_start_0|> st = set() for i in nums: if i in st: st.discard(i) else: st.add(i) return list(st) <|end_body_0|> <|body_start_1|> xor = reduce(lambda a, b: a ^ b, nums) xor &= -xor res = [0, 0] for n in n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> st = set() for i in num...
stack_v2_sparse_classes_36k_train_001196
791
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber", "signature": "def singleNumber(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_019214
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: d...
3b16c72d9361c4bb063e4b2789db695f1e0149bf
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" st = set() for i in nums: if i in st: st.discard(i) else: st.add(i) return list(st) def singleNumber(self, nums): """:type ...
the_stack_v2_python_sparse
single_number3.py
bingh0616/algorithms
train
1
5a5d1c152592e4f6bd4de88ddd6659a917fde0fe
[ "print(f'Running test: {description}')\nnumber_of_qubits = len(valid_states[0])\nnumber_of_valid_states = len(valid_states)\nmeasurement = program.declare('ro', 'BIT', number_of_qubits)\nfor i in range(0, number_of_qubits):\n program += MEASURE(qubits[i], measurement[i])\nassigned_program = address_qubits(progra...
<|body_start_0|> print(f'Running test: {description}') number_of_qubits = len(valid_states[0]) number_of_valid_states = len(valid_states) measurement = program.declare('ro', 'BIT', number_of_qubits) for i in range(0, number_of_qubits): program += MEASURE(qubits[i], me...
This class contains some basic tests to show how Forest deals with entanglement.
EntanglementTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntanglementTests: """This class contains some basic tests to show how Forest deals with entanglement.""" def run_test(self, description, program, qubits, iterations, valid_states): """Runs a given program as a unit test, measuring the results and ensuring that the resulting state ma...
stack_v2_sparse_classes_36k_train_001197
7,424
permissive
[ { "docstring": "Runs a given program as a unit test, measuring the results and ensuring that the resulting state matches one of the provided target states. Parameters: description (str): A human-readable description of the test, which will be printed to the log. program (Program): The program to run during the ...
5
stack_v2_sparse_classes_30k_train_002047
Implement the Python class `EntanglementTests` described below. Class description: This class contains some basic tests to show how Forest deals with entanglement. Method signatures and docstrings: - def run_test(self, description, program, qubits, iterations, valid_states): Runs a given program as a unit test, measu...
Implement the Python class `EntanglementTests` described below. Class description: This class contains some basic tests to show how Forest deals with entanglement. Method signatures and docstrings: - def run_test(self, description, program, qubits, iterations, valid_states): Runs a given program as a unit test, measu...
941488f8f8a81a4b7d7fe28414ce14fa478a692a
<|skeleton|> class EntanglementTests: """This class contains some basic tests to show how Forest deals with entanglement.""" def run_test(self, description, program, qubits, iterations, valid_states): """Runs a given program as a unit test, measuring the results and ensuring that the resulting state ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntanglementTests: """This class contains some basic tests to show how Forest deals with entanglement.""" def run_test(self, description, program, qubits, iterations, valid_states): """Runs a given program as a unit test, measuring the results and ensuring that the resulting state matches one of ...
the_stack_v2_python_sparse
Forest/ForestFundamentals/entanglement.py
taibah/qsfe
train
0
9844f087896c578baa46c72c26a27d81f030285d
[ "self.steps = self.steps + 1\npercept = s.percept(self.steps, 'l')\nif percept:\n print('Shore reached')\nelse:\n self.move_right()", "self.steps = self.steps + 1\npercept = s.percept(self.steps, 'r')\nif percept:\n print('Shore reached')\nelse:\n self.move_left()" ]
<|body_start_0|> self.steps = self.steps + 1 percept = s.percept(self.steps, 'l') if percept: print('Shore reached') else: self.move_right() <|end_body_0|> <|body_start_1|> self.steps = self.steps + 1 percept = s.percept(self.steps, 'r') i...
Class that defines agent
agent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class agent: """Class that defines agent""" def move_left(self): """Perform action moves left""" <|body_0|> def move_right(self): """Perform action move right""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.steps = self.steps + 1 percept ...
stack_v2_sparse_classes_36k_train_001198
2,091
no_license
[ { "docstring": "Perform action moves left", "name": "move_left", "signature": "def move_left(self)" }, { "docstring": "Perform action move right", "name": "move_right", "signature": "def move_right(self)" } ]
2
stack_v2_sparse_classes_30k_train_000705
Implement the Python class `agent` described below. Class description: Class that defines agent Method signatures and docstrings: - def move_left(self): Perform action moves left - def move_right(self): Perform action move right
Implement the Python class `agent` described below. Class description: Class that defines agent Method signatures and docstrings: - def move_left(self): Perform action moves left - def move_right(self): Perform action move right <|skeleton|> class agent: """Class that defines agent""" def move_left(self): ...
5d903a90a9f6bf9862145d51d14322b75d297f0a
<|skeleton|> class agent: """Class that defines agent""" def move_left(self): """Perform action moves left""" <|body_0|> def move_right(self): """Perform action move right""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class agent: """Class that defines agent""" def move_left(self): """Perform action moves left""" self.steps = self.steps + 1 percept = s.percept(self.steps, 'l') if percept: print('Shore reached') else: self.move_right() def move_right(self):...
the_stack_v2_python_sparse
ailab_in/week1/lab1/LAB1_P1.py
iamrajee/AI_lab
train
4
18aff7108ae0acf145fef485287a630f45124200
[ "def add(n1, n2, c):\n r = n1 + n2 + c\n return (r % 10, r / 10)\ndummy = ListNode(None)\np, p1, p2 = (dummy, l1, l2)\nc = 0\nwhile p1 and p2:\n r, c = add(p1.val, p2.val, c)\n p.next = ListNode(r)\n p, p1, p2 = (p.next, p1.next, p2.next)\np1 = p1 if p1 else p2\nwhile p1:\n r, c = add(p1.val, 0, c...
<|body_start_0|> def add(n1, n2, c): r = n1 + n2 + c return (r % 10, r / 10) dummy = ListNode(None) p, p1, p2 = (dummy, l1, l2) c = 0 while p1 and p2: r, c = add(p1.val, p2.val, c) p.next = ListNode(r) p, p1, p2 = (p.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001199
1,834
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers2", "signature": "def addTwoNumbers2(self, l1...
2
stack_v2_sparse_classes_30k_train_003856
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
33b6b68a8136109d2aaa26bb8bf9e873f995d5ab
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" def add(n1, n2, c): r = n1 + n2 + c return (r % 10, r / 10) dummy = ListNode(None) p, p1, p2 = (dummy, l1, l2) c = 0 while p1 and p2: ...
the_stack_v2_python_sparse
python2/l0002_add_two_numbers.py
sprax/1337
train
0