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
c4b90b070da3eecd558f03896fdff1bcb0a6f500
[ "def MockedOpen(requested_path, mode='rb'):\n try:\n fixture_path = os.path.join(self.base_path, 'VFSFixture', requested_path.lstrip('/'))\n return builtins.open.old_target(fixture_path, mode)\n except IOError:\n return builtins.open.old_target(requested_path, mode)\nwith utils.MultiStubb...
<|body_start_0|> def MockedOpen(requested_path, mode='rb'): try: fixture_path = os.path.join(self.base_path, 'VFSFixture', requested_path.lstrip('/')) return builtins.open.old_target(fixture_path, mode) except IOError: return builtins.open....
LinuxOnlyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinuxOnlyTest: def testEnumerateUsersLinux(self): """Enumerate users from the wtmp file.""" <|body_0|> def testEnumerateFilesystemsLinux(self): """Enumerate filesystems.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def MockedOpen(requested_path, ...
stack_v2_sparse_classes_36k_train_027700
2,429
permissive
[ { "docstring": "Enumerate users from the wtmp file.", "name": "testEnumerateUsersLinux", "signature": "def testEnumerateUsersLinux(self)" }, { "docstring": "Enumerate filesystems.", "name": "testEnumerateFilesystemsLinux", "signature": "def testEnumerateFilesystemsLinux(self)" } ]
2
null
Implement the Python class `LinuxOnlyTest` described below. Class description: Implement the LinuxOnlyTest class. Method signatures and docstrings: - def testEnumerateUsersLinux(self): Enumerate users from the wtmp file. - def testEnumerateFilesystemsLinux(self): Enumerate filesystems.
Implement the Python class `LinuxOnlyTest` described below. Class description: Implement the LinuxOnlyTest class. Method signatures and docstrings: - def testEnumerateUsersLinux(self): Enumerate users from the wtmp file. - def testEnumerateFilesystemsLinux(self): Enumerate filesystems. <|skeleton|> class LinuxOnlyTe...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class LinuxOnlyTest: def testEnumerateUsersLinux(self): """Enumerate users from the wtmp file.""" <|body_0|> def testEnumerateFilesystemsLinux(self): """Enumerate filesystems.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinuxOnlyTest: def testEnumerateUsersLinux(self): """Enumerate users from the wtmp file.""" def MockedOpen(requested_path, mode='rb'): try: fixture_path = os.path.join(self.base_path, 'VFSFixture', requested_path.lstrip('/')) return builtins.open.old...
the_stack_v2_python_sparse
grr/client/grr_response_client/client_actions/linux/linux_test.py
google/grr
train
4,683
7b03886651aed082dbce29f2c2b6121a3af1a264
[ "ports = []\nfor start, end in self.term.destination_port:\n if start == end:\n ports.append(str(start))\n else:\n ports.append('%d-%d' % (start, end))\nreturn ports", "settings = [str(x) for x in self.term.logging]\nif any((value in settings for value in ['true', 'True'])):\n return True\n...
<|body_start_0|> ports = [] for start, end in self.term.destination_port: if start == end: ports.append(str(start)) else: ports.append('%d-%d' % (start, end)) return ports <|end_body_0|> <|body_start_1|> settings = [str(x) for x in...
A Term object.
Term
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Term: """A Term object.""" def _GetPorts(self): """Return a port or port range in string format.""" <|body_0|> def _GetLoggingSetting(self): """Return true if a term indicates that logging is desired.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027701
5,001
permissive
[ { "docstring": "Return a port or port range in string format.", "name": "_GetPorts", "signature": "def _GetPorts(self)" }, { "docstring": "Return true if a term indicates that logging is desired.", "name": "_GetLoggingSetting", "signature": "def _GetLoggingSetting(self)" } ]
2
stack_v2_sparse_classes_30k_train_004351
Implement the Python class `Term` described below. Class description: A Term object. Method signatures and docstrings: - def _GetPorts(self): Return a port or port range in string format. - def _GetLoggingSetting(self): Return true if a term indicates that logging is desired.
Implement the Python class `Term` described below. Class description: A Term object. Method signatures and docstrings: - def _GetPorts(self): Return a port or port range in string format. - def _GetLoggingSetting(self): Return true if a term indicates that logging is desired. <|skeleton|> class Term: """A Term o...
d145ca447e0e04895507777b8c5834c22e90df11
<|skeleton|> class Term: """A Term object.""" def _GetPorts(self): """Return a port or port range in string format.""" <|body_0|> def _GetLoggingSetting(self): """Return true if a term indicates that logging is desired.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Term: """A Term object.""" def _GetPorts(self): """Return a port or port range in string format.""" ports = [] for start, end in self.term.destination_port: if start == end: ports.append(str(start)) else: ports.append('%d-%d'...
the_stack_v2_python_sparse
capirca/lib/gcp.py
google/capirca
train
743
a58c9f6bb4db8cb3b604763a3cd1f1912c62c83b
[ "self.datatype = datatype\nself.datarange = datarange\nself.num = num\nself.strlen = strlen\nself.myclient = pymongo.MongoClient(ad)\nself.db = self.myclient[client_name]\nself.db_first = self.db[set_name]", "@wraps(func)\ndef wrapper(*args, **kwargs):\n self.getmongo()\n return func(*args, **kwargs)\nretur...
<|body_start_0|> self.datatype = datatype self.datarange = datarange self.num = num self.strlen = strlen self.myclient = pymongo.MongoClient(ad) self.db = self.myclient[client_name] self.db_first = self.db[set_name] <|end_body_0|> <|body_start_1|> @wraps(...
Attentions: This is a decorated class, you may use it by '@'
Random_mongo_gener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Random_mongo_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, ad, client_name, set_name, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- ad: the adress of your MongoDB server, default is mon...
stack_v2_sparse_classes_36k_train_027702
4,162
no_license
[ { "docstring": "Introduction ------------ constructor Parameters ---------- ad: the adress of your MongoDB server, default is mongodb://localhost:27017/ client_name: the name of your client of MongoDB set_name: the name of your dataset of MongoDB datatype: the type of the random data you need, it now only suppo...
3
null
Implement the Python class `Random_mongo_gener` described below. Class description: Attentions: This is a decorated class, you may use it by '@' Method signatures and docstrings: - def __init__(self, ad, client_name, set_name, datatype, datarange, num, strlen): Introduction ------------ constructor Parameters -------...
Implement the Python class `Random_mongo_gener` described below. Class description: Attentions: This is a decorated class, you may use it by '@' Method signatures and docstrings: - def __init__(self, ad, client_name, set_name, datatype, datarange, num, strlen): Introduction ------------ constructor Parameters -------...
661dba7ea846859056fd6ee7a310d352ca178e98
<|skeleton|> class Random_mongo_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, ad, client_name, set_name, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- ad: the adress of your MongoDB server, default is mon...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Random_mongo_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, ad, client_name, set_name, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- ad: the adress of your MongoDB server, default is mongodb://localh...
the_stack_v2_python_sparse
包亦航2018011890/The_final_edition_of_all_the_homework/Random_filter_mongo(fourth_homework)/Random_mongo_gener.py
wanghan79/2020_Python
train
4
c2238e9fa6aaa593827f8f977f44b5ef64d72779
[ "flag_seed = False\nif seed is None:\n if dimension is None or n_chains is None:\n raise ValueError('UQpy: Either `seed` or `dimension` and `n_chains` must be provided.')\n flag_seed = True\nself.nsamples = nsamples\nself.nsamples_per_chain = nsamples_per_chain\nsuper().__init__(pdf_target=pdf_target, ...
<|body_start_0|> flag_seed = False if seed is None: if dimension is None or n_chains is None: raise ValueError('UQpy: Either `seed` or `dimension` and `n_chains` must be provided.') flag_seed = True self.nsamples = nsamples self.nsamples_per_chain ...
Stretch
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stretch: def __init__(self, pdf_target: Union[Callable, list[Callable]]=None, log_pdf_target: Union[Callable, list[Callable]]=None, args_target: tuple=None, burn_length: Annotated[int, Is[lambda x: x >= 0]]=0, jump: PositiveInteger=1, dimension: int=None, seed: list=None, save_log_pdf: bool=Fals...
stack_v2_sparse_classes_36k_train_027703
8,369
permissive
[ { "docstring": "Affine-invariant sampler with Stretch moves, parallel implementation. :cite:`Stretch1` :cite:`Stretch2` :param pdf_target: Target density function from which to draw random samples. Either `pdf_target` or `log_pdf_target` must be provided (the latter should be preferred for better numerical stab...
2
null
Implement the Python class `Stretch` described below. Class description: Implement the Stretch class. Method signatures and docstrings: - def __init__(self, pdf_target: Union[Callable, list[Callable]]=None, log_pdf_target: Union[Callable, list[Callable]]=None, args_target: tuple=None, burn_length: Annotated[int, Is[l...
Implement the Python class `Stretch` described below. Class description: Implement the Stretch class. Method signatures and docstrings: - def __init__(self, pdf_target: Union[Callable, list[Callable]]=None, log_pdf_target: Union[Callable, list[Callable]]=None, args_target: tuple=None, burn_length: Annotated[int, Is[l...
9e98a6279aa5a2ec2d6d4c61226c34712547bcc6
<|skeleton|> class Stretch: def __init__(self, pdf_target: Union[Callable, list[Callable]]=None, log_pdf_target: Union[Callable, list[Callable]]=None, args_target: tuple=None, burn_length: Annotated[int, Is[lambda x: x >= 0]]=0, jump: PositiveInteger=1, dimension: int=None, seed: list=None, save_log_pdf: bool=Fals...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stretch: def __init__(self, pdf_target: Union[Callable, list[Callable]]=None, log_pdf_target: Union[Callable, list[Callable]]=None, args_target: tuple=None, burn_length: Annotated[int, Is[lambda x: x >= 0]]=0, jump: PositiveInteger=1, dimension: int=None, seed: list=None, save_log_pdf: bool=False, concatenate...
the_stack_v2_python_sparse
src/UQpy/sampling/mcmc/Stretch.py
SURGroup/UQpy
train
215
1bef22617f313d3b5a3e2f18dbf6dc44db1bf8c1
[ "self.k = k\nself.que = nums\nheapq.heapify(self.que)", "heapq.heappush(self.que, val)\nwhile len(self.que) > self.k:\n heapq.heappop(self.que)\nreturn self.que[0]" ]
<|body_start_0|> self.k = k self.que = nums heapq.heapify(self.que) <|end_body_0|> <|body_start_1|> heapq.heappush(self.que, val) while len(self.que) > self.k: heapq.heappop(self.que) return self.que[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.que = nums heapq.heapify(s...
stack_v2_sparse_classes_36k_train_027704
3,461
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_test_000700
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
bec26b74d7848747cc3751ae2ed23104ada6dc0f
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.que = nums heapq.heapify(self.que) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.que, val) while len(self.que) > self.k: ...
the_stack_v2_python_sparse
Algorithms/No.703-Kth Largest Element in a Stream.py
zongzhicheng/LeetCode
train
0
c34da0717f7d210842cdbd34e6cf8c2c3dbfcfdc
[ "try:\n last_data = Data.objects.values('station').annotate(latest_id=Max('id'))\n ids = [d.get('latest_id') for d in last_data]\n data = Data.objects.filter(station__active=True, id__in=ids).order_by('station__name')\n serializer = RealtimeDataSerializer(data, many=True, context={'request': request})\n...
<|body_start_0|> try: last_data = Data.objects.values('station').annotate(latest_id=Max('id')) ids = [d.get('latest_id') for d in last_data] data = Data.objects.filter(station__active=True, id__in=ids).order_by('station__name') serializer = RealtimeDataSerializer(...
Realtime last data Fetches only the last measured data of each station
LastRealtimeDataViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LastRealtimeDataViewSet: """Realtime last data Fetches only the last measured data of each station""" def list(self, request): """Gets the last fetched data""" <|body_0|> def retrieve(self, request, pk=None): """Gets the last fetched data for the given station"""...
stack_v2_sparse_classes_36k_train_027705
8,606
no_license
[ { "docstring": "Gets the last fetched data", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Gets the last fetched data for the given station", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
null
Implement the Python class `LastRealtimeDataViewSet` described below. Class description: Realtime last data Fetches only the last measured data of each station Method signatures and docstrings: - def list(self, request): Gets the last fetched data - def retrieve(self, request, pk=None): Gets the last fetched data for...
Implement the Python class `LastRealtimeDataViewSet` described below. Class description: Realtime last data Fetches only the last measured data of each station Method signatures and docstrings: - def list(self, request): Gets the last fetched data - def retrieve(self, request, pk=None): Gets the last fetched data for...
a6becc62eaf5c96e146431631c0d081600e7c5d3
<|skeleton|> class LastRealtimeDataViewSet: """Realtime last data Fetches only the last measured data of each station""" def list(self, request): """Gets the last fetched data""" <|body_0|> def retrieve(self, request, pk=None): """Gets the last fetched data for the given station"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LastRealtimeDataViewSet: """Realtime last data Fetches only the last measured data of each station""" def list(self, request): """Gets the last fetched data""" try: last_data = Data.objects.values('station').annotate(latest_id=Max('id')) ids = [d.get('latest_id') f...
the_stack_v2_python_sparse
torinometeo/realtime/views/api.py
TorinoMeteo/tm-website
train
0
8d8cbc2d7d526ef646f3a236d44f9af1bd7ead27
[ "self.window_size = window_size\nself.history_size = history_size\nself.msgs = dict()\nself.history = [[] for _ in range(history_size)]", "mid: Tuple[bytes, bytes] = (msg.seqno, msg.from_id)\nself.msgs[mid] = msg\nself.history[0].append(CacheEntry(mid, msg.topicIDs))", "if mid in self.msgs:\n return self.msg...
<|body_start_0|> self.window_size = window_size self.history_size = history_size self.msgs = dict() self.history = [[] for _ in range(history_size)] <|end_body_0|> <|body_start_1|> mid: Tuple[bytes, bytes] = (msg.seqno, msg.from_id) self.msgs[mid] = msg self.hist...
MessageCache
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" <|body_0|> def put(self, msg: rpc_pb2.Message) -> Non...
stack_v2_sparse_classes_36k_train_027706
2,953
permissive
[ { "docstring": "Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache", "name": "__init__", "signature": "def __init__(self, window_size: int, history_size: int) -> None" }, { "docstring": "Put a message into the ...
5
null
Implement the Python class `MessageCache` described below. Class description: Implement the MessageCache class. Method signatures and docstrings: - def __init__(self, window_size: int, history_size: int) -> None: Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history des...
Implement the Python class `MessageCache` described below. Class description: Implement the MessageCache class. Method signatures and docstrings: - def __init__(self, window_size: int, history_size: int) -> None: Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history des...
b38b36862f44421aec998e438b668cff265de75c
<|skeleton|> class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" <|body_0|> def put(self, msg: rpc_pb2.Message) -> Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" self.window_size = window_size self.history_size = history_size ...
the_stack_v2_python_sparse
libp2p/pubsub/mcache.py
libp2p/py-libp2p
train
399
02870e6291030b2e797dd98e6c4e742f5b4cd94a
[ "n = len(a)\nm = len(b)\nif n > m:\n b = '0' * (n - m) + b\nelif n < m:\n a = '0' * (m - n) + a\ncarry = 0\nout = list()\nfor x, y in zip(reversed(a), reversed(b)):\n s = int(x) + int(y) + carry\n out.insert(0, str(s % 2))\n carry = s // 2\nif carry > 0:\n out.insert(0, '1')\nreturn ''.join(out)",...
<|body_start_0|> n = len(a) m = len(b) if n > m: b = '0' * (n - m) + b elif n < m: a = '0' * (m - n) + a carry = 0 out = list() for x, y in zip(reversed(a), reversed(b)): s = int(x) + int(y) + carry out.insert(0, str...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBinary_v1(self, a: str, b: str) -> str: """Procss at the character level.""" <|body_0|> def addBinary_v2(self, a: str, b: str) -> str: """Use itertools.zip_longest""" <|body_1|> def addBinary_v3(self, a: str, b: str) -> str: """C...
stack_v2_sparse_classes_36k_train_027707
2,099
no_license
[ { "docstring": "Procss at the character level.", "name": "addBinary_v1", "signature": "def addBinary_v1(self, a: str, b: str) -> str" }, { "docstring": "Use itertools.zip_longest", "name": "addBinary_v2", "signature": "def addBinary_v2(self, a: str, b: str) -> str" }, { "docstrin...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary_v1(self, a: str, b: str) -> str: Procss at the character level. - def addBinary_v2(self, a: str, b: str) -> str: Use itertools.zip_longest - def addBinary_v3(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary_v1(self, a: str, b: str) -> str: Procss at the character level. - def addBinary_v2(self, a: str, b: str) -> str: Use itertools.zip_longest - def addBinary_v3(self, ...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def addBinary_v1(self, a: str, b: str) -> str: """Procss at the character level.""" <|body_0|> def addBinary_v2(self, a: str, b: str) -> str: """Use itertools.zip_longest""" <|body_1|> def addBinary_v3(self, a: str, b: str) -> str: """C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addBinary_v1(self, a: str, b: str) -> str: """Procss at the character level.""" n = len(a) m = len(b) if n > m: b = '0' * (n - m) + b elif n < m: a = '0' * (m - n) + a carry = 0 out = list() for x, y in zip(r...
the_stack_v2_python_sparse
python3/string_array/add_binary.py
victorchu/algorithms
train
0
400f13836414d7042113e33413fa78a61ed73576
[ "super().__init__()\nimport sklearn\nimport sklearn.svm\nself.model = sklearn.svm.LinearSVC", "specs = super(LinearSVC, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{LinearSVC} \\\\textit{Linear Support Vector Classification} is\\n similar to SVC with parameter kern...
<|body_start_0|> super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.LinearSVC <|end_body_0|> <|body_start_1|> specs = super(LinearSVC, cls).getInputSpecification() specs.description = 'The \\xmlNode{LinearSVC} \\textit{Linear Support Vector Cla...
Linear Support Vector Classifier
LinearSVC
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearSVC: """Linear Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that ...
stack_v2_sparse_classes_36k_train_027708
9,587
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
null
Implement the Python class `LinearSVC` described below. Class description: Linear Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a refer...
Implement the Python class `LinearSVC` described below. Class description: Linear Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a refer...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class LinearSVC: """Linear Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearSVC: """Linear Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.LinearSVC ...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/SVM/LinearSVC.py
idaholab/raven
train
201
7821c114132cad6bbbae204cb605867db2f677af
[ "PlotCanvas1D.__init__(self, parent, id, xlabel, ylabel, xscale, yscale)\nself.bank = FilterBank()\npub.subscribe(self.PostProcess, 'filter.change')\nself.Bind(wx.EVT_WINDOW_DESTROY, self.OnDelete)", "PlotCanvas1D.OnDelete(self, event)\npub.unsubscribe(self.PostProcess, 'filter.change')\nevent.Skip()", "event.S...
<|body_start_0|> PlotCanvas1D.__init__(self, parent, id, xlabel, ylabel, xscale, yscale) self.bank = FilterBank() pub.subscribe(self.PostProcess, 'filter.change') self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDelete) <|end_body_0|> <|body_start_1|> PlotCanvas1D.OnDelete(self, event) ...
Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str)
PlotCanvasF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str...
stack_v2_sparse_classes_36k_train_027709
5,257
no_license
[ { "docstring": "Initialization. Parameters: parent - parent window (wx.Window) id - id (int) xlabel - label and units of abscissa axis ([str,quantities]) ylabel - label and units of ordinate axis ([str,quantities]) xscale - abscissa scale type (linear or log) yscale - ordinate scale type (linear or log)", "...
6
stack_v2_sparse_classes_30k_train_011069
Implement the Python class `PlotCanvasF` described below. Class description: Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canva...
Implement the Python class `PlotCanvasF` described below. Class description: Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canva...
712accd3534ca35ae4c5c7f1c9c33fc935552ca6
<|skeleton|> class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str)""" def...
the_stack_v2_python_sparse
terapy_2/plot/canvasF.py
dawidgadziala/terapy
train
0
58d0388509b70e4bf541f3742244ea577d9b7ba5
[ "self.csv_path = csv_path\nself.cow_list = []\nself.date = date.strftime('%Y/%m/%d')\nself.csv_path += date.strftime('%Y%m%d') + '/'\nself.__read_from_db(self.__get_cow_id_list())", "dt = datetime.datetime(int(self.date[:4]), int(self.date[5:7]), int(self.date[8:10]))\nprint('reading cow information : ' + self.da...
<|body_start_0|> self.csv_path = csv_path self.cow_list = [] self.date = date.strftime('%Y/%m/%d') self.csv_path += date.strftime('%Y%m%d') + '/' self.__read_from_db(self.__get_cow_id_list()) <|end_body_0|> <|body_start_1|> dt = datetime.datetime(int(self.date[:4]), int(...
Cowshed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" <|body_0|> def __read_from_db(self, cow_id_list): """1頭ずつデータベースからRSSI情報を読み込む""" <|body_1|> def __get_cow_id_list(self): """csvファイルからその日第一放牧場にいた牛...
stack_v2_sparse_classes_36k_train_027710
2,305
no_license
[ { "docstring": "その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み", "name": "__init__", "signature": "def __init__(self, date: datetime, csv_path)" }, { "docstring": "1頭ずつデータベースからRSSI情報を読み込む", "name": "__read_from_db", "signature": "def __read_from_db(self, cow_id_list)" }, { "docstring":...
5
null
Implement the Python class `Cowshed` described below. Class description: Implement the Cowshed class. Method signatures and docstrings: - def __init__(self, date: datetime, csv_path): その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み - def __read_from_db(self, cow_id_list): 1頭ずつデータベースからRSSI情報を読み込む - def __get_cow_id_list(self...
Implement the Python class `Cowshed` described below. Class description: Implement the Cowshed class. Method signatures and docstrings: - def __init__(self, date: datetime, csv_path): その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み - def __read_from_db(self, cow_id_list): 1頭ずつデータベースからRSSI情報を読み込む - def __get_cow_id_list(self...
9046329d57ef10b6643c9c6e7dcc3ea9b6294dee
<|skeleton|> class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" <|body_0|> def __read_from_db(self, cow_id_list): """1頭ずつデータベースからRSSI情報を読み込む""" <|body_1|> def __get_cow_id_list(self): """csvファイルからその日第一放牧場にいた牛...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cowshed: def __init__(self, date: datetime, csv_path): """その日いた牛を登録する 日付をキーにしてコンストラクタでRSSIデータの読み込み""" self.csv_path = csv_path self.cow_list = [] self.date = date.strftime('%Y/%m/%d') self.csv_path += date.strftime('%Y%m%d') + '/' self.__read_from_db(self.__get_...
the_stack_v2_python_sparse
COW_PROJECT/cows/cowshed_rssi.py
FUKUSHUN/cow_python
train
1
7a46c0bd0e12585f6d99073dee22f0e9bfc94f49
[ "if isinstance(key, int):\n return Setting(key)\nif key not in Setting._member_map_:\n extend_enum(Setting, key, default)\nreturn Setting[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 9 <= value <= 15:\n extend_e...
<|body_start_0|> if isinstance(key, int): return Setting(key) if key not in Setting._member_map_: extend_enum(Setting, key, default) return Setting[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 65535): raise Val...
[Setting] HTTP/2 Settings
Setting
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Setting: """[Setting] HTTP/2 Settings""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027711
2,159
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_018538
Implement the Python class `Setting` described below. Class description: [Setting] HTTP/2 Settings Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `Setting` described below. Class description: [Setting] HTTP/2 Settings Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class Setting: """[Setting]...
71363d7948003fec88cedcf5bc80b6befa2ba244
<|skeleton|> class Setting: """[Setting] HTTP/2 Settings""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Setting: """[Setting] HTTP/2 Settings""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Setting(key) if key not in Setting._member_map_: extend_enum(Setting, key, default) return Setting[key] ...
the_stack_v2_python_sparse
pcapkit/const/http/setting.py
hiok2000/PyPCAPKit
train
0
62288bb47c70bd3b05fa887bf99c3deb3ba7d5c1
[ "def iterator(node, arr):\n if node:\n arr.append(str(node.val))\n iterator(node.left, arr)\n iterator(node.right, arr)\n else:\n arr.append('null')\nresult = []\niterator(root, result)\nreturn ' '.join(result)", "def iterator(it):\n val = next(it)\n if val != 'null':\n ...
<|body_start_0|> def iterator(node, arr): if node: arr.append(str(node.val)) iterator(node.left, arr) iterator(node.right, arr) else: arr.append('null') result = [] iterator(root, result) return ' '.j...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_027712
1,430
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_010148
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
057ed5c6fe19268f36a1d5051d27b07aae0b63e0
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def iterator(node, arr): if node: arr.append(str(node.val)) iterator(node.left, arr) iterator(node.right, arr) els...
the_stack_v2_python_sparse
2020/2020-03/06/eugene.py
wavetogether/wave_algorithm_challenge
train
3
ff63a8032ba6acdc6c44c738382e4f480ba0c684
[ "if filestream is None:\n self.Blue = 0\n self.Green = 0\n self.Red = 0\n self.Reserved = 0\nelse:\n self.PopulateFromFileStream(filestream)", "if fs is None:\n raise Exception('Invalid File stream')\noffset = fs.tell()\nfs.seek(0, 2)\nend = fs.tell()\nfs.seek(offset)\nif end - offset < BmpColor...
<|body_start_0|> if filestream is None: self.Blue = 0 self.Green = 0 self.Red = 0 self.Reserved = 0 else: self.PopulateFromFileStream(filestream) <|end_body_0|> <|body_start_1|> if fs is None: raise Exception('Invalid File ...
An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ```
BmpColorMap
[ "BSD-2-Clause-Patent" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BmpColorMap: """An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ```""" def __init__(self, filestream=None): """Inits an empty object or loa...
stack_v2_sparse_classes_36k_train_027713
13,139
permissive
[ { "docstring": "Inits an empty object or loads from an fs.", "name": "__init__", "signature": "def __init__(self, filestream=None)" }, { "docstring": "Loads a bmp from a filestream. Args: fs (obj): A loaded filestream. Raises: (Exception): Invalid filestream", "name": "PopulateFromFileStream...
4
stack_v2_sparse_classes_30k_train_018778
Implement the Python class `BmpColorMap` described below. Class description: An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ``` Method signatures and docstrings: - def __in...
Implement the Python class `BmpColorMap` described below. Class description: An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ``` Method signatures and docstrings: - def __in...
78295929b37af62a8cfc4c28eab72ed0c468f350
<|skeleton|> class BmpColorMap: """An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ```""" def __init__(self, filestream=None): """Inits an empty object or loa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BmpColorMap: """An object representing a BMP_COLOR_MAP. Attributes: Blue (int): blue Green (int): green Red (int): red ``` typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } BMP_COLOR_MAP; ```""" def __init__(self, filestream=None): """Inits an empty object or loads from an fs...
the_stack_v2_python_sparse
edk2toollib/uefi/bmp_object.py
tianocore/edk2-pytool-library
train
47
d5df0fc6a7a4b5729fbf2bb3a4c94119f6289269
[ "found_business = db.get(BusinessModel, businessId)\nif found_business is not None:\n return (found_business, 200)\nelse:\n return ({'message': 'business not found'}, 400)", "business_to_change = db.get(BusinessModel, businessId)\nargs = update_business_parser.parse_args()\nbusines_payload = args\nis_not_va...
<|body_start_0|> found_business = db.get(BusinessModel, businessId) if found_business is not None: return (found_business, 200) else: return ({'message': 'business not found'}, 400) <|end_body_0|> <|body_start_1|> business_to_change = db.get(BusinessModel, busine...
This Class handles endpoints for a specific business
Business
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Business: """This Class handles endpoints for a specific business""" def get(self, current_user, token, businessId): """returns a specific business""" <|body_0|> def put(self, current_user, token, businessId): """updates a specific businesses data""" <|bo...
stack_v2_sparse_classes_36k_train_027714
6,766
permissive
[ { "docstring": "returns a specific business", "name": "get", "signature": "def get(self, current_user, token, businessId)" }, { "docstring": "updates a specific businesses data", "name": "put", "signature": "def put(self, current_user, token, businessId)" }, { "docstring": "delet...
3
stack_v2_sparse_classes_30k_train_015767
Implement the Python class `Business` described below. Class description: This Class handles endpoints for a specific business Method signatures and docstrings: - def get(self, current_user, token, businessId): returns a specific business - def put(self, current_user, token, businessId): updates a specific businesses...
Implement the Python class `Business` described below. Class description: This Class handles endpoints for a specific business Method signatures and docstrings: - def get(self, current_user, token, businessId): returns a specific business - def put(self, current_user, token, businessId): updates a specific businesses...
6a36b51876479adf99874d91dd0bc765f4839dd6
<|skeleton|> class Business: """This Class handles endpoints for a specific business""" def get(self, current_user, token, businessId): """returns a specific business""" <|body_0|> def put(self, current_user, token, businessId): """updates a specific businesses data""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Business: """This Class handles endpoints for a specific business""" def get(self, current_user, token, businessId): """returns a specific business""" found_business = db.get(BusinessModel, businessId) if found_business is not None: return (found_business, 200) ...
the_stack_v2_python_sparse
apis/v1/weconnect_api/business_api.py
tibetegya/WeConnect
train
1
bbe3e6162ed90a73dd0d2c6247a8cd7463dd88c2
[ "if region in ['default', 'us-west-1']:\n return '%s://%sapi.us-west-1.altus.cloudera.com:%d' % (scheme, service_name, port)\nelif region == 'usg-1':\n return '%s://api.%s.cdp.clouderagovt.com:%d' % (scheme, region, port)\nelse:\n return '%s://api.%s.cdp.cloudera.com:%d' % (scheme, region, port)", "if re...
<|body_start_0|> if region in ['default', 'us-west-1']: return '%s://%sapi.us-west-1.altus.cloudera.com:%d' % (scheme, service_name, port) elif region == 'usg-1': return '%s://api.%s.cdp.clouderagovt.com:%d' % (scheme, region, port) else: return '%s://api.%s.c...
A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.
EndpointResolver
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EndpointResolver: """A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.""" def _construct_altus_endpoint(self, service_name, scheme, region, port): """Construct a default base URL to an Altus service. :param service_name: service name, as referenced in it...
stack_v2_sparse_classes_36k_train_027715
17,043
permissive
[ { "docstring": "Construct a default base URL to an Altus service. :param service_name: service name, as referenced in its URLs :param scheme: URL scheme, e.g., 'https' :param port: service port :param region: service region :returns: Altus service base URL", "name": "_construct_altus_endpoint", "signatu...
6
stack_v2_sparse_classes_30k_train_013683
Implement the Python class `EndpointResolver` described below. Class description: A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator. Method signatures and docstrings: - def _construct_altus_endpoint(self, service_name, scheme, region, port): Construct a default base URL to an Altus servic...
Implement the Python class `EndpointResolver` described below. Class description: A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator. Method signatures and docstrings: - def _construct_altus_endpoint(self, service_name, scheme, region, port): Construct a default base URL to an Altus servic...
c3de560c93914d400be86c4039b9f60c2c6d87c4
<|skeleton|> class EndpointResolver: """A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.""" def _construct_altus_endpoint(self, service_name, scheme, region, port): """Construct a default base URL to an Altus service. :param service_name: service name, as referenced in it...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EndpointResolver: """A builder of endpoint URLs for Altus and CDP services. Used by EndpointCreator.""" def _construct_altus_endpoint(self, service_name, scheme, region, port): """Construct a default base URL to an Altus service. :param service_name: service name, as referenced in its URLs :param...
the_stack_v2_python_sparse
cdpcli/endpoint.py
cloudera/cdpcli
train
9
433f98ff29f5b2bf1f99d8aad5899984a658d99c
[ "if isinstance(identifier, str):\n domain = expression.OR([[(field, '=', identifier)] for field in self.MSM_STR_DOMAIN])\nelif isinstance(identifier, int):\n domain = [('id', '=', identifier)]\nelse:\n raise TypeError(_('Identifier must be either int or str, not %s') % type(identifier))\nreturn domain", ...
<|body_start_0|> if isinstance(identifier, str): domain = expression.OR([[(field, '=', identifier)] for field in self.MSM_STR_DOMAIN]) elif isinstance(identifier, int): domain = [('id', '=', identifier)] else: raise TypeError(_('Identifier must be either int o...
MixinStockModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixinStockModel: def _get_msm_domain(self, identifier): """Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: - identifier: str or int The identifier to search by :returns: List of tuples (Odoo style domain)""" ...
stack_v2_sparse_classes_36k_train_027716
3,927
no_license
[ { "docstring": "Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: - identifier: str or int The identifier to search by :returns: List of tuples (Odoo style domain)", "name": "_get_msm_domain", "signature": "def _get_msm_domain(se...
2
stack_v2_sparse_classes_30k_train_001464
Implement the Python class `MixinStockModel` described below. Class description: Implement the MixinStockModel class. Method signatures and docstrings: - def _get_msm_domain(self, identifier): Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: ...
Implement the Python class `MixinStockModel` described below. Class description: Implement the MixinStockModel class. Method signatures and docstrings: - def _get_msm_domain(self, identifier): Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: ...
0f69491b1538892c1921ae8063d9ea269e15d9ce
<|skeleton|> class MixinStockModel: def _get_msm_domain(self, identifier): """Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: - identifier: str or int The identifier to search by :returns: List of tuples (Odoo style domain)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixinStockModel: def _get_msm_domain(self, identifier): """Return a domain based on MSM_STR_DOMAIN attribute (which can be changed on the model which this model is mixed in to) :args: - identifier: str or int The identifier to search by :returns: List of tuples (Odoo style domain)""" if isinst...
the_stack_v2_python_sparse
addons/udes_stock/models/mixin_stock_model.py
unipartdigital/udes-open
train
7
79a79a52a7e610447fec27dad59384e673f05400
[ "super().__init__()\nself.workFunc = workFunc\nself.updateHz = updateHz\nself.stopToken = stopToken\nself.worker = None\nself.running = False", "self.worker = TimerThread(Q=self, workFunc=self.workFunc, updateHz=self.updateHz, stopToken=self.stopToken)\nself.running = True\nself.worker.start()", "if not self.em...
<|body_start_0|> super().__init__() self.workFunc = workFunc self.updateHz = updateHz self.stopToken = stopToken self.worker = None self.running = False <|end_body_0|> <|body_start_1|> self.worker = TimerThread(Q=self, workFunc=self.workFunc, updateHz=self.update...
Perform work at semi-steady intervals until asked to stop
TimerQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimerQueue: """Perform work at semi-steady intervals until asked to stop""" def __init__(self, workFunc, updateHz, stopToken=None): """Set up the queue""" <|body_0|> def start(self): """Start work and run forever""" <|body_1|> def stop(self): ...
stack_v2_sparse_classes_36k_train_027717
3,564
no_license
[ { "docstring": "Set up the queue", "name": "__init__", "signature": "def __init__(self, workFunc, updateHz, stopToken=None)" }, { "docstring": "Start work and run forever", "name": "start", "signature": "def start(self)" }, { "docstring": "Administer the poison pill", "name":...
4
stack_v2_sparse_classes_30k_train_002213
Implement the Python class `TimerQueue` described below. Class description: Perform work at semi-steady intervals until asked to stop Method signatures and docstrings: - def __init__(self, workFunc, updateHz, stopToken=None): Set up the queue - def start(self): Start work and run forever - def stop(self): Administer ...
Implement the Python class `TimerQueue` described below. Class description: Perform work at semi-steady intervals until asked to stop Method signatures and docstrings: - def __init__(self, workFunc, updateHz, stopToken=None): Set up the queue - def start(self): Start work and run forever - def stop(self): Administer ...
297f9f5733fe256e5c96f2da82f49d82c2a4ba9d
<|skeleton|> class TimerQueue: """Perform work at semi-steady intervals until asked to stop""" def __init__(self, workFunc, updateHz, stopToken=None): """Set up the queue""" <|body_0|> def start(self): """Start work and run forever""" <|body_1|> def stop(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimerQueue: """Perform work at semi-steady intervals until asked to stop""" def __init__(self, workFunc, updateHz, stopToken=None): """Set up the queue""" super().__init__() self.workFunc = workFunc self.updateHz = updateHz self.stopToken = stopToken self.w...
the_stack_v2_python_sparse
Learning/threading_examples.py
jwatson-CO-edu/py_info
train
0
59111bdc1b60f021656c7156101eff297ba249db
[ "nums = nums1 + nums2\nnums.sort()\nn = len(nums)\nif n % 2 == 0:\n return (nums[(n - 1) // 2] + nums[(n + 1) // 2]) / 2.0\nelse:\n return nums[n // 2]", "l1, l2 = (len(nums1), len(nums2))\nif l1 > l2:\n return self.findMedianSortedArrays2(nums2, nums1)\nhalf = (l1 + l2 + 1) // 2\nleft = 0\nright = l1\nw...
<|body_start_0|> nums = nums1 + nums2 nums.sort() n = len(nums) if n % 2 == 0: return (nums[(n - 1) // 2] + nums[(n + 1) // 2]) / 2.0 else: return nums[n // 2] <|end_body_0|> <|body_start_1|> l1, l2 = (len(nums1), len(nums2)) if l1 > l2: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays1(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21.4MB beaten 5.12%。""" <|body_0|> def findMedianSortedArrays2(self, nums1, nums2): ...
stack_v2_sparse_classes_36k_train_027718
3,447
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21.4MB beaten 5.12%。", "name": "findMedianSortedArrays1", "signature": "def findMedianSortedArrays1(self, nums1, nums2)" }, { "docstring": ":type nums1: ...
2
stack_v2_sparse_classes_30k_train_011424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays1(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays1(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21...
a2e5256f27dbfb23fc34119fc857cd9b00e28c03
<|skeleton|> class Solution: def findMedianSortedArrays1(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21.4MB beaten 5.12%。""" <|body_0|> def findMedianSortedArrays2(self, nums1, nums2): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays1(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float 时间复杂度:O(m+n),新数组组内排序,164ms beaten 24.66% 空间复杂度:O(m+n),使用了新空间排序合并数组,21.4MB beaten 5.12%。""" nums = nums1 + nums2 nums.sort() n = len(nums) if n % 2 =...
the_stack_v2_python_sparse
toTheMoon/leetcode_004_MedianofTwoSortedArrays.py
jercas/offer66-leetcode-newcode
train
0
0980c384b69ae5becc6907d91c08b01ea0750f64
[ "url = reverse('login')\nresponse = self.client.get(url)\nlogger.info(response)\nself.assertEqual(response.status_code, 200)", "user = User.objects.create_user(username='user', password='Word9876')\nurl = reverse('login')\nresponse = self.client.post(url, {'username': 'user', 'password': 'Word9876'})\nlogger.info...
<|body_start_0|> url = reverse('login') response = self.client.get(url) logger.info(response) self.assertEqual(response.status_code, 200) <|end_body_0|> <|body_start_1|> user = User.objects.create_user(username='user', password='Word9876') url = reverse('login') ...
Test login page.
LoginPageTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPageTestCase: """Test login page.""" def test_login_page_get_request(self): """Test get request for Login Page.""" <|body_0|> def test_login_user(self): """Test we can login user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = revers...
stack_v2_sparse_classes_36k_train_027719
3,223
no_license
[ { "docstring": "Test get request for Login Page.", "name": "test_login_page_get_request", "signature": "def test_login_page_get_request(self)" }, { "docstring": "Test we can login user.", "name": "test_login_user", "signature": "def test_login_user(self)" } ]
2
stack_v2_sparse_classes_30k_train_017941
Implement the Python class `LoginPageTestCase` described below. Class description: Test login page. Method signatures and docstrings: - def test_login_page_get_request(self): Test get request for Login Page. - def test_login_user(self): Test we can login user.
Implement the Python class `LoginPageTestCase` described below. Class description: Test login page. Method signatures and docstrings: - def test_login_page_get_request(self): Test get request for Login Page. - def test_login_user(self): Test we can login user. <|skeleton|> class LoginPageTestCase: """Test login ...
5d303bfb6f8729d73a34020bbec494ddb8099450
<|skeleton|> class LoginPageTestCase: """Test login page.""" def test_login_page_get_request(self): """Test get request for Login Page.""" <|body_0|> def test_login_user(self): """Test we can login user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginPageTestCase: """Test login page.""" def test_login_page_get_request(self): """Test get request for Login Page.""" url = reverse('login') response = self.client.get(url) logger.info(response) self.assertEqual(response.status_code, 200) def test_login_user...
the_stack_v2_python_sparse
accounts/tests.py
ghrust/cs50w-finalProject-CRM
train
1
ad3e822a848fb09cb289c5f4a5df3359ac7a962e
[ "if self.request.method == 'GET':\n return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH'):\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToUpdateCust...
<|body_start_0|> if self.request.method == 'GET': return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity()) elif self.request.method == 'POST': return (permissions.IsAuthenticated(),) elif self.request.method in ('PUT', 'PATCH'): return (permissions.IsAut...
Custom membership label view set
CustomMembershipLabelViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomMembershipLabelViewSet: """Custom membership label view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): "...
stack_v2_sparse_classes_36k_train_027720
27,778
permissive
[ { "docstring": "Get permissions", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Get serializer class", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "List custom membership labels", "na...
3
stack_v2_sparse_classes_30k_train_004008
Implement the Python class `CustomMembershipLabelViewSet` described below. Class description: Custom membership label view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List custom m...
Implement the Python class `CustomMembershipLabelViewSet` described below. Class description: Custom membership label view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List custom m...
cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8
<|skeleton|> class CustomMembershipLabelViewSet: """Custom membership label view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomMembershipLabelViewSet: """Custom membership label view set""" def get_permissions(self): """Get permissions""" if self.request.method == 'GET': return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity()) elif self.request.method == 'POST': return ...
the_stack_v2_python_sparse
membership/views.py
810Teams/clubs-and-events-backend
train
3
31c7f47f36202dd5b0dac7e1a31c8759f99aa7b9
[ "m, n = (len(grid), len(grid[0]))\nnum = 0\nfor i in range(m):\n for j in range(n):\n if grid[i][j] == 0:\n continue\n for x, y in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]:\n if 0 <= x < m and 0 <= y < n and (grid[x][y] == 1):\n continue\n num...
<|body_start_0|> m, n = (len(grid), len(grid[0])) num = 0 for i in range(m): for j in range(n): if grid[i][j] == 0: continue for x, y in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]: if 0 <= x < m and 0 <= y ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def islandPerimeter(self, grid: List[List[int]]) -> int: """迭代""" <|body_0|> def islandPerimeterDFS(self, grid: List[List[int]]) -> int: """DFS""" <|body_1|> <|end_skeleton|> <|body_start_0|> m, n = (len(grid), len(grid[0])) num = ...
stack_v2_sparse_classes_36k_train_027721
1,959
no_license
[ { "docstring": "迭代", "name": "islandPerimeter", "signature": "def islandPerimeter(self, grid: List[List[int]]) -> int" }, { "docstring": "DFS", "name": "islandPerimeterDFS", "signature": "def islandPerimeterDFS(self, grid: List[List[int]]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_000068
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def islandPerimeter(self, grid: List[List[int]]) -> int: 迭代 - def islandPerimeterDFS(self, grid: List[List[int]]) -> int: DFS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def islandPerimeter(self, grid: List[List[int]]) -> int: 迭代 - def islandPerimeterDFS(self, grid: List[List[int]]) -> int: DFS <|skeleton|> class Solution: def islandPerimet...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def islandPerimeter(self, grid: List[List[int]]) -> int: """迭代""" <|body_0|> def islandPerimeterDFS(self, grid: List[List[int]]) -> int: """DFS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def islandPerimeter(self, grid: List[List[int]]) -> int: """迭代""" m, n = (len(grid), len(grid[0])) num = 0 for i in range(m): for j in range(n): if grid[i][j] == 0: continue for x, y in [(i - 1, j), (i + ...
the_stack_v2_python_sparse
463.岛屿的周长/solution.py
QtTao/daily_leetcode
train
0
ddf05c43bc1c6308cc8ac7821b7ef1aa5367b47d
[ "ex = lambda: (_ for _ in ()).throw(parse_file.SyntaxException)\nwith self.assertRaises(parse_file.SyntaxException):\n ex()", "message = 'Problem'\ntext = ['text line 0', 'text line 1', 'text line 2', 'text line 3']\nline_nums = [-1, 0]\nfor line_num in line_nums:\n ex = parse_file.SyntaxProblem(message=mes...
<|body_start_0|> ex = lambda: (_ for _ in ()).throw(parse_file.SyntaxException) with self.assertRaises(parse_file.SyntaxException): ex() <|end_body_0|> <|body_start_1|> message = 'Problem' text = ['text line 0', 'text line 1', 'text line 2', 'text line 3'] line_nums ...
Class to test error throwing.
TestErrors
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestErrors: """Class to test error throwing.""" def test_syntax_exception(self): """Test the SyntaxException class.""" <|body_0|> def test_syntax_problem(self): """Test the SyntaxProblem class.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ex ...
stack_v2_sparse_classes_36k_train_027722
13,813
no_license
[ { "docstring": "Test the SyntaxException class.", "name": "test_syntax_exception", "signature": "def test_syntax_exception(self)" }, { "docstring": "Test the SyntaxProblem class.", "name": "test_syntax_problem", "signature": "def test_syntax_problem(self)" } ]
2
stack_v2_sparse_classes_30k_train_016016
Implement the Python class `TestErrors` described below. Class description: Class to test error throwing. Method signatures and docstrings: - def test_syntax_exception(self): Test the SyntaxException class. - def test_syntax_problem(self): Test the SyntaxProblem class.
Implement the Python class `TestErrors` described below. Class description: Class to test error throwing. Method signatures and docstrings: - def test_syntax_exception(self): Test the SyntaxException class. - def test_syntax_problem(self): Test the SyntaxProblem class. <|skeleton|> class TestErrors: """Class to ...
e10166847bd112fcd4fb7044e1478515104017e4
<|skeleton|> class TestErrors: """Class to test error throwing.""" def test_syntax_exception(self): """Test the SyntaxException class.""" <|body_0|> def test_syntax_problem(self): """Test the SyntaxProblem class.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestErrors: """Class to test error throwing.""" def test_syntax_exception(self): """Test the SyntaxException class.""" ex = lambda: (_ for _ in ()).throw(parse_file.SyntaxException) with self.assertRaises(parse_file.SyntaxException): ex() def test_syntax_problem(s...
the_stack_v2_python_sparse
unit_tests/test_parse_file.py
Tubbz-alt/harmony
train
0
7a13fcdd4b91b16898a62ddbc8bb01e0ca4f84d8
[ "self._monitor = monitor\nself._attr_available = False\nself._attr_name = f'{self._monitor.name} Status'", "if not (state := self._monitor.function):\n self._attr_native_value = None\nelse:\n self._attr_native_value = state.value\nself._attr_available = self._monitor.is_available" ]
<|body_start_0|> self._monitor = monitor self._attr_available = False self._attr_name = f'{self._monitor.name} Status' <|end_body_0|> <|body_start_1|> if not (state := self._monitor.function): self._attr_native_value = None else: self._attr_native_value =...
Get the status of each ZoneMinder monitor.
ZMSensorMonitors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" <|body_0|> def update(self) -> None: """Update the sensor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027723
4,501
permissive
[ { "docstring": "Initialize monitor sensor.", "name": "__init__", "signature": "def __init__(self, monitor: Monitor) -> None" }, { "docstring": "Update the sensor.", "name": "update", "signature": "def update(self) -> None" } ]
2
null
Implement the Python class `ZMSensorMonitors` described below. Class description: Get the status of each ZoneMinder monitor. Method signatures and docstrings: - def __init__(self, monitor: Monitor) -> None: Initialize monitor sensor. - def update(self) -> None: Update the sensor.
Implement the Python class `ZMSensorMonitors` described below. Class description: Get the status of each ZoneMinder monitor. Method signatures and docstrings: - def __init__(self, monitor: Monitor) -> None: Initialize monitor sensor. - def update(self) -> None: Update the sensor. <|skeleton|> class ZMSensorMonitors:...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" <|body_0|> def update(self) -> None: """Update the sensor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" self._monitor = monitor self._attr_available = False self._attr_name = f'{self._monitor.name} Status' def update(self) -> ...
the_stack_v2_python_sparse
homeassistant/components/zoneminder/sensor.py
home-assistant/core
train
35,501
3a6a97ee603e24510284d8d739456792e9822180
[ "cumset = []\ncumset.append(0)\nmaxsum = -1 << 32\ncursum = 0\nfor i in range(len(nums)):\n cursum += nums[i]\n idx = bisect.bisect_left(cumset, cursum - k)\n if 0 <= idx < len(cumset):\n maxsum = max(maxsum, cursum - cumset[idx])\n bisect.insort(cumset, cursum)\nreturn maxsum", "\"\"\"\n ...
<|body_start_0|> cumset = [] cumset.append(0) maxsum = -1 << 32 cursum = 0 for i in range(len(nums)): cursum += nums[i] idx = bisect.bisect_left(cumset, cursum - k) if 0 <= idx < len(cumset): maxsum = max(maxsum, cursum - cumset...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArraylessK(self, nums, k): """we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we should use insort from the bisect""" <|body_0|> def maxSumSubmatrix(self, matrix, k): ...
stack_v2_sparse_classes_36k_train_027724
2,512
no_license
[ { "docstring": "we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we should use insort from the bisect", "name": "maxSubArraylessK", "signature": "def maxSubArraylessK(self, nums, k)" }, { "docstring": ":type ma...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArraylessK(self, nums, k): we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we sho...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArraylessK(self, nums, k): we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we sho...
5510ef424135783f6dc40d3f5e85c4c42677c211
<|skeleton|> class Solution: def maxSubArraylessK(self, nums, k): """we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we should use insort from the bisect""" <|body_0|> def maxSumSubmatrix(self, matrix, k): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArraylessK(self, nums, k): """we need to find the sum[right]-sum[left]<=k since the bitsect return the index of the sorted value we can't directly pop the nums[idx] we should use insort from the bisect""" cumset = [] cumset.append(0) maxsum = -1 << 32 ...
the_stack_v2_python_sparse
crackfun/363. Max Sum of Rectangle No Larger Than K.py
JoyiS/Leetcode
train
0
ef57f740108f96b9686b4b3f2beb38c96836d6c4
[ "self.set_default_value_mode(DefaultValue.DefaultDict, default)\nif key is not None and (not isinstance(key, Member)):\n opt, types = is_optional(extract_types(key))\n key = Instance(types, optional=opt)\nif value is not None and (not isinstance(value, Member)):\n opt, types = is_optional(extract_types(val...
<|body_start_0|> self.set_default_value_mode(DefaultValue.DefaultDict, default) if key is not None and (not isinstance(key, Member)): opt, types = is_optional(extract_types(key)) key = Instance(types, optional=opt) if value is not None and (not isinstance(value, Member)):...
A value of type `dict` implementing __missing__
DefaultDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultDict: """A value of type `dict` implementing __missing__""" def __init__(self, key=None, value=None, default=None, *, missing=None): """Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, or None, optional A member to use for validating the type...
stack_v2_sparse_classes_36k_train_027725
8,471
permissive
[ { "docstring": "Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, or None, optional A member to use for validating the types of keys allowed in the dict. This can also be a type or a tuple of types, which will be wrapped with an Instance member. If this is not given, no key val...
4
stack_v2_sparse_classes_30k_train_005999
Implement the Python class `DefaultDict` described below. Class description: A value of type `dict` implementing __missing__ Method signatures and docstrings: - def __init__(self, key=None, value=None, default=None, *, missing=None): Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, ...
Implement the Python class `DefaultDict` described below. Class description: A value of type `dict` implementing __missing__ Method signatures and docstrings: - def __init__(self, key=None, value=None, default=None, *, missing=None): Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, ...
761a52821d8c77b5718216256963682d11599c1e
<|skeleton|> class DefaultDict: """A value of type `dict` implementing __missing__""" def __init__(self, key=None, value=None, default=None, *, missing=None): """Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, or None, optional A member to use for validating the type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultDict: """A value of type `dict` implementing __missing__""" def __init__(self, key=None, value=None, default=None, *, missing=None): """Initialize a DefaultDict. Parameters ---------- key : Member, type, tuple of types, or None, optional A member to use for validating the types of keys all...
the_stack_v2_python_sparse
atom/dict.py
nucleic/atom
train
251
0c146d5a26cc0cb941453e2d4ed1b86257ced4d2
[ "R_0 = pyEpiabm.core.Parameters.instance().basic_reproduction_num\ninfect_profile = pyEpiabm.core.Parameters.instance().infectiousness_prof\ntotal_infectiousness = np.sum(infect_profile)\nsummed_infectiousness = sum([person.infectiousness for person in inf_cell.persons])\naverage_number_to_infect = R_0 * (summed_in...
<|body_start_0|> R_0 = pyEpiabm.core.Parameters.instance().basic_reproduction_num infect_profile = pyEpiabm.core.Parameters.instance().infectiousness_prof total_infectiousness = np.sum(infect_profile) summed_infectiousness = sum([person.infectiousness for person in inf_cell.persons]) ...
Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells.
SpatialInfection
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells.""" def cell_inf(inf_cell, time: float): """Calculate the infectiousness of one cell towards its nearby cells. Does not include interventions s...
stack_v2_sparse_classes_36k_train_027726
7,809
permissive
[ { "docstring": "Calculate the infectiousness of one cell towards its nearby cells. Does not include interventions such as isolation, or whether individual is a carehome resident. Returns the expected number of infections for a given timestep. Parameters ---------- inf_cell : Cell Cell causing the infection time...
4
stack_v2_sparse_classes_30k_train_007064
Implement the Python class `SpatialInfection` described below. Class description: Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells. Method signatures and docstrings: - def cell_inf(inf_cell, time: float): Calculate the infectiousness of one cell t...
Implement the Python class `SpatialInfection` described below. Class description: Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells. Method signatures and docstrings: - def cell_inf(inf_cell, time: float): Calculate the infectiousness of one cell t...
c11de122c6bfdf9103162e4045758808da5df322
<|skeleton|> class SpatialInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells.""" def cell_inf(inf_cell, time: float): """Calculate the infectiousness of one cell towards its nearby cells. Does not include interventions s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpatialInfection: """Class to calculate the infectiousness and susceptibility parameters for the force of infection parameter, between cells.""" def cell_inf(inf_cell, time: float): """Calculate the infectiousness of one cell towards its nearby cells. Does not include interventions such as isolat...
the_stack_v2_python_sparse
pyEpiabm/pyEpiabm/property/spatial_foi.py
SABS-R3-Epidemiology/epiabm
train
21
874171fb7054b334d262d12df669510698f640c0
[ "if self.request.user.is_superuser:\n return models.ScheduledOperation.objects.all()\nreturn models.ScheduledOperation.objects.filter(Q(user=self.request.user) | Q(action__workflow__shared=self.request.user)).distinct()", "if self.request.user.is_superuser:\n serializer.save()\nelse:\n serializer.save(us...
<|body_start_0|> if self.request.user.is_superuser: return models.ScheduledOperation.objects.all() return models.ScheduledOperation.objects.filter(Q(user=self.request.user) | Q(action__workflow__shared=self.request.user)).distinct() <|end_body_0|> <|body_start_1|> if self.request.us...
Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters
ScheduledOperationAPIListCreate
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduledOperationAPIListCreate: """Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters""" def get_queryset(self): """Filter the Scheduled operations only for the cu...
stack_v2_sparse_classes_36k_train_027727
5,691
permissive
[ { "docstring": "Filter the Scheduled operations only for the current user.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create the operation.", "name": "perform_create", "signature": "def perform_create(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_009289
Implement the Python class `ScheduledOperationAPIListCreate` described below. Class description: Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters Method signatures and docstrings: - def get_querys...
Implement the Python class `ScheduledOperationAPIListCreate` described below. Class description: Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters Method signatures and docstrings: - def get_querys...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ScheduledOperationAPIListCreate: """Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters""" def get_queryset(self): """Filter the Scheduled operations only for the cu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScheduledOperationAPIListCreate: """Class to operate through the list of actions scheduled for a user. get: Return the list of scheduled actions post: Create a new scheduled action with the given parameters""" def get_queryset(self): """Filter the Scheduled operations only for the current user.""...
the_stack_v2_python_sparse
ontask/scheduler/api.py
abelardopardo/ontask_b
train
43
82c384921445ffbdfb17070d64dc83b4f5ec4285
[ "if item_type.lower() == 'books':\n return cls.create_book()\nif item_type.lower() == 'journals':\n return cls.create_journal()\nif item_type.lower() == 'dvds':\n return cls.create_dvd()", "call_number = input('Enter Call Number: ')\ntitle = input('Enter title: ')\nnum_copies = int(input('Enter number of...
<|body_start_0|> if item_type.lower() == 'books': return cls.create_book() if item_type.lower() == 'journals': return cls.create_journal() if item_type.lower() == 'dvds': return cls.create_dvd() <|end_body_0|> <|body_start_1|> call_number = input('Ent...
A factory class used to create different types of Items.
LibraryItemGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryItemGenerator: """A factory class used to create different types of Items.""" def generate_item(cls, item_type): """Determines which type of object to generate. :param item_type: a string :return: an object""" <|body_0|> def create_book(): """Creates a Boo...
stack_v2_sparse_classes_36k_train_027728
2,058
no_license
[ { "docstring": "Determines which type of object to generate. :param item_type: a string :return: an object", "name": "generate_item", "signature": "def generate_item(cls, item_type)" }, { "docstring": "Creates a Book object. :return: a Book object", "name": "create_book", "signature": "d...
4
stack_v2_sparse_classes_30k_train_009999
Implement the Python class `LibraryItemGenerator` described below. Class description: A factory class used to create different types of Items. Method signatures and docstrings: - def generate_item(cls, item_type): Determines which type of object to generate. :param item_type: a string :return: an object - def create_...
Implement the Python class `LibraryItemGenerator` described below. Class description: A factory class used to create different types of Items. Method signatures and docstrings: - def generate_item(cls, item_type): Determines which type of object to generate. :param item_type: a string :return: an object - def create_...
11c3806aee78fa0e78bdf8037d4c203645df5500
<|skeleton|> class LibraryItemGenerator: """A factory class used to create different types of Items.""" def generate_item(cls, item_type): """Determines which type of object to generate. :param item_type: a string :return: an object""" <|body_0|> def create_book(): """Creates a Boo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LibraryItemGenerator: """A factory class used to create different types of Items.""" def generate_item(cls, item_type): """Determines which type of object to generate. :param item_type: a string :return: an object""" if item_type.lower() == 'books': return cls.create_book() ...
the_stack_v2_python_sparse
Labs/Lab3/library_item_generator.py
chrisyandev/PythonAssignments
train
0
040cac117559b65f873a0d687f0241cdd66465f6
[ "left = []\nmaxv = 0\nv = [(-1, -2)]\nfor j, pt in enumerate(s):\n if pt == '(':\n left.append(j)\n if pt == ')' and left:\n l = left.pop()\n r = j\n pl, pr = v[-1]\n if r > pr and l < pl:\n v.pop()\n if l == v[-1][1] + 1:\n l = v[-1][0]\n ...
<|body_start_0|> left = [] maxv = 0 v = [(-1, -2)] for j, pt in enumerate(s): if pt == '(': left.append(j) if pt == ')' and left: l = left.pop() r = j pl, pr = v[-1] if r > pr and l < ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = [] maxv = 0 v = [(-1,...
stack_v2_sparse_classes_36k_train_027729
1,288
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses1", "signature": "def longestValidParentheses1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001594
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses1(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses1(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestVal...
863b89be674a82eef60c0f33d726ac08d43f2e01
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" left = [] maxv = 0 v = [(-1, -2)] for j, pt in enumerate(s): if pt == '(': left.append(j) if pt == ')' and left: l = left.pop() ...
the_stack_v2_python_sparse
q32_Longest_Valid_Parentheses.py
Ryuya1995/leetcode
train
0
5990ccb1b5f9112ef136e851311cd6ffc554c581
[ "m, n = (len(grid), len(grid[0]))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i - 1][j - 1]\nreturn dp[-1][-1]", "m, n = (len(grid), len(grid[0]))\ndp = [0] * (n + 1)\nfor i in range(1, m + 1):\n ...
<|body_start_0|> m, n = (len(grid), len(grid[0])) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i - 1][j - 1] return dp[-1][-1] <|end_body_0|> <|body_start_1|> ...
Soluton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" <|body_0|> def maxValue(self, grid): """dp[i...
stack_v2_sparse_classes_36k_train_027730
1,413
no_license
[ { "docstring": "dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)", "name": "maxValue", "signature": "def maxValue(self, grid)" }, { "docstring": "dp[i][j] 从(0, 0)走...
2
stack_v2_sparse_classes_30k_train_013820
Implement the Python class `Soluton` described below. Class description: Implement the Soluton class. Method signatures and docstrings: - def maxValue(self, grid): dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回...
Implement the Python class `Soluton` described below. Class description: Implement the Soluton class. Method signatures and docstrings: - def maxValue(self, grid): dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" <|body_0|> def maxValue(self, grid): """dp[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" m, n = (len(grid), len(grid[0])) dp = [[0] * (n + 1) for _ in r...
the_stack_v2_python_sparse
3_Offer2nd-HandWriting/6_DP/7_礼物的最大价值.py
fzingithub/SwordRefers2Offer
train
1
f93f46dc0c834c774173be259cb70e1bcef527c0
[ "super().__init__()\nself.dml = dml\nself.evaluate = evaluate\nif dml == 2:\n self.json_backbone_description = json_arch_file_backbone[0]\n self.weight_standardization = weight_standardization\n with open(self.json_backbone_description, 'r', encoding='utf-8') as read_file:\n data_backbone = json.loa...
<|body_start_0|> super().__init__() self.dml = dml self.evaluate = evaluate if dml == 2: self.json_backbone_description = json_arch_file_backbone[0] self.weight_standardization = weight_standardization with open(self.json_backbone_description, 'r', enc...
ISyNet
ISyNet
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ISyNet: """ISyNet""" def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False): """Network initialisation""" <|body_0|> def construct(self, *inputs, **_kwargs): """IsyNet construct fo...
stack_v2_sparse_classes_36k_train_027731
4,662
permissive
[ { "docstring": "Network initialisation", "name": "__init__", "signature": "def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False)" }, { "docstring": "IsyNet construct for dml=1 and dml=2", "name": "construct",...
3
stack_v2_sparse_classes_30k_train_019320
Implement the Python class `ISyNet` described below. Class description: ISyNet Method signatures and docstrings: - def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False): Network initialisation - def construct(self, *inputs, **_kwargs)...
Implement the Python class `ISyNet` described below. Class description: ISyNet Method signatures and docstrings: - def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False): Network initialisation - def construct(self, *inputs, **_kwargs)...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ISyNet: """ISyNet""" def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False): """Network initialisation""" <|body_0|> def construct(self, *inputs, **_kwargs): """IsyNet construct fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ISyNet: """ISyNet""" def __init__(self, num_classes=1000, json_arch_file_backbone='', dropout=0.5, weight_standardization=0, last_bn=0, dml=1, evaluate=False): """Network initialisation""" super().__init__() self.dml = dml self.evaluate = evaluate if dml == 2: ...
the_stack_v2_python_sparse
research/cv/ISyNet/ISyNet/model.py
mindspore-ai/models
train
301
d29e9a848f8944ce5fd9aab77409833adf4a05a6
[ "self.color_factor = color_factor\nself.contrast_factor = contrast_factor\nself.brightness_factor = brightness_factor", "_color = random.uniform(*self.color_factor)\n_contrast = random.uniform(*self.contrast_factor)\n_brightness = random.uniform(*self.brightness_factor)\n_HSV = np.dot(cv2.cvtColor(image, cv2.COLO...
<|body_start_0|> self.color_factor = color_factor self.contrast_factor = contrast_factor self.brightness_factor = brightness_factor <|end_body_0|> <|body_start_1|> _color = random.uniform(*self.color_factor) _contrast = random.uniform(*self.contrast_factor) _brightness =...
Random crop image and label.
RandomColor_pair
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomColor_pair: """Random crop image and label.""" def __init__(self, color_factor, contrast_factor, brightness_factor): """Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: contrast_factor range :param brightness_factor: brightness_f...
stack_v2_sparse_classes_36k_train_027732
1,828
permissive
[ { "docstring": "Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: contrast_factor range :param brightness_factor: brightness_factor range", "name": "__init__", "signature": "def __init__(self, color_factor, contrast_factor, brightness_factor)" }, { ...
2
null
Implement the Python class `RandomColor_pair` described below. Class description: Random crop image and label. Method signatures and docstrings: - def __init__(self, color_factor, contrast_factor, brightness_factor): Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: con...
Implement the Python class `RandomColor_pair` described below. Class description: Random crop image and label. Method signatures and docstrings: - def __init__(self, color_factor, contrast_factor, brightness_factor): Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: con...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class RandomColor_pair: """Random crop image and label.""" def __init__(self, color_factor, contrast_factor, brightness_factor): """Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: contrast_factor range :param brightness_factor: brightness_f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomColor_pair: """Random crop image and label.""" def __init__(self, color_factor, contrast_factor, brightness_factor): """Construct RandomColor_pair class. :param color_factor: color_factor range :param contrast_factor: contrast_factor range :param brightness_factor: brightness_factor range""...
the_stack_v2_python_sparse
zeus/datasets/transforms/RandomColor_pair.py
huawei-noah/xingtian
train
308
74034a218d3b8b8ac517817ba2939d6ef0cfcb22
[ "if Singleton.__instance is None:\n Singleton()\nreturn Singleton.__instance", "if Singleton.__instance:\n raise Exception(\"Can't create more than one singleton class!\")\nelse:\n Singleton.__instance = self" ]
<|body_start_0|> if Singleton.__instance is None: Singleton() return Singleton.__instance <|end_body_0|> <|body_start_1|> if Singleton.__instance: raise Exception("Can't create more than one singleton class!") else: Singleton.__instance = self <|end_b...
Singleton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Singleton: def getInstance(): """Static getter for Singleton instance property""" <|body_0|> def __init__(self): """Virtually private constructor""" <|body_1|> <|end_skeleton|> <|body_start_0|> if Singleton.__instance is None: Singleton(...
stack_v2_sparse_classes_36k_train_027733
1,340
no_license
[ { "docstring": "Static getter for Singleton instance property", "name": "getInstance", "signature": "def getInstance()" }, { "docstring": "Virtually private constructor", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_004657
Implement the Python class `Singleton` described below. Class description: Implement the Singleton class. Method signatures and docstrings: - def getInstance(): Static getter for Singleton instance property - def __init__(self): Virtually private constructor
Implement the Python class `Singleton` described below. Class description: Implement the Singleton class. Method signatures and docstrings: - def getInstance(): Static getter for Singleton instance property - def __init__(self): Virtually private constructor <|skeleton|> class Singleton: def getInstance(): ...
6397e6ec85df34aacd32fb0ad615d21a7c676244
<|skeleton|> class Singleton: def getInstance(): """Static getter for Singleton instance property""" <|body_0|> def __init__(self): """Virtually private constructor""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Singleton: def getInstance(): """Static getter for Singleton instance property""" if Singleton.__instance is None: Singleton() return Singleton.__instance def __init__(self): """Virtually private constructor""" if Singleton.__instance: raise...
the_stack_v2_python_sparse
OOP/Singleton.py
jabhax/python-data-structures-and-algorithms
train
0
427256978898c22ec7f70553bdf49741ace4e542
[ "self.uid = uid.encode()\nself.cb_obj = callback_obj\nself.cb_obj_gossip = callback_obj_gossip\nself.port = port\nself.chunks_size = chunks_size\nself.loop = asyncio.get_event_loop()\nself.udp_sock = UdpSender(self.loop, ip, int(port))\nself.token_size = 2 * struct.calcsize('i') + struct.calcsize('17s')\nself.token...
<|body_start_0|> self.uid = uid.encode() self.cb_obj = callback_obj self.cb_obj_gossip = callback_obj_gossip self.port = port self.chunks_size = chunks_size self.loop = asyncio.get_event_loop() self.udp_sock = UdpSender(self.loop, ip, int(port)) self.token...
Creates a server recv channel for pingpong and gossip
ServerRecvChannel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerRecvChannel: """Creates a server recv channel for pingpong and gossip""" def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024): """Initialize callbacks, parameters and create tcp/udp sockets""" <|body_0|> async def tcp_listen(self):...
stack_v2_sparse_classes_36k_train_027734
5,713
permissive
[ { "docstring": "Initialize callbacks, parameters and create tcp/udp sockets", "name": "__init__", "signature": "def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024)" }, { "docstring": "Wait for tcp connections to arrive", "name": "tcp_listen", "signature...
6
stack_v2_sparse_classes_30k_train_004681
Implement the Python class `ServerRecvChannel` described below. Class description: Creates a server recv channel for pingpong and gossip Method signatures and docstrings: - def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024): Initialize callbacks, parameters and create tcp/udp socke...
Implement the Python class `ServerRecvChannel` described below. Class description: Creates a server recv channel for pingpong and gossip Method signatures and docstrings: - def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024): Initialize callbacks, parameters and create tcp/udp socke...
c44b71b782afcae360fb3ed90b1d43da78eae338
<|skeleton|> class ServerRecvChannel: """Creates a server recv channel for pingpong and gossip""" def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024): """Initialize callbacks, parameters and create tcp/udp sockets""" <|body_0|> async def tcp_listen(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerRecvChannel: """Creates a server recv channel for pingpong and gossip""" def __init__(self, uid, callback_obj, callback_obj_gossip, port, ip, chunks_size=1024): """Initialize callbacks, parameters and create tcp/udp sockets""" self.uid = uid.encode() self.cb_obj = callback_o...
the_stack_v2_python_sparse
self-stabilizing-coded-atomic-storage/code/channel/serverRecvChannel.py
eladschiller/self-stabilizing-cloud
train
0
a6bf7c2de8205404655cda35ce86cdf8c5f9659e
[ "def build_tree_skeleton(start: int, end: int) -> BSTNode:\n if start > end:\n return\n if start == end:\n return BSTNode(nodes[start])\n m = start + (end - start >> 1)\n currNode = BSTNode(nodes[m])\n currNode.left = build_tree_skeleton(start, m - 1)\n currNode.right = build_tree_sk...
<|body_start_0|> def build_tree_skeleton(start: int, end: int) -> BSTNode: if start > end: return if start == end: return BSTNode(nodes[start]) m = start + (end - start >> 1) currNode = BSTNode(nodes[m]) currNode.left = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def createSortedArray(self, instructions: List[int]) -> int: """Use binary search tree.""" <|body_0|> def createSortedArray2(self, instructions: List[int]) -> int: """Use binary indexed tree. x & -x could get the least significant bit.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_027735
2,961
no_license
[ { "docstring": "Use binary search tree.", "name": "createSortedArray", "signature": "def createSortedArray(self, instructions: List[int]) -> int" }, { "docstring": "Use binary indexed tree. x & -x could get the least significant bit.", "name": "createSortedArray2", "signature": "def crea...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def createSortedArray(self, instructions: List[int]) -> int: Use binary search tree. - def createSortedArray2(self, instructions: List[int]) -> int: Use binary indexed tree. x & ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def createSortedArray(self, instructions: List[int]) -> int: Use binary search tree. - def createSortedArray2(self, instructions: List[int]) -> int: Use binary indexed tree. x & ...
edb870f83f0c4568cce0cacec04ee70cf6b545bf
<|skeleton|> class Solution: def createSortedArray(self, instructions: List[int]) -> int: """Use binary search tree.""" <|body_0|> def createSortedArray2(self, instructions: List[int]) -> int: """Use binary indexed tree. x & -x could get the least significant bit.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def createSortedArray(self, instructions: List[int]) -> int: """Use binary search tree.""" def build_tree_skeleton(start: int, end: int) -> BSTNode: if start > end: return if start == end: return BSTNode(nodes[start]) ...
the_stack_v2_python_sparse
2021/create_sorted_array_through_instructions.py
eronekogin/leetcode
train
0
91ea7d755cb344054a63f3cf460e64963b35c06c
[ "user = User.objects.get(username=username)\nuid = user.pk\nprofile = get_object_or_404(Profile.objects.all(), user_id=uid)\nserializer = ProfileSerializer(profile, many=False)\nreturn Response({'profile': serializer.data})", "user_check = self.request.user\nif Profile.objects.filter(user=user_check).exists():\n ...
<|body_start_0|> user = User.objects.get(username=username) uid = user.pk profile = get_object_or_404(Profile.objects.all(), user_id=uid) serializer = ProfileSerializer(profile, many=False) return Response({'profile': serializer.data}) <|end_body_0|> <|body_start_1|> use...
Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile.
CreateRetrieveProfileView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateRetrieveProfileView: """Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile.""" def get(self, request, username): """Returns a single user profile. Matches a profile based on the ...
stack_v2_sparse_classes_36k_train_027736
7,872
permissive
[ { "docstring": "Returns a single user profile. Matches a profile based on the username.", "name": "get", "signature": "def get(self, request, username)" }, { "docstring": "Creates and saves a single user profile to the database. Checks if a profile already exits for the current user.", "name...
2
stack_v2_sparse_classes_30k_train_000916
Implement the Python class `CreateRetrieveProfileView` described below. Class description: Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile. Method signatures and docstrings: - def get(self, request, username): Retur...
Implement the Python class `CreateRetrieveProfileView` described below. Class description: Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile. Method signatures and docstrings: - def get(self, request, username): Retur...
4b14cce62be06c0bd652fcc9be3264d8c62f8718
<|skeleton|> class CreateRetrieveProfileView: """Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile.""" def get(self, request, username): """Returns a single user profile. Matches a profile based on the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateRetrieveProfileView: """Implements two user profile related views. The 'get' view fetches a single profile from the database and the 'post' view creates a single user profile.""" def get(self, request, username): """Returns a single user profile. Matches a profile based on the username.""" ...
the_stack_v2_python_sparse
authors/apps/profiles/views.py
andela/ah-the-answer-backend
train
0
4f55f1f09a3c65cb3a54d1c561733fd56e0a22e0
[ "self.grid = grid\nself.init = init\nself.end = end\nself.path = None", "max_X, max_Y = grid.shape\nmy_X, my_Y = curr_node.pos\narea = [(a + my_X, b + my_Y) for a, b in [(-1, 0), (1, 0), (0, -1), (0, 1)]]\nwithin_range = (p for p in area if p[0] in range(max_X) and p[1] in range(max_Y))\ncell_types = (PathFinder....
<|body_start_0|> self.grid = grid self.init = init self.end = end self.path = None <|end_body_0|> <|body_start_1|> max_X, max_Y = grid.shape my_X, my_Y = curr_node.pos area = [(a + my_X, b + my_Y) for a, b in [(-1, 0), (1, 0), (0, -1), (0, 1)]] within_ran...
PathFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PathFinder: def __init__(self, grid, init, end): """:param grid: :param init: :param end:""" <|body_0|> def walkable_node_neighbors(grid, curr_node, rad=1): """Gets the set of surrounding tiles given a tile and its set radius""" <|body_1|> def check_type...
stack_v2_sparse_classes_36k_train_027737
4,915
no_license
[ { "docstring": ":param grid: :param init: :param end:", "name": "__init__", "signature": "def __init__(self, grid, init, end)" }, { "docstring": "Gets the set of surrounding tiles given a tile and its set radius", "name": "walkable_node_neighbors", "signature": "def walkable_node_neighbo...
5
stack_v2_sparse_classes_30k_train_015922
Implement the Python class `PathFinder` described below. Class description: Implement the PathFinder class. Method signatures and docstrings: - def __init__(self, grid, init, end): :param grid: :param init: :param end: - def walkable_node_neighbors(grid, curr_node, rad=1): Gets the set of surrounding tiles given a ti...
Implement the Python class `PathFinder` described below. Class description: Implement the PathFinder class. Method signatures and docstrings: - def __init__(self, grid, init, end): :param grid: :param init: :param end: - def walkable_node_neighbors(grid, curr_node, rad=1): Gets the set of surrounding tiles given a ti...
a40407c2d8818f46eb66e36aad9664f94339db23
<|skeleton|> class PathFinder: def __init__(self, grid, init, end): """:param grid: :param init: :param end:""" <|body_0|> def walkable_node_neighbors(grid, curr_node, rad=1): """Gets the set of surrounding tiles given a tile and its set radius""" <|body_1|> def check_type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PathFinder: def __init__(self, grid, init, end): """:param grid: :param init: :param end:""" self.grid = grid self.init = init self.end = end self.path = None def walkable_node_neighbors(grid, curr_node, rad=1): """Gets the set of surrounding tiles given a ...
the_stack_v2_python_sparse
gazebo_world_gen/generators/path_finder.py
Houman-HM/anafi_tools
train
0
d33da881f7d70d3af29075bdcb2ad57fa0b9abd3
[ "self = object.__new__(cls)\nself.name = cls.DEFAULT_NAME\nself.value = value\nself.metadata_type = ApplicationCommandOptionMetadataBase\nreturn self", "self.value = value\nself.name = name\nself.metadata_type = metadata_type\nself.INSTANCES[value] = self" ]
<|body_start_0|> self = object.__new__(cls) self.name = cls.DEFAULT_NAME self.value = value self.metadata_type = ApplicationCommandOptionMetadataBase return self <|end_body_0|> <|body_start_1|> self.value = value self.name = name self.metadata_type = meta...
Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `type<ApplicationCommandOptionMetadataBase>` The option type's respective metadata type. Class Attr...
ApplicationCommandOptionType
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationCommandOptionType: """Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `type<ApplicationCommandOptionMetadataBase>...
stack_v2_sparse_classes_36k_train_027738
6,762
permissive
[ { "docstring": "Creates a new application command option type with the given value. Parameters ---------- value : `int` The application command option type's identifier value. Returns ------- self : `instance<cls>` The created instance.", "name": "_from_value", "signature": "def _from_value(cls, value)"...
2
stack_v2_sparse_classes_30k_train_009633
Implement the Python class `ApplicationCommandOptionType` described below. Class description: Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `typ...
Implement the Python class `ApplicationCommandOptionType` described below. Class description: Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `typ...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class ApplicationCommandOptionType: """Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `type<ApplicationCommandOptionMetadataBase>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationCommandOptionType: """Represents an application command option's type. Attributes ---------- name : `str` The name of the application command option type. value : `int` The identifier value the application command option type. metadata_type : `type<ApplicationCommandOptionMetadataBase>` The option ...
the_stack_v2_python_sparse
hata/discord/application_command/application_command_option/preinstanced.py
HuyaneMatsu/hata
train
3
eb729a61d5d9ae3b01a81d2efd7b413497fbfc9e
[ "if self.status == enums.TrxStatus.CANCELLATION:\n return -self.trx.amount\nreturn self.trx.amount", "currency = self.trx.wallet.currency\nif self.trx.amount < Money(0, currency or settings.DEFAULT_CURRENCY):\n return self.status in (enums.TrxStatus.PENDING, enums.TrxStatus.CANCELLATION)\nelse:\n return ...
<|body_start_0|> if self.status == enums.TrxStatus.CANCELLATION: return -self.trx.amount return self.trx.amount <|end_body_0|> <|body_start_1|> currency = self.trx.wallet.currency if self.trx.amount < Money(0, currency or settings.DEFAULT_CURRENCY): return self.s...
WalletTransactionStatus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WalletTransactionStatus: def signed_amount(self): """Returns the amount in a signed form based on the trx type""" <|body_0|> def countable(self): """Returns a boolean depending on if the transactions counts or not. For example, rejected transactions do not contribute...
stack_v2_sparse_classes_36k_train_027739
5,721
permissive
[ { "docstring": "Returns the amount in a signed form based on the trx type", "name": "signed_amount", "signature": "def signed_amount(self)" }, { "docstring": "Returns a boolean depending on if the transactions counts or not. For example, rejected transactions do not contribute to the wallet bala...
2
stack_v2_sparse_classes_30k_train_009937
Implement the Python class `WalletTransactionStatus` described below. Class description: Implement the WalletTransactionStatus class. Method signatures and docstrings: - def signed_amount(self): Returns the amount in a signed form based on the trx type - def countable(self): Returns a boolean depending on if the tran...
Implement the Python class `WalletTransactionStatus` described below. Class description: Implement the WalletTransactionStatus class. Method signatures and docstrings: - def signed_amount(self): Returns the amount in a signed form based on the trx type - def countable(self): Returns a boolean depending on if the tran...
c63e824ce246b15163e352f5150ef4ecbee81b96
<|skeleton|> class WalletTransactionStatus: def signed_amount(self): """Returns the amount in a signed form based on the trx type""" <|body_0|> def countable(self): """Returns a boolean depending on if the transactions counts or not. For example, rejected transactions do not contribute...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WalletTransactionStatus: def signed_amount(self): """Returns the amount in a signed form based on the trx type""" if self.status == enums.TrxStatus.CANCELLATION: return -self.trx.amount return self.trx.amount def countable(self): """Returns a boolean depending ...
the_stack_v2_python_sparse
src/wallet/models.py
uppsaladatavetare/foobar-api
train
16
ae37d435670305c2cc3de0c4ccbc889376378c04
[ "try:\n natController = NatController()\n json_data = json.loads(request.data.decode())\n natController.add_arp_entry(json_data)\n return Response(status=202)\nexcept Exception as err:\n return Response(json.dumps(str(err)), status=500, mimetype='application/json')", "try:\n natController = NatC...
<|body_start_0|> try: natController = NatController() json_data = json.loads(request.data.decode()) natController.add_arp_entry(json_data) return Response(status=202) except Exception as err: return Response(json.dumps(str(err)), status=500, mi...
Arp_Table
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arp_Table: def post(self): """Add an arp entry""" <|body_0|> def get(self): """Get the arp table""" <|body_1|> def delete(self, id): """Remove the configuration of an interface""" <|body_2|> <|end_skeleton|> <|body_start_0|> try...
stack_v2_sparse_classes_36k_train_027740
3,754
no_license
[ { "docstring": "Add an arp entry", "name": "post", "signature": "def post(self)" }, { "docstring": "Get the arp table", "name": "get", "signature": "def get(self)" }, { "docstring": "Remove the configuration of an interface", "name": "delete", "signature": "def delete(sel...
3
stack_v2_sparse_classes_30k_train_012270
Implement the Python class `Arp_Table` described below. Class description: Implement the Arp_Table class. Method signatures and docstrings: - def post(self): Add an arp entry - def get(self): Get the arp table - def delete(self, id): Remove the configuration of an interface
Implement the Python class `Arp_Table` described below. Class description: Implement the Arp_Table class. Method signatures and docstrings: - def post(self): Add an arp entry - def get(self): Get the arp table - def delete(self, id): Remove the configuration of an interface <|skeleton|> class Arp_Table: def pos...
6070e3cb6bf957e04f5d8267db11f3296410e18e
<|skeleton|> class Arp_Table: def post(self): """Add an arp entry""" <|body_0|> def get(self): """Get the arp table""" <|body_1|> def delete(self, id): """Remove the configuration of an interface""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Arp_Table: def post(self): """Add an arp entry""" try: natController = NatController() json_data = json.loads(request.data.decode()) natController.add_arp_entry(json_data) return Response(status=202) except Exception as err: r...
the_stack_v2_python_sparse
configuration-agent/nat/rest_api/resources/arp_table.py
ReliableLion/frog4-configurable-vnf
train
0
0effc22b3ce6ddb34dae9a2200c07d3506aa2e6a
[ "self.sensors = sensors\nself.last_state: State | None = None\nself.coordinator = coordinator\nself.attribute = attribute\nself.block: Block | None = block\nself.entity_description = description\nself._attr_should_poll = False\nself._attr_device_info = DeviceInfo(connections={(CONNECTION_NETWORK_MAC, coordinator.ma...
<|body_start_0|> self.sensors = sensors self.last_state: State | None = None self.coordinator = coordinator self.attribute = attribute self.block: Block | None = block self.entity_description = description self._attr_should_poll = False self._attr_device_i...
Represent a shelly sleeping block attribute entity.
ShellySleepingBlockAttributeEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, entry: RegistryEntry | None=None, sensors: Mapping[tuple[str, str], ...
stack_v2_sparse_classes_36k_train_027741
21,943
permissive
[ { "docstring": "Initialize the sleeping sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, entry: RegistryEntry | None=None, sensors: Mapping[tuple[str, str], BlockEntityDescription...
2
null
Implement the Python class `ShellySleepingBlockAttributeEntity` described below. Class description: Represent a shelly sleeping block attribute entity. Method signatures and docstrings: - def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, ...
Implement the Python class `ShellySleepingBlockAttributeEntity` described below. Class description: Represent a shelly sleeping block attribute entity. Method signatures and docstrings: - def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, entry: RegistryEntry | None=None, sensors: Mapping[tuple[str, str], ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShellySleepingBlockAttributeEntity: """Represent a shelly sleeping block attribute entity.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block | None, attribute: str, description: BlockEntityDescription, entry: RegistryEntry | None=None, sensors: Mapping[tuple[str, str], BlockEntityDe...
the_stack_v2_python_sparse
homeassistant/components/shelly/entity.py
home-assistant/core
train
35,501
8a7f13568bc8f378597a01bb498e62fa72014a84
[ "jsonFilePath = RESULTS_DIRECTORY + '/' + fileName + '.json'\nif not os.path.exists(jsonFilePath):\n self.clear()\n self.set_status(404)\n self.finish('%s does not exist' % (fileName + '.json'))\nelse:\n with open(jsonFilePath, 'r') as jsonFile:\n data = jsonFile.read()\n self.set_header('Cont...
<|body_start_0|> jsonFilePath = RESULTS_DIRECTORY + '/' + fileName + '.json' if not os.path.exists(jsonFilePath): self.clear() self.set_status(404) self.finish('%s does not exist' % (fileName + '.json')) else: with open(jsonFilePath, 'r') as jsonFi...
file handler
FileHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileHandler: """file handler""" def get(self, fileName): """get method""" <|body_0|> def post(self, fileName): """post""" <|body_1|> <|end_skeleton|> <|body_start_0|> jsonFilePath = RESULTS_DIRECTORY + '/' + fileName + '.json' if not os....
stack_v2_sparse_classes_36k_train_027742
2,178
permissive
[ { "docstring": "get method", "name": "get", "signature": "def get(self, fileName)" }, { "docstring": "post", "name": "post", "signature": "def post(self, fileName)" } ]
2
null
Implement the Python class `FileHandler` described below. Class description: file handler Method signatures and docstrings: - def get(self, fileName): get method - def post(self, fileName): post
Implement the Python class `FileHandler` described below. Class description: file handler Method signatures and docstrings: - def get(self, fileName): get method - def post(self, fileName): post <|skeleton|> class FileHandler: """file handler""" def get(self, fileName): """get method""" <|bo...
f0472c3932f839657fd98e6d3f85c7e87f7b0982
<|skeleton|> class FileHandler: """file handler""" def get(self, fileName): """get method""" <|body_0|> def post(self, fileName): """post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileHandler: """file handler""" def get(self, fileName): """get method""" jsonFilePath = RESULTS_DIRECTORY + '/' + fileName + '.json' if not os.path.exists(jsonFilePath): self.clear() self.set_status(404) self.finish('%s does not exist' % (fileN...
the_stack_v2_python_sparse
integration-test/src/python/http_server/main.py
maosongfu/heron
train
4
711041dbc401089fa7ea6cb68b1be9e3f7203009
[ "for vals in vals_list:\n if not vals.get('name', False) and self._context.get('create_fleet_vehicle', False):\n vals.update({'name': 'NEW VEHICLE', 'detailed_type': 'product', 'is_vehicle': True})\n return super(ProductProduct, self).create(vals)", "ctx = dict(self.env.context)\nres = super(ProductP...
<|body_start_0|> for vals in vals_list: if not vals.get('name', False) and self._context.get('create_fleet_vehicle', False): vals.update({'name': 'NEW VEHICLE', 'detailed_type': 'product', 'is_vehicle': True}) return super(ProductProduct, self).create(vals) <|end_body_0|>...
Product model.
ProductProduct
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductProduct: """Product model.""" def create(self, vals_list): """Overridden method to update the product information.""" <|body_0|> def write(self, vals): """Overridden method to update the vehicle information.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_027743
4,610
no_license
[ { "docstring": "Overridden method to update the product information.", "name": "create", "signature": "def create(self, vals_list)" }, { "docstring": "Overridden method to update the vehicle information.", "name": "write", "signature": "def write(self, vals)" } ]
2
null
Implement the Python class `ProductProduct` described below. Class description: Product model. Method signatures and docstrings: - def create(self, vals_list): Overridden method to update the product information. - def write(self, vals): Overridden method to update the vehicle information.
Implement the Python class `ProductProduct` described below. Class description: Product model. Method signatures and docstrings: - def create(self, vals_list): Overridden method to update the product information. - def write(self, vals): Overridden method to update the vehicle information. <|skeleton|> class Product...
7618a365ac78c0f59390a3a6b5fcdd9f76a5ddec
<|skeleton|> class ProductProduct: """Product model.""" def create(self, vals_list): """Overridden method to update the product information.""" <|body_0|> def write(self, vals): """Overridden method to update the vehicle information.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductProduct: """Product model.""" def create(self, vals_list): """Overridden method to update the product information.""" for vals in vals_list: if not vals.get('name', False) and self._context.get('create_fleet_vehicle', False): vals.update({'name': 'NEW VE...
the_stack_v2_python_sparse
vehicles_dealership/models/fleet_vehicle.py
JayVora-SerpentCS/fleet_management
train
29
79c756691ca4186debb8c1de5da3f520db87cfc7
[ "blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None))\nself.template_name = blog.template.path\nself.entry = blog\nreturn super(BlogDetailView, self).get(request, *args, **kwargs)", "context = super(BlogDetailView, self).get_context_data(**kwargs)\ntag_lines = [('Create simple, human-like, conversat...
<|body_start_0|> blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None)) self.template_name = blog.template.path self.entry = blog return super(BlogDetailView, self).get(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> context = super(BlogDetailView, self).ge...
Our view to set the template path prior to a regular get request.
BlogDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" <|body_0|> def get_context_data(self, **kwargs): """Set the blog en...
stack_v2_sparse_classes_36k_train_027744
3,135
no_license
[ { "docstring": "Here we base our render on the selected template/blog entry.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Set the blog entry context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005023
Implement the Python class `BlogDetailView` described below. Class description: Our view to set the template path prior to a regular get request. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Here we base our render on the selected template/blog entry. - def get_context_data(self, **kwa...
Implement the Python class `BlogDetailView` described below. Class description: Our view to set the template path prior to a regular get request. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Here we base our render on the selected template/blog entry. - def get_context_data(self, **kwa...
4cd52c07bb64e9d9381a957323d277489a02181a
<|skeleton|> class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" <|body_0|> def get_context_data(self, **kwargs): """Set the blog en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None)) self.template_name...
the_stack_v2_python_sparse
cms/blog/views.py
webmaxdev0110/digi-django
train
0
5e689a13d9a6503791cb1d84dc0efc29d8ad5ab3
[ "profit = 0\nfor i in range(1, len(prices)):\n if prices[i] > prices[i - 1]:\n profit += prices[i] - prices[i - 1]\nreturn profit", "profit = day = 0\ntotal_days = len(prices) - 1\nwhile day < total_days:\n while day < total_days and prices[day] >= prices[day + 1]:\n day += 1\n valley = pri...
<|body_start_0|> profit = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: profit += prices[i] - prices[i - 1] return profit <|end_body_0|> <|body_start_1|> profit = day = 0 total_days = len(prices) - 1 while day < total_days: ...
Stock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" <|body_0|> def max_profit_(self, prices: List[int]) -> int: """Approach: Peak Valley Time Complexity: O(N) Sp...
stack_v2_sparse_classes_36k_train_027745
1,201
no_license
[ { "docstring": "Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:", "name": "max_profit", "signature": "def max_profit(self, prices: List[int]) -> int" }, { "docstring": "Approach: Peak Valley Time Complexity: O(N) Space Complexity: O(1) :param pric...
2
stack_v2_sparse_classes_30k_train_017130
Implement the Python class `Stock` described below. Class description: Implement the Stock class. Method signatures and docstrings: - def max_profit(self, prices: List[int]) -> int: Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return: - def max_profit_(self, prices: List[in...
Implement the Python class `Stock` described below. Class description: Implement the Stock class. Method signatures and docstrings: - def max_profit(self, prices: List[int]) -> int: Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return: - def max_profit_(self, prices: List[in...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" <|body_0|> def max_profit_(self, prices: List[int]) -> int: """Approach: Peak Valley Time Complexity: O(N) Sp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" profit = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: profit += prices[i] - price...
the_stack_v2_python_sparse
expedia/best_time_to_buy_stock_ii.py
Shiv2157k/leet_code
train
1
4dc9c40b29e57b7eff0e79eeeb05b39133c8f296
[ "self.D = diffusion_coefficient\nself.T = t_max\nself.X0 = x_left\nself.X1 = x_right\nself.Y0 = y_bottom\nself.Y1 = y_top\nself.Nx = x_steps\nself.Ny = y_steps\nself.Nt = t_steps\nself.dx = (self.X1 - self.X0) / (self.Nx - 1)\nself.dy = (self.Y1 - self.Y0) / (self.Ny - 1)\nself.x = np.linspace(self.X0 + self.dx, se...
<|body_start_0|> self.D = diffusion_coefficient self.T = t_max self.X0 = x_left self.X1 = x_right self.Y0 = y_bottom self.Y1 = y_top self.Nx = x_steps self.Ny = y_steps self.Nt = t_steps self.dx = (self.X1 - self.X0) / (self.Nx - 1) ...
Simulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulator: def __init__(self, diffusion_coefficient, t_max, t_steps, x_left, x_right, x_steps, y_bottom, y_top, y_steps, train_data): """Constructor method initializing the parameters for the Burger's equation. :param diffusion_coefficient: The diffusion coefficient :param t_max: Stop ti...
stack_v2_sparse_classes_36k_train_027746
4,138
no_license
[ { "docstring": "Constructor method initializing the parameters for the Burger's equation. :param diffusion_coefficient: The diffusion coefficient :param t_max: Stop time of the simulation :param t_steps: Number of simulation steps :param x_left: Left end of the 1D simulation field :param x_right: Right end of t...
3
stack_v2_sparse_classes_30k_train_001319
Implement the Python class `Simulator` described below. Class description: Implement the Simulator class. Method signatures and docstrings: - def __init__(self, diffusion_coefficient, t_max, t_steps, x_left, x_right, x_steps, y_bottom, y_top, y_steps, train_data): Constructor method initializing the parameters for th...
Implement the Python class `Simulator` described below. Class description: Implement the Simulator class. Method signatures and docstrings: - def __init__(self, diffusion_coefficient, t_max, t_steps, x_left, x_right, x_steps, y_bottom, y_top, y_steps, train_data): Constructor method initializing the parameters for th...
82b4eac6b55be3b44e736f139ed50256c4415f0c
<|skeleton|> class Simulator: def __init__(self, diffusion_coefficient, t_max, t_steps, x_left, x_right, x_steps, y_bottom, y_top, y_steps, train_data): """Constructor method initializing the parameters for the Burger's equation. :param diffusion_coefficient: The diffusion coefficient :param t_max: Stop ti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Simulator: def __init__(self, diffusion_coefficient, t_max, t_steps, x_left, x_right, x_steps, y_bottom, y_top, y_steps, train_data): """Constructor method initializing the parameters for the Burger's equation. :param diffusion_coefficient: The diffusion coefficient :param t_max: Stop time of the simu...
the_stack_v2_python_sparse
data/burger_2d/simulator.py
CognitiveModeling/finn
train
28
caccb734707b1ce314af178a2558160ef6ccbaa1
[ "super(MoveItemsForm, self).__init__(project, *args, **kwargs)\nif subdir is not None:\n choices = [(d.name, d.name) for d in display_dirs]\n if subdir:\n choices.insert(0, ('../', '(Parent directory)'))\n self.fields['destination_folder'].widget.choices = choices", "cleaned_data = super(MoveItems...
<|body_start_0|> super(MoveItemsForm, self).__init__(project, *args, **kwargs) if subdir is not None: choices = [(d.name, d.name) for d in display_dirs] if subdir: choices.insert(0, ('../', '(Parent directory)')) self.fields['destination_folder'].widge...
Form for moving items into a target folder
MoveItemsForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoveItemsForm: """Form for moving items into a target folder""" def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs): """Set the choices for the destination folder""" <|body_0|> def clean(self): """Selected destination folder: - May only b...
stack_v2_sparse_classes_36k_train_027747
45,155
permissive
[ { "docstring": "Set the choices for the destination folder", "name": "__init__", "signature": "def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs)" }, { "docstring": "Selected destination folder: - May only be '..' if subdir is not the top level - Must not be one of the ...
3
null
Implement the Python class `MoveItemsForm` described below. Class description: Form for moving items into a target folder Method signatures and docstrings: - def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs): Set the choices for the destination folder - def clean(self): Selected destination...
Implement the Python class `MoveItemsForm` described below. Class description: Form for moving items into a target folder Method signatures and docstrings: - def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs): Set the choices for the destination folder - def clean(self): Selected destination...
304e093dc550da8636552dc601d6545c07ffc771
<|skeleton|> class MoveItemsForm: """Form for moving items into a target folder""" def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs): """Set the choices for the destination folder""" <|body_0|> def clean(self): """Selected destination folder: - May only b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoveItemsForm: """Form for moving items into a target folder""" def __init__(self, project, subdir=None, display_dirs=None, *args, **kwargs): """Set the choices for the destination folder""" super(MoveItemsForm, self).__init__(project, *args, **kwargs) if subdir is not None: ...
the_stack_v2_python_sparse
physionet-django/project/forms.py
MIT-LCP/physionet-build
train
50
86367a1d88a19de1f9555d5703d705fba9ca793d
[ "try:\n with transaction.atomic():\n self.create(user=user, group=group, project=group.project, is_active=True, reason=reason)\nexcept IntegrityError:\n pass", "from sentry.models import User, UserOption, UserOptionValue\nusers = User.objects.filter(sentry_orgmember_set__teams=group.project.team, is_...
<|body_start_0|> try: with transaction.atomic(): self.create(user=user, group=group, project=group.project, is_active=True, reason=reason) except IntegrityError: pass <|end_body_0|> <|body_start_1|> from sentry.models import User, UserOption, UserOptionVa...
GroupSubscriptionManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" <|body_0|> def get_participants(self, group): """Identify all users who are p...
stack_v2_sparse_classes_36k_train_027748
5,262
permissive
[ { "docstring": "Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.", "name": "subscribe", "signature": "def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown)" }, { "docstring": "Identify all users who are participating with a given issue.", ...
2
stack_v2_sparse_classes_30k_train_018735
Implement the Python class `GroupSubscriptionManager` described below. Class description: Implement the GroupSubscriptionManager class. Method signatures and docstrings: - def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): Subscribe a user to an issue, but only if the user has not explicitly un...
Implement the Python class `GroupSubscriptionManager` described below. Class description: Implement the GroupSubscriptionManager class. Method signatures and docstrings: - def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): Subscribe a user to an issue, but only if the user has not explicitly un...
b937615079d7b24dc225a83b99b1b65da932fc66
<|skeleton|> class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" <|body_0|> def get_participants(self, group): """Identify all users who are p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" try: with transaction.atomic(): self.create(user=user, group=group, project=...
the_stack_v2_python_sparse
src/sentry/models/groupsubscription.py
atlassian/sentry
train
1
20b41ef161ada47f25a02d82a5561b3fc3044a74
[ "self.filepath = filepath\nxls_file = pd.ExcelFile(filepath)\nself.book = xls_file", "sheet = self.book.parse('Final QC Results', skiprows=1, index_col=[0, 1])\nnew_column_names = ['VerifyBam_Omni_Free', 'VerifyBam_Affy_Free', 'VerifyBam_Omni_Chip', 'VerifyBam_Affy_Chip', 'Indel_Ratio', 'Passed_QC']\ndf = ''\nif ...
<|body_start_0|> self.filepath = filepath xls_file = pd.ExcelFile(filepath) self.book = xls_file <|end_body_0|> <|body_start_1|> sheet = self.book.parse('Final QC Results', skiprows=1, index_col=[0, 1]) new_column_names = ['VerifyBam_Omni_Free', 'VerifyBam_Affy_Free', 'VerifyBam...
Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3
p3BAMQC
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables -----...
stack_v2_sparse_classes_36k_train_027749
1,566
permissive
[ { "docstring": "Constructor Class variables --------------- filepath: str Path to the spreadsheet book: ExcelFile object", "name": "__init__", "signature": "def __init__(self, filepath)" }, { "docstring": "Method to get the sheet corresponding to 'Final QC Results' Parameters ---------- group: s...
2
stack_v2_sparse_classes_30k_train_012110
Implement the Python class `p3BAMQC` described below. Class description: Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3 Method signatures and docstrings: - def __...
Implement the Python class `p3BAMQC` described below. Class description: Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3 Method signatures and docstrings: - def __...
3926e2713fd5bce8fe7de71a30a1c067b6d7cb0b
<|skeleton|> class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables -----...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables --------------- fi...
the_stack_v2_python_sparse
build/lib/p3/p3BAMQC.py
vj573/igsr_analysis
train
0
80cbb12e4003c66e1e08043c367f0737ea486da2
[ "lower_file_ext = file_extension.lower()\nif lower_file_ext == '.vtk':\n return vtk.vtkPolyDataReader()\nif lower_file_ext == '.ply':\n return vtk.vtkPLYReader()\nif lower_file_ext == '.obj':\n return OBJReader()\nreturn None", "if not file_name or not os.path.isfile(file_name):\n return None\ndata_re...
<|body_start_0|> lower_file_ext = file_extension.lower() if lower_file_ext == '.vtk': return vtk.vtkPolyDataReader() if lower_file_ext == '.ply': return vtk.vtkPLYReader() if lower_file_ext == '.obj': return OBJReader() return None <|end_body_0...
VtkIO
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VtkIO: def __get_reader(self, file_extension): """Returns a reader that can read the file type having the provided extension. Returns None if no such reader.""" <|body_0|> def load(self, file_name): """Loads the data from the file 'file_name' and returns it. Returns ...
stack_v2_sparse_classes_36k_train_027750
1,198
permissive
[ { "docstring": "Returns a reader that can read the file type having the provided extension. Returns None if no such reader.", "name": "__get_reader", "signature": "def __get_reader(self, file_extension)" }, { "docstring": "Loads the data from the file 'file_name' and returns it. Returns None if ...
2
stack_v2_sparse_classes_30k_train_003960
Implement the Python class `VtkIO` described below. Class description: Implement the VtkIO class. Method signatures and docstrings: - def __get_reader(self, file_extension): Returns a reader that can read the file type having the provided extension. Returns None if no such reader. - def load(self, file_name): Loads t...
Implement the Python class `VtkIO` described below. Class description: Implement the VtkIO class. Method signatures and docstrings: - def __get_reader(self, file_extension): Returns a reader that can read the file type having the provided extension. Returns None if no such reader. - def load(self, file_name): Loads t...
6cae388a51e0509d280f55b9ebc9be3c4c45f794
<|skeleton|> class VtkIO: def __get_reader(self, file_extension): """Returns a reader that can read the file type having the provided extension. Returns None if no such reader.""" <|body_0|> def load(self, file_name): """Loads the data from the file 'file_name' and returns it. Returns ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VtkIO: def __get_reader(self, file_extension): """Returns a reader that can read the file type having the provided extension. Returns None if no such reader.""" lower_file_ext = file_extension.lower() if lower_file_ext == '.vtk': return vtk.vtkPolyDataReader() if lo...
the_stack_v2_python_sparse
IO/vtkio.py
zibneuro/brainvispy
train
2
d8674da0d7b90507cca013d3d5df134e02f9bedd
[ "tk = Track()\ntk.add(0.0, self.head_mot.pantilt(0.8, 0.6, 0.5))\ntk.add(0.01, self.head_mot.moveeyes(0.0, 0.5))\ntk.add(0.5, self.head_mot.pantilt(-0.8, -0.6, 0.5))\ntk.add(0.51, self.head_mot.moveeyes(0.4, 0.5))\ntk.add(3.0, self.lights_mot.white_glow(255, 0.1, float('inf')))\nreturn tk", "tk = Track()\ntk.add(...
<|body_start_0|> tk = Track() tk.add(0.0, self.head_mot.pantilt(0.8, 0.6, 0.5)) tk.add(0.01, self.head_mot.moveeyes(0.0, 0.5)) tk.add(0.5, self.head_mot.pantilt(-0.8, -0.6, 0.5)) tk.add(0.51, self.head_mot.moveeyes(0.4, 0.5)) tk.add(3.0, self.lights_mot.white_glow(255, 0....
TestAnimations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnimations: def seizure(self): """Actuate joints through range of motions""" <|body_0|> def test_pan(self): """Move pan axis independently.""" <|body_1|> def test_tilt(self): """Move tilt axis independently.""" <|body_2|> def tes...
stack_v2_sparse_classes_36k_train_027751
1,605
no_license
[ { "docstring": "Actuate joints through range of motions", "name": "seizure", "signature": "def seizure(self)" }, { "docstring": "Move pan axis independently.", "name": "test_pan", "signature": "def test_pan(self)" }, { "docstring": "Move tilt axis independently.", "name": "te...
4
stack_v2_sparse_classes_30k_train_003615
Implement the Python class `TestAnimations` described below. Class description: Implement the TestAnimations class. Method signatures and docstrings: - def seizure(self): Actuate joints through range of motions - def test_pan(self): Move pan axis independently. - def test_tilt(self): Move tilt axis independently. - d...
Implement the Python class `TestAnimations` described below. Class description: Implement the TestAnimations class. Method signatures and docstrings: - def seizure(self): Actuate joints through range of motions - def test_pan(self): Move pan axis independently. - def test_tilt(self): Move tilt axis independently. - d...
e28512b63c599995ef8153549c2bae0b92097246
<|skeleton|> class TestAnimations: def seizure(self): """Actuate joints through range of motions""" <|body_0|> def test_pan(self): """Move pan axis independently.""" <|body_1|> def test_tilt(self): """Move tilt axis independently.""" <|body_2|> def tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnimations: def seizure(self): """Actuate joints through range of motions""" tk = Track() tk.add(0.0, self.head_mot.pantilt(0.8, 0.6, 0.5)) tk.add(0.01, self.head_mot.moveeyes(0.0, 0.5)) tk.add(0.5, self.head_mot.pantilt(-0.8, -0.6, 0.5)) tk.add(0.51, self.h...
the_stack_v2_python_sparse
kuri_api/src/kuri_api/anim/library/test_animations.py
hcrlab/kuri
train
11
dfb27d9e80990a4a558c33a885fb7485849711e8
[ "if not command in self:\n if command:\n message = '[SP] ' + _command_strings['Invalid Command'].get_string(command=command)\n else:\n message = '[SP] ' + _command_strings['No Command'].get_string()\n self._print_help(message)\n return\nif hasattr(self[command], 'args'):\n required = [x...
<|body_start_0|> if not command in self: if command: message = '[SP] ' + _command_strings['Invalid Command'].get_string(command=command) else: message = '[SP] ' + _command_strings['No Command'].get_string() self._print_help(message) ...
Class used for executing "sp" sub-command functionality
_SPCommands
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SPCommands: """Class used for executing "sp" sub-command functionality""" def call_command(self, command, args): """Executes the given "sp" sub-command""" <|body_0|> def _print_help(self, message=''): """Prints all "sp" sub-commands.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_027752
11,931
no_license
[ { "docstring": "Executes the given \"sp\" sub-command", "name": "call_command", "signature": "def call_command(self, command, args)" }, { "docstring": "Prints all \"sp\" sub-commands.", "name": "_print_help", "signature": "def _print_help(self, message='')" } ]
2
stack_v2_sparse_classes_30k_train_013389
Implement the Python class `_SPCommands` described below. Class description: Class used for executing "sp" sub-command functionality Method signatures and docstrings: - def call_command(self, command, args): Executes the given "sp" sub-command - def _print_help(self, message=''): Prints all "sp" sub-commands.
Implement the Python class `_SPCommands` described below. Class description: Class used for executing "sp" sub-command functionality Method signatures and docstrings: - def call_command(self, command, args): Executes the given "sp" sub-command - def _print_help(self, message=''): Prints all "sp" sub-commands. <|skel...
b84df87f67ecb0fb2487e68e8b4b6bee3944f506
<|skeleton|> class _SPCommands: """Class used for executing "sp" sub-command functionality""" def call_command(self, command, args): """Executes the given "sp" sub-command""" <|body_0|> def _print_help(self, message=''): """Prints all "sp" sub-commands.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SPCommands: """Class used for executing "sp" sub-command functionality""" def call_command(self, command, args): """Executes the given "sp" sub-command""" if not command in self: if command: message = '[SP] ' + _command_strings['Invalid Command'].get_string(co...
the_stack_v2_python_sparse
addons/source-python/packages/source-python/_core/commands.py
aurorapar/Source.Python
train
0
a193284ae99705ea719e6dee5f6c92dde2c39085
[ "rlt = []\nself._less_equal(0, k, rlt)\nreturn rlt", "item = self._data[idx]\nif item._key <= k:\n rl.append((item._key, item._value))\nif self._has_left(idx):\n self._less_equal(self._left(idx), k, rl)\nif self._has_right(idx):\n self._less_equal(self._right(idx), k, rl)" ]
<|body_start_0|> rlt = [] self._less_equal(0, k, rlt) return rlt <|end_body_0|> <|body_start_1|> item = self._data[idx] if item._key <= k: rl.append((item._key, item._value)) if self._has_left(idx): self._less_equal(self._left(idx), k, rl) ...
PriorityQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriorityQueue: def less_equal(self, k): """Return the elements that having a key less than or equal to k.""" <|body_0|> def _less_equal(self, idx, k, rl): """Append the elements that having a key less than or equal to `k` to `rl`.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_027753
1,037
no_license
[ { "docstring": "Return the elements that having a key less than or equal to k.", "name": "less_equal", "signature": "def less_equal(self, k)" }, { "docstring": "Append the elements that having a key less than or equal to `k` to `rl`.", "name": "_less_equal", "signature": "def _less_equal...
2
null
Implement the Python class `PriorityQueue` described below. Class description: Implement the PriorityQueue class. Method signatures and docstrings: - def less_equal(self, k): Return the elements that having a key less than or equal to k. - def _less_equal(self, idx, k, rl): Append the elements that having a key less ...
Implement the Python class `PriorityQueue` described below. Class description: Implement the PriorityQueue class. Method signatures and docstrings: - def less_equal(self, k): Return the elements that having a key less than or equal to k. - def _less_equal(self, idx, k, rl): Append the elements that having a key less ...
70b23ead7a89e46a84d9d914e7c8fa678edd1f90
<|skeleton|> class PriorityQueue: def less_equal(self, k): """Return the elements that having a key less than or equal to k.""" <|body_0|> def _less_equal(self, idx, k, rl): """Append the elements that having a key less than or equal to `k` to `rl`.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PriorityQueue: def less_equal(self, k): """Return the elements that having a key less than or equal to k.""" rlt = [] self._less_equal(0, k, rlt) return rlt def _less_equal(self, idx, k, rl): """Append the elements that having a key less than or equal to `k` to `rl...
the_stack_v2_python_sparse
priority_queue_ch09/creativity/less_equal_to_k_c9_35.py
wanyikang/dsap
train
1
69fd10c4b73c6c38caa17541d3dff90e5d40f349
[ "self._setup(field_mapping={'simulationType': FieldMapping(SimulationSource.Type.decode, SimulationSource.Type.encode), 'streamName': FieldMapping(str), 'siddhiAppName': FieldMapping(str), 'timestampInterval': FieldMapping(int), 'attributeConfiguration': ListFieldMapping(AttributeConfiguration.parse, AttributeConfi...
<|body_start_0|> self._setup(field_mapping={'simulationType': FieldMapping(SimulationSource.Type.decode, SimulationSource.Type.encode), 'streamName': FieldMapping(str), 'siddhiAppName': FieldMapping(str), 'timestampInterval': FieldMapping(int), 'attributeConfiguration': ListFieldMapping(AttributeConfiguration.p...
SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration
SimulationSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationSource: """SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration""" def __init__(self, simulationType=Type.RANDOM_DATA_SIMULATION, streamName=NotSet(), siddhiAppName=NotSet(), timestampInterval=NotSet(), attributeConfiguration=NotSet(), fileName=No...
stack_v2_sparse_classes_36k_train_027754
4,647
permissive
[ { "docstring": "Instantiates Simulation Source. Refer SP4 Documentation for details on parameters :param simulationType: Type of SimulationSource :param streamName: :param siddhiAppName: :param timestampInterval: :param attributeConfiguration: :param fileName: for File Access :param isOrdered: :param delimiter:...
2
stack_v2_sparse_classes_30k_train_003891
Implement the Python class `SimulationSource` described below. Class description: SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration Method signatures and docstrings: - def __init__(self, simulationType=Type.RANDOM_DATA_SIMULATION, streamName=NotSet(), siddhiAppName=NotSet(), time...
Implement the Python class `SimulationSource` described below. Class description: SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration Method signatures and docstrings: - def __init__(self, simulationType=Type.RANDOM_DATA_SIMULATION, streamName=NotSet(), siddhiAppName=NotSet(), time...
343db17ca1331d0a53335478d01bba69338cf24b
<|skeleton|> class SimulationSource: """SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration""" def __init__(self, simulationType=Type.RANDOM_DATA_SIMULATION, streamName=NotSet(), siddhiAppName=NotSet(), timestampInterval=NotSet(), attributeConfiguration=NotSet(), fileName=No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationSource: """SimulationSource APIObject which can be added to sources of FeedSimulationConfiguration""" def __init__(self, simulationType=Type.RANDOM_DATA_SIMULATION, streamName=NotSet(), siddhiAppName=NotSet(), timestampInterval=NotSet(), attributeConfiguration=NotSet(), fileName=NotSet(), isOrd...
the_stack_v2_python_sparse
PySiddhi/sp/EventSimulator/SimulationSource.py
whummer/PySiddhi
train
0
2e109bfb663710d13ac5480a911cb09c0bc21c87
[ "if not year:\n raise InvalidArgument(year)\nelif not isinstance(year, int):\n raise TypeError('year is not an int')\nelif year not in [2020, 2035, 2050]:\n logging.error('Year provided is not one of: 2020, 2035, 2050')\n raise InvalidArgument(year)\nif not return_period:\n raise InvalidArgument(retu...
<|body_start_0|> if not year: raise InvalidArgument(year) elif not isinstance(year, int): raise TypeError('year is not an int') elif year not in [2020, 2035, 2050]: logging.error('Year provided is not one of: 2020, 2035, 2050') raise InvalidArgumen...
This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Probability Depth for the given list of IDs
Tile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tile: """This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Probability Depth for the given list of IDs"...
stack_v2_sparse_classes_36k_train_027755
5,783
permissive
[ { "docstring": "Retrieves probability depth tile data from the First Street Foundation API given a list of search_items and returns a list of Probability Depth Tile objects. Args: year (int): The year to get the tile return_period (int): The return period to get the tile search_items (list of tuple): A list of ...
2
stack_v2_sparse_classes_30k_train_012102
Implement the Python class `Tile` described below. Class description: This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Proba...
Implement the Python class `Tile` described below. Class description: This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Proba...
f6bcd43bf76fd9ee893482bcc17614f9ed01d0c5
<|skeleton|> class Tile: """This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Probability Depth for the given list of IDs"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tile: """This class receives a list of coordinate and parameters, and handles the return of a tile from the request. Methods: get_probability_depth: Retrieves a list of Probability Depth for the given list of IDs get_historic_event: Retrieves a list of Probability Depth for the given list of IDs""" def g...
the_stack_v2_python_sparse
firststreet/api/tile.py
rht/fsf_api_access_python
train
0
ade668531b2826af021815d512daa48ced3b2a27
[ "left, right = (0, len(nums) - 1)\nwhile left < right:\n if nums[left] < nums[right]:\n break\n mid = left + (right - left) // 2\n if nums[mid] >= nums[left]:\n left = mid + 1\n else:\n right = mid\nmin_num_index = left\nleft, right = (0, min_num_index - 1)\nwhile left < right:\n ...
<|body_start_0|> left, right = (0, len(nums) - 1) while left < right: if nums[left] < nums[right]: break mid = left + (right - left) // 2 if nums[mid] >= nums[left]: left = mid + 1 else: right = mid m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the nums. Part 2 which are all smaller than or equivalent to the min num in the nums. Split nums into tw...
stack_v2_sparse_classes_36k_train_027756
2,562
no_license
[ { "docstring": "We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the nums. Part 2 which are all smaller than or equivalent to the min num in the nums. Split nums into two parts by using binary search to find min num. Final...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the num...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the num...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def search(self, nums, target): """We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the nums. Part 2 which are all smaller than or equivalent to the min num in the nums. Split nums into tw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums, target): """We could split the nums into two part according to the min num in the nums. Part 1 which are all bigger than the min num is on the left of the nums. Part 2 which are all smaller than or equivalent to the min num in the nums. Split nums into two parts by usi...
the_stack_v2_python_sparse
python_solution/BinarySearch/33_SearchInRotatedSortedArray.py
Dimen61/leetcode
train
4
03099adea2c47f4756ec8b789dca398b0f3e9a4f
[ "re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['validTo'])\nresult = re\nAssertions().assert_in_text(result, expect['createMonthTicketConfigMsg'])", "re = MonthTicketBill(userLogin).openMonthTicketBill(send_data['c...
<|body_start_0|> re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['validTo']) result = re Assertions().assert_in_text(result, expect['createMonthTicketConfigMsg']) <|end_body_0|> <|body_start_1|> ...
VIP车无在场严出
TestNoPresenceVipStrictOutProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNoPresenceVipStrictOutProcess: """VIP车无在场严出""" def test_createMonthTicketConfig(self, userLogin, send_data, expect): """创建自定义月票类型""" <|body_0|> def test_openMonthTicketBill(self, userLogin, send_data, expect): """用自定义月票类型开通月票""" <|body_1|> def te...
stack_v2_sparse_classes_36k_train_027757
2,801
no_license
[ { "docstring": "创建自定义月票类型", "name": "test_createMonthTicketConfig", "signature": "def test_createMonthTicketConfig(self, userLogin, send_data, expect)" }, { "docstring": "用自定义月票类型开通月票", "name": "test_openMonthTicketBill", "signature": "def test_openMonthTicketBill(self, userLogin, send_d...
5
null
Implement the Python class `TestNoPresenceVipStrictOutProcess` described below. Class description: VIP车无在场严出 Method signatures and docstrings: - def test_createMonthTicketConfig(self, userLogin, send_data, expect): 创建自定义月票类型 - def test_openMonthTicketBill(self, userLogin, send_data, expect): 用自定义月票类型开通月票 - def test_m...
Implement the Python class `TestNoPresenceVipStrictOutProcess` described below. Class description: VIP车无在场严出 Method signatures and docstrings: - def test_createMonthTicketConfig(self, userLogin, send_data, expect): 创建自定义月票类型 - def test_openMonthTicketBill(self, userLogin, send_data, expect): 用自定义月票类型开通月票 - def test_m...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class TestNoPresenceVipStrictOutProcess: """VIP车无在场严出""" def test_createMonthTicketConfig(self, userLogin, send_data, expect): """创建自定义月票类型""" <|body_0|> def test_openMonthTicketBill(self, userLogin, send_data, expect): """用自定义月票类型开通月票""" <|body_1|> def te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNoPresenceVipStrictOutProcess: """VIP车无在场严出""" def test_createMonthTicketConfig(self, userLogin, send_data, expect): """创建自定义月票类型""" re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['valid...
the_stack_v2_python_sparse
test_suite/parkingManage/monthTicket/test_noPresenceVipStrictOutProcess.py
oyebino/pomp_api
train
1
3f7259b83f08a24eac10abb9ab866a68d13511dc
[ "test_dir = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'datafiles')\ntest_files = os.path.join(test_dir, 'arch.*.elf')\nfor test in glob.glob(test_files):\n test_file = os.path.basename(test)\n exp_arch = test_file.split('.')[1]\n arch = qemu.Qemu.DetectArch(test_file, test_dir)\n if arch...
<|body_start_0|> test_dir = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'datafiles') test_files = os.path.join(test_dir, 'arch.*.elf') for test in glob.glob(test_files): test_file = os.path.basename(test) exp_arch = test_file.split('.')[1] arch =...
Verify Qemu logic works
QemuTests
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QemuTests: """Verify Qemu logic works""" def testArchDetect(self): """Verify we correctly probe each arch""" <|body_0|> def testRegisterStr(self): """Verify the binfmt register string doesn't exceed kernel limits""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_027758
1,686
permissive
[ { "docstring": "Verify we correctly probe each arch", "name": "testArchDetect", "signature": "def testArchDetect(self)" }, { "docstring": "Verify the binfmt register string doesn't exceed kernel limits", "name": "testRegisterStr", "signature": "def testRegisterStr(self)" } ]
2
null
Implement the Python class `QemuTests` described below. Class description: Verify Qemu logic works Method signatures and docstrings: - def testArchDetect(self): Verify we correctly probe each arch - def testRegisterStr(self): Verify the binfmt register string doesn't exceed kernel limits
Implement the Python class `QemuTests` described below. Class description: Verify Qemu logic works Method signatures and docstrings: - def testArchDetect(self): Verify we correctly probe each arch - def testRegisterStr(self): Verify the binfmt register string doesn't exceed kernel limits <|skeleton|> class QemuTests...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class QemuTests: """Verify Qemu logic works""" def testArchDetect(self): """Verify we correctly probe each arch""" <|body_0|> def testRegisterStr(self): """Verify the binfmt register string doesn't exceed kernel limits""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QemuTests: """Verify Qemu logic works""" def testArchDetect(self): """Verify we correctly probe each arch""" test_dir = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'datafiles') test_files = os.path.join(test_dir, 'arch.*.elf') for test in glob.glob(test_files...
the_stack_v2_python_sparse
third_party/chromite/lib/qemu_unittest.py
metux/chromium-suckless
train
5
767bdb1f5d36e4adf2109c0e5e3496fb049c52f9
[ "count, self.dp = (0, [0])\nfor i in nums:\n count += i\n self.dp.append(count)", "n = len(self.dp)\nl = 0 if i < 0 else i\nr = n - 1 if j > n - 1 else j\nreturn self.dp[j + 1] - self.dp[i]" ]
<|body_start_0|> count, self.dp = (0, [0]) for i in nums: count += i self.dp.append(count) <|end_body_0|> <|body_start_1|> n = len(self.dp) l = 0 if i < 0 else i r = n - 1 if j > n - 1 else j return self.dp[j + 1] - self.dp[i] <|end_body_1|>
Solution description
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution description""" def __init__(self, nums): """type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> count, self.dp = (0, [0]) ...
stack_v2_sparse_classes_36k_train_027759
743
permissive
[ { "docstring": "type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_001068
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def __init__(self, nums): type nums: List[int] - def sumRange(self, i, j): type i: int :type j: int :rtype: int
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def __init__(self, nums): type nums: List[int] - def sumRange(self, i, j): type i: int :type j: int :rtype: int <|skeleton|> class Solution: """Solution description""" def __ini...
869ee24c50c08403b170e8f7868699185e9dfdd1
<|skeleton|> class Solution: """Solution description""" def __init__(self, nums): """type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Solution description""" def __init__(self, nums): """type nums: List[int]""" count, self.dp = (0, [0]) for i in nums: count += i self.dp.append(count) def sumRange(self, i, j): """type i: int :type j: int :rtype: int""" n =...
the_stack_v2_python_sparse
Range Sum Query-Immutable/2.py
cerebrumaize/leetcode
train
0
735bae795469da88214a623f5221ad6616d7a6e0
[ "username = self.cleaned_data['username']\nif not username:\n raise forms.ValidationError('Please enter your username.')\nreturn username", "password = self.cleaned_data['password']\nif not password:\n raise forms.ValidationError('Please enter your password.')\nreturn password" ]
<|body_start_0|> username = self.cleaned_data['username'] if not username: raise forms.ValidationError('Please enter your username.') return username <|end_body_0|> <|body_start_1|> password = self.cleaned_data['password'] if not password: raise forms.Val...
Login form for the application.
LoginForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginForm: """Login form for the application.""" def clean_username(self): """Method to clean username.""" <|body_0|> def clean_password(self): """Method to clean password.""" <|body_1|> <|end_skeleton|> <|body_start_0|> username = self.cleaned_...
stack_v2_sparse_classes_36k_train_027760
9,900
no_license
[ { "docstring": "Method to clean username.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Method to clean password.", "name": "clean_password", "signature": "def clean_password(self)" } ]
2
null
Implement the Python class `LoginForm` described below. Class description: Login form for the application. Method signatures and docstrings: - def clean_username(self): Method to clean username. - def clean_password(self): Method to clean password.
Implement the Python class `LoginForm` described below. Class description: Login form for the application. Method signatures and docstrings: - def clean_username(self): Method to clean username. - def clean_password(self): Method to clean password. <|skeleton|> class LoginForm: """Login form for the application....
cb392be0402543acf074425fcaf8edf054269012
<|skeleton|> class LoginForm: """Login form for the application.""" def clean_username(self): """Method to clean username.""" <|body_0|> def clean_password(self): """Method to clean password.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginForm: """Login form for the application.""" def clean_username(self): """Method to clean username.""" username = self.cleaned_data['username'] if not username: raise forms.ValidationError('Please enter your username.') return username def clean_passwo...
the_stack_v2_python_sparse
cpovc_auth/forms.py
uonafya/cpims-2.3beta
train
4
44814b099f64dee905ec8d102f927b8e855f2503
[ "self.nonadmin_user = User.objects.create_user('testuser', 'testemail@x.com', 'testpass')\nself.nonadmin_user.save()\nself.nonadmin_client = Client()\nself.admin_user = User.objects.create_superuser('testuser2', 'testemail@x.com', 'testpass')\nself.admin_user.save()\nself.admin_client = Client()\nself.login_url = r...
<|body_start_0|> self.nonadmin_user = User.objects.create_user('testuser', 'testemail@x.com', 'testpass') self.nonadmin_user.save() self.nonadmin_client = Client() self.admin_user = User.objects.create_superuser('testuser2', 'testemail@x.com', 'testpass') self.admin_user.save() ...
Tests the evaluate_teams view.
TestEvaluateTeams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEvaluateTeams: """Tests the evaluate_teams view.""" def setUp(self): """Sets up the tests.""" <|body_0|> def test_evaluate_teams_nonadmin(self): """Tests that you can only access data as admin.""" <|body_1|> def test_invalid_mission(self): ...
stack_v2_sparse_classes_36k_train_027761
2,576
permissive
[ { "docstring": "Sets up the tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that you can only access data as admin.", "name": "test_evaluate_teams_nonadmin", "signature": "def test_evaluate_teams_nonadmin(self)" }, { "docstring": "Tests that an i...
4
stack_v2_sparse_classes_30k_train_014923
Implement the Python class `TestEvaluateTeams` described below. Class description: Tests the evaluate_teams view. Method signatures and docstrings: - def setUp(self): Sets up the tests. - def test_evaluate_teams_nonadmin(self): Tests that you can only access data as admin. - def test_invalid_mission(self): Tests that...
Implement the Python class `TestEvaluateTeams` described below. Class description: Tests the evaluate_teams view. Method signatures and docstrings: - def setUp(self): Sets up the tests. - def test_evaluate_teams_nonadmin(self): Tests that you can only access data as admin. - def test_invalid_mission(self): Tests that...
509f36562fc895433fcd01da755a35dd04581025
<|skeleton|> class TestEvaluateTeams: """Tests the evaluate_teams view.""" def setUp(self): """Sets up the tests.""" <|body_0|> def test_evaluate_teams_nonadmin(self): """Tests that you can only access data as admin.""" <|body_1|> def test_invalid_mission(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEvaluateTeams: """Tests the evaluate_teams view.""" def setUp(self): """Sets up the tests.""" self.nonadmin_user = User.objects.create_user('testuser', 'testemail@x.com', 'testpass') self.nonadmin_user.save() self.nonadmin_client = Client() self.admin_user = Us...
the_stack_v2_python_sparse
server/auvsi_suas/views/auvsi_admin/evaluate_teams_test.py
matcheydj/interop
train
1
9241f155c40c326f06cbd293c52808a9e507b778
[ "self.ssn = ssn\nself.date_of_birth = date_of_birth\nself.report_id = report_id\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nssn = dictionary.get('ssn')\ndate_of_birth = dictionary.get('dateOfBirth')\nreport_id = dictionary.get('reportId')\nfor key in cls._names....
<|body_start_0|> self.ssn = ssn self.date_of_birth = date_of_birth self.report_id = report_id self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None ssn = dictionary.get('ssn') date_of_bir...
Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date of birth in YYYY-MM-DD format. report_id (string): The `reportId` of the original VOIE Payro...
PayrollProviderRefreshData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PayrollProviderRefreshData: """Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date of birth in YYYY-MM-DD format. report_...
stack_v2_sparse_classes_36k_train_027762
2,293
permissive
[ { "docstring": "Constructor for the PayrollProviderRefreshData class", "name": "__init__", "signature": "def __init__(self, ssn=None, date_of_birth=None, report_id=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary...
2
null
Implement the Python class `PayrollProviderRefreshData` described below. Class description: Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date...
Implement the Python class `PayrollProviderRefreshData` described below. Class description: Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class PayrollProviderRefreshData: """Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date of birth in YYYY-MM-DD format. report_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PayrollProviderRefreshData: """Implementation of the 'Payroll Provider Refresh Data' model. TODO: type model description here. Attributes: ssn (string): The full SSN without hyphens that matches the consumer’s SSN. date_of_birth (string): The consumer’s date of birth in YYYY-MM-DD format. report_id (string): ...
the_stack_v2_python_sparse
finicityapi/models/payroll_provider_refresh_data.py
monarchmoney/finicity-python
train
0
36fedc0d4d7c9e540837200553580a609fa26f9e
[ "self.error = error\nself.object_status = object_status\nself.resource_pool_id = resource_pool_id\nself.restored_object_id = restored_object_id\nself.source_object_id = source_object_id", "if dictionary is None:\n return None\nerror = cohesity_management_sdk.models.request_error.RequestError.from_dictionary(di...
<|body_start_0|> self.error = error self.object_status = object_status self.resource_pool_id = resource_pool_id self.restored_object_id = restored_object_id self.source_object_id = source_object_id <|end_body_0|> <|body_start_1|> if dictionary is None: return...
Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatusEnum): Specifies the status of an object during a Restore Task. 'kFilesCloned' indica...
RestoreObjectState
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreObjectState: """Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatusEnum): Specifies the status of an objec...
stack_v2_sparse_classes_36k_train_027763
4,997
permissive
[ { "docstring": "Constructor for the RestoreObjectState class", "name": "__init__", "signature": "def __init__(self, error=None, object_status=None, resource_pool_id=None, restored_object_id=None, source_object_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args:...
2
stack_v2_sparse_classes_30k_val_001067
Implement the Python class `RestoreObjectState` described below. Class description: Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatus...
Implement the Python class `RestoreObjectState` described below. Class description: Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatus...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreObjectState: """Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatusEnum): Specifies the status of an objec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreObjectState: """Implementation of the 'RestoreObjectState' model. Specifies the state of an individual object in a Restore Task. Attributes: error (RequestError): Specifies if an error occurred during the restore operation. object_status (ObjectStatusEnum): Specifies the status of an object during a Re...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_object_state.py
cohesity/management-sdk-python
train
24
a25f7db5bf5b9b08f5689f0a26ce1984e192c186
[ "connections.sort(key=lambda e: e[2])\nuf = UnionFind(N)\ncost = 0\nfor i, j, c in connections:\n root_i, root_j = (uf.find(i), uf.find(j))\n if root_i != root_j:\n cost += c\n uf.union(i, j)\n if uf.components == 1:\n return cost", "graph = collections.defaultdict(list)\nfor u, v, c...
<|body_start_0|> connections.sort(key=lambda e: e[2]) uf = UnionFind(N) cost = 0 for i, j, c in connections: root_i, root_j = (uf.find(i), uf.find(j)) if root_i != root_j: cost += c uf.union(i, j) if uf.components == 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumCost1(self, N: int, connections: List[List[int]]) -> int: """Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if it will not create cycle Time: O(ElogE + Elog*V) Space: O(V)""" <|body_0|> def mini...
stack_v2_sparse_classes_36k_train_027764
4,361
no_license
[ { "docstring": "Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if it will not create cycle Time: O(ElogE + Elog*V) Space: O(V)", "name": "minimumCost1", "signature": "def minimumCost1(self, N: int, connections: List[List[int]]) -> int" }, {...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumCost1(self, N: int, connections: List[List[int]]) -> int: Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumCost1(self, N: int, connections: List[List[int]]) -> int: Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def minimumCost1(self, N: int, connections: List[List[int]]) -> int: """Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if it will not create cycle Time: O(ElogE + Elog*V) Space: O(V)""" <|body_0|> def mini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumCost1(self, N: int, connections: List[List[int]]) -> int: """Kruskal’s Algorithm: 1. Sort edges by weight 2. Add edge from lowest weight to highest 3. Only add an edge if it will not create cycle Time: O(ElogE + Elog*V) Space: O(V)""" connections.sort(key=lambda e: e[2]) ...
the_stack_v2_python_sparse
Leetcode 1135. Connecting Cities With Minimum Cost.py
Chaoran-sjsu/leetcode
train
0
dbe60bfcd07dcd80e863819d375ee479e710ce1e
[ "self.pat = pat\nM = len(pat)\nR = 256\nself.right = [-1 for i in range(0, R)]\nfor j in range(0, M):\n self.right[ord(pat[j])] = j", "N = len(txt)\nM = len(self.pat)\nskip = 0\ni = 0\nwhile i <= N - M:\n skip = 0\n for j in range(M - 1, -1, -1):\n if not self.pat[j] == txt[i + j]:\n sk...
<|body_start_0|> self.pat = pat M = len(pat) R = 256 self.right = [-1 for i in range(0, R)] for j in range(0, M): self.right[ord(pat[j])] = j <|end_body_0|> <|body_start_1|> N = len(txt) M = len(self.pat) skip = 0 i = 0 while i...
The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).
BoyerMoore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :...
stack_v2_sparse_classes_36k_train_027765
2,087
no_license
[ { "docstring": "Preprocesses the pattern string. :param pat: the pattern string", "name": "__init__", "signature": "def __init__(self, pat)" }, { "docstring": "Returns the index of the first occurrrence of the pattern string in the text string. :param txt: the text string :return: the index of t...
2
stack_v2_sparse_classes_30k_train_017338
Implement the Python class `BoyerMoore` described below. Class description: The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule). Method signatures and docstrings: - de...
Implement the Python class `BoyerMoore` described below. Class description: The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule). Method signatures and docstrings: - de...
658e3a42b712fb79a4afc8c3acf24161bd5d6737
<|skeleton|> class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoyerMoore: """The BoyerMoore class finds the first occurence of a pattern string in a text string. This implementation uses the Boyer-Moore algorithm (with the bad-character rule, but not the strong good suffix rule).""" def __init__(self, pat): """Preprocesses the pattern string. :param pat: th...
the_stack_v2_python_sparse
algs4/strings/boyer_moore.py
bhavyaagg/python-test
train
0
578ebf00d79b37da2bd12279416450aec8535f8e
[ "print('初始化浏览器对象')\nself.driver = Driver().browser_chrome()\nlogin = LoginPage(self.driver)\nu_name = 'admin'\npassword = 'admin123'\nlogin_actual = login.login(u_name, password)\nself.login_actual = login_actual\nself.admin = u_name", "time.sleep(3)\nprint('关闭浏览器')\nself.driver.quit()" ]
<|body_start_0|> print('初始化浏览器对象') self.driver = Driver().browser_chrome() login = LoginPage(self.driver) u_name = 'admin' password = 'admin123' login_actual = login.login(u_name, password) self.login_actual = login_actual self.admin = u_name <|end_body_0|...
BaseTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseTest: def setUp(self): """初始化浏览器对象""" <|body_0|> def tearDown(self): """清理""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('初始化浏览器对象') self.driver = Driver().browser_chrome() login = LoginPage(self.driver) u_name = ...
stack_v2_sparse_classes_36k_train_027766
689
no_license
[ { "docstring": "初始化浏览器对象", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "清理", "name": "tearDown", "signature": "def tearDown(self)" } ]
2
stack_v2_sparse_classes_30k_train_016816
Implement the Python class `BaseTest` described below. Class description: Implement the BaseTest class. Method signatures and docstrings: - def setUp(self): 初始化浏览器对象 - def tearDown(self): 清理
Implement the Python class `BaseTest` described below. Class description: Implement the BaseTest class. Method signatures and docstrings: - def setUp(self): 初始化浏览器对象 - def tearDown(self): 清理 <|skeleton|> class BaseTest: def setUp(self): """初始化浏览器对象""" <|body_0|> def tearDown(self): ...
b98793fad55500ccb58105a24711ae4b3d8ac6c8
<|skeleton|> class BaseTest: def setUp(self): """初始化浏览器对象""" <|body_0|> def tearDown(self): """清理""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseTest: def setUp(self): """初始化浏览器对象""" print('初始化浏览器对象') self.driver = Driver().browser_chrome() login = LoginPage(self.driver) u_name = 'admin' password = 'admin123' login_actual = login.login(u_name, password) self.login_actual = login_actua...
the_stack_v2_python_sparse
testcase/base_test.py
chenkangkang002/CrmAuto
train
0
8313e79ff3c157db64aafa45a01063d465e5344e
[ "self.name = name\nself.customer = customer\nself.pickup = pickup\nself.dropoff = dropoff\nself.pickuptime = pickuptime\nself.dropofftime = dropofftime\nself.rating = rating\nself.notes = notes\nself.date_created = datetime.datetime.now()", "dict = {}\ndict['id'] = self.id\ndict['name'] = self.name\ndict['custome...
<|body_start_0|> self.name = name self.customer = customer self.pickup = pickup self.dropoff = dropoff self.pickuptime = pickuptime self.dropofftime = dropofftime self.rating = rating self.notes = notes self.date_created = datetime.datetime.now() <...
Request info
Report
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Report: """Request info""" def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): """Initialize a report""" <|body_0|> def to_dict(self): """Dictionary representation of a report""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_027767
1,565
no_license
[ { "docstring": "Initialize a report", "name": "__init__", "signature": "def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes)" }, { "docstring": "Dictionary representation of a report", "name": "to_dict", "signature": "def to_dict(self)" } ]
2
stack_v2_sparse_classes_30k_test_000191
Implement the Python class `Report` described below. Class description: Request info Method signatures and docstrings: - def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): Initialize a report - def to_dict(self): Dictionary representation of a report
Implement the Python class `Report` described below. Class description: Request info Method signatures and docstrings: - def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): Initialize a report - def to_dict(self): Dictionary representation of a report <|skeleton|> class Repor...
86c6dc617fef1f2bcbb939e23c665ce34ddc3e65
<|skeleton|> class Report: """Request info""" def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): """Initialize a report""" <|body_0|> def to_dict(self): """Dictionary representation of a report""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Report: """Request info""" def __init__(self, name, customer, pickup, dropoff, pickuptime, dropofftime, rating, notes): """Initialize a report""" self.name = name self.customer = customer self.pickup = pickup self.dropoff = dropoff self.pickuptime = pickupt...
the_stack_v2_python_sparse
report.py
zachdg/SBAdatastore
train
0
10da93c0d7f5ef64418ea9b565226d9d449d84f1
[ "flag = True\na_index = 0\nb_index = 0\nresult = ''\nwhile a_index < A or b_index < B:\n if flag:\n if A - a_index >= 2:\n result += 'aa'\n elif A - a_index >= 1:\n result += 'a'\n a_index += 2\n else:\n if B - b_index >= 2:\n result += 'bb'\n ...
<|body_start_0|> flag = True a_index = 0 b_index = 0 result = '' while a_index < A or b_index < B: if flag: if A - a_index >= 2: result += 'aa' elif A - a_index >= 1: result += 'a' ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _strWithout3a3b(self, A, B): """:type A: int :type B: int :rtype: str""" <|body_0|> def _strWithout3a3b(self, A, B): """:type A: int :type B: int :rtype: str""" <|body_1|> def strWithout3a3b(self, A, B): """:type A: int :type B: int...
stack_v2_sparse_classes_36k_train_027768
3,244
permissive
[ { "docstring": ":type A: int :type B: int :rtype: str", "name": "_strWithout3a3b", "signature": "def _strWithout3a3b(self, A, B)" }, { "docstring": ":type A: int :type B: int :rtype: str", "name": "_strWithout3a3b", "signature": "def _strWithout3a3b(self, A, B)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_004239
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _strWithout3a3b(self, A, B): :type A: int :type B: int :rtype: str - def _strWithout3a3b(self, A, B): :type A: int :type B: int :rtype: str - def strWithout3a3b(self, A, B): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _strWithout3a3b(self, A, B): :type A: int :type B: int :rtype: str - def _strWithout3a3b(self, A, B): :type A: int :type B: int :rtype: str - def strWithout3a3b(self, A, B): ...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _strWithout3a3b(self, A, B): """:type A: int :type B: int :rtype: str""" <|body_0|> def _strWithout3a3b(self, A, B): """:type A: int :type B: int :rtype: str""" <|body_1|> def strWithout3a3b(self, A, B): """:type A: int :type B: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _strWithout3a3b(self, A, B): """:type A: int :type B: int :rtype: str""" flag = True a_index = 0 b_index = 0 result = '' while a_index < A or b_index < B: if flag: if A - a_index >= 2: result += 'aa' ...
the_stack_v2_python_sparse
984.string-without-aaa-or-bbb.py
windard/leeeeee
train
0
39ee4a5fced47b3a3d474d763697c2d5249f784d
[ "if app:\n self.app = app\n self.init_app(app)", "self.init_config(app)\napp.extensions['invenio-app-ils'] = _InvenioAppIlsState(app)\napp.register_blueprint(Blueprint('invenio_app_ils_mail', __name__, template_folder='templates'))\nlogging.getLogger('py.warnings').propagate = False", "for k in dir(config...
<|body_start_0|> if app: self.app = app self.init_app(app) <|end_body_0|> <|body_start_1|> self.init_config(app) app.extensions['invenio-app-ils'] = _InvenioAppIlsState(app) app.register_blueprint(Blueprint('invenio_app_ils_mail', __name__, template_folder='templ...
Invenio App ILS UI app.
InvenioAppIls
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" <|body_0|> def init_app(self, app): """Flask application initialization.""" <|body_1|> def init_config(self, app): """Initialize config...
stack_v2_sparse_classes_36k_train_027769
3,362
permissive
[ { "docstring": "Extension initialization.", "name": "__init__", "signature": "def __init__(self, app=None)" }, { "docstring": "Flask application initialization.", "name": "init_app", "signature": "def init_app(self, app)" }, { "docstring": "Initialize configuration.", "name":...
3
stack_v2_sparse_classes_30k_train_014998
Implement the Python class `InvenioAppIls` described below. Class description: Invenio App ILS UI app. Method signatures and docstrings: - def __init__(self, app=None): Extension initialization. - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration.
Implement the Python class `InvenioAppIls` described below. Class description: Invenio App ILS UI app. Method signatures and docstrings: - def __init__(self, app=None): Extension initialization. - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration. <|ske...
961e88ba144b1371b629dfbc0baaf388e46e667f
<|skeleton|> class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" <|body_0|> def init_app(self, app): """Flask application initialization.""" <|body_1|> def init_config(self, app): """Initialize config...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" if app: self.app = app self.init_app(app) def init_app(self, app): """Flask application initialization.""" self.init_config(app) ...
the_stack_v2_python_sparse
invenio_app_ils/ext.py
lauren-d/invenio-app-ils
train
0
a7cea7e7e5813eefbfa3f08a884114b71044aba6
[ "loc = Operation().readXml('addressselection', 'search').format(name=field_name)\nself.clickElement(loc)\nprovince_loc = Operation().readXml('addressselection', 'province').format(field_name, province)\ncity_loc = Operation().readXml('addressselection', 'city').format(field_name, city)\nregion_loc = Operation().rea...
<|body_start_0|> loc = Operation().readXml('addressselection', 'search').format(name=field_name) self.clickElement(loc) province_loc = Operation().readXml('addressselection', 'province').format(field_name, province) city_loc = Operation().readXml('addressselection', 'city').format(field_...
基础组件-地址选择器
AddressSelection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressSelection: """基础组件-地址选择器""" def search(self, field_name, province, city, region): """列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return:""" <|body_0|> def normal(self, field_name, province, city, region): "...
stack_v2_sparse_classes_36k_train_027770
2,635
no_license
[ { "docstring": "列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return:", "name": "search", "signature": "def search(self, field_name, province, city, region)" }, { "docstring": "地址选择器非必填输入值 :param field_name:字段名称 :param province: 省份 :param city: 城市 ...
3
stack_v2_sparse_classes_30k_test_000408
Implement the Python class `AddressSelection` described below. Class description: 基础组件-地址选择器 Method signatures and docstrings: - def search(self, field_name, province, city, region): 列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return: - def normal(self, field_name, pr...
Implement the Python class `AddressSelection` described below. Class description: 基础组件-地址选择器 Method signatures and docstrings: - def search(self, field_name, province, city, region): 列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return: - def normal(self, field_name, pr...
f307ca71cfae22d419a6d96c27dfbf6c04683e82
<|skeleton|> class AddressSelection: """基础组件-地址选择器""" def search(self, field_name, province, city, region): """列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return:""" <|body_0|> def normal(self, field_name, province, city, region): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddressSelection: """基础组件-地址选择器""" def search(self, field_name, province, city, region): """列表筛选字段地址组件输入内容 :param field_name: 字段名称 :param province: 省份 :param city: 城市 :param region: 地区 :return:""" loc = Operation().readXml('addressselection', 'search').format(name=field_name) self...
the_stack_v2_python_sparse
ui/qiqiao/basic_components/address_selection.py
Donny2019/QiqiaoPlusAutoTest
train
0
6dbbb0165a3e7b4a8f5c1900e13b0dda93327c4f
[ "super(Cont_RDB, self).__init__()\nself.InChan = InChannel\nself.OutChan = OutChannel\nself.G = growRate\nself.C = nConvLayers\nif self.InChan != self.G:\n self.InConv = ops.Conv2d(self.InChan, self.G, 1, padding=0, stride=1)\nif self.OutChan != self.G and self.OutChan != self.InChan:\n self.OutConv = ops.Con...
<|body_start_0|> super(Cont_RDB, self).__init__() self.InChan = InChannel self.OutChan = OutChannel self.G = growRate self.C = nConvLayers if self.InChan != self.G: self.InConv = ops.Conv2d(self.InChan, self.G, 1, padding=0, stride=1) if self.OutChan !...
Contextual residual dense block.
Cont_RDB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cont_RDB: """Contextual residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param gro...
stack_v2_sparse_classes_36k_train_027771
14,306
permissive
[ { "docstring": "Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth rate of block :type growRate: int :param nConvLayers: the number of convlution layer :type nConvLayers: int :param kSize: ker...
2
null
Implement the Python class `Cont_RDB` described below. Class description: Contextual residual dense block. Method signatures and docstrings: - def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: ...
Implement the Python class `Cont_RDB` described below. Class description: Contextual residual dense block. Method signatures and docstrings: - def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class Cont_RDB: """Contextual residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param gro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cont_RDB: """Contextual residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth...
the_stack_v2_python_sparse
zeus/networks/erdb_esr.py
huawei-noah/xingtian
train
308
2aee7812c31fc9bec54d3faea20b1f288279177e
[ "self.tokens = tokens\nfilters = list(FILTERS.keys()) if filters is None else filters\nconfiguration = CONFIGURATION if configuration is None else configuration\nself.re_filter = None\nself.set_filter = set()\nre_filters = list()\nfor filter in filters:\n if filter not in list(FILTERS.keys()):\n raise Exc...
<|body_start_0|> self.tokens = tokens filters = list(FILTERS.keys()) if filters is None else filters configuration = CONFIGURATION if configuration is None else configuration self.re_filter = None self.set_filter = set() re_filters = list() for filter in filters: ...
Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words.
TokenRemover
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenRemover: """Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words.""" def __init__(self, tokens, filters=None, configuration=None): """Constructor.""" <|body_0|> def execute(self): """For each token in the given l...
stack_v2_sparse_classes_36k_train_027772
2,445
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, tokens, filters=None, configuration=None)" }, { "docstring": "For each token in the given list, if the token is not in the specified filter(s), append it to a new list. Return the new list.", "name": "execute...
2
null
Implement the Python class `TokenRemover` described below. Class description: Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words. Method signatures and docstrings: - def __init__(self, tokens, filters=None, configuration=None): Constructor. - def execute(self): For each...
Implement the Python class `TokenRemover` described below. Class description: Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words. Method signatures and docstrings: - def __init__(self, tokens, filters=None, configuration=None): Constructor. - def execute(self): For each...
b027a5d7407043b6541e2aa02704a7239f109485
<|skeleton|> class TokenRemover: """Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words.""" def __init__(self, tokens, filters=None, configuration=None): """Constructor.""" <|body_0|> def execute(self): """For each token in the given l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokenRemover: """Given a list of tokens and a list of filters, return a list of tokens excluding the filtered words.""" def __init__(self, tokens, filters=None, configuration=None): """Constructor.""" self.tokens = tokens filters = list(FILTERS.keys()) if filters is None else filt...
the_stack_v2_python_sparse
app/lib/nlp/tokenremover.py
andymeneely/sira-nlp
train
1
f6efe8553112d1dbc3a2a5fb26b1c0fd8aaab44c
[ "if file is None:\n file = sys.stderr\nfor line in self.format_exc(limit):\n file.write(line)", "result = ['Traceback (most recent call last):\\n']\ntb_list = self._traceback\nif limit is not None:\n tb_list = tb_list[-limit:]\nresult.extend(traceback.format_list(tb_list))\nif self.cause is not None:\n ...
<|body_start_0|> if file is None: file = sys.stderr for line in self.format_exc(limit): file.write(line) <|end_body_0|> <|body_start_1|> result = ['Traceback (most recent call last):\n'] tb_list = self._traceback if limit is not None: tb_list ...
DecisionExceptionWithTracebackMixIn
[ "Apache-2.0", "JSON" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecisionExceptionWithTracebackMixIn: def print_exc(self, limit=None, file=None): """Print exception information and up to limit stack trace entries to file""" <|body_0|> def format_exc(self, limit=None): """This is like exception.print_exc(limit) but returns a string...
stack_v2_sparse_classes_36k_train_027773
15,163
permissive
[ { "docstring": "Print exception information and up to limit stack trace entries to file", "name": "print_exc", "signature": "def print_exc(self, limit=None, file=None)" }, { "docstring": "This is like exception.print_exc(limit) but returns a string instead of printing to a file.", "name": "f...
2
stack_v2_sparse_classes_30k_train_016573
Implement the Python class `DecisionExceptionWithTracebackMixIn` described below. Class description: Implement the DecisionExceptionWithTracebackMixIn class. Method signatures and docstrings: - def print_exc(self, limit=None, file=None): Print exception information and up to limit stack trace entries to file - def fo...
Implement the Python class `DecisionExceptionWithTracebackMixIn` described below. Class description: Implement the DecisionExceptionWithTracebackMixIn class. Method signatures and docstrings: - def print_exc(self, limit=None, file=None): Print exception information and up to limit stack trace entries to file - def fo...
49d8ed3bc9c57294504be82e933a051e1901b76e
<|skeleton|> class DecisionExceptionWithTracebackMixIn: def print_exc(self, limit=None, file=None): """Print exception information and up to limit stack trace entries to file""" <|body_0|> def format_exc(self, limit=None): """This is like exception.print_exc(limit) but returns a string...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecisionExceptionWithTracebackMixIn: def print_exc(self, limit=None, file=None): """Print exception information and up to limit stack trace entries to file""" if file is None: file = sys.stderr for line in self.format_exc(limit): file.write(line) def format...
the_stack_v2_python_sparse
botoflow/exceptions.py
DalavanCloud/botoflow
train
1
8a6f0d52d714f803465af4612c27800394cb413d
[ "super(InceptionAux, self).__init__()\nif conv_block is None:\n conv_block = BasicConv2d\nself.conv = conv_block(in_channels, 128, kernel_size=1)\nself.fc1 = nn.Linear(2048, 1024)\nself.fc2 = nn.Linear(1024, out_channels)", "x = F.adaptive_avg_pool2d(x, (4, 4))\nx = self.conv(x)\nx = torch.flatten(x, 1)\nx = F...
<|body_start_0|> super(InceptionAux, self).__init__() if conv_block is None: conv_block = BasicConv2d self.conv = conv_block(in_channels, 128, kernel_size=1) self.fc1 = nn.Linear(2048, 1024) self.fc2 = nn.Linear(1024, out_channels) <|end_body_0|> <|body_start_1|> ...
Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in_features=2048, out_features=1024) (1): ReLU(inplace=True) (2): Drop (fc2): (0)...
InceptionAux
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionAux: """Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in_features=2048, out_features=1024) (1):...
stack_v2_sparse_classes_36k_train_027774
13,487
no_license
[ { "docstring": ":param in_channels : int, number of input channels :param out_channels : int, number of classes :param conv_block :", "name": "__init__", "signature": "def __init__(self, in_channels: int, out_channels: int, conv_block=None)" }, { "docstring": ":param x : torch.Tensor, 2D tensor ...
2
stack_v2_sparse_classes_30k_train_004729
Implement the Python class `InceptionAux` described below. Class description: Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in...
Implement the Python class `InceptionAux` described below. Class description: Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in...
9189d2eeb748b1e539a1062a09a06b38a09780de
<|skeleton|> class InceptionAux: """Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in_features=2048, out_features=1024) (1):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InceptionAux: """Build the classifier neural network auxiliary outputs in an inception layer. Neural network structure : (adaptive_avg_pool2d): (0): AdaptiveAvgPool2d(output_size = 4) (conv): (0): Conv2d(in_channels, 128, kernel_size=1) (fc1): (0): Linear(in_features=2048, out_features=1024) (1): ReLU(inplace...
the_stack_v2_python_sparse
Simulations/helpers/model/googLeNet.py
emmahoggett/Error_class_lenstronomy
train
1
fc80c3db5081138fe127fe60f74d9d5178dcec71
[ "super().__init__(parent, **kwargs)\nfile_menu = tk.Menu(self, tearoff=False)\nfile_menu.add_command(label='Select file…', command=callbacks['file->select'])\nfile_menu.add_separator()\nfile_menu.add_command(label='Quit', command=callbacks['file->quit'])\nself.add_cascade(label='File', menu=file_menu)\noptions_menu...
<|body_start_0|> super().__init__(parent, **kwargs) file_menu = tk.Menu(self, tearoff=False) file_menu.add_command(label='Select file…', command=callbacks['file->select']) file_menu.add_separator() file_menu.add_command(label='Quit', command=callbacks['file->quit']) self....
The Application's main menu
MainMenu
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainMenu: """The Application's main menu""" def __init__(self, parent, settings, callbacks, **kwargs): """Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks - a dict containing Python callables""" <|body_0|>...
stack_v2_sparse_classes_36k_train_027775
8,462
permissive
[ { "docstring": "Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks - a dict containing Python callables", "name": "__init__", "signature": "def __init__(self, parent, settings, callbacks, **kwargs)" }, { "docstring": "Show the ...
2
null
Implement the Python class `MainMenu` described below. Class description: The Application's main menu Method signatures and docstrings: - def __init__(self, parent, settings, callbacks, **kwargs): Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks -...
Implement the Python class `MainMenu` described below. Class description: The Application's main menu Method signatures and docstrings: - def __init__(self, parent, settings, callbacks, **kwargs): Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks -...
217ff90413dc2813a1b29d5ade52e23a72efadf5
<|skeleton|> class MainMenu: """The Application's main menu""" def __init__(self, parent, settings, callbacks, **kwargs): """Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks - a dict containing Python callables""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainMenu: """The Application's main menu""" def __init__(self, parent, settings, callbacks, **kwargs): """Constructor for MainMenu arguments: parent - The parent widget settings - a dict containing Tkinter variables callbacks - a dict containing Python callables""" super().__init__(parent...
the_stack_v2_python_sparse
Chapter06/ABQ_Data_Entry/abq_data_entry/views.py
PacktPublishing/Python-GUI-Programming-with-Tkinter
train
236
940e8c453141dd0b351311626c8584225e5258d3
[ "l1, l2 = (len(s) + 1, len(t) + 1)\ncur = [0] * l2\ncur[0] = 1\nfor i in xrange(1, l1):\n pre = cur[:]\n for j in xrange(1, l2):\n cur[j] = pre[j] + pre[j - 1] * (s[i - 1] == t[j - 1])\nreturn cur[-1]", "l1, l2 = (len(s) + 1, len(t) + 1)\ndp = [[1] * l2 for _ in xrange(l1)]\nfor j in xrange(1, l2):\n...
<|body_start_0|> l1, l2 = (len(s) + 1, len(t) + 1) cur = [0] * l2 cur[0] = 1 for i in xrange(1, l1): pre = cur[:] for j in xrange(1, l2): cur[j] = pre[j] + pre[j - 1] * (s[i - 1] == t[j - 1]) return cur[-1] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numDistinct(self, s, t): """:type s: str :type t: str :rtype: int O(n) space beats 70.80%""" <|body_0|> def numDistinct1(self, s, t): """:type s: str :type t: str :rtype: int O(m*n) space beats 4.40%""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_027776
922
no_license
[ { "docstring": ":type s: str :type t: str :rtype: int O(n) space beats 70.80%", "name": "numDistinct", "signature": "def numDistinct(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: int O(m*n) space beats 4.40%", "name": "numDistinct1", "signature": "def numDistinct1(sel...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDistinct(self, s, t): :type s: str :type t: str :rtype: int O(n) space beats 70.80% - def numDistinct1(self, s, t): :type s: str :type t: str :rtype: int O(m*n) space beat...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDistinct(self, s, t): :type s: str :type t: str :rtype: int O(n) space beats 70.80% - def numDistinct1(self, s, t): :type s: str :type t: str :rtype: int O(m*n) space beat...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def numDistinct(self, s, t): """:type s: str :type t: str :rtype: int O(n) space beats 70.80%""" <|body_0|> def numDistinct1(self, s, t): """:type s: str :type t: str :rtype: int O(m*n) space beats 4.40%""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numDistinct(self, s, t): """:type s: str :type t: str :rtype: int O(n) space beats 70.80%""" l1, l2 = (len(s) + 1, len(t) + 1) cur = [0] * l2 cur[0] = 1 for i in xrange(1, l1): pre = cur[:] for j in xrange(1, l2): cu...
the_stack_v2_python_sparse
LeetCode/115_distinct_subsequences.py
yao23/Machine_Learning_Playground
train
12
34cdc2845fae444287d181b590b5c5221a197645
[ "self._check_attr('path')\nscheme = urlparse.urlparse(self.path).scheme\nstorage_drv = cloudfs.cloudfs(scheme)\nbase_url = os.path.dirname(self.path)\nmanifest_path = tempfile.mktemp()\ntry:\n with open(manifest_path, 'w') as f:\n storage_drv.get(self.path, f)\n c = metaconf.Configuration('ini')\n c...
<|body_start_0|> self._check_attr('path') scheme = urlparse.urlparse(self.path).scheme storage_drv = cloudfs.cloudfs(scheme) base_url = os.path.dirname(self.path) manifest_path = tempfile.mktemp() try: with open(manifest_path, 'w') as f: storag...
Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage.
EphSnapshot
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EphSnapshot: """Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage.""" def _destroy(self): """Reads chunks paths from manifest, then deletes manifest and chunks from cloud storage....
stack_v2_sparse_classes_36k_train_027777
8,426
permissive
[ { "docstring": "Reads chunks paths from manifest, then deletes manifest and chunks from cloud storage.", "name": "_destroy", "signature": "def _destroy(self)" }, { "docstring": "Represents current status of ephemeral snapshot. Status updates exclusively in 'snapshot' method of ephemeral volume",...
3
stack_v2_sparse_classes_30k_train_013661
Implement the Python class `EphSnapshot` described below. Class description: Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage. Method signatures and docstrings: - def _destroy(self): Reads chunks paths from manif...
Implement the Python class `EphSnapshot` described below. Class description: Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage. Method signatures and docstrings: - def _destroy(self): Reads chunks paths from manif...
fe3e5ea7285248298fa1f9d90b61e4bfd71e6851
<|skeleton|> class EphSnapshot: """Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage.""" def _destroy(self): """Reads chunks paths from manifest, then deletes manifest and chunks from cloud storage....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EphSnapshot: """Respresents snapshot of data on ephemeral volume, uploaded to cloud storage provider. Contains all necessary info to restore functionall ephemeral storage.""" def _destroy(self): """Reads chunks paths from manifest, then deletes manifest and chunks from cloud storage.""" s...
the_stack_v2_python_sparse
src/scalarizr/storage2/volumes/eph.py
wingZero21/scalarizr
train
0
4f3ed0decd4622a5e1163138da5420c9f08c9af9
[ "transformations = {'H': ['HO', 'OH'], 'O': ['HH']}\nnew_molecules = p19.transform_molecule('HOH', transformations)\nexpected = set(['HOOH', 'HOHO', 'OHOH', 'HOOH', 'HHHH'])\nself.assertEquals(expected, new_molecules)\nnew_molecules = p19.transform_molecule('HOHOHO', transformations)\nself.assertEquals(7, len(new_m...
<|body_start_0|> transformations = {'H': ['HO', 'OH'], 'O': ['HH']} new_molecules = p19.transform_molecule('HOH', transformations) expected = set(['HOOH', 'HOHO', 'OHOH', 'HOOH', 'HHHH']) self.assertEquals(expected, new_molecules) new_molecules = p19.transform_molecule('HOHOHO', ...
Tests for Day 19 Puzzle.
TestPuzzle19
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPuzzle19: """Tests for Day 19 Puzzle.""" def test_transform_molecule(self): """Tests for transform_molecule()""" <|body_0|> def test_steps_to_build_molecule(self): """Tests for steps_to_build_molecule()""" <|body_1|> def test_reverse_transformati...
stack_v2_sparse_classes_36k_train_027778
2,934
no_license
[ { "docstring": "Tests for transform_molecule()", "name": "test_transform_molecule", "signature": "def test_transform_molecule(self)" }, { "docstring": "Tests for steps_to_build_molecule()", "name": "test_steps_to_build_molecule", "signature": "def test_steps_to_build_molecule(self)" },...
6
null
Implement the Python class `TestPuzzle19` described below. Class description: Tests for Day 19 Puzzle. Method signatures and docstrings: - def test_transform_molecule(self): Tests for transform_molecule() - def test_steps_to_build_molecule(self): Tests for steps_to_build_molecule() - def test_reverse_transformations(...
Implement the Python class `TestPuzzle19` described below. Class description: Tests for Day 19 Puzzle. Method signatures and docstrings: - def test_transform_molecule(self): Tests for transform_molecule() - def test_steps_to_build_molecule(self): Tests for steps_to_build_molecule() - def test_reverse_transformations(...
99d1f68ddf92b989ff775c270d315eb8df4dbd55
<|skeleton|> class TestPuzzle19: """Tests for Day 19 Puzzle.""" def test_transform_molecule(self): """Tests for transform_molecule()""" <|body_0|> def test_steps_to_build_molecule(self): """Tests for steps_to_build_molecule()""" <|body_1|> def test_reverse_transformati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPuzzle19: """Tests for Day 19 Puzzle.""" def test_transform_molecule(self): """Tests for transform_molecule()""" transformations = {'H': ['HO', 'OH'], 'O': ['HH']} new_molecules = p19.transform_molecule('HOH', transformations) expected = set(['HOOH', 'HOHO', 'OHOH', 'H...
the_stack_v2_python_sparse
puzzle19/python/test_puzzle19.py
jramaswami/Advent-Of-Code-2015
train
0
7d40021a7809292734db186325aff32ae39491c3
[ "protocol = request.uri\nwhite_list = ['register', 'login', 'checkLogin', 'registerInitData']\nif protocol.split('/')[2] in white_list:\n return True\ntoken = request.headers.get('Authorization', None)\nif token:\n res = Authentication.verifyToken(token)\n if res:\n return True\n else:\n r...
<|body_start_0|> protocol = request.uri white_list = ['register', 'login', 'checkLogin', 'registerInitData'] if protocol.split('/')[2] in white_list: return True token = request.headers.get('Authorization', None) if token: res = Authentication.verifyToken(...
用户认证公共方法
AuthenticationUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationUtil: """用户认证公共方法""" def verifyUser(cls, request): """用户认证""" <|body_0|> def getUserIdByToken(self, request): """根据token获得用户ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> protocol = request.uri white_list = ['register',...
stack_v2_sparse_classes_36k_train_027779
1,191
no_license
[ { "docstring": "用户认证", "name": "verifyUser", "signature": "def verifyUser(cls, request)" }, { "docstring": "根据token获得用户ID", "name": "getUserIdByToken", "signature": "def getUserIdByToken(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_016041
Implement the Python class `AuthenticationUtil` described below. Class description: 用户认证公共方法 Method signatures and docstrings: - def verifyUser(cls, request): 用户认证 - def getUserIdByToken(self, request): 根据token获得用户ID
Implement the Python class `AuthenticationUtil` described below. Class description: 用户认证公共方法 Method signatures and docstrings: - def verifyUser(cls, request): 用户认证 - def getUserIdByToken(self, request): 根据token获得用户ID <|skeleton|> class AuthenticationUtil: """用户认证公共方法""" def verifyUser(cls, request): ...
5feaf8b466c125e93fd08f31cc0eed99c9b4d164
<|skeleton|> class AuthenticationUtil: """用户认证公共方法""" def verifyUser(cls, request): """用户认证""" <|body_0|> def getUserIdByToken(self, request): """根据token获得用户ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticationUtil: """用户认证公共方法""" def verifyUser(cls, request): """用户认证""" protocol = request.uri white_list = ['register', 'login', 'checkLogin', 'registerInitData'] if protocol.split('/')[2] in white_list: return True token = request.headers.get('Aut...
the_stack_v2_python_sparse
base/authentication/AuthenticationUtil.py
goodcan/financial-system-backend
train
1
39698fb0c885a501db6195e6ec338136f23efc55
[ "self._seed = seed\nself._optimizers = optimizers\nself._dnn_builder_fn = functools.partial(_SimpleDNNBuilder, layer_size=layer_size, feature_columns=feature_columns, learn_mixture_weights=learn_mixture_weights)", "num_layers = 0\nseed = self._seed\nif previous_ensemble:\n num_layers = tf.get_static_value(prev...
<|body_start_0|> self._seed = seed self._optimizers = optimizers self._dnn_builder_fn = functools.partial(_SimpleDNNBuilder, layer_size=layer_size, feature_columns=feature_columns, learn_mixture_weights=learn_mixture_weights) <|end_body_0|> <|body_start_1|> num_layers = 0 seed =...
Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to the adaptive network presented in Figure 2 of [Cortes et al. ICML 2017](https://arxiv.o...
SimpleDNNGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleDNNGenerator: """Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to the adaptive network presented in Figure ...
stack_v2_sparse_classes_36k_train_027780
5,621
permissive
[ { "docstring": "Initializes a DNN `Generator`. Args: optimizers: A defaultdict of string for training both the subnetwork and the mixture weights. layer_size: Number of nodes in each hidden layer of the subnetwork candidates. Note that this parameter is ignored in a DNN with no hidden layers. learn_mixture_weig...
2
stack_v2_sparse_classes_30k_val_000888
Implement the Python class `SimpleDNNGenerator` described below. Class description: Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to th...
Implement the Python class `SimpleDNNGenerator` described below. Class description: Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to th...
5dc6421f562ea447e501fa355a48a6ee89856a1d
<|skeleton|> class SimpleDNNGenerator: """Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to the adaptive network presented in Figure ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleDNNGenerator: """Generates a two DNN subnetworks at each iteration. The first DNN has an identical shape to the most recently added subnetwork in `previous_ensemble`. The second has the same shape plus one more dense layer on top. This is similar to the adaptive network presented in Figure 2 of [Cortes ...
the_stack_v2_python_sparse
sqlflow_models/simple_dnn_generator.py
sql-machine-learning/models
train
37
f283e03baec31c90a4d5155e7093ac57af448ea3
[ "if subsets is not None:\n for ss in subsets:\n self[ss] = set()", "if key not in self:\n self[key] = set()\nself[key].add(val)" ]
<|body_start_0|> if subsets is not None: for ss in subsets: self[ss] = set() <|end_body_0|> <|body_start_1|> if key not in self: self[key] = set() self[key].add(val) <|end_body_1|>
Dictionary of sets
SetDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetDict: """Dictionary of sets""" def __init__(self, subsets=None): """sets can be pre-defined to allow for empty sets or shared subsets objects""" <|body_0|> def add(self, key, val): """add a value to a set""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_027781
5,202
permissive
[ { "docstring": "sets can be pre-defined to allow for empty sets or shared subsets objects", "name": "__init__", "signature": "def __init__(self, subsets=None)" }, { "docstring": "add a value to a set", "name": "add", "signature": "def add(self, key, val)" } ]
2
stack_v2_sparse_classes_30k_train_014420
Implement the Python class `SetDict` described below. Class description: Dictionary of sets Method signatures and docstrings: - def __init__(self, subsets=None): sets can be pre-defined to allow for empty sets or shared subsets objects - def add(self, key, val): add a value to a set
Implement the Python class `SetDict` described below. Class description: Dictionary of sets Method signatures and docstrings: - def __init__(self, subsets=None): sets can be pre-defined to allow for empty sets or shared subsets objects - def add(self, key, val): add a value to a set <|skeleton|> class SetDict: "...
163736e360a7d49901fe42f4e9bd10faf708b69d
<|skeleton|> class SetDict: """Dictionary of sets""" def __init__(self, subsets=None): """sets can be pre-defined to allow for empty sets or shared subsets objects""" <|body_0|> def add(self, key, val): """add a value to a set""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SetDict: """Dictionary of sets""" def __init__(self, subsets=None): """sets can be pre-defined to allow for empty sets or shared subsets objects""" if subsets is not None: for ss in subsets: self[ss] = set() def add(self, key, val): """add a value ...
the_stack_v2_python_sparse
lib/pycbio/stats/venn.py
diekhans/pycbio
train
2
a3f0273dc906dab230528fb8f5f16602ea0b5078
[ "password1 = self.cleaned_data['password1']\npassword2 = self.cleaned_data['password2']\nif password1 and password2:\n if password1 != password2:\n raise forms.ValidationError('Senhas diferentes')\n elif len(password1) < 8:\n raise forms.ValidationError('Senha muito curta')\nreturn password2", ...
<|body_start_0|> password1 = self.cleaned_data['password1'] password2 = self.cleaned_data['password2'] if password1 and password2: if password1 != password2: raise forms.ValidationError('Senhas diferentes') elif len(password1) < 8: raise fo...
Formulário de criação do usuário
UserForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserForm: """Formulário de criação do usuário""" def clean_password2(self): """Validação das senhas""" <|body_0|> def clean_email(self): """Validação do campo email""" <|body_1|> def save(self, commit=True): """Salva o usuário caso o formulár...
stack_v2_sparse_classes_36k_train_027782
1,625
no_license
[ { "docstring": "Validação das senhas", "name": "clean_password2", "signature": "def clean_password2(self)" }, { "docstring": "Validação do campo email", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Salva o usuário caso o formulário seja válido", ...
3
stack_v2_sparse_classes_30k_train_013874
Implement the Python class `UserForm` described below. Class description: Formulário de criação do usuário Method signatures and docstrings: - def clean_password2(self): Validação das senhas - def clean_email(self): Validação do campo email - def save(self, commit=True): Salva o usuário caso o formulário seja válido
Implement the Python class `UserForm` described below. Class description: Formulário de criação do usuário Method signatures and docstrings: - def clean_password2(self): Validação das senhas - def clean_email(self): Validação do campo email - def save(self, commit=True): Salva o usuário caso o formulário seja válido ...
8b3c6fb9eeb1479ccf92ae05ed578a9c44fa7138
<|skeleton|> class UserForm: """Formulário de criação do usuário""" def clean_password2(self): """Validação das senhas""" <|body_0|> def clean_email(self): """Validação do campo email""" <|body_1|> def save(self, commit=True): """Salva o usuário caso o formulár...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserForm: """Formulário de criação do usuário""" def clean_password2(self): """Validação das senhas""" password1 = self.cleaned_data['password1'] password2 = self.cleaned_data['password2'] if password1 and password2: if password1 != password2: r...
the_stack_v2_python_sparse
django/_class_based_views/training/accounts/forms.py
ThiaguinhoLS/Code
train
0
faf1accc4d8e99f5bfdb3715c761518e7bf244ea
[ "super(OverlayDialog, self).__init__(parent, Qt.SplashScreen)\nself.setAcceptDrops(True)\nself.setAttribute(Qt.WA_TranslucentBackground)\nbgcolor = self.palette().color(QPalette.Background)\nself.setPalette(QColor(bgcolor.red(), bgcolor.green(), bgcolor.blue(), 0))\nself.setModal(True)\nlayout = QVBoxLayout(self)\n...
<|body_start_0|> super(OverlayDialog, self).__init__(parent, Qt.SplashScreen) self.setAcceptDrops(True) self.setAttribute(Qt.WA_TranslucentBackground) bgcolor = self.palette().color(QPalette.Background) self.setPalette(QColor(bgcolor.red(), bgcolor.green(), bgcolor.blue(), 0)) ...
The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept.
OverlayDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OverlayDialog: """The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept.""" def __init__(self, parent, widget): """Construct an OverlayDialog with the given Qt GUI parent and di...
stack_v2_sparse_classes_36k_train_027783
30,088
no_license
[ { "docstring": "Construct an OverlayDialog with the given Qt GUI parent and displaying the given widget.", "name": "__init__", "signature": "def __init__(self, parent, widget)" }, { "docstring": "Display this OverlayDialog int he correct positon.", "name": "show", "signature": "def show(...
2
stack_v2_sparse_classes_30k_train_020855
Implement the Python class `OverlayDialog` described below. Class description: The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept. Method signatures and docstrings: - def __init__(self, parent, widget): Const...
Implement the Python class `OverlayDialog` described below. Class description: The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept. Method signatures and docstrings: - def __init__(self, parent, widget): Const...
afa9c9547716909d806a0bd8165bfe896617ca7e
<|skeleton|> class OverlayDialog: """The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept.""" def __init__(self, parent, widget): """Construct an OverlayDialog with the given Qt GUI parent and di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OverlayDialog: """The OverlayDialog is a semitransparent window that is drawn over a module to allow the user to associate their drag/drop operations with a more specific concept.""" def __init__(self, parent, widget): """Construct an OverlayDialog with the given Qt GUI parent and displaying the ...
the_stack_v2_python_sparse
boxfish/ModuleFrame.py
LLNL/boxfish
train
4
fbc20ae178d157ca11d6759fb9beaee95357946a
[ "self.envirophat = envirophat\nself.use_leds = use_leds\nself.light = None\nself.light_red = None\nself.light_green = None\nself.light_blue = None\nself.accelerometer_x = None\nself.accelerometer_y = None\nself.accelerometer_z = None\nself.magnetometer_x = None\nself.magnetometer_y = None\nself.magnetometer_z = Non...
<|body_start_0|> self.envirophat = envirophat self.use_leds = use_leds self.light = None self.light_red = None self.light_green = None self.light_blue = None self.accelerometer_x = None self.accelerometer_y = None self.accelerometer_z = None ...
Get the latest data and update.
EnvirophatData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvirophatData: """Get the latest data and update.""" def __init__(self, envirophat, use_leds): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from Enviro pHAT.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027784
8,346
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, envirophat, use_leds)" }, { "docstring": "Get the latest data from Enviro pHAT.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_016345
Implement the Python class `EnvirophatData` described below. Class description: Get the latest data and update. Method signatures and docstrings: - def __init__(self, envirophat, use_leds): Initialize the data object. - def update(self): Get the latest data from Enviro pHAT.
Implement the Python class `EnvirophatData` described below. Class description: Get the latest data and update. Method signatures and docstrings: - def __init__(self, envirophat, use_leds): Initialize the data object. - def update(self): Get the latest data from Enviro pHAT. <|skeleton|> class EnvirophatData: ""...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class EnvirophatData: """Get the latest data and update.""" def __init__(self, envirophat, use_leds): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from Enviro pHAT.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvirophatData: """Get the latest data and update.""" def __init__(self, envirophat, use_leds): """Initialize the data object.""" self.envirophat = envirophat self.use_leds = use_leds self.light = None self.light_red = None self.light_green = None s...
the_stack_v2_python_sparse
homeassistant/components/envirophat/sensor.py
AlexxIT/home-assistant
train
9
07ec6d159647e67be88be21ce15767639c5a6122
[ "self.type = None\nself.subsvc = None\nself.submsg = None", "self.type = type\nself.subsvc = subsvc\nself.submsg = submsg", "if self.type == '' and self.subsvc == 0 and (self.submsg == 0):\n return None\nfiltr = {'type': self.type, 'svc': self.subsvc, 'msg': self.submsg}\nprint(filtr)\nreturn filtr" ]
<|body_start_0|> self.type = None self.subsvc = None self.submsg = None <|end_body_0|> <|body_start_1|> self.type = type self.subsvc = subsvc self.submsg = submsg <|end_body_1|> <|body_start_2|> if self.type == '' and self.subsvc == 0 and (self.submsg == 0): ...
This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id
FilterModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterModel: """This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id""" def __init__(self): """This is the constructor of the class""" <|body_0|> def set_filter_options(self, type: str, ...
stack_v2_sparse_classes_36k_train_027785
1,116
no_license
[ { "docstring": "This is the constructor of the class", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This method sets all the parameters :param type: The packet type :param subsvc: The packet subservice :param submsg: The packet submessage", "name": "set_filter_opt...
3
stack_v2_sparse_classes_30k_train_019146
Implement the Python class `FilterModel` described below. Class description: This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id Method signatures and docstrings: - def __init__(self): This is the constructor of the class - def set_...
Implement the Python class `FilterModel` described below. Class description: This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id Method signatures and docstrings: - def __init__(self): This is the constructor of the class - def set_...
9ac0538ae38d48149db9ce52a3112515e8ff1bb5
<|skeleton|> class FilterModel: """This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id""" def __init__(self): """This is the constructor of the class""" <|body_0|> def set_filter_options(self, type: str, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterModel: """This class represents the model of a Filter view. It defines the type of the packets to be shown, the subservice id and the submessage id""" def __init__(self): """This is the constructor of the class""" self.type = None self.subsvc = None self.submsg = Non...
the_stack_v2_python_sparse
app/Model/FilterModel.py
ESROCOS/tools-pusconsole
train
0
980de806b394bb46849606d7e27fdf360354e87e
[ "url = reverse('api-manufacturer-part-list')\nresponse = self.get(url)\nself.assertEqual(len(response.data), 3)\ndata = {'part': 1, 'manufacturer': 7, 'MPN': 'MPN_TEST'}\nresponse = self.client.post(url, data, format='json')\nself.assertEqual(response.status_code, status.HTTP_201_CREATED)\nself.assertEqual(response...
<|body_start_0|> url = reverse('api-manufacturer-part-list') response = self.get(url) self.assertEqual(len(response.data), 3) data = {'part': 1, 'manufacturer': 7, 'MPN': 'MPN_TEST'} response = self.client.post(url, data, format='json') self.assertEqual(response.status_co...
Series of tests for the Manufacturer DRF API.
ManufacturerTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManufacturerTest: """Series of tests for the Manufacturer DRF API.""" def test_manufacturer_part_list(self): """Test the ManufacturerPart API list functionality""" <|body_0|> def test_manufacturer_part_detail(self): """Tests for the ManufacturerPart detail endpoi...
stack_v2_sparse_classes_36k_train_027786
19,439
permissive
[ { "docstring": "Test the ManufacturerPart API list functionality", "name": "test_manufacturer_part_list", "signature": "def test_manufacturer_part_list(self)" }, { "docstring": "Tests for the ManufacturerPart detail endpoint.", "name": "test_manufacturer_part_detail", "signature": "def t...
4
stack_v2_sparse_classes_30k_train_008640
Implement the Python class `ManufacturerTest` described below. Class description: Series of tests for the Manufacturer DRF API. Method signatures and docstrings: - def test_manufacturer_part_list(self): Test the ManufacturerPart API list functionality - def test_manufacturer_part_detail(self): Tests for the Manufactu...
Implement the Python class `ManufacturerTest` described below. Class description: Series of tests for the Manufacturer DRF API. Method signatures and docstrings: - def test_manufacturer_part_list(self): Test the ManufacturerPart API list functionality - def test_manufacturer_part_detail(self): Tests for the Manufactu...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ManufacturerTest: """Series of tests for the Manufacturer DRF API.""" def test_manufacturer_part_list(self): """Test the ManufacturerPart API list functionality""" <|body_0|> def test_manufacturer_part_detail(self): """Tests for the ManufacturerPart detail endpoi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManufacturerTest: """Series of tests for the Manufacturer DRF API.""" def test_manufacturer_part_list(self): """Test the ManufacturerPart API list functionality""" url = reverse('api-manufacturer-part-list') response = self.get(url) self.assertEqual(len(response.data), 3) ...
the_stack_v2_python_sparse
InvenTree/company/test_api.py
inventree/InvenTree
train
3,077
876d1d26635d85f2f94a706ea78757ce80e3824d
[ "if 'odd' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytes([MaxVal // 2] * arraylength)", "with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1)\nwith self.assertRaises(TypeError):\n result = min(1)"...
<|body_start_0|> if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension MaxVal = 255 MinVal = 0 self.gentest = bytes([MaxVal // 2] * arraylength) <|end_body_0|> <|body_start_1|> with self.assertRai...
Test bmin for basic parameter tests. op_template_params
bmin_parameter_odd_arraysize_with_simd_bytes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bmin_parameter_odd_arraysize_with_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type odd le...
stack_v2_sparse_classes_36k_train_027787
49,998
permissive
[ { "docstring": "Initialise.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test bmin - Sequence type bytes. Test invalid parameter type odd length array with SIMD.", "name": "test_bmin_param_function_01", "signature": "def test_bmin_param_function_01(self)" }, {...
5
stack_v2_sparse_classes_30k_train_012936
Implement the Python class `bmin_parameter_odd_arraysize_with_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test invalid ...
Implement the Python class `bmin_parameter_odd_arraysize_with_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test invalid ...
28fe0705fc59b0646a4d44e539c919173e8e8b99
<|skeleton|> class bmin_parameter_odd_arraysize_with_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type odd le...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bmin_parameter_odd_arraysize_with_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension M...
the_stack_v2_python_sparse
unittest/test_bmin.py
m1griffin/bytesfunc
train
2
b59184dbc2b01283fc25d6fbce49fab813168f4e
[ "dkc.get_kubectl_configuration(dkc.Commands.GET_PODS)\nmock_execute_kubectl_command.assert_called_once_with(['get', 'pods', '--all-namespaces'], human_readable=False)\ndkc.get_kubectl_configuration(dkc.Commands.GET_CONFIGURED_CONTEXT)\nmock_execute_kubectl_command.assert_called_with(['config', 'view'], human_readab...
<|body_start_0|> dkc.get_kubectl_configuration(dkc.Commands.GET_PODS) mock_execute_kubectl_command.assert_called_once_with(['get', 'pods', '--all-namespaces'], human_readable=False) dkc.get_kubectl_configuration(dkc.Commands.GET_CONFIGURED_CONTEXT) mock_execute_kubectl_command.assert_cal...
KubernetesClusterTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesClusterTest: def test_project_configuration_gcloud(self, mock_execute_kubectl_command): """Tests gcloud commands.""" <|body_0|> def test_Commands(self): """Verify commands are formaated properly.""" <|body_1|> def test_execute_kubectl_command(s...
stack_v2_sparse_classes_36k_train_027788
3,280
permissive
[ { "docstring": "Tests gcloud commands.", "name": "test_project_configuration_gcloud", "signature": "def test_project_configuration_gcloud(self, mock_execute_kubectl_command)" }, { "docstring": "Verify commands are formaated properly.", "name": "test_Commands", "signature": "def test_Comm...
3
null
Implement the Python class `KubernetesClusterTest` described below. Class description: Implement the KubernetesClusterTest class. Method signatures and docstrings: - def test_project_configuration_gcloud(self, mock_execute_kubectl_command): Tests gcloud commands. - def test_Commands(self): Verify commands are formaat...
Implement the Python class `KubernetesClusterTest` described below. Class description: Implement the KubernetesClusterTest class. Method signatures and docstrings: - def test_project_configuration_gcloud(self, mock_execute_kubectl_command): Tests gcloud commands. - def test_Commands(self): Verify commands are formaat...
3fb199658f68e7debf4906d9ce32a9a307e39243
<|skeleton|> class KubernetesClusterTest: def test_project_configuration_gcloud(self, mock_execute_kubectl_command): """Tests gcloud commands.""" <|body_0|> def test_Commands(self): """Verify commands are formaated properly.""" <|body_1|> def test_execute_kubectl_command(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KubernetesClusterTest: def test_project_configuration_gcloud(self, mock_execute_kubectl_command): """Tests gcloud commands.""" dkc.get_kubectl_configuration(dkc.Commands.GET_PODS) mock_execute_kubectl_command.assert_called_once_with(['get', 'pods', '--all-namespaces'], human_readable=F...
the_stack_v2_python_sparse
sdk/python/kfp/cli/diagnose_me/kubernetes_cluster_test.py
kubeflow/pipelines
train
3,434
7e211fd2c0414dcfea889002ba45d2d8c6c78b07
[ "try:\n environment = await self.application.objects.get(TestEnvironment, id=int(environment_id))\n await self.application.objects.delete(environment)\n return self.json(JsonResponse(code=1, data={'id': environment_id}))\nexcept TestEnvironment.DoesNotExist:\n self.set_status(400)\n return self.json(...
<|body_start_0|> try: environment = await self.application.objects.get(TestEnvironment, id=int(environment_id)) await self.application.objects.delete(environment) return self.json(JsonResponse(code=1, data={'id': environment_id})) except TestEnvironment.DoesNotExist: ...
TestEnvironmentChangeHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEnvironmentChangeHandler: async def delete(self, environment_id, *args, **kwargs): """删除测试环境数据 :param environment_id: 删除环境的id""" <|body_0|> async def patch(self, environment_id, *args, **kwargs): """更新测试环境数据 :param environment_id: 更新的测试环境id""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027789
17,374
permissive
[ { "docstring": "删除测试环境数据 :param environment_id: 删除环境的id", "name": "delete", "signature": "async def delete(self, environment_id, *args, **kwargs)" }, { "docstring": "更新测试环境数据 :param environment_id: 更新的测试环境id", "name": "patch", "signature": "async def patch(self, environment_id, *args, **...
2
stack_v2_sparse_classes_30k_train_017004
Implement the Python class `TestEnvironmentChangeHandler` described below. Class description: Implement the TestEnvironmentChangeHandler class. Method signatures and docstrings: - async def delete(self, environment_id, *args, **kwargs): 删除测试环境数据 :param environment_id: 删除环境的id - async def patch(self, environment_id, *...
Implement the Python class `TestEnvironmentChangeHandler` described below. Class description: Implement the TestEnvironmentChangeHandler class. Method signatures and docstrings: - async def delete(self, environment_id, *args, **kwargs): 删除测试环境数据 :param environment_id: 删除环境的id - async def patch(self, environment_id, *...
dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb
<|skeleton|> class TestEnvironmentChangeHandler: async def delete(self, environment_id, *args, **kwargs): """删除测试环境数据 :param environment_id: 删除环境的id""" <|body_0|> async def patch(self, environment_id, *args, **kwargs): """更新测试环境数据 :param environment_id: 更新的测试环境id""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEnvironmentChangeHandler: async def delete(self, environment_id, *args, **kwargs): """删除测试环境数据 :param environment_id: 删除环境的id""" try: environment = await self.application.objects.get(TestEnvironment, id=int(environment_id)) await self.application.objects.delete(envi...
the_stack_v2_python_sparse
apps/project/handlers.py
xiaoxiaolulu/MagicTestPlatform
train
5
f0d86abd0b544c2067bcc2dadf9d6d615a2b08cd
[ "super(ItemThread, self).__init__(name=name)\nself.domain_name = domain_name\nself.conn = SDBConnection()\nself.item_names = item_names\nself.items = []", "for item_name in self.item_names:\n item = self.conn.get_attributes(self.domain_name, item_name)\n self.items.append(item)" ]
<|body_start_0|> super(ItemThread, self).__init__(name=name) self.domain_name = domain_name self.conn = SDBConnection() self.item_names = item_names self.items = [] <|end_body_0|> <|body_start_1|> for item_name in self.item_names: item = self.conn.get_attribu...
A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto.sdb.connection.ItemThread.run>` method...
ItemThread
[ "CC-BY-3.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "ZPL-2.0", "Unlicense", "LGPL-3.0-only", "CC0-1.0", "LicenseRef-scancode-other-permissive", "CNRI-Python", "LicenseRef-scancode-warranty-disclaimer", "GPL-2.0-or-later", "Python-2.0", "GPL-3.0...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto....
stack_v2_sparse_classes_36k_train_027790
26,088
permissive
[ { "docstring": ":param str name: A thread name. Used for identification. :param str domain_name: The name of a SimpleDB :class:`Domain <boto.sdb.domain.Domain>` :type item_names: string or list of strings :param item_names: The name(s) of the items to retrieve from the specified :class:`Domain <boto.sdb.domain....
2
stack_v2_sparse_classes_30k_train_018316
Implement the Python class `ItemThread` described below. Class description: A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will ...
Implement the Python class `ItemThread` described below. Class description: A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will ...
dccb9467675c67b9c3399fc76c5de6d31bfb8255
<|skeleton|> class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemThread: """A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the ``items`` instance variable after :py:meth:`run() <run>` is called. .. tip:: The item retrieval will not start until the :func:`run() <boto.sdb.connectio...
the_stack_v2_python_sparse
desktop/core/ext-py3/boto-2.49.0/boto/sdb/connection.py
cloudera/hue
train
5,655
c528b65351ac1d5e000c4844dcd29781b8bac9e3
[ "i, j = (0, len(nums) - 1)\nwhile i < j:\n m = i + (j - i) // 2\n e = 2 * (m // 2)\n o = e + 1\n if nums[e] == nums[o]:\n i = o + 1\n else:\n j = e - 1\nreturn nums[i]", "if len(nums) == 1:\n return nums[0]\ns, e = (0, (len(nums) + 1) // 2 - 1)\nwhile s <= e:\n m = s + (e - s) /...
<|body_start_0|> i, j = (0, len(nums) - 1) while i < j: m = i + (j - i) // 2 e = 2 * (m // 2) o = e + 1 if nums[e] == nums[o]: i = o + 1 else: j = e - 1 return nums[i] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" <|body_0|> def singleNonDuplicate(self, nums: List[int]) -> int: """Nov 30, 2021 21:40""" <|body_1|> def singleNonDuplicate(self, nums: List[int]) -> int: """N...
stack_v2_sparse_classes_36k_train_027791
3,053
no_license
[ { "docstring": "06/03/2020 21:59", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums: List[int]) -> int" }, { "docstring": "Nov 30, 2021 21:40", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums: List[int]) -> int" }, { "doc...
5
stack_v2_sparse_classes_30k_train_019275
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: 06/03/2020 21:59 - def singleNonDuplicate(self, nums: List[int]) -> int: Nov 30, 2021 21:40 - def singleNonDuplicate(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: 06/03/2020 21:59 - def singleNonDuplicate(self, nums: List[int]) -> int: Nov 30, 2021 21:40 - def singleNonDuplicate(self, n...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" <|body_0|> def singleNonDuplicate(self, nums: List[int]) -> int: """Nov 30, 2021 21:40""" <|body_1|> def singleNonDuplicate(self, nums: List[int]) -> int: """N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" i, j = (0, len(nums) - 1) while i < j: m = i + (j - i) // 2 e = 2 * (m // 2) o = e + 1 if nums[e] == nums[o]: i = o + 1 els...
the_stack_v2_python_sparse
leetcode/solved/540_Single_Element_in_a_Sorted_Array/solution.py
sungminoh/algorithms
train
0
875a7f3220088ce9c46c968cfab587625f324583
[ "self.start = np.array(start)\nself.end = np.array(end)\nself.length = np.linalg.norm(self.start - self.end)", "from numpy.linalg import norm\nnpoints = nlong + 1\nx = np.linspace(self.start[0], self.end[0], npoints)\ny = np.linspace(self.start[1], self.end[1], npoints)\nz = np.linspace(self.start[2], self.end[2]...
<|body_start_0|> self.start = np.array(start) self.end = np.array(end) self.length = np.linalg.norm(self.start - self.end) <|end_body_0|> <|body_start_1|> from numpy.linalg import norm npoints = nlong + 1 x = np.linspace(self.start[0], self.end[0], npoints) y = n...
GeometricLine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeometricLine: def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3)): """Constructs a line given the start and ending points""" <|body_0|> def ComputeExtrusion(self, nlong=10): """Computes extrusion of base_mesh along self (line) using equal spacing input: nlo...
stack_v2_sparse_classes_36k_train_027792
6,773
permissive
[ { "docstring": "Constructs a line given the start and ending points", "name": "__init__", "signature": "def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3))" }, { "docstring": "Computes extrusion of base_mesh along self (line) using equal spacing input: nlong: [int] number of discretisat...
2
stack_v2_sparse_classes_30k_train_013197
Implement the Python class `GeometricLine` described below. Class description: Implement the GeometricLine class. Method signatures and docstrings: - def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3)): Constructs a line given the start and ending points - def ComputeExtrusion(self, nlong=10): Computes extru...
Implement the Python class `GeometricLine` described below. Class description: Implement the GeometricLine class. Method signatures and docstrings: - def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3)): Constructs a line given the start and ending points - def ComputeExtrusion(self, nlong=10): Computes extru...
256777e369b0d2774887bd4ea69e1c42d1bc82f0
<|skeleton|> class GeometricLine: def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3)): """Constructs a line given the start and ending points""" <|body_0|> def ComputeExtrusion(self, nlong=10): """Computes extrusion of base_mesh along self (line) using equal spacing input: nlo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeometricLine: def __init__(self, start=(0.0, 0.0, 0.0), end=(1.0, 2.0, 3)): """Constructs a line given the start and ending points""" self.start = np.array(start) self.end = np.array(end) self.length = np.linalg.norm(self.start - self.end) def ComputeExtrusion(self, nlong...
the_stack_v2_python_sparse
Florence/MeshGeneration/GeometricPath.py
romeric/florence
train
79
f0768889e616d1cc18a888ab78feb0f5d2499aa7
[ "g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US01', 'US01_birthday_after_today.ged')])\ncapturedOutput = io.StringIO()\nsys.stdout = capturedOutput\ng.user_story_01()\nsys.stdout = sys.__stdout__\noutput_str1 = 'US01 - Jaf /Jo1/ birthday after today on line 21\\n'\nself.assertEqual(capturedOutput.get...
<|body_start_0|> g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US01', 'US01_birthday_after_today.ged')]) capturedOutput = io.StringIO() sys.stdout = capturedOutput g.user_story_01() sys.stdout = sys.__stdout__ output_str1 = 'US01 - Jaf /Jo1/ birthday after to...
Tests that theuser_story_01 function throws when expected.
Test_user_story_01
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_user_story_01: """Tests that theuser_story_01 function throws when expected.""" def test_check_user_story_01(self): """Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError.""" <|body_0|> def test_check_user_story_01_2(self): """Te...
stack_v2_sparse_classes_36k_train_027793
2,665
no_license
[ { "docstring": "Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError.", "name": "test_check_user_story_01", "signature": "def test_check_user_story_01(self)" }, { "docstring": "Tests that user_story_01 rejects illegitimate death day by throwing a ValueError.", "na...
4
stack_v2_sparse_classes_30k_train_017244
Implement the Python class `Test_user_story_01` described below. Class description: Tests that theuser_story_01 function throws when expected. Method signatures and docstrings: - def test_check_user_story_01(self): Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError. - def test_check_user...
Implement the Python class `Test_user_story_01` described below. Class description: Tests that theuser_story_01 function throws when expected. Method signatures and docstrings: - def test_check_user_story_01(self): Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError. - def test_check_user...
ccfc3b5e11a48a93c53ff745cb254c4c79fab95f
<|skeleton|> class Test_user_story_01: """Tests that theuser_story_01 function throws when expected.""" def test_check_user_story_01(self): """Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError.""" <|body_0|> def test_check_user_story_01_2(self): """Te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_user_story_01: """Tests that theuser_story_01 function throws when expected.""" def test_check_user_story_01(self): """Tests that user_story_01 rejects illegitimate birth day by throwing a ValueError.""" g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US01', 'US01_birthday...
the_stack_v2_python_sparse
test_directory/US01/US01_Test.py
AkshayLavhagale/SSW555A_GEDCOM_analyzer
train
0
870c99b4e5291a370ca144b8c34247870ab9cccb
[ "left, right = (0, len(nums) - 1)\nwhile left < right:\n mid = left + (right - left) // 2\n if nums[mid] > target:\n right = mid - 1\n elif nums[mid] < target:\n left = mid + 1\n else:\n right = mid\nstart_pos = left\nif nums[start_pos] != target:\n return [-1, -1]\nleft, right =...
<|body_start_0|> left, right = (0, len(nums) - 1) while left < right: mid = left + (right - left) // 2 if nums[mid] > target: right = mid - 1 elif nums[mid] < target: left = mid + 1 else: right = mid ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange(self, nums, target): """A better and universal binary search solution. :type nums: List[int] :type target: int :rtype: List[int]"...
stack_v2_sparse_classes_36k_train_027794
2,385
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "searchRange", "signature": "def searchRange(self, nums, target)" }, { "docstring": "A better and universal binary search solution. :type nums: List[int] :type target: int :rtype: List[int]", "name": "searchR...
2
stack_v2_sparse_classes_30k_val_000489
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange(self, nums, target): A better and universal binary search solutio...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange(self, nums, target): A better and universal binary search solutio...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange(self, nums, target): """A better and universal binary search solution. :type nums: List[int] :type target: int :rtype: List[int]"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchRange(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" left, right = (0, len(nums) - 1) while left < right: mid = left + (right - left) // 2 if nums[mid] > target: right = mid - 1 ...
the_stack_v2_python_sparse
python_solution/BinarySearch/34_SearchForARange.py
Dimen61/leetcode
train
4
f9059120be663c1fb83cd5e8d1cb73eae37836e2
[ "ExecutionElement.__init__(self, id_, errors)\nself.app_name = app_name\nself.action_name = action_name\nself.name = name\nself.priority = priority\nself.parameters = []\nif parameters:\n self.parameters = parameters\nself.position = position\nself._arguments_api = None\nself.validate()", "if not self.errors:\...
<|body_start_0|> ExecutionElement.__init__(self, id_, errors) self.app_name = app_name self.action_name = action_name self.name = name self.priority = priority self.parameters = [] if parameters: self.parameters = parameters self.position = pos...
Action
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: def __init__(self, app_name, action_name, name, priority=3, id_=None, parameters=None, position=None, errors=None): """Initializes a new Action object. A Workflow has one or more actions that it executes. Args: app_name (str): The name of the app associated with the Action action...
stack_v2_sparse_classes_36k_train_027795
3,831
no_license
[ { "docstring": "Initializes a new Action object. A Workflow has one or more actions that it executes. Args: app_name (str): The name of the app associated with the Action action_name (str): The name of the action associated with a Action name (str): The name of the Action object. priority (int, optional): Optio...
3
stack_v2_sparse_classes_30k_train_012101
Implement the Python class `Action` described below. Class description: Implement the Action class. Method signatures and docstrings: - def __init__(self, app_name, action_name, name, priority=3, id_=None, parameters=None, position=None, errors=None): Initializes a new Action object. A Workflow has one or more action...
Implement the Python class `Action` described below. Class description: Implement the Action class. Method signatures and docstrings: - def __init__(self, app_name, action_name, name, priority=3, id_=None, parameters=None, position=None, errors=None): Initializes a new Action object. A Workflow has one or more action...
06caf8b82d4424db1bf007ca7ab8cf61b4185765
<|skeleton|> class Action: def __init__(self, app_name, action_name, name, priority=3, id_=None, parameters=None, position=None, errors=None): """Initializes a new Action object. A Workflow has one or more actions that it executes. Args: app_name (str): The name of the app associated with the Action action...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Action: def __init__(self, app_name, action_name, name, priority=3, id_=None, parameters=None, position=None, errors=None): """Initializes a new Action object. A Workflow has one or more actions that it executes. Args: app_name (str): The name of the app associated with the Action action_name (str): T...
the_stack_v2_python_sparse
api_gateway/executiondb/action.py
krzim/triple-play
train
0
a7fe876fa0dd334004e81e119d8dbbae3e8ce0b3
[ "if not matrix or not matrix[0]:\n return\nm, n = (len(matrix), len(matrix[0]))\nself.prefix_sum = [[0] * (n + 1) for _ in range(m + 1)]\nfor x in range(1, m + 1):\n for y in range(1, n + 1):\n self.prefix_sum[x][y] = sum((self.prefix_sum[x - 1][y], self.prefix_sum[x][y - 1], -self.prefix_sum[x - 1][y ...
<|body_start_0|> if not matrix or not matrix[0]: return m, n = (len(matrix), len(matrix[0])) self.prefix_sum = [[0] * (n + 1) for _ in range(m + 1)] for x in range(1, m + 1): for y in range(1, n + 1): self.prefix_sum[x][y] = sum((self.prefix_sum[x ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, x1, y1, x2, y2): """:type x1: int :type y1: int :type x2: int :type y2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not ...
stack_v2_sparse_classes_36k_train_027796
1,422
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type x1: int :type y1: int :type x2: int :type y2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, x1, y1, x2, y2)" } ]
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, x1, y1, x2, y2): :type x1: int :type y1: int :type x2: int :type y2: int :rtype: int
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, x1, y1, x2, y2): :type x1: int :type y1: int :type x2: int :type y2: int :rtype: int <|skeleton...
91892fd64281d96b8a9d5c0d57b938c314ae71be
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, x1, y1, x2, y2): """:type x1: int :type y1: int :type x2: int :type y2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix or not matrix[0]: return m, n = (len(matrix), len(matrix[0])) self.prefix_sum = [[0] * (n + 1) for _ in range(m + 1)] for x in range(1, m + 1): for y in rang...
the_stack_v2_python_sparse
leetcode/304_range_sum_query_2d_immutable.py
jaychsu/algorithm
train
143
dd510799959e92cca747645259e1926cd0387ca7
[ "self._baseController = base\nEvent.on('group_update', self.update_based_on_group)\nEvent.on('topology_change', self.update_based_on_topology)\nEvent.on('switch_connected', self.add_ipv4_decap_rule)\nself.table_manager = TableEntryManager(controller=base, name='TunnelController')\nself.table_manager.init_table('ing...
<|body_start_0|> self._baseController = base Event.on('group_update', self.update_based_on_group) Event.on('topology_change', self.update_based_on_topology) Event.on('switch_connected', self.add_ipv4_decap_rule) self.table_manager = TableEntryManager(controller=base, name='Tunnel...
TunnelController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TunnelController: def __init__(self, base): """Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type""" <|body_0|> def update_bier_encap_entry(self, switch=None): """Add bier encap entry for...
stack_v2_sparse_classes_36k_train_027797
6,767
permissive
[ { "docstring": "Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type", "name": "__init__", "signature": "def __init__(self, base)" }, { "docstring": "Add bier encap entry for given prefix :param switch: switch where ru...
6
stack_v2_sparse_classes_30k_train_014619
Implement the Python class `TunnelController` described below. Class description: Implement the TunnelController class. Method signatures and docstrings: - def __init__(self, base): Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type - def...
Implement the Python class `TunnelController` described below. Class description: Implement the TunnelController class. Method signatures and docstrings: - def __init__(self, base): Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type - def...
38d28a58d40a16d9c3aaabd4a37a61404705d0dd
<|skeleton|> class TunnelController: def __init__(self, base): """Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type""" <|body_0|> def update_bier_encap_entry(self, switch=None): """Add bier encap entry for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TunnelController: def __init__(self, base): """Init Tunnelcontroller with base controller and add cli commands :param base: basecontroller :param type: Sets bier or bier-te type""" self._baseController = base Event.on('group_update', self.update_based_on_group) Event.on('topolo...
the_stack_v2_python_sparse
Controller-Implementation/libs/controller/TunnelController.py
uni-tue-kn/p4-bier
train
12
89f95e76da8855e7c66229e30d32b041b0dbc7c5
[ "items = []\nif info.line.strip().startswith(('import ', 'from ')) and info.is_python_like:\n items += module_completion(info.line, [info.filename])\nelif info.obj:\n base = info.obj\n tokens = set(info.split_words(-1))\n items = [item for item in tokens if item.startswith(base) and len(item) > len(base...
<|body_start_0|> items = [] if info.line.strip().startswith(('import ', 'from ')) and info.is_python_like: items += module_completion(info.line, [info.filename]) elif info.obj: base = info.obj tokens = set(info.split_words(-1)) items = [item for it...
Basic Introspection Plugin for Spyder
FallbackPlugin
[ "Python-2.0", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FallbackPlugin: """Basic Introspection Plugin for Spyder""" def get_completions(self, info): """Return a list of completion strings Simple completion based on python-like identifiers and whitespace""" <|body_0|> def get_definition(self, info): """Find the definit...
stack_v2_sparse_classes_36k_train_027798
13,005
permissive
[ { "docstring": "Return a list of completion strings Simple completion based on python-like identifiers and whitespace", "name": "get_completions", "signature": "def get_completions(self, info)" }, { "docstring": "Find the definition for an object within a set of source code This is used to find ...
2
stack_v2_sparse_classes_30k_train_007038
Implement the Python class `FallbackPlugin` described below. Class description: Basic Introspection Plugin for Spyder Method signatures and docstrings: - def get_completions(self, info): Return a list of completion strings Simple completion based on python-like identifiers and whitespace - def get_definition(self, in...
Implement the Python class `FallbackPlugin` described below. Class description: Basic Introspection Plugin for Spyder Method signatures and docstrings: - def get_completions(self, info): Return a list of completion strings Simple completion based on python-like identifiers and whitespace - def get_definition(self, in...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class FallbackPlugin: """Basic Introspection Plugin for Spyder""" def get_completions(self, info): """Return a list of completion strings Simple completion based on python-like identifiers and whitespace""" <|body_0|> def get_definition(self, info): """Find the definit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FallbackPlugin: """Basic Introspection Plugin for Spyder""" def get_completions(self, info): """Return a list of completion strings Simple completion based on python-like identifiers and whitespace""" items = [] if info.line.strip().startswith(('import ', 'from ')) and info.is_pyt...
the_stack_v2_python_sparse
lib/python2.7/site-packages/spyderlib/utils/introspection/fallback_plugin.py
wangyum/Anaconda
train
11
5cd81ff8a1e2b333244eb751ee2eeb1eb102f79e
[ "if not isinstance(admin, AbstractAdminPage):\n raise InvalidAdminPageTypeError('Input parameter [{admin}] is not an instance of [{base}].'.format(admin=admin, base=AbstractAdminPage))\nsuper().__init__(**options)\nself._admin = admin", "result = {}\nfor method in self._admin.method_names:\n result[method] ...
<|body_start_0|> if not isinstance(admin, AbstractAdminPage): raise InvalidAdminPageTypeError('Input parameter [{admin}] is not an instance of [{base}].'.format(admin=admin, base=AbstractAdminPage)) super().__init__(**options) self._admin = admin <|end_body_0|> <|body_start_1|> ...
admin schema class.
AdminSchema
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminSchema: """admin schema class.""" def __init__(self, admin, **options): """initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin page instance. :keyword SECURE_TRUE | SECURE_FALSE reada...
stack_v2_sparse_classes_36k_train_027799
11,627
permissive
[ { "docstring": "initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin page instance. :keyword SECURE_TRUE | SECURE_FALSE readable: specifies that any column or attribute which has `allow_read=False` or its name starts ...
2
null
Implement the Python class `AdminSchema` described below. Class description: admin schema class. Method signatures and docstrings: - def __init__(self, admin, **options): initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin...
Implement the Python class `AdminSchema` described below. Class description: admin schema class. Method signatures and docstrings: - def __init__(self, admin, **options): initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class AdminSchema: """admin schema class.""" def __init__(self, admin, **options): """initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin page instance. :keyword SECURE_TRUE | SECURE_FALSE reada...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminSchema: """admin schema class.""" def __init__(self, admin, **options): """initializes an instance of AdminSchema. note that at least one of keyword arguments must be provided. :param AbstractAdminPage admin: related admin page instance. :keyword SECURE_TRUE | SECURE_FALSE readable: specifie...
the_stack_v2_python_sparse
src/pyrin/admin/page/schema.py
mononobi/pyrin
train
20